Repository: ambari
Updated Branches:
  refs/heads/trunk 3d97d7d13 -> cb2ef7c21


AMBARI-5392 Recommend putting Region Server in Maintenance Mode when 
Decommissioning Region Server. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: cb2ef7c21c5b57596f0bb90375937d4fc286fb6e
Parents: 3d97d7d
Author: aBabiichuk <ababiic...@cybervisiontech.com>
Authored: Tue Apr 8 16:21:41 2014 +0300
Committer: aBabiichuk <ababiic...@cybervisiontech.com>
Committed: Tue Apr 8 16:21:41 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host.js         |  2 +-
 ambari-web/app/controllers/main/host/details.js | 32 +++++++++++++++++++-
 ambari-web/app/messages.js                      |  1 +
 3 files changed, 33 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/cb2ef7c2/ambari-web/app/controllers/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host.js 
b/ambari-web/app/controllers/main/host.js
index 41a0e42..8b707d7 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -343,7 +343,7 @@ App.MainHostController = Em.ArrayController.extend({
         //For decommession
         if (svcName == "HBASE") {
           // HBASE service, decommission RegionServer in batch requests
-          
App.router.get('mainHostDetailsController').doDecommissionRegionServer(hostNames,
 svcName, masterName, slaveName);
+          
App.router.get('mainHostDetailsController').warnBeforeDecommission(hostNames, 
svcName, masterName, slaveName);
         } else {
           var parameters = {
             "slave_type": slaveName

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb2ef7c2/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 dfa3710..25b9a93 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -697,7 +697,7 @@ App.MainHostDetailsController = Em.Controller.extend({
       }
       // HBASE service, decommission RegionServer
       if (svcName === "HBASE") {
-        self.doDecommissionRegionServer(hostName, svcName, "HBASE_MASTER", 
"HBASE_REGIONSERVER");
+        self.warnBeforeDecommission(hostName, svcName, "HBASE_MASTER", 
"HBASE_REGIONSERVER");
       }
 
       // load data (if we need to show this background operations popup) from 
persist
@@ -767,7 +767,37 @@ App.MainHostDetailsController = Em.Controller.extend({
   },
 
   /**
+   * Recomends user to put component in MM before decommision (for HBASE only)
+   * @method warnBeforeDecommission
+   * @param {string[]} hostNames - list of host when run from bulk operations 
or current host
+   * @param {string} serviceName - serviceName
+   * @param {string} componentName - master compoent name
+   * @param {string} slaveType - slave component name
+   */
+  warnBeforeDecommission: function(hostNames, serviceName, componentName, 
slaveType) {
+    if (this.get('content.hostComponents').findProperty('componentName', 
componentName).get('passiveState') == "OFF") {
+      App.ModalPopup.show({
+        header: Em.I18n.t('common.warning'),
+        message: function(){
+          return 
Em.I18n.t('hostPopup.reccomendation.beforeDecommission').format(App.format.components[componentName]);
+        }.property(),
+        bodyClass: Ember.View.extend({
+          template: Em.Handlebars.compile('<div class="alert 
alert-warning">{{message}}</div>')
+        }),
+        secondary: false
+      });
+    } else {
+      this.doDecommissionRegionServer(hostNames, serviceName, componentName, 
slaveType);
+    }
+  },
+
+  /**
    * Performs Decommission (for RegionServer)
+   * @method doDecommissionRegionServer
+   * @param {string[]} hostNames - list of host when run from bulk operations 
or current host
+   * @param {string} serviceName - serviceName
+   * @param {string} componentName - master compoent name
+   * @param {string} slaveType - slave component name
    */
   doDecommissionRegionServer: function(hostNames, serviceName, componentName, 
slaveType){
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb2ef7c2/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index c99853d..796358f 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -245,6 +245,7 @@ Em.I18n.translations = {
   'hostPopup.bgop.sourceRequestSchedule.aborted': 'Future operations of this 
batch request have been aborted',
   'hostPopup.bgop.abort.rollingRestart': 'Abort Rolling Restart',
   'hostPopup.warning.alertsTimeOut': 'Maintenance Mode has been turned {0}. It 
may take a few minutes for the alerts to be {1}.',
+  'hostPopup.reccomendation.beforeDecommission': '{0} Maintenance Mode is pre 
required for decommissioning.',
 
   'question.sure':'Are you sure?',
 

Reply via email to