Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Fixes Discard Deletion button
Browse files Browse the repository at this point in the history
Closes-Bug: #1253919

Change-Id: I05f77fd82027bb289636dd128d978a5d8cab1d6c
  • Loading branch information
Cesarsar committed Nov 26, 2013
1 parent 268d4a0 commit c9f7921
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
4 changes: 0 additions & 4 deletions nailgun/static/css/main.css
Expand Up @@ -4387,10 +4387,6 @@ input.input-append {
text-transform: uppercase;
}

.btn-configure-interfaces {
margin-right: 30px;
}

.btn-group-congiration[data-invalid=true] i {
display: inline;
}
Expand Down
2 changes: 1 addition & 1 deletion nailgun/static/js/models.js
Expand Up @@ -153,7 +153,7 @@ define(['utils', 'deepModel'], function(utils) {
return _.omit(result, 'checked');
},
isSelectable: function() {
return ((this.get('online') && this.get('status') != 'error') || this.get('cluster')) && !this.get('pending_deletion');
return (this.get('online') && this.get('status') != 'error') || this.get('cluster');
},
hasRole: function(role, onlyDeployedRoles) {
var roles = onlyDeployedRoles ? this.get('roles') : _.union(this.get('roles'), this.get('pending_roles'));
Expand Down
14 changes: 6 additions & 8 deletions nailgun/static/js/views/cluster_page_tabs/nodes_tab.js
Expand Up @@ -537,8 +537,8 @@ function(utils, models, commonViews, dialogViews, nodesManagementPanelTemplate,
this.selectAllCheckbox.set('checked', availableNodes.length && this.nodes.where({checked: true}).length == availableNodes.length);
},
calculateSelectAllDisabledState: function() {
var availableNodes = this.nodes.where({disabled: false, checked: false});
var disabled = !availableNodes.length || (this.screen.roles && this.screen.roles.isControllerRoleSelected() && availableNodes.length > 1) || this.screen instanceof EditNodesScreen || this.screen.isLocked();
var availableNodes = this.nodes.filter(function(node) {return node.isSelectable();});
var disabled = !this.nodes.where({disabled: false}).length || (this.screen.roles && this.screen.roles.isControllerRoleSelected() && availableNodes.length > 1) || this.screen instanceof EditNodesScreen || this.screen.isLocked();
this.selectAllCheckbox.set('disabled', disabled);
},
groupNodes: function(attribute) {
Expand Down Expand Up @@ -569,6 +569,7 @@ function(utils, models, commonViews, dialogViews, nodesManagementPanelTemplate,
disabled: false
});
this.selectAllCheckbox.on('change:checked', this.selectNodes, this);
this.nodes.on('change:checked', this.calculateSelectAllCheckedState, this);
},
renderNodeGroups: function() {
this.$('.nodes').html('');
Expand Down Expand Up @@ -638,6 +639,7 @@ function(utils, models, commonViews, dialogViews, nodesManagementPanelTemplate,
});
this.selectAllCheckbox.on('change:checked', this.selectNodes, this);
this.selectAllCheckbox.on('change:disabled', this.nodeList.calculateSelectAllDisabledState, this.nodeList);
this.nodes.on('change:checked', this.calculateSelectAllCheckedState, this);
},
renderNode: function(node) {
var nodeView = new Node({
Expand Down Expand Up @@ -697,7 +699,6 @@ function(utils, models, commonViews, dialogViews, nodesManagementPanelTemplate,
},
'.node-checkbox input': {
observe: 'checked',
stickitChange: true,
attributes: [{
name: 'disabled',
observe: 'disabled'
Expand Down Expand Up @@ -846,10 +847,6 @@ function(utils, models, commonViews, dialogViews, nodesManagementPanelTemplate,
return this.hasChanges() && !(this.screen instanceof EditNodesScreen) ? 'icon-back-in-time' : 'icon-logs';
},
onNodeSelection: function(node, checked, options) {
if (options.stickitChange) {
this.group.calculateSelectAllCheckedState();
this.group.nodeList.calculateSelectAllCheckedState();
}
if (!checked) {
node.set({pending_roles: this.initialRoles});
}
Expand Down Expand Up @@ -925,7 +922,8 @@ function(utils, models, commonViews, dialogViews, nodesManagementPanelTemplate,
pending_roles: []
});
},
discardDeletion: function() {
discardDeletion: function(e) {
e.preventDefault();
this.updateNode({pending_deletion: false});
},
showNodeLogs: function() {
Expand Down

0 comments on commit c9f7921

Please sign in to comment.