浏览代码

AMBARI-15519 Add Service Wizard with nodes in the maintenance mode (zhewang)

Zhe (Joe) Wang 9 年之前
父节点
当前提交
8c6796f38b

+ 1 - 0
ambari-web/app/controllers/wizard.js

@@ -1222,6 +1222,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
         osType: item.Hosts.os_type,
         osArch: item.Hosts.os_arch,
         ip: item.Hosts.ip,
+        maintenance_state: item.Hosts.maintenance_state,
         bootStatus: "REGISTERED",
         isInstalled: true,
         hostComponents: item.host_components,

+ 2 - 0
ambari-web/app/mixins/wizard/assign_master_components.js

@@ -589,6 +589,7 @@ App.AssignMasterComponents = Em.Mixin.create({
           cpu: _host.cpu,
           memory: _host.memory,
           disk_info: _host.disk_info,
+          maintenance_state: _host.maintenance_state,
           host_info: Em.I18n.t('installer.step5.hostInfo').fmt(_host.name, numberUtils.bytesToSize(_host.memory, 1, 'parseFloat', 1024), _host.cpu)
         }));
       }
@@ -975,6 +976,7 @@ App.AssignMasterComponents = Em.Mixin.create({
   isHostNameValid: function (componentName, selectedHost) {
     return (selectedHost.trim() !== '') &&
     this.get('hosts').mapProperty('host_name').contains(selectedHost) &&
+    (this.get('hosts').filterProperty('host_name', selectedHost).filterProperty('maintenance_state', 'OFF').length > 0) &&
     (this.get('selectedServicesMasters').
         filterProperty('component_name', componentName).
         mapProperty('selectedHost').

+ 1 - 1
ambari-web/app/utils/ajax/ajax.js

@@ -2447,7 +2447,7 @@ var urls = {
     'mock': ''
   },
   'hosts.confirmed': {
-    'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/os_type,Hosts/os_arch,Hosts/ip,host_components/HostRoles/state&minimal_response=true',
+    'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/os_type,Hosts/os_arch,Hosts/ip,Hosts/maintenance_state,host_components/HostRoles/state&minimal_response=true',
     'mock': '/data/hosts/HDP2/hosts.json'
   },
   'hosts.with_searchTerm': {

+ 6 - 2
ambari-web/test/controllers/main/service/add_controller_test.js

@@ -227,7 +227,8 @@ describe('App.AddServiceController', function() {
                 ip: '10.1.1.0',
                 os_arch: 'x86_64',
                 os_type: 'centos6',
-                total_mem: 4194304
+                total_mem: 4194304,
+                maintenance_state: 'ON'
               },
               host_components: hostComponents[0]
             },
@@ -241,7 +242,8 @@ describe('App.AddServiceController', function() {
                 ip: '10.1.1.1',
                 os_arch: 'x86',
                 os_type: 'centos5',
-                total_mem: 3145728
+                total_mem: 3145728,
+                maintenance_state: 'OFF'
               },
               host_components: hostComponents[1]
             }
@@ -258,6 +260,7 @@ describe('App.AddServiceController', function() {
             ip: '10.1.1.0',
             bootStatus: 'REGISTERED',
             isInstalled: true,
+            maintenance_state: 'ON',
             hostComponents: hostComponents[0],
             id: 0
           },
@@ -271,6 +274,7 @@ describe('App.AddServiceController', function() {
             ip: '10.1.1.1',
             bootStatus: 'REGISTERED',
             isInstalled: true,
+            maintenance_state: 'OFF',
             hostComponents: hostComponents[1],
             id: 1
           }

+ 9 - 3
ambari-web/test/controllers/wizard/step5_test.js

@@ -915,9 +915,9 @@ describe('App.WizardStep5Controller', function () {
     beforeEach(function () {
       c.setProperties({
         hosts: [
-          {host_name: 'h1'},
-          {host_name: 'h2'},
-          {host_name: 'h3'}
+          {host_name: 'h1', maintenance_state: 'OFF'},
+          {host_name: 'h2', maintenance_state: 'ON'},
+          {host_name: 'h3', maintenance_state: 'OFF'},
         ],
         selectedServicesMasters: [
           {component_name: 'c1', selectedHost: 'h1'},
@@ -941,6 +941,12 @@ describe('App.WizardStep5Controller', function () {
           m: 'hostName not exists',
           e: false
         },
+        {
+          componentName: 'c1',
+          selectedHost: 'h2',
+          m: 'host maintainenance on',
+          e: false
+        },
         {
           componentName: 'c4',
           selectedHost: 'h3',