Browse Source

AMBARI-2540. Host Check UI: Show details action should provide appropriate content. (Aleksandr Kovalenko via srimanth)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1499030 13f79535-47bb-0310-9956-ffa450edef68
Srimanth 12 years ago
parent
commit
2db1b45b07

+ 41 - 30
ambari-web/app/controllers/wizard/step3_controller.js

@@ -915,31 +915,36 @@ App.WizardStep3Controller = Em.Controller.extend({
               warnings: categoryWarnings.filterProperty('category', 'processes'),
               warnings: categoryWarnings.filterProperty('category', 'processes'),
               title: Em.I18n.t('installer.step3.hostWarningsPopup.processes'),
               title: Em.I18n.t('installer.step3.hostWarningsPopup.processes'),
               message: Em.I18n.t('installer.step3.hostWarningsPopup.processes.message'),
               message: Em.I18n.t('installer.step3.hostWarningsPopup.processes.message'),
-              type: Em.I18n.t('common.process')
+              type: Em.I18n.t('common.process'),
+              category: 'process'
             },
             },
             {
             {
               warnings: categoryWarnings.filterProperty('category', 'packages'),
               warnings: categoryWarnings.filterProperty('category', 'packages'),
               title: Em.I18n.t('installer.step3.hostWarningsPopup.packages'),
               title: Em.I18n.t('installer.step3.hostWarningsPopup.packages'),
               message: Em.I18n.t('installer.step3.hostWarningsPopup.packages.message'),
               message: Em.I18n.t('installer.step3.hostWarningsPopup.packages.message'),
-              type: Em.I18n.t('common.package')
+              type: Em.I18n.t('common.package'),
+              category: 'package'
             },
             },
             {
             {
               warnings: categoryWarnings.filterProperty('category', 'fileFolders'),
               warnings: categoryWarnings.filterProperty('category', 'fileFolders'),
               title: Em.I18n.t('installer.step3.hostWarningsPopup.fileFolders'),
               title: Em.I18n.t('installer.step3.hostWarningsPopup.fileFolders'),
               message: Em.I18n.t('installer.step3.hostWarningsPopup.fileFolders.message'),
               message: Em.I18n.t('installer.step3.hostWarningsPopup.fileFolders.message'),
-              type: Em.I18n.t('common.path')
+              type: Em.I18n.t('common.path'),
+              category: 'fileFolders'
             },
             },
             {
             {
               warnings: categoryWarnings.filterProperty('category', 'services'),
               warnings: categoryWarnings.filterProperty('category', 'services'),
               title: Em.I18n.t('installer.step3.hostWarningsPopup.services'),
               title: Em.I18n.t('installer.step3.hostWarningsPopup.services'),
               message: Em.I18n.t('installer.step3.hostWarningsPopup.services.message'),
               message: Em.I18n.t('installer.step3.hostWarningsPopup.services.message'),
-              type: Em.I18n.t('common.service')
+              type: Em.I18n.t('common.service'),
+              category: 'service'
             },
             },
             {
             {
               warnings: categoryWarnings.filterProperty('category', 'users'),
               warnings: categoryWarnings.filterProperty('category', 'users'),
               title: Em.I18n.t('installer.step3.hostWarningsPopup.users'),
               title: Em.I18n.t('installer.step3.hostWarningsPopup.users'),
               message: Em.I18n.t('installer.step3.hostWarningsPopup.users.message'),
               message: Em.I18n.t('installer.step3.hostWarningsPopup.users.message'),
-              type: Em.I18n.t('common.user')
+              type: Em.I18n.t('common.user'),
+              category: 'user'
             }
             }
           ]
           ]
         }.property('category', 'warningsByHost'),
         }.property('category', 'warningsByHost'),
@@ -952,38 +957,44 @@ App.WizardStep3Controller = Em.Controller.extend({
         /**
         /**
          * generate detailed content to show it in new window
          * generate detailed content to show it in new window
          */
          */
-        contentInDetails: function(){
+        contentInDetails: function () {
           var content = this.get('content');
           var content = this.get('content');
+          var warningsByHost = this.get('warningsByHost').slice();
+          warningsByHost.shift();
           var newContent = '';
           var newContent = '';
-          if(content.hostName == 'All Hosts'){
-            newContent += '<h4>'+Em.I18n.t('installer.step3.warningsWindow.allHosts')+'</h4>';
-          } else {
-            newContent += '<h4>' + Em.I18n.t('installer.step3.warningsWindow.warningsOn') + content.hostName + '</h4>';
+          newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.header') + new Date;
+          newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.hosts');
+          newContent += warningsByHost.mapProperty('name').join(' ');
+          if (content.findProperty('category', 'fileFolders').warnings.length) {
+            newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.fileFolders');
+            newContent += content.findProperty('category', 'fileFolders').warnings.mapProperty('name').join(' ') +  Em.I18n.t('installer.step3.hostWarningsPopup.report.folder');
           }
           }
-          newContent += '<div>' + Em.I18n.t('installer.step3.warningsWindow.directoriesAndFiles') + '</div><div>';
-          content.directoriesFiles.filterProperty('isWarn', true).forEach(function(path){
-              newContent += path.name + '&nbsp;'
-          });
-          if(content.directoriesFiles.filterProperty('isWarn', true).length == 0){
-            newContent += Em.I18n.t('installer.step3.warningsWindow.noWarnings');
+          if (content.findProperty('category', 'process').warnings.length) {
+            newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.process');
+            content.findProperty('category', 'process').warnings.forEach(function (process, i) {
+              process.hosts.forEach(function (host, j) {
+                if (!!i || !!j) {
+                  newContent += ',';
+                }
+                newContent += '(' + host + ',' + process.user + ',' + process.pid + ')';
+              });
+            });
           }
           }
-          newContent += '</div><br/><div>PACKAGES</div><div>';
-          content.packages.filterProperty('isWarn', true).forEach(function(_package){
-              newContent += _package.name + '&nbsp;'
-          });
-          if(content.packages.filterProperty('isWarn', true).length == 0){
-            newContent += Em.I18n.t('installer.step3.warningsWindow.noWarnings');
+          if (content.findProperty('category', 'package').warnings.length) {
+            newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.package');
+            newContent += content.findProperty('category', 'package').warnings.mapProperty('name').join(' ');
+          }
+          if (content.findProperty('category', 'service').warnings.length) {
+            newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.service');
+            newContent += content.findProperty('category', 'service').warnings.mapProperty('name').join(' ');
           }
           }
-          newContent += '</div><br/><div>PROCESSES</div><div>';
-          content.processes.filterProperty('isWarn', true).forEach(function(process, index){
-              newContent += '(' + content.hostName + ',' + process.pid + ',' + process.user + ')';
-              newContent += (index != (content.processes.filterProperty('isWarn', true).length-1)) ? ',' : '';
-          })
-          if(content.processes.filterProperty('isWarn', true).length == 0){
-            newContent += Em.I18n.t('installer.step3.warningsWindow.noWarnings');
+          if (content.findProperty('category', 'user').warnings.length) {
+            newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.user');
+            newContent += content.findProperty('category', 'user').warnings.mapProperty('name').join(' ');
           }
           }
+          newContent += '</p>';
           return newContent;
           return newContent;
-        }.property('content'),
+        }.property('content', 'warningsByHost'),
         /**
         /**
          * open new browser tab with detailed content
          * open new browser tab with detailed content
          */
          */

+ 9 - 1
ambari-web/app/messages.js

@@ -309,7 +309,15 @@ Em.I18n.translations = {
   'installer.step3.hosts.remove.popup.body':'Are you sure you want to remove the selected host(s)?',
   'installer.step3.hosts.remove.popup.body':'Are you sure you want to remove the selected host(s)?',
   'installer.step3.hostInformation.popup.header':'Error in retrieving host Information',
   'installer.step3.hostInformation.popup.header':'Error in retrieving host Information',
   'installer.step3.hostInformation.popup.body' : 'All bootstrapped hosts registered but unable to retrieve cpu and memory related information',
   'installer.step3.hostInformation.popup.body' : 'All bootstrapped hosts registered but unable to retrieve cpu and memory related information',
-  'installer.step3.hostWarningsPopup.details':'Show Details',
+  'installer.step3.hostWarningsPopup.report':'Show Report',
+  'installer.step3.hostWarningsPopup.report.header': '<p style="font-family: monospace">######################################<br># Host Checks Report<br>#<br># Generated: ',
+  'installer.step3.hostWarningsPopup.report.hosts': '<br>######################################<br><br>######################################<br># Hosts<br>#<br># A space delimited list of hosts which have issues.<br># Provided so that administrators can easily copy hostnames into scripts, email etc.<br>######################################<br>HOSTS<br>',
+  'installer.step3.hostWarningsPopup.report.fileFolders': '<br><br>######################################<br># Files and Folders<br>#<br># A space delimited list of files and folders which should not exist.<br># Provided so that administrators can easily copy paths into scripts, email etc.<br># Example: rm -r /etc/hadoop /etc/hbase /etc/some\\ /folder<br>######################################<br>FILES AND FOLDERS<br>',
+  'installer.step3.hostWarningsPopup.report.process': '<br><br>######################################<br># Processes<br>#<br># A comma separated list of process tuples which should not be running.<br># Provided so that administrators can easily copy paths into scripts, email etc.<br>######################################<br>PROCESSES<br>',
+  'installer.step3.hostWarningsPopup.report.package': '<br><br>######################################<br># Packages<br>#<br># A space delimited list of software packages which should be uninstalled.<br># Provided so that administrators can easily copy paths into scripts, email etc.<br># Example: yum remove hadoop-hdfs nagios<br>######################################<br>PACKAGES<br>',
+  'installer.step3.hostWarningsPopup.report.service': '<br><br>######################################<br># Services<br>#<br># A space delimited list of services which should be up and running.<br># Provided so that administrators can easily copy paths into scripts, email etc.<br># Example: services start ntpd httpd<br>######################################<br>SERVICES<br>',
+  'installer.step3.hostWarningsPopup.report.user': '<br><br>######################################<br># Users<br>#<br># A space delimited list of users who should not exist.<br># Provided so that administrators can easily copy paths into scripts, email etc.<br># Example: userdel hdfs<br>######################################<br>USERS<br>',
+  'installer.step3.hostWarningsPopup.report.folder': '\\ /folder',
   'installer.step3.hostWarningsPopup.notice':'The following issues were detected on some hosts. Click the Rerun Checks button after manually resolve the issues. To resolve the warnings, run /usr/lib/python2.6/site-packages/ambari_agent/HostCleanup.py on each host.',
   'installer.step3.hostWarningsPopup.notice':'The following issues were detected on some hosts. Click the Rerun Checks button after manually resolve the issues. To resolve the warnings, run /usr/lib/python2.6/site-packages/ambari_agent/HostCleanup.py on each host.',
   'installer.step3.hostWarningsPopup.summary':'{0} issues on {1} hosts',
   'installer.step3.hostWarningsPopup.summary':'{0} issues on {1} hosts',
   'installer.step3.hostWarningsPopup.processes':'process issues',
   'installer.step3.hostWarningsPopup.processes':'process issues',

+ 1 - 1
ambari-web/app/templates/wizard/step3_host_warnings_popup.hbs

@@ -31,7 +31,7 @@
     <div class="span3 offset2">
     <div class="span3 offset2">
       <a href="javascript.void(0)" title="Show Details" {{action openWarningsInDialog target="view"}}
       <a href="javascript.void(0)" title="Show Details" {{action openWarningsInDialog target="view"}}
          class="task-detail-open-dialog"><i
          class="task-detail-open-dialog"><i
-              class="icon-external-link"></i> {{t installer.step3.hostWarningsPopup.details}}</a>
+              class="icon-external-link"></i> {{t installer.step3.hostWarningsPopup.report}}</a>
     </div>
     </div>
   </div>
   </div>
   <div class="summary">
   <div class="summary">