瀏覽代碼

AMBARI-9707 Install Wizard, step 3, Host Checks popup: Tooltip with host names missing in some sections.(ababiichuk)

aBabiichuk 10 年之前
父節點
當前提交
6c22c4deb9

+ 0 - 7
ambari-web/app/controllers/wizard/step3_controller.js

@@ -1623,13 +1623,6 @@ App.WizardStep3Controller = Em.Controller.extend({
       }
     }
 
-    warnings.forEach(function (warn) {
-      if (warn.hosts.length < 11) {
-        warn.hostsList = warn.hosts.join('<br>')
-      } else {
-        warn.hostsList = warn.hosts.slice(0, 10).join('<br>') + '<br> ' + Em.I18n.t('installer.step3.hostWarningsPopup.moreHosts').format(warn.hosts.length - 10);
-      }
-    });
     hosts.unshift({
       name: 'All Hosts',
       warnings: warnings

+ 29 - 30
ambari-web/app/views/wizard/step3/hostWarningPopupBody_view.js

@@ -149,7 +149,7 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
     var jdkCategoryWarnings = this.get('bodyController.jdkCategoryWarnings') || [];
     var thpCategoryWarnings = this.get('bodyController.thpCategoryWarnings');
     var categoryWarnings = this.get('categoryWarnings');
-    return [
+    var warningsArray = [
       Em.Object.create({
         warnings: thpCategoryWarnings,
         title: Em.I18n.t('installer.step3.hostWarningsPopup.thp'),
@@ -157,8 +157,7 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         type: Em.I18n.t('common.issues'),
         emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.thp'),
         action: Em.I18n.t('installer.step3.hostWarningsPopup.action.enabled'),
-        category: 'thp',
-        isCollapsed: true
+        category: 'thp'
       }),
       Em.Object.create({
         warnings: jdkCategoryWarnings,
@@ -167,8 +166,7 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         type: Em.I18n.t('common.issues'),
         emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.jdk'),
         action: Em.I18n.t('installer.step3.hostWarningsPopup.action.exists'),
-        category: 'jdk',
-        isCollapsed: true
+        category: 'jdk'
       }),
       Em.Object.create({
         warnings: diskCategoryWarnings,
@@ -177,8 +175,7 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         type: Em.I18n.t('common.issues'),
         emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.disk'),
         action: Em.I18n.t('installer.step3.hostWarningsPopup.action.exists'),
-        category: 'disk',
-        isCollapsed: true
+        category: 'disk'
       }),
       Em.Object.create({
         warnings: repoCategoryWarnings,
@@ -187,8 +184,7 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         type: Em.I18n.t('common.issues'),
         emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.repositories'),
         action: Em.I18n.t('installer.step3.hostWarningsPopup.action.invalid'),
-        category: 'repositories',
-        isCollapsed: true
+        category: 'repositories'
       }),
       Em.Object.create({
         warnings: categoryWarnings.filterProperty('category', 'firewall'),
@@ -197,8 +193,7 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         type: Em.I18n.t('common.issues'),
         emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.firewall'),
         action: Em.I18n.t('installer.step3.hostWarningsPopup.action.running'),
-        category: 'firewall',
-        isCollapsed: true
+        category: 'firewall'
       }),
       Em.Object.create({
         warnings: categoryWarnings.filterProperty('category', 'processes'),
@@ -207,8 +202,7 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         type: Em.I18n.t('common.process'),
         emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.processes'),
         action: Em.I18n.t('installer.step3.hostWarningsPopup.action.running'),
-        category: 'process',
-        isCollapsed: true
+        category: 'process'
       }),
       Em.Object.create({
         warnings: categoryWarnings.filterProperty('category', 'packages'),
@@ -217,8 +211,7 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         type: Em.I18n.t('common.package'),
         emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.packages'),
         action: Em.I18n.t('installer.step3.hostWarningsPopup.action.installed'),
-        category: 'package',
-        isCollapsed: true
+        category: 'package'
       }),
       Em.Object.create({
         warnings: categoryWarnings.filterProperty('category', 'fileFolders'),
@@ -227,8 +220,7 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         type: Em.I18n.t('common.path'),
         emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.filesAndFolders'),
         action: Em.I18n.t('installer.step3.hostWarningsPopup.action.exists'),
-        category: 'fileFolders',
-        isCollapsed: true
+        category: 'fileFolders'
       }),
       Em.Object.create({
         warnings: categoryWarnings.filterProperty('category', 'services'),
@@ -237,8 +229,7 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         type: Em.I18n.t('common.service'),
         emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.services'),
         action: Em.I18n.t('installer.step3.hostWarningsPopup.action.notRunning'),
-        category: 'service',
-        isCollapsed: true
+        category: 'service'
       }),
       Em.Object.create({
         warnings: categoryWarnings.filterProperty('category', 'users'),
@@ -247,8 +238,7 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         type: Em.I18n.t('common.user'),
         emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.users'),
         action: Em.I18n.t('installer.step3.hostWarningsPopup.action.exists'),
-        category: 'user',
-        isCollapsed: true
+        category: 'user'
       }),
       Em.Object.create({
         warnings: categoryWarnings.filterProperty('category', 'misc'),
@@ -257,8 +247,7 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         type: Em.I18n.t('installer.step3.hostWarningsPopup.misc.umask'),
         emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.misc'),
         action: Em.I18n.t('installer.step3.hostWarningsPopup.action.exists'),
-        category: 'misc',
-        isCollapsed: true
+        category: 'misc'
       }),
       Em.Object.create({
         warnings: categoryWarnings.filterProperty('category', 'alternatives'),
@@ -267,16 +256,14 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         type: Em.I18n.t('installer.step3.hostWarningsPopup.alternatives.umask'),
         emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.alternatives.empty'),
         action: Em.I18n.t('installer.step3.hostWarningsPopup.action.exists'),
-        category: 'alternatives',
-        isCollapsed: true
+        category: 'alternatives'
       }),
       Em.Object.create({
         warnings: categoryWarnings.filterProperty('category', 'reverseLookup'),
         title: Em.I18n.t('installer.step3.hostWarningsPopup.reverseLookup'),
         message: Em.I18n.t('installer.step3.hostWarningsPopup.reverseLookup.message'),
         emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.reverseLookup.empty'),
-        category: 'reverseLookup',
-        isCollapsed: true
+        category: 'reverseLookup'
       }),
       Em.Object.create({
         warnings: hostCheckWarnings,
@@ -285,10 +272,22 @@ App.WizardStep3HostWarningPopupBody = Em.View.extend({
         type: Em.I18n.t('common.issues'),
         emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.resolution.validation.empty'),
         action: Em.I18n.t('installer.step3.hostWarningsPopup.action.failed'),
-        category: 'hostNameResolution',
-        isCollapsed: true
+        category: 'hostNameResolution'
       })
-    ]
+    ];
+    warningsArray.forEach(function (warningType) {
+      warningType.set('isCollapsed', true);
+      warningType.get('warnings').forEach(function (warn) {
+        var hosts = Em.get(warn, 'hosts');
+        if (hosts) {
+          var hostsList = hosts.length < 11 ? hosts.join('<br>') :
+            hosts.slice(0, 10).join('<br>') + '<br> ' +
+              Em.I18n.t('installer.step3.hostWarningsPopup.moreHosts').format(warn.hosts.length - 10);
+          Em.set(warn, 'hostsList', hostsList);
+        }
+      });
+    });
+    return warningsArray;
   }.property('category', 'warningsByHost', 'bodyController.jdkCategoryWarnings', 'bodyController.repoCategoryWarnings', 'bodyController.diskCategoryWarnings', 'bodyController.hostCheckWarnings',  'bodyController.thpCategoryWarnings'),
 
   /**

+ 137 - 0
ambari-web/test/views/wizard/step3/hostWarningPopupBody_view_test.js

@@ -211,4 +211,141 @@ describe('App.WizardStep3HostWarningPopupBody', function() {
     });
   });
 
+  describe('#content', function () {
+
+    it('should return array with warning objects', function () {
+      view.set('bodyController', Em.Object.create({
+        hostCheckWarnings: [
+          {
+            hosts: ['h0', 'h1', 'h2', 'h3', 'h4', 'h5', 'h5', 'h7', 'h8', 'h9', 'h10']
+          }
+        ],
+        repoCategoryWarnings: [
+          {
+            hosts: ['h11', 'h12']
+          }
+        ],
+        diskCategoryWarnings: [
+          {
+            hosts: ['h13']
+          }
+        ],
+        jdkCategoryWarnings: [
+          {
+            hosts: ['h14']
+          }
+        ],
+        thpCategoryWarnings: [
+          {
+            hosts: ['h15']
+          }
+        ]
+      }));
+      view.reopen({
+        categoryWarnings: [
+          {
+            category: 'firewall',
+            hosts: ['h16']
+          },
+          {
+            category: 'firewall',
+            hosts: ['h17']
+          },
+          {
+            category: 'processes',
+            hosts: ['h18']
+          },
+          {
+            category: 'packages',
+            hosts: ['h19']
+          },
+          {
+            category: 'fileFolders',
+            hosts: ['h20']
+          },
+          {
+            category: 'services',
+            hosts: ['h21']
+          },
+          {
+            category: 'users',
+            hosts: ['h22']
+          },
+          {
+            category: 'misc',
+            hosts: ['h23']
+          },
+          {
+            category: 'alternatives',
+            hosts: ['h24']
+          },
+          {
+            category: 'reverseLookup',
+            hosts: ['h25']
+          },
+          {
+            category: 'reverseLookup',
+            hosts: ['h26']
+          },
+          {
+            category: 'reverseLookup',
+            hosts: ['h27']
+          },
+          {
+            category: 'reverseLookup',
+            hosts: ['h28']
+          },
+          {
+            category: 'reverseLookup',
+            hosts: ['h29']
+          },
+          {
+            category: 'reverseLookup',
+            hosts: ['h30']
+          },
+          {
+            category: 'reverseLookup',
+            hosts: ['h31']
+          },
+          {
+            category: 'reverseLookup',
+            hosts: ['h32']
+          },
+          {
+            category: 'reverseLookup',
+            hosts: ['h33']
+          },
+          {
+            category: 'reverseLookup',
+            hosts: ['h34']
+          },
+          {
+            category: 'reverseLookup',
+            hosts: ['h35', 'h36']
+          }
+        ]
+      });
+      var content = view.get('content');
+      expect(content.mapProperty('isCollapsed').uniq()).to.eql([true]);
+      expect(content.findProperty('category', 'hostNameResolution').get('warnings')[0].hostsList).
+        to.equal('h0<br>h1<br>h2<br>h3<br>h4<br>h5<br>h5<br>h7<br>h8<br>h9<br> ' + Em.I18n.t('installer.step3.hostWarningsPopup.moreHosts').format(1));
+      expect(content.findProperty('category', 'repositories').get('warnings')[0].hostsList).to.equal('h11<br>h12');
+      expect(content.findProperty('category', 'disk').get('warnings')[0].hostsList).to.equal('h13');
+      expect(content.findProperty('category', 'jdk').get('warnings')[0].hostsList).to.equal('h14');
+      expect(content.findProperty('category', 'thp').get('warnings')[0].hostsList).to.equal('h15');
+      expect(content.findProperty('category', 'firewall').get('warnings').mapProperty('hostsList')).to.eql(['h16', 'h17']);
+      expect(content.findProperty('category', 'process').get('warnings')[0].hostsList).to.equal('h18');
+      expect(content.findProperty('category', 'package').get('warnings')[0].hostsList).to.equal('h19');
+      expect(content.findProperty('category', 'fileFolders').get('warnings')[0].hostsList).to.equal('h20');
+      expect(content.findProperty('category', 'service').get('warnings')[0].hostsList).to.equal('h21');
+      expect(content.findProperty('category', 'user').get('warnings')[0].hostsList).to.equal('h22');
+      expect(content.findProperty('category', 'misc').get('warnings')[0].hostsList).to.equal('h23');
+      expect(content.findProperty('category', 'alternatives').get('warnings')[0].hostsList).to.equal('h24');
+      expect(content.findProperty('category', 'reverseLookup').get('warnings').mapProperty('hostsList')).to.eql([
+        'h25', 'h26', 'h27', 'h28', 'h29', 'h30', 'h31', 'h32', 'h33', 'h34', 'h35<br>h36'
+      ]);
+    });
+
+  });
+
 });