You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2016/04/26 11:21:10 UTC

ambari git commit: AMBARI-16098 Add service host in maintenance mode. (atkach)

Repository: ambari
Updated Branches:
  refs/heads/trunk 784c5414d -> dbf42773b


AMBARI-16098 Add service host in maintenance mode. (atkach)


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

Branch: refs/heads/trunk
Commit: dbf42773bd03842fcadead813a72f39c1e851a9b
Parents: 784c541
Author: Andrii Tkach <at...@apache.org>
Authored: Mon Apr 25 20:32:38 2016 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Tue Apr 26 12:10:05 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/wizard.js            |  3 +-
 .../mixins/wizard/assign_master_components.js   | 11 +--
 ambari-web/app/styles/application.less          |  2 +-
 .../common/assign_master_components.hbs         |  2 +-
 .../test/controllers/wizard/step5_test.js       | 74 ++++++++++++--------
 5 files changed, 53 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/dbf42773/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index f242523..52fb241 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -745,8 +745,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
           ip: _host.ip,
           bootStatus: _host.bootStatus,
           isInstalled: false,
-          id: indx++,
-          maintenance_state: "OFF"
+          id: indx++
         };
       }
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/dbf42773/ambari-web/app/mixins/wizard/assign_master_components.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/assign_master_components.js b/ambari-web/app/mixins/wizard/assign_master_components.js
index bcb628d..0e4a23d 100644
--- a/ambari-web/app/mixins/wizard/assign_master_components.js
+++ b/ambari-web/app/mixins/wizard/assign_master_components.js
@@ -590,6 +590,7 @@ App.AssignMasterComponents = Em.Mixin.create({
           memory: _host.memory,
           disk_info: _host.disk_info,
           maintenance_state: _host.maintenance_state,
+          isInstalled: _host.isInstalled,
           host_info: Em.I18n.t('installer.step5.hostInfo').fmt(_host.name, numberUtils.bytesToSize(_host.memory, 1, 'parseFloat', 1024), _host.cpu)
         }));
       }
@@ -966,7 +967,7 @@ App.AssignMasterComponents = Em.Mixin.create({
    * <ul>
    *  <li>host name shouldn't be empty</li>
    *  <li>host should exist</li>
-   *  <li>host shouldn't be in maintainenance mode. If it's in Installer we set it to 'OFF'</li>
+   *  <li>if host installed maintenance state should be 'OFF'</li>
    *  <li>host should have only one component with <code>componentName</code></li>
    * </ul>
    * @param {string} componentName
@@ -976,8 +977,10 @@ App.AssignMasterComponents = Em.Mixin.create({
    */
   isHostNameValid: function (componentName, selectedHost) {
     return (selectedHost.trim() !== '') &&
-    (this.get('hosts').filterProperty('host_name', selectedHost).filterProperty('maintenance_state', 'OFF').length > 0) &&
-    (this.get('selectedServicesMasters').
+      (this.get('hosts').filter(function(host) {
+        return host.host_name === selectedHost && (!host.isInstalled || host.maintenance_state === 'OFF');
+      }).length > 0) &&
+      (this.get('selectedServicesMasters').
         filterProperty('component_name', componentName).
         mapProperty('selectedHost').
         filter(function (h) {
@@ -1004,7 +1007,7 @@ App.AssignMasterComponents = Em.Mixin.create({
       }
       if (component) {
         component.set("isHostNameValid", flag);
-        component.set("errorMessage", flag ? '' : Em.I18n.t('installer.step5.error.host.invalid'));
+        component.set("errorMessage", flag ? null : Em.I18n.t('installer.step5.error.host.invalid'));
       }
     }
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/dbf42773/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 890a43c..8a34462 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -616,7 +616,7 @@ h1 {
 }
 
 .popover {
-  z-index: 1050;
+  z-index: 10000;
   width: 350px;
   .popover-inner {
     word-wrap: break-word;

http://git-wip-us.apache.org/repos/asf/ambari/blob/dbf42773/ambari-web/app/templates/common/assign_master_components.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/assign_master_components.hbs b/ambari-web/app/templates/common/assign_master_components.hbs
index e864e08..860e01d 100644
--- a/ambari-web/app/templates/common/assign_master_components.hbs
+++ b/ambari-web/app/templates/common/assign_master_components.hbs
@@ -103,7 +103,7 @@
                           </span>
                           <span rel="popover" title="Error" {{bindAttr data-content="errorMessage"}}>
                             {{#if errorMessage}}
-                              <i class="icon-remove-sign"></i>
+                              <i class="icon-exclamation-sign"></i>
                             {{/if}}
                           </span>
                         </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/dbf42773/ambari-web/test/controllers/wizard/step5_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step5_test.js b/ambari-web/test/controllers/wizard/step5_test.js
index 2bf36d6..a1ecbce 100644
--- a/ambari-web/test/controllers/wizard/step5_test.js
+++ b/ambari-web/test/controllers/wizard/step5_test.js
@@ -915,9 +915,9 @@ describe('App.WizardStep5Controller', function () {
     beforeEach(function () {
       c.setProperties({
         hosts: [
-          {host_name: 'h1', maintenance_state: 'OFF'},
-          {host_name: 'h2', maintenance_state: 'ON'},
-          {host_name: 'h3', maintenance_state: 'OFF'},
+          {host_name: 'h1', isInstalled: false},
+          {host_name: 'h2', isInstalled: true, maintenance_state: 'ON'},
+          {host_name: 'h3', isInstalled: true, maintenance_state: 'OFF'}
         ],
         selectedServicesMasters: [
           {component_name: 'c1', selectedHost: 'h1'},
@@ -929,35 +929,47 @@ describe('App.WizardStep5Controller', function () {
     });
 
     Em.A([
-        {
-          componentName: 'c1',
-          selectedHost: '   ',
-          m: 'empty hostName is invalid',
-          e: false
-        },
-        {
-          componentName: 'c1',
-          selectedHost: 'h4',
-          m: 'hostName not exists',
-          e: false
-        },
-        {
-          componentName: 'c1',
-          selectedHost: 'h2',
-          m: 'host maintainenance on',
-          e: false
-        },
-        {
-          componentName: 'c4',
-          selectedHost: 'h3',
-          m: 'component not exists on host',
-          e: true
-        }
-      ]).forEach(function (test) {
-        it(test.m, function () {
-          expect(c.isHostNameValid(test.componentName, test.selectedHost)).to.equal(test.e);
-        });
+      {
+        componentName: 'c1',
+        selectedHost: '   ',
+        m: 'empty hostName is invalid',
+        e: false
+      },
+      {
+        componentName: 'c1',
+        selectedHost: 'h4',
+        m: 'hostName not exists',
+        e: false
+      },
+      {
+        componentName: 'c1',
+        selectedHost: 'h1',
+        m: 'not installed host',
+        e: true
+      },
+      {
+        componentName: 'c1',
+        selectedHost: 'h2',
+        m: 'installed host with maintenance ON',
+        e: false
+      },
+      {
+        componentName: 'c1',
+        selectedHost: 'h3',
+        m: 'installed host with maintenance OFF',
+        e: true
+      },
+      {
+        componentName: 'c4',
+        selectedHost: 'h3',
+        m: 'component not exists on host',
+        e: true
+      }
+    ]).forEach(function (test) {
+      it(test.m, function () {
+        expect(c.isHostNameValid(test.componentName, test.selectedHost)).to.equal(test.e);
       });
+    });
 
   });