Updated Branches: refs/heads/trunk e10272390 -> 0dba52dfc
AMBARI-3632. Need ability to remove hbase master (xiwang) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/0dba52df Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/0dba52df Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/0dba52df Branch: refs/heads/trunk Commit: 0dba52dfc703f44b440945edfd9d2d62f2303735 Parents: e102723 Author: Xi Wang <[email protected]> Authored: Wed Oct 30 16:39:53 2013 -0700 Committer: Xi Wang <[email protected]> Committed: Wed Oct 30 16:39:53 2013 -0700 ---------------------------------------------------------------------- ambari-web/app/controllers/main/host/details.js | 54 +++++++++++++++++++- ambari-web/app/messages.js | 2 + ambari-web/app/styles/application.less | 10 ++++ ambari-web/app/templates/main/host/summary.hbs | 17 ++++-- ambari-web/app/views/main/host/summary.js | 13 ++++- 5 files changed, 88 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0dba52df/ambari-web/app/controllers/main/host/details.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js index ef76e1a..d5bbfa5 100644 --- a/ambari-web/app/controllers/main/host/details.js +++ b/ambari-web/app/controllers/main/host/details.js @@ -156,11 +156,61 @@ App.MainHostDetailsController = Em.Controller.extend({ } else { App.router.get('clusterController').loadUpdatedStatusDelayed(500); } - App.router.get('backgroundOperationsController').showPopup(); + if (App.router.get('mainAdminUserSettingsController').loadShowBgChecked()) { + App.router.get('backgroundOperationsController').showPopup(); + } }); }, /** + * send command to server to delete selected host component + * + */ + deleteComponent: function (event) { + var self = this; + var component = event.context; + var componentName = component.get('componentName').toUpperCase().toString(); + var displayName = component.get('displayName'); + var numberOfComponents = 0; + var isLastComponent = false; + var allComponents = component.get('service.hostComponents'); + allComponents.forEach(function(component) { + if (component.get('componentName') == componentName) numberOfComponents++; + if (numberOfComponents > 1) return; + }); + if (numberOfComponents == 1) { + isLastComponent = true; + } + App.ModalPopup.show({ + header: Em.I18n.t('popup.confirmation.commonHeader'), + bodyClass: Ember.View.extend({ + templateName: require('templates/main/host/details/deleteComponentPopup') + }), + enablePrimary: false, + lastComponent: function() { + if (isLastComponent) { + this.set('enablePrimary',false); + return true; + } else { + this.set('enablePrimary',true); + return false; + } + }.property(), + lastComponentError: Em.View.extend({ + template: Ember.Handlebars.compile(Em.I18n.t('hosts.host.deleteComponent.popup.warning').format(displayName)) + }), + deleteComponentMsg: function() { + return Em.I18n.t('hosts.host.deleteComponent.popup.msg').format(displayName); + }.property(), + onPrimary: function () { + if (!this.get('enablePrimary')) return; + self._doDeleteHostComponent(component); + this.hide(); + }, + }); + + }, + /** * Deletes the given host component, or all host components. * * @param component When <code>null</code> all host components are deleted. @@ -346,7 +396,7 @@ App.MainHostDetailsController = Em.Controller.extend({ onPrimary: function () { this.hide(); if (component.get('componentName') === 'CLIENTS') { - // Clients component has many sub-components which + // Clients component has many sub-components which // need to be installed. var scs = component.get('subComponentNames'); scs.forEach(function (sc) { http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0dba52df/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index be9a725..8c9568e 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -1276,6 +1276,8 @@ Em.I18n.translations = { 'host.host.componentFilter.master':'Master Components', 'host.host.componentFilter.slave':'Slave Components', 'host.host.componentFilter.client':'Client Components', + 'hosts.host.deleteComponent.popup.msg':'Are you sure you want to delete {0}?', + 'hosts.host.deleteComponent.popup.warning':'<b>WARNING!</b> Delete the last <i>{0}</i> component in the cluster?</br>Deleting the last component in the cluster could result in permanent loss of service data.', 'hosts.host.installComponent.msg':'Are you sure you want to install {0}?', 'hosts.host.addComponent.msg':'Are you sure you want to add {0}?', 'hosts.host.addComponent.note':'Note: After this component is installed, go to Services -> Nagios to restart the Nagios service. This is required for the alerts and notifications to work properly.', http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0dba52df/ambari-web/app/styles/application.less ---------------------------------------------------------------------- diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less index ce55792..6568d9b 100644 --- a/ambari-web/app/styles/application.less +++ b/ambari-web/app/styles/application.less @@ -3016,6 +3016,16 @@ table.graphs { font-style: italic; } } + + .host-components { + .dropdown-menu { + .disabled { + pointer-events: none; + color: #808080; + cursor: default; + } + } + } } .background-operations { http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0dba52df/ambari-web/app/templates/main/host/summary.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/host/summary.hbs b/ambari-web/app/templates/main/host/summary.hbs index 3c41091..10ab4ca 100644 --- a/ambari-web/app/templates/main/host/summary.hbs +++ b/ambari-web/app/templates/main/host/summary.hbs @@ -69,11 +69,11 @@ <span class="caret pull-right"></span> </a> <ul class="dropdown-menu"> - <li> - <div class="component-text-status"> - {{view.componentTextStatus}} - </div> - </li> + <li> + <div class="component-text-status"> + {{view.componentTextStatus}} + </div> + </li> {{#if view.isDataNode}} {{#if view.isDataNodeDecommissionAvailable}} <li {{bindAttr class="view.noActionAvailable"}}> @@ -90,6 +90,13 @@ </li> {{/if}} {{/if}} + {{#if view.isHBaseMaster}} + <li {{bindAttr class="view.isDeleteHBaseMasterDisabled:disabled"}}> + <a href="javascript:void(null)" data-toggle="modal" {{action "deleteComponent" view.content target="controller"}}> + {{t common.delete}} + </a> + </li> + {{/if}} {{#unless view.isInstalling}} {{#if view.isStart}} <li {{bindAttr class=" view.isDecommissioning:hidden view.noActionAvailable"}}> http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0dba52df/ambari-web/app/views/main/host/summary.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/host/summary.js b/ambari-web/app/views/main/host/summary.js index b19e41a..51ef1a0 100644 --- a/ambari-web/app/views/main/host/summary.js +++ b/ambari-web/app/views/main/host/summary.js @@ -425,7 +425,18 @@ App.MainHostSummaryView = Em.View.extend({ var decommissionHostNames = this.get('decommissionDataNodeHostNames'); var hostName = App.router.get('mainHostDetailsController.content.hostName'); return decommissionHostNames != null && decommissionHostNames.contains(hostName); - }.property('App.router.mainHostDetailsController.content', 'decommissionDataNodeHostNames') + }.property('App.router.mainHostDetailsController.content', 'decommissionDataNodeHostNames'), + + /** + * Shows whether we need to show Delete button + */ + isHBaseMaster: function () { + return this.get('content.componentName') === 'HBASE_MASTER'; + }.property('content'), + isDeleteHBaseMasterDisabled: function () { + return !(this.get('workStatus') == App.HostComponentStatus.stopped || this.get('workStatus') == App.HostComponentStatus.unknown || + this.get('workStatus') == App.HostComponentStatus.install_failed || this.get('workStatus') == App.HostComponentStatus.upgrade_failed); + }.property('workStatus'), }), timeSinceHeartBeat: function () {
