Browse Source

AMBARI-1454. Service page: add "Reassign <Master Component>" action items to "Maintenance" pulldown. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1448437 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 years ago
parent
commit
ae6df00240

+ 3 - 0
CHANGES.txt

@@ -12,6 +12,9 @@ Trunk (unreleased changes):
 
  NEW FEATURES
 
+ AMBARI-1454. Service page: add "Reassign <Master Component>" action items
+ to "Maintenance" pulldown. (yusaku)
+
  AMBARI-1349. Expose host-specific Nagios alerts in Ambari Web. (yusaku)
 
  AMBARI-1294. Add isEmpty() query operator support. (jspeidel)

+ 21 - 11
ambari-web/app/controllers/main/service/item.js

@@ -252,25 +252,35 @@ App.MainServiceItemController = Em.Controller.extend({
     });
   },
 
+  /**
+   * On click callback for <code>Reassign <master component></code> button
+   * @param hostComponent
+   */
+  reassignMaster: function (hostComponent) {
+    console.log('In Reassign Master', hostComponent);
+    App.ModalPopup.show({
+      header: 'Reassign Master Wizard',
+      body: 'Reassign Master Wizard',
+      secondary: false,
+      onPrimary: function() {
+        this.hide();
+      }
+    });
+  },
+
   /**
    * On click callback for <code>action</code> dropdown menu
+   * Calls runSmokeTest, runRebalancer, runCompaction or reassignMaster depending on context
    * @param event
    */
   doAction: function (event) {
     if ($(event.target).hasClass('disabled') || $(event.target.parentElement).hasClass('disabled')) {
       return;
     }
-    var methodName = event.context;
-    switch (methodName) {
-      case 'runRebalancer':
-        this.runRebalancer();
-        break;
-      case 'runCompaction':
-        this.runCompaction();
-        break;
-      case 'runSmokeTest':
-        this.runSmokeTest();
-        break;
+    var methodName = event.context.action;
+    var context = event.context.context;
+    if (methodName) {
+      this[methodName](context);
     }
   }
 })

+ 1 - 1
ambari-web/app/templates/main/service/item.hbs

@@ -29,7 +29,7 @@
       <!-- dropdown menu links -->
       {{#each option in view.maintenance}}
       <li {{bindAttr class="controller.content.isStopDisabled:disabled"}}>
-        <a {{action "doAction" option.action target="controller" href=true}}>{{option.label}}</a>
+        <a {{action "doAction" option target="controller" href=true}}>{{option.label}}</a>
       </li>
       {{/each}}
     </ul>

+ 3 - 0
ambari-web/app/views/main/service/item.js

@@ -32,6 +32,9 @@ App.MainServiceItemView = Em.View.extend({
 //        break;
       default:
         options.push({action: 'runSmokeTest', 'label': Em.I18n.t('services.service.actions.run.smoke')});
+        this.get('controller.content.hostComponents').filterProperty('isMaster').forEach (function (hostComponent){
+          options.push({action: 'reassignMaster', context: hostComponent, 'label': Em.I18n.t('services.service.actions.reassign.master').format(hostComponent.get('displayName'))});
+        })
     }
     return options;
   }.property('controller.content'),