Просмотр исходного кода

AMBARI-3666. Add "Move" option to Actions menu on the host details page. (akovalenko)

Aleksandr Kovalenko 11 лет назад
Родитель
Сommit
9b0af755db

+ 1 - 0
ambari-web/app/config.js

@@ -37,6 +37,7 @@ App.maxRunsForAppBrowser = 500;
 App.pageReloadTime=3600000;
 App.singleNodeInstall = false;
 App.singleNodeAlias = document.location.hostname;
+App.reassignableComponents = ['NAMENODE', 'SECONDARY_NAMENODE', 'JOBTRACKER', 'RESOURCEMANAGER'];
 
 // experimental features are automatically enabled if running on brunch server
 App.enableExperimental = false;

+ 14 - 0
ambari-web/app/controllers/main/host/details.js

@@ -870,6 +870,20 @@ App.MainHostDetailsController = Em.Controller.extend({
     App.showConfirmationPopup(function() {
 
     });
+  },
+  /**
+   * open Reassign Master Wizard with selected component
+   * @param event
+   */
+  moveComponent: function (event) {
+    App.showConfirmationPopup(function() {
+      var component = event.context;
+      var reassignMasterController = App.router.get('reassignMasterController');
+      reassignMasterController.saveComponentToReassign(component);
+      reassignMasterController.getSecurityStatus();
+      reassignMasterController.setCurrentStep('1');
+      App.router.transitionTo('services.reassign');
+    });
   }
 
 });

+ 1 - 0
ambari-web/app/messages.js

@@ -151,6 +151,7 @@ Em.I18n.translations = {
   'common.tags': 'Tags',
   'common.important': 'Important',
   'common.allServices':'All Services',
+  'common.move':'Move',
 
   'requestInfo.installComponents':'Install Components',
   'requestInfo.installServices':'Install Services',

+ 7 - 0
ambari-web/app/templates/main/host/summary.hbs

@@ -126,6 +126,13 @@
                         </a>
                       </li>
                     {{/if}}
+                    {{#if view.isReassignable}}
+                      <li {{bindAttr class="view.noActionAvailable"}}>
+                        <a href="javascript:void(null)" data-toggle="modal" {{action "moveComponent" view.content target="controller"}}>
+                          {{t common.move}}
+                        </a>
+                      </li>
+                    {{/if}}
                   {{/unless}}
                 </ul>
               </div>

+ 4 - 0
ambari-web/app/views/main/host/summary.js

@@ -438,6 +438,10 @@ App.MainHostSummaryView = Em.View.extend({
         this.get('workStatus') == App.HostComponentStatus.install_failed || this.get('workStatus') == App.HostComponentStatus.upgrade_failed);
     }.property('workStatus'),
 
+    isReassignable: function () {
+      return App.supports.reassignMaster && App.reassignableComponents.contains(this.get('content.componentName')) && App.Host.find().content.length > 1;
+    }.property('content.componentName')
+
   }),
   timeSinceHeartBeat: function () {
     var d = this.get('content.lastHeartBeatTime');

+ 1 - 2
ambari-web/app/views/main/service/item.js

@@ -25,7 +25,6 @@ App.MainServiceItemView = Em.View.extend({
     var service = this.get('controller.content');
     var hosts = App.Host.find().content.length;
     var allMasters = this.get('controller.content.hostComponents').filterProperty('isMaster').mapProperty('componentName').uniq();
-    var reassignableMasters = ['NAMENODE', 'SECONDARY_NAMENODE', 'JOBTRACKER', 'RESOURCEMANAGER'];
     var disabled = this.get('controller.isStopDisabled');
     switch (service.get('serviceName')) {
       case 'GANGLIA':
@@ -36,7 +35,7 @@ App.MainServiceItemView = Em.View.extend({
       case 'MAPREDUCE':
         if (App.supports.reassignMaster && hosts > 1) {
           allMasters.forEach(function (hostComponent) {
-            if (reassignableMasters.contains(hostComponent)) {
+            if (App.reassignableComponents.contains(hostComponent)) {
               options.push({action: 'reassignMaster', context: hostComponent,
                 'label': Em.I18n.t('services.service.actions.reassign.master').format(App.format.role(hostComponent)), disabled: false});
             }