浏览代码

AMBARI-3551: Reassign Master: option for the wizard should be hidden on single node cluster. (jaimin)

Jaimin Jetly 11 年之前
父节点
当前提交
c16d009a96

+ 5 - 4
ambari-web/app/controllers/main/admin/highAvailability_controller.js

@@ -34,14 +34,15 @@ App.MainAdminHighAvailabilityController = Em.Controller.extend({
       this.showErrorPopup(Em.I18n.t('admin.highAvailability.error.security'));
       return;
     } else {
-      if (App.Host.find().content.length < 3) {
-        message.push(Em.I18n.t('admin.highAvailability.error.hostsNum'));
+      if (App.HostComponent.find().findProperty('componentName', 'NAMENODE').get('workStatus') !== 'STARTED') {
+        message.push(Em.I18n.t('admin.highAvailability.error.namenodeStarted'));
       }
       if (App.HostComponent.find().filterProperty('componentName', 'ZOOKEEPER_SERVER').length < 3) {
         message.push(Em.I18n.t('admin.highAvailability.error.zooKeeperNum'));
       }
-      if (App.HostComponent.find().findProperty('componentName', 'NAMENODE').get('workStatus') !== 'STARTED') {
-        message.push(Em.I18n.t('admin.highAvailability.error.namenodeStarted'));
+
+      if (App.Host.find().content.length < 3) {
+        message.push(Em.I18n.t('admin.highAvailability.error.hostsNum'));
       }
       if (message.length > 0) {
         this.showErrorPopup(message);

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

@@ -23,6 +23,7 @@ App.MainServiceItemView = Em.View.extend({
   maintenance: function(){
     var options = [];
     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'];
     switch (service.get('serviceName')) {
@@ -32,7 +33,7 @@ App.MainServiceItemView = Em.View.extend({
       case 'YARN':
       case 'HDFS':
       case 'MAPREDUCE':
-        if (App.supports.reassignMaster) {
+        if (App.supports.reassignMaster && hosts > 1) {
           allMasters.forEach(function (hostComponent) {
             if (reassignableMasters.contains(hostComponent)) {
               options.push({action: 'reassignMaster', context: hostComponent,