-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Moved common stuff to a mixin
- Loading branch information
1 parent
4a6977b
commit 89aed15
Showing
9 changed files
with
72 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Mixin.create({ | ||
|
||
session: Ember.inject.service(), | ||
|
||
actions: { | ||
del(manifest) { | ||
let flashMessages = this.get('flashMessages'); | ||
flashMessages.clearMessages(); | ||
this.get('kubeClient').deleteRecord(manifest).then(() => { | ||
let kind = manifest.kind; | ||
this.get(`session.pendingRemoval.${kind.toLowerCase()}`).push(manifest.metadata.name); | ||
let message = `Successfully sent request to delete ${manifest.kind} ${manifest.metadata.name}`; | ||
flashMessages.positive(message); | ||
this.transitionTo(Ember.Inflector.inflector.pluralize(kind).dasherize()); | ||
}).catch((error) => { | ||
window.console.error(error); | ||
let message = null; | ||
if (error.errors) { | ||
message = error.errors[0].detail; | ||
} else { | ||
message = error.message; | ||
} | ||
flashMessages.negative(message, { sticky: true }); | ||
}); | ||
} | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,12 @@ | ||
import Ember from 'ember'; | ||
import ResourceDeleteAction from 'kube-admin/mixins/resource-delete-action'; | ||
|
||
export default Ember.Route.extend({ | ||
session: Ember.inject.service(), | ||
export default Ember.Route.extend(ResourceDeleteAction, { | ||
|
||
kubeClient: Ember.inject.service(), | ||
|
||
model(params) { | ||
return this.get('kubeClient').findRecord('pod', params.namespace, params.name); | ||
}, | ||
|
||
actions: { | ||
del(manifest) { | ||
let flashMessages = this.get('flashMessages'); | ||
flashMessages.clearMessages(); | ||
this.get('kubeClient').deleteRecord(manifest).then(() => { | ||
let kind = manifest.kind.toLowerCase(); | ||
this.get(`session.pendingRemoval.${kind}`).push(manifest.metadata.name); | ||
let message = `Successfully sent request to delete ${manifest.kind} ${manifest.metadata.name}`; | ||
flashMessages.positive(message); | ||
this.transitionTo('pods'); | ||
}).catch((error) => { | ||
flashMessages.negative(error.errors[0].detail, { timeout: 10000 }); | ||
}); | ||
} | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import Ember from 'ember'; | ||
import ResourceDeleteAction from 'kube-admin/mixins/resource-delete-action'; | ||
|
||
export default Ember.Route.extend(ResourceDeleteAction, { | ||
|
||
export default Ember.Route.extend({ | ||
kubeClient: Ember.inject.service(), | ||
|
||
model(params) { | ||
return this.get('kubeClient').findRecord('service', params.namespace, params.name); | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters