Repository: ambari
Updated Branches:
  refs/heads/trunk 35ae35971 -> 699179ab4


AMBARI-6396. Provide ability to remove ZK component from a host. (Max Shepel 
via akovalenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/699179ab
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/699179ab
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/699179ab

Branch: refs/heads/trunk
Commit: 699179ab4d554a7431ed5ea7725e31936a56c22c
Parents: 35ae359
Author: Aleksandr Kovalenko <akovale...@hortonworks.com>
Authored: Mon Jul 7 15:25:24 2014 +0300
Committer: Aleksandr Kovalenko <akovale...@hortonworks.com>
Committed: Mon Jul 7 15:37:07 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 21 ++++++++++++++++++--
 ambari-web/app/messages.js                      |  1 +
 .../app/models/stack_service_component.js       |  2 +-
 .../main/host/details/deleteComponentPopup.hbs  |  4 ++++
 4 files changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/699179ab/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 2988ded..a41f761 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -226,6 +226,9 @@ App.MainHostDetailsController = Em.Controller.extend({
         this.set('isChecked', !isLastComponent);
         return isLastComponent;
       }.property(),
+      isZkServer: function () {
+        return componentName == 'ZOOKEEPER_SERVER';
+      }.property(),
       lastComponentError: Em.View.extend({
         template: 
Em.Handlebars.compile(Em.I18n.t('hosts.host.deleteComponent.popup.warning').format(displayName))
       }),
@@ -235,6 +238,9 @@ App.MainHostDetailsController = Em.Controller.extend({
       deleteComponentMsg: function () {
         return 
Em.I18n.t('hosts.host.deleteComponent.popup.msg1').format(displayName);
       }.property(),
+      deleteZkServerMsg: Em.View.extend({
+        template: 
Em.Handlebars.compile(Em.I18n.t('hosts.host.deleteComponent.popup.deleteZooKeeperServer'))
+      }),
       onPrimary: function () {
         var popup = this;
         self._doDeleteHostComponent(component, function () {
@@ -284,8 +290,12 @@ App.MainHostDetailsController = Em.Controller.extend({
    * Success callback for delete host component request
    * @method _doDeleteHostComponentSuccessCallback
    */
-  _doDeleteHostComponentSuccessCallback: function () {
+  _doDeleteHostComponentSuccessCallback: function (response, request, data) {
     this.set('_deletedHostComponentResult', null);
+    if (data.componentName == 'ZOOKEEPER_SERVER') {
+      this.set('fromDeleteZkServer', true);
+      this.loadConfigs();
+    }
   },
 
   /**
@@ -741,14 +751,21 @@ App.MainHostDetailsController = Em.Controller.extend({
   fromDeleteHost: false,
 
   /**
+   * Is ZooKeeper Server being deleted from host
+   * @type {bool}
+   */
+  fromDeleteZkServer: false,
+
+  /**
    * Get list of hostnames where ZK Server is installed
    * @returns {string[]}
    * @method getZkServerHosts
    */
   getZkServerHosts: function () {
     var zks = App.HostComponent.find().filterProperty('componentName', 
'ZOOKEEPER_SERVER').mapProperty('hostName');
-    if (this.get('fromDeleteHost')) {
+    if (this.get('fromDeleteHost') || this.get('fromDeleteZkServer')) {
       this.set('fromDeleteHost', false);
+      this.set('fromDeleteZkServer', false);
       return zks.without(this.get('content.hostName'));
     }
     return zks;

http://git-wip-us.apache.org/repos/asf/ambari/blob/699179ab/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index bc14fc1..fd25d8a 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1579,6 +1579,7 @@ Em.I18n.translations = {
   'host.host.componentFilter.client':'Client Components',
   'hosts.host.deleteComponent.popup.msg1':'Are you sure you want to delete 
{0}?',
   'hosts.host.deleteComponent.popup.msg2':'<b>Important:</b> After this 
<i>{0}</i> is deleted, go to <i>Services -> Nagios</i> to restart the Nagios 
service.  This is required for the alerts and notifications to work properly.',
+  'hosts.host.deleteComponent.popup.deleteZooKeeperServer':'Deleting 
<i>ZooKeeper Server</i> may reconfigure such 
properties:<ul><li>ha.zookeeper.quorum</li><li>hbase.zookeeper.quorum</li><li>templeton.zookeeper.hosts</li></ul>',
   '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.deleteComponent.popup.confirm':'Confirm Delete',
   'hosts.host.installComponent.popup.confirm':'Confirm Install',

http://git-wip-us.apache.org/repos/asf/ambari/blob/699179ab/ambari-web/app/models/stack_service_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service_component.js 
b/ambari-web/app/models/stack_service_component.js
index 5e48e7b..51f944a 100644
--- a/ambari-web/app/models/stack_service_component.js
+++ b/ambari-web/app/models/stack_service_component.js
@@ -47,7 +47,7 @@ App.StackServiceComponent = DS.Model.extend({
   }.property('componentName'),
 
   isDeletable: function() {
-    return ['SUPERVISOR', 'HBASE_MASTER', 'DATANODE', 'TASKTRACKER', 
'NODEMANAGER', 'HBASE_REGIONSERVER', 
'GANGLIA_MONITOR'].contains(this.get('componentName'));
+    return ['SUPERVISOR', 'HBASE_MASTER', 'DATANODE', 'TASKTRACKER', 
'NODEMANAGER', 'HBASE_REGIONSERVER', 'GANGLIA_MONITOR', 
'ZOOKEEPER_SERVER'].contains(this.get('componentName'));
   }.property('componentName'),
 
   isRollinRestartAllowed: function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/699179ab/ambari-web/app/templates/main/host/details/deleteComponentPopup.hbs
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/templates/main/host/details/deleteComponentPopup.hbs 
b/ambari-web/app/templates/main/host/details/deleteComponentPopup.hbs
index 5459223..36cbeaa 100644
--- a/ambari-web/app/templates/main/host/details/deleteComponentPopup.hbs
+++ b/ambari-web/app/templates/main/host/details/deleteComponentPopup.hbs
@@ -23,4 +23,8 @@
         <div class='span10'>{{view lastComponentError}}</div>
     </div>
 {{/if}}
+{{#if isZkServer}}
+  <br />
+  <div class='alert'>{{view deleteZkServerMsg}}</div>
+{{/if}}
 <div class='alert'>{{view restartNagiosMsg}}</div>
\ No newline at end of file

Reply via email to