AMBARI-3851. Remove host action is always enabled (alexantonenko)
diff --git a/ambari-web/app/models/config_group.js b/ambari-web/app/models/config_group.js
index b8338ef..d71dddf 100644
--- a/ambari-web/app/models/config_group.js
+++ b/ambari-web/app/models/config_group.js
@@ -109,10 +109,6 @@
return (this.get('isDefault') || this.get('availableHosts.length') === 0);
}.property('availableHosts.length'),
- isDeleteHostsDisabled: function () {
- return (this.get('isDefault') || this.get('hosts.length') === 0);
- }.property('hosts.length'),
-
/**
* Collection of (site, tag) pairs representing properties.
*
diff --git a/ambari-web/app/templates/main/service/manage_configuration_groups_popup.hbs b/ambari-web/app/templates/main/service/manage_configuration_groups_popup.hbs
index 7927bd6..dc61b6d 100644
--- a/ambari-web/app/templates/main/service/manage_configuration_groups_popup.hbs
+++ b/ambari-web/app/templates/main/service/manage_configuration_groups_popup.hbs
@@ -62,7 +62,7 @@
</div>
<div class="button-group pull-right">
<button rel="button-info" class="btn" {{bindAttr data-original-title="view.addHostTooltip" disabled="selectedConfigGroup.isAddHostsDisabled"}} {{action addHosts target="controller"}} ><i class="icon-plus"></i></button>
- <button rel="button-info" class="btn" {{bindAttr data-original-title="view.removeHostTooltip" disabled="selectedConfigGroup.isDeleteHostsDisabled"}} {{action deleteHosts target="controller"}} ><i class="icon-minus"></i></button>
+ <button rel="button-info" class="btn" {{bindAttr data-original-title="view.removeHostTooltip" disabled="view.isDeleteHostsDisabled"}} {{action deleteHosts target="controller"}} ><i class="icon-minus"></i></button>
</div>
</div>
<div class="row-fluid">
diff --git a/ambari-web/app/views/main/service/manage_config_groups_view.js b/ambari-web/app/views/main/service/manage_config_groups_view.js
index 9c4de24..c6f4577 100644
--- a/ambari-web/app/views/main/service/manage_config_groups_view.js
+++ b/ambari-web/app/views/main/service/manage_config_groups_view.js
@@ -64,6 +64,18 @@
$("[rel='button-info']").tooltip();
},
+ isDeleteHostsDisabled: function () {
+ var selectedConfigGroup = this.get('controller.selectedConfigGroup');
+ if(selectedConfigGroup){
+ if(selectedConfigGroup.isDefault || this.get('controller.selectedHosts').length === 0){
+ return true;
+ }else{
+ return false;
+ }
+ }
+ return true;
+ }.property('controller.selectedConfigGroup', 'controller.selectedConfigGroup.hosts.length', 'controller.selectedHosts.length'),
+
addButtonTooltip: function () {
return Em.I18n.t('services.service.config_groups_popup.addButton');
}.property(),