mirror of https://github.com/status-im/consul.git
ui: ask for confirmation before deleting keys #520
This commit is contained in:
parent
3d3c48bd50
commit
99e572cffb
|
@ -161,23 +161,25 @@ App.KvShowController.reopen({
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteFolder: function() {
|
deleteFolder: function() {
|
||||||
this.set('isLoading', true);
|
|
||||||
|
|
||||||
|
this.set('isLoading', true);
|
||||||
var controller = this;
|
var controller = this;
|
||||||
var dc = controller.get('dc').get('datacenter');
|
var dc = controller.get('dc').get('datacenter');
|
||||||
var grandParent = controller.get('grandParentKey');
|
var grandParent = controller.get('grandParentKey');
|
||||||
var token = App.get('settings.token');
|
var token = App.get('settings.token');
|
||||||
|
|
||||||
// Delete the folder
|
if (window.confirm("Are you sure you want to delete this folder?")) {
|
||||||
Ember.$.ajax({
|
// Delete the folder
|
||||||
url: (formatUrl("/v1/kv/" + controller.get('parentKey') + '?recurse', dc, token)),
|
Ember.$.ajax({
|
||||||
type: 'DELETE'
|
url: (formatUrl("/v1/kv/" + controller.get('parentKey') + '?recurse', dc, token)),
|
||||||
}).then(function(response) {
|
type: 'DELETE'
|
||||||
controller.transitionToNearestParent(grandParent);
|
}).then(function(response) {
|
||||||
}).fail(function(response) {
|
controller.transitionToNearestParent(grandParent);
|
||||||
// Render the error message on the form if the request failed
|
}).fail(function(response) {
|
||||||
controller.set('errorMessage', 'Received error while processing: ' + response.statusText);
|
// Render the error message on the form if the request failed
|
||||||
});
|
controller.set('errorMessage', 'Received error while processing: ' + response.statusText);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -219,24 +221,26 @@ App.KvEditController = KvBaseController.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteKey: function() {
|
deleteKey: function() {
|
||||||
this.set('isLoading', true);
|
|
||||||
|
|
||||||
|
this.set('isLoading', true);
|
||||||
var controller = this;
|
var controller = this;
|
||||||
var dc = controller.get('dc').get('datacenter');
|
var dc = controller.get('dc').get('datacenter');
|
||||||
var key = controller.get("model");
|
var key = controller.get("model");
|
||||||
var parent = controller.getParentKeyRoute();
|
var parent = controller.getParentKeyRoute();
|
||||||
var token = App.get('settings.token');
|
var token = App.get('settings.token');
|
||||||
|
|
||||||
// Delete the key
|
if (window.confirm("Are you sure you want to delete this key?")) {
|
||||||
Ember.$.ajax({
|
// Delete the key
|
||||||
url: (formatUrl("/v1/kv/" + key.get('Key'), dc, token)),
|
Ember.$.ajax({
|
||||||
type: 'DELETE'
|
url: (formatUrl("/v1/kv/" + key.get('Key'), dc, token)),
|
||||||
}).then(function(data) {
|
type: 'DELETE'
|
||||||
controller.transitionToNearestParent(parent);
|
}).then(function(data) {
|
||||||
}).fail(function(response) {
|
controller.transitionToNearestParent(parent);
|
||||||
// Render the error message on the form if the request failed
|
}).fail(function(response) {
|
||||||
controller.set('errorMessage', 'Received error while processing: ' + response.statusText);
|
// Render the error message on the form if the request failed
|
||||||
});
|
controller.set('errorMessage', 'Received error while processing: ' + response.statusText);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue