mirror of
https://github.com/status-im/consul.git
synced 2025-01-13 15:26:48 +00:00
Redirect to correct root path when deleting keys
This commit is contained in:
parent
d40b3ae6a6
commit
17e3756200
@ -171,9 +171,14 @@ App.KvEditController = Ember.Controller.extend({
|
|||||||
deleteKey: function() {
|
deleteKey: function() {
|
||||||
this.set('isLoading', true);
|
this.set('isLoading', true);
|
||||||
|
|
||||||
var dc = this.get('dc').get('datacenter');
|
|
||||||
var key = this.get("model");
|
|
||||||
var controller = this;
|
var controller = this;
|
||||||
|
var dc = controller.get('dc').get('datacenter');
|
||||||
|
var key = controller.get("model");
|
||||||
|
var parent = key.get('parentKey');
|
||||||
|
|
||||||
|
if (parent === '/') {
|
||||||
|
parent = controller.get('rootKey');
|
||||||
|
}
|
||||||
|
|
||||||
// Delete the key
|
// Delete the key
|
||||||
Ember.$.ajax({
|
Ember.$.ajax({
|
||||||
@ -181,7 +186,7 @@ App.KvEditController = Ember.Controller.extend({
|
|||||||
type: 'DELETE'
|
type: 'DELETE'
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
// Tranisiton back up a level
|
// Tranisiton back up a level
|
||||||
controller.transitionToRoute('kv.show', key.get('parentKey'));
|
controller.transitionToRoute('kv.show', parent);
|
||||||
controller.set('isLoading', false);
|
controller.set('isLoading', false);
|
||||||
}).fail(function(response) {
|
}).fail(function(response) {
|
||||||
// Render the error message on the form if the request failed
|
// Render the error message on the form if the request failed
|
||||||
|
@ -167,6 +167,7 @@ App.KvEditRoute = App.BaseRoute.extend({
|
|||||||
controller.set('parentKey', parentKeys.parent);
|
controller.set('parentKey', parentKeys.parent);
|
||||||
controller.set('grandParentKey', parentKeys.grandParent);
|
controller.set('grandParentKey', parentKeys.grandParent);
|
||||||
controller.set('siblings', models.keys);
|
controller.set('siblings', models.keys);
|
||||||
|
controller.set('rootKey', this.rootKey);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user