You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/09/04 14:07:31 UTC

ambari git commit: AMBARI-13009. Hosts check popup tooltip is too big (onechiporenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk a84a5b5eb -> 09bb34e9d


AMBARI-13009. Hosts check popup tooltip is too big (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 09bb34e9d6e723dcd96555d9b31ca987bd2622f0
Parents: a84a5b5
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Fri Sep 4 15:01:35 2015 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Fri Sep 4 15:01:35 2015 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step3_controller.js  | 62 +++++++++++++++++++-
 .../wizard/step3/step3_host_warnings_popup.hbs  |  2 +-
 .../wizard/step3/hostWarningPopupBody_view.js   | 12 ++--
 .../test/controllers/wizard/step3_test.js       |  7 ++-
 .../step3/hostWarningPopupBody_view_test.js     |  8 +--
 5 files changed, 76 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/09bb34e9/ambari-web/app/controllers/wizard/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js
index 658e26c..1e707c9 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -32,11 +32,41 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
 
   registeredHosts: [],
 
+  /**
+   * @typedef {{
+   *  name: string,
+   *  hosts: string[],
+   *  hostsLong: string[],
+   *  hostsNames: string[],
+   *  onSingleHost: boolean
+   * }} checkWarning
+   */
+
+  /**
+   * @type {checkWarning[]}
+   */
   hostCheckWarnings: [],
+
+  /**
+   * @type {checkWarning[]}
+   */
   repoCategoryWarnings: [],
+
+  /**
+   * @type {checkWarning[]}
+   */
   diskCategoryWarnings: [],
+
+  /**
+   * @type {checkWarning[]}
+   */
   thpCategoryWarnings: [],
+
+  /**
+   * @type {checkWarning[]}
+   */
   jdkCategoryWarnings: null,
+
   jdkRequestIndex: null,
 
   registrationStartedAt: null,
@@ -853,6 +883,7 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
         jdkWarnings.push({
           name: Em.I18n.t('installer.step3.hostWarningsPopup.jdk.name').format(invalidJavaHome),
           hosts: hostsJDKContext,
+          hostsLong: hostsJDKContext,
           hostsNames: hostsJDKNames,
           category: 'jdk',
           onSingleHost: false
@@ -1082,15 +1113,17 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
       var name = Em.I18n.t('installer.step3.hostWarningsPopup.resolution.validation.error');
       var hostInfo = this.get("hostCheckWarnings").findProperty('name', name);
       if (["FAILED", "COMPLETED", "TIMEDOUT"].contains(task.Tasks.status)) {
-        if (!(task.Tasks.status == "COMPLETED" && Em.get(task, "Tasks.structured_out.host_resolution_check.failed_count") == 0)) {
+        if (task.Tasks.status == "COMPLETED" && Em.get(task, "Tasks.structured_out.host_resolution_check.failed_count") != 0) {
           var targetHostName = Em.get(task, "Tasks.host_name");
           var relatedHostNames = Em.get(task, "Tasks.structured_out.host_resolution_check.failures")
             ? Em.get(task, "Tasks.structured_out.host_resolution_check.failures").mapProperty('host') : [];
-          var contextMessage = Em.I18n.t('installer.step3.hostWarningsPopup.resolution.validation.context').format(targetHostName, relatedHostNames.join(', '));
+          var contextMessage = Em.I18n.t('installer.step3.hostWarningsPopup.resolution.validation.context').format(targetHostName, relatedHostNames.length + ' ' + Em.I18n.t('installer.step3.hostWarningsPopup.host' + (relatedHostNames.length == 1 ? '' : 's')));
+          var contextMessageLong = Em.I18n.t('installer.step3.hostWarningsPopup.resolution.validation.context').format(targetHostName, relatedHostNames.join(', '));
           if (!hostInfo) {
             hostInfo = {
               name: name,
               hosts: [contextMessage],
+              hostsLong: [contextMessageLong],
               hostsNames: [targetHostName],
               onSingleHost: true
             };
@@ -1098,7 +1131,9 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
           } else {
             if (!hostInfo.hostsNames.contains(targetHostName)) {
               hostInfo.hosts.push(contextMessage);
+              hostInfo.hostsLong.push(contextMessageLong);
               hostInfo.hostsNames.push(targetHostName);
+              hostInfo.onSingleHost = false;
             }
           }
         }
@@ -1174,6 +1209,7 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
       repoWarnings.push({
         name: Em.I18n.t('installer.step3.hostWarningsPopup.repositories.name'),
         hosts: hostsContext,
+        hostsLong: hostsContext,
         hostsNames: hostsRepoNames,
         category: 'repositories',
         onSingleHost: false
@@ -1183,6 +1219,7 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
       diskWarnings.push({
         name: Em.I18n.t('installer.step3.hostWarningsPopup.disk.name'),
         hosts: hostsDiskContext,
+        hostsLong: hostsDiskContext,
         hostsNames: hostsDiskNames,
         category: 'disk',
         onSingleHost: false
@@ -1192,6 +1229,7 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
       thpWarnings.push({
         name: Em.I18n.t('installer.step3.hostWarningsPopup.thp.name'),
         hosts: thpContext,
+        hostsLong: thpContext,
         hostsNames: thpHostsNames,
         category: 'thp',
         onSingleHost: false
@@ -1499,11 +1537,13 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
         warning = warningCategories.fileFoldersWarnings[path.name];
         if (warning) {
           warning.hosts.push(_host.Hosts.host_name);
+          warning.hostsLong.push(_host.Hosts.host_name);
           warning.onSingleHost = false;
         } else {
           warningCategories.fileFoldersWarnings[path.name] = warning = {
             name: path.name,
             hosts: [_host.Hosts.host_name],
+            hostsLong: [_host.Hosts.host_name],
             category: 'fileFolders',
             onSingleHost: true
           };
@@ -1519,6 +1559,7 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
           warning = warningCategories.packagesWarnings[_package.name];
           if (warning) {
             warning.hosts.push(_host.Hosts.host_name);
+            warning.hostsLong.push(_host.Hosts.host_name);
             warning.version = _package.version;
             warning.onSingleHost = false;
           } else {
@@ -1526,6 +1567,7 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
               name: _package.name,
               version: _package.version,
               hosts: [_host.Hosts.host_name],
+              hostsLong: [_host.Hosts.host_name],
               category: 'packages',
               onSingleHost: true
             };
@@ -1543,11 +1585,13 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
           warning = warningCategories.processesWarnings[process.pid];
           if (warning) {
             warning.hosts.push(_host.Hosts.host_name);
+            warning.hostsLong.push(_host.Hosts.host_name);
             warning.onSingleHost = false;
           } else {
             warningCategories.processesWarnings[process.pid] = warning = {
               name: (process.command.substr(0, 35) + '...'),
               hosts: [_host.Hosts.host_name],
+              hostsLong: [_host.Hosts.host_name],
               category: 'processes',
               user: process.user,
               pid: process.pid,
@@ -1571,11 +1615,13 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
             warning = warningCategories.servicesWarnings[service.name];
             if (warning) {
               warning.hosts.push(_host.Hosts.host_name);
+              warning.hostsLong.push(_host.Hosts.host_name);
               warning.onSingleHost = false;
             } else {
               warningCategories.servicesWarnings[service.name] = warning = {
                 name: service.name,
                 hosts: [_host.Hosts.host_name],
+                hostsLong: [_host.Hosts.host_name],
                 category: 'services',
                 onSingleHost: true
               };
@@ -1592,11 +1638,13 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
           warning = warningCategories.usersWarnings[user.userName];
           if (warning) {
             warning.hosts.push(_host.Hosts.host_name);
+            warning.hostsLong.push(_host.Hosts.host_name);
             warning.onSingleHost = false;
           } else {
             warningCategories.usersWarnings[user.userName] = warning = {
               name: user.userName,
               hosts: [_host.Hosts.host_name],
+              hostsLong: [_host.Hosts.host_name],
               category: 'users',
               onSingleHost: true
             };
@@ -1611,11 +1659,13 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
         warning = warnings.filterProperty('category', 'misc').findProperty('name', umask);
         if (warning) {
           warning.hosts.push(_host.Hosts.host_name);
+          warning.hostsLong.push(_host.Hosts.host_name);
           warning.onSingleHost = false;
         } else {
           warning = {
             name: umask,
             hosts: [_host.Hosts.host_name],
+            hostsLong: [_host.Hosts.host_name],
             category: 'misc',
             onSingleHost: true
           };
@@ -1630,11 +1680,13 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
         warning = warnings.filterProperty('category', 'firewall').findProperty('name', name);
         if (warning) {
           warning.hosts.push(_host.Hosts.host_name);
+          warning.hostsLong.push(_host.Hosts.host_name);
           warning.onSingleHost = false;
         } else {
           warning = {
             name: name,
             hosts: [_host.Hosts.host_name],
+            hostsLong: [_host.Hosts.host_name],
             category: 'firewall',
             onSingleHost: true
           };
@@ -1648,12 +1700,14 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
           warning = warningCategories.alternativeWarnings[alternative.name];
           if (warning) {
             warning.hosts.push(_host.Hosts.host_name);
+            warning.hostsLong.push(_host.Hosts.host_name);
             warning.onSingleHost = false;
           } else {
             warningCategories.alternativeWarnings[alternative.name] = warning = {
               name: alternative.name,
               target: alternative.target,
               hosts: [_host.Hosts.host_name],
+              hostsLong: [_host.Hosts.host_name],
               category: 'alternatives',
               onSingleHost: true
             };
@@ -1667,11 +1721,13 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
         warning = warnings.filterProperty('category', 'reverseLookup').findProperty('name', name);
         if (warning) {
           warning.hosts.push(_host.Hosts.host_name);
+          warning.hostsLong.push(_host.Hosts.host_name);
           warning.onSingleHost = false;
         } else {
           warning = {
             name: name,
             hosts: [_host.Hosts.host_name],
+            hostsLong: [_host.Hosts.host_name],
             category: 'reverseLookup',
             onSingleHost: true
           };
@@ -1683,7 +1739,7 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, {
     }, this);
 
     for (var categoryId in warningCategories) {
-      var category = warningCategories[categoryId]
+      var category = warningCategories[categoryId];
       for (var warningId in category) {
         warnings.push(category[warningId]);
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/09bb34e9/ambari-web/app/templates/wizard/step3/step3_host_warnings_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step3/step3_host_warnings_popup.hbs b/ambari-web/app/templates/wizard/step3/step3_host_warnings_popup.hbs
index a9dfd59..4b0f753 100644
--- a/ambari-web/app/templates/wizard/step3/step3_host_warnings_popup.hbs
+++ b/ambari-web/app/templates/wizard/step3/step3_host_warnings_popup.hbs
@@ -70,7 +70,7 @@
                       <td class="package-version">{{warning.target}}</td>
                     {{/if}}
                     <td>{{category.action}}
-                      <a href="javascript:void(null);" rel='HostsListTooltip' {{bindAttr data-original-title="warning.hostsList"}} {{action showHostsPopup warning.hosts}}>
+                      <a href="javascript:void(null);" rel='HostsListTooltip' {{bindAttr data-original-title="warning.hostsList"}} {{action showHostsPopup warning.hostsLong}}>
                         {{warning.hosts.length}}
                         {{#if warning.onSingleHost}}
                           {{t installer.step3.hostWarningsPopup.host}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/09bb34e9/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js b/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js
index 0a1a823..b9d43a5 100644
--- a/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js
+++ b/ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js
@@ -316,23 +316,23 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
     newContent += this.get('hostNamesWithWarnings').join(' ');
     if (content.findProperty('category', 'thp').warnings.length) {
       newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.thp');
-      newContent += content.findProperty('category', 'thp').warnings[0].hosts.join(' ');
+      newContent += content.findProperty('category', 'thp').warnings[0].hostsLong.join(' ');
     }
     if (content.findProperty('category', 'jdk').warnings.length) {
       newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.jdk');
-      newContent += content.findProperty('category', 'jdk').warnings[0].hosts.join('<br>');
+      newContent += content.findProperty('category', 'jdk').warnings[0].hostsLong.join('<br>');
     }
     if (content.findProperty('category', 'disk').warnings.length) {
       newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.disk');
-      newContent += content.findProperty('category', 'disk').warnings[0].hosts.join('<br>');
+      newContent += content.findProperty('category', 'disk').warnings[0].hostsLong.join('<br>');
     }
     if (content.findProperty('category', 'repositories').warnings.length) {
       newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.repositories');
-      newContent += content.findProperty('category', 'repositories').warnings[0].hosts.join('<br>');
+      newContent += content.findProperty('category', 'repositories').warnings[0].hostsLong.join('<br>');
     }
     if (content.findProperty('category', 'hostNameResolution').warnings.length) {
       newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.hostNameResolution');
-      newContent += content.findProperty('category', 'hostNameResolution').warnings[0].hosts.join('<br>');
+      newContent += content.findProperty('category', 'hostNameResolution').warnings[0].hostsLong.join('<br>');
     }
     if (content.findProperty('category', 'firewall').warnings.length) {
       newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.firewall');
@@ -344,7 +344,7 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
     }
     if (content.findProperty('category', 'reverseLookup').warnings.length) {
       newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.reverseLookup');
-      newContent += content.findProperty('category', 'reverseLookup').warnings[0].hosts.join(' ');
+      newContent += content.findProperty('category', 'reverseLookup').warnings[0].hostsLong.join(' ');
     }
     if (content.findProperty('category', 'process').warnings.length) {
       newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.process');

http://git-wip-us.apache.org/repos/asf/ambari/blob/09bb34e9/ambari-web/test/controllers/wizard/step3_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js
index 65a672d..aede550 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -1682,6 +1682,7 @@ describe('App.WizardStep3Controller', function () {
       var warnings = c.get('warnings');
       expect(warnings.length).to.equal(1);
       expect(warnings[0].hosts).to.eql(['c1']);
+      expect(warnings[0].hostsLong).to.eql(['c1']);
       expect(warnings[0].onSingleHost).to.equal(true);
 
     });
@@ -1714,6 +1715,7 @@ describe('App.WizardStep3Controller', function () {
       var warnings = c.get('warnings');
       expect(warnings.length).to.equal(1);
       expect(warnings[0].hosts).to.eql(['c1']);
+      expect(warnings[0].hostsLong).to.eql(['c1']);
       expect(warnings[0].onSingleHost).to.equal(true);
 
     });
@@ -1729,6 +1731,7 @@ describe('App.WizardStep3Controller', function () {
       var warnings = c.get('warnings');
       expect(warnings.length).to.equal(1);
       expect(warnings[0].hosts).to.eql(['c1', 'c2']);
+      expect(warnings[0].hostsLong).to.eql(['c1', 'c2']);
       expect(warnings[0].onSingleHost).to.equal(false);
 
     });
@@ -1755,6 +1758,7 @@ describe('App.WizardStep3Controller', function () {
       var warnings = c.get('warnings');
       expect(warnings.length).to.equal(1);
       expect(warnings[0].hosts).to.eql(['c1']);
+      expect(warnings[0].hostsLong).to.eql(['c1']);
       expect(warnings[0].onSingleHost).to.equal(true);
 
     });
@@ -1770,6 +1774,7 @@ describe('App.WizardStep3Controller', function () {
       var warnings = c.get('warnings');
       expect(warnings.length).to.equal(1);
       expect(warnings[0].hosts).to.eql(['c1', 'c2']);
+      expect(warnings[0].hostsLong).to.eql(['c1', 'c2']);
       expect(warnings[0].onSingleHost).to.equal(false);
 
     });
@@ -2323,7 +2328,7 @@ describe('App.WizardStep3Controller', function () {
       expect(c.get('isJDKWarningsLoaded')).to.equal(expected);
     });
 
-    it('should do propert request to ambari-server', function () {
+    it('should do proper request to ambari-server', function () {
 
       var data = null,
         jdkRequestIndex = 'jdkRequestIndex',

http://git-wip-us.apache.org/repos/asf/ambari/blob/09bb34e9/ambari-web/test/views/wizard/step3/hostWarningPopupBody_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step3/hostWarningPopupBody_view_test.js b/ambari-web/test/views/wizard/step3/hostWarningPopupBody_view_test.js
index aa5d023..3cd53a0 100644
--- a/ambari-web/test/views/wizard/step3/hostWarningPopupBody_view_test.js
+++ b/ambari-web/test/views/wizard/step3/hostWarningPopupBody_view_test.js
@@ -153,13 +153,13 @@ describe('App.WizardStep3HostWarningPopupBody', function() {
     var content = [
       {category: 'firewall', warnings: [{name: 'n1'}, {name: 'n2'}, {name: 'n3'}]},
       {category: 'fileFolders', warnings: [{name: 'n4'}, {name: 'n5'}, {name: 'n6'}]},
-      {category: 'reverseLookup', warnings: [{name: 'n19', hosts: ["h1"]}]},
+      {category: 'reverseLookup', warnings: [{name: 'n19', hosts: ["h1"], hostsLong: ["h1"]}]},
       {
         category: 'process',
         warnings: [
-          {name: 'n7', hosts:['h1', 'h2'], user: 'u1', pid: 'pid1'},
-          {name: 'n8', hosts:['h2'], user: 'u2', pid: 'pid2'},
-          {name: 'n9', hosts:['h3'], user: 'u1', pid: 'pid3'}
+          {name: 'n7', hosts:['h1', 'h2'], hostsLong:['h1', 'h2'], user: 'u1', pid: 'pid1'},
+          {name: 'n8', hosts:['h2'], hostsLong:['h2'], user: 'u2', pid: 'pid2'},
+          {name: 'n9', hosts:['h3'], hostsLong:['h3'], user: 'u1', pid: 'pid3'}
         ]
       },
       {category: 'package', warnings: [{name: 'n10'}, {name: 'n11'}, {name: 'n12'}]},