mirror of https://github.com/status-im/consul.git
Add deregister node button
This commit is contained in:
parent
c8f35aea45
commit
d9d5e03188
|
@ -506,7 +506,10 @@
|
|||
<hr>
|
||||
</div>
|
||||
|
||||
<h3 class="no-margin">{{ model.Node }} <small> {{ model.Address }}</small></h3>
|
||||
<h3 class="no-margin">
|
||||
{{ model.Node }} <small> {{ model.Address }}</small>
|
||||
<button {{ action "deregisterNode" }} {{ bind-attr class=":btn :btn-danger :pull-right :btn-mini isLoading:btn-warning" }}>Deregister</button>
|
||||
</h3>
|
||||
<hr>
|
||||
|
||||
<h5>Services</h5>
|
||||
|
|
|
@ -289,6 +289,31 @@ App.NodesShowController = Ember.ObjectController.extend({
|
|||
dc: Ember.computed.alias("controllers.dc"),
|
||||
|
||||
actions: {
|
||||
deregisterNode: function() {
|
||||
this.set('isLoading', true);
|
||||
var controller = this;
|
||||
var node = controller.get('model');
|
||||
var dc = controller.get('dc').get('datacenter');
|
||||
var token = App.get('settings.token');
|
||||
|
||||
if (window.confirm("Are you sure you want to deregister this node?")) {
|
||||
// Deregister node
|
||||
Ember.$.ajax({
|
||||
url: formatUrl('/v1/catalog/deregister', dc, token),
|
||||
type: 'PUT',
|
||||
data: JSON.stringify({
|
||||
'Datacenter': dc,
|
||||
'Node': node.Node
|
||||
})
|
||||
}).then(function(response) {
|
||||
controller.transitionToRoute('nodes');
|
||||
console.log(controller);
|
||||
}).fail(function(response) {
|
||||
controller.set('errorMessage', 'Received error while processing: ' + response.statusText);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
invalidateSession: function(sessionId) {
|
||||
this.set('isLoading', true);
|
||||
var controller = this;
|
||||
|
|
Loading…
Reference in New Issue