Browse Source

AMBARI-2506. Host Check UI: Issues should be grouped by Issue Type. (srimanth)

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

+ 78 - 60
ambari-web/app/controllers/wizard/step3_controller.js

@@ -689,45 +689,33 @@ App.WizardStep3Controller = Em.Controller.extend({
         console.log("last_agent_env is missing for " + _host.Hosts.host_name + ".  Skipping _host check.");
         console.log("last_agent_env is missing for " + _host.Hosts.host_name + ".  Skipping _host check.");
         return;
         return;
       }
       }
-      
-      // TODO - Remove when correct parsing code in place.
-      if (!_host.Hosts.last_agent_env.paths) {
-        return;
-      }
-      
+
       //parse all directories and files warnings for host
       //parse all directories and files warnings for host
 
 
       //todo: to be removed after check in new API
       //todo: to be removed after check in new API
       var stackFoldersAndFiles = _host.Hosts.last_agent_env.stackFoldersAndFiles || _host.Hosts.last_agent_env.paths;
       var stackFoldersAndFiles = _host.Hosts.last_agent_env.stackFoldersAndFiles || _host.Hosts.last_agent_env.paths;
 
 
       stackFoldersAndFiles.forEach(function (path) {
       stackFoldersAndFiles.forEach(function (path) {
-
-        //todo: to be removed after check in new API
-        if (path.type === 'not_exist') {
-
-          warning = warnings.findProperty('name', path.name);
-          if (warning) {
-            warning.hosts.push(_host.Hosts.host_name);
-            warning.onSingleHost = false;
-          } else {
-            warning = {
-              name: path.name,
-              hosts: [_host.Hosts.host_name],
-              category: 'fileFolders',
-              onSingleHost: true
-            }
-            warnings.push(warning);
+        warning = warnings.findProperty('name', path.name);
+        if (warning) {
+          warning.hosts.push(_host.Hosts.host_name);
+          warning.onSingleHost = false;
+        } else {
+          warning = {
+            name: path.name,
+            hosts: [_host.Hosts.host_name],
+            category: 'fileFolders',
+            onSingleHost: true
           }
           }
-          host.warnings.push(warning);
+          warnings.push(warning);
         }
         }
+        host.warnings.push(warning);
       }, this);
       }, this);
 
 
       //parse all package warnings for host
       //parse all package warnings for host
       _host.Hosts.last_agent_env.rpms.forEach(function (_package) {
       _host.Hosts.last_agent_env.rpms.forEach(function (_package) {
 
 
-        //todo: to be removed after check in new API
         if (_package.installed) {
         if (_package.installed) {
-
           warning = warnings.findProperty('name', _package.name);
           warning = warnings.findProperty('name', _package.name);
           if (warning) {
           if (warning) {
             warning.hosts.push(_host.Hosts.host_name);
             warning.hosts.push(_host.Hosts.host_name);
@@ -751,28 +739,23 @@ App.WizardStep3Controller = Em.Controller.extend({
       var javaProcs = _host.Hosts.last_agent_env.hostHealth ? _host.Hosts.last_agent_env.hostHealth.activeJavaProcs : _host.Hosts.last_agent_env.javaProcs;
       var javaProcs = _host.Hosts.last_agent_env.hostHealth ? _host.Hosts.last_agent_env.hostHealth.activeJavaProcs : _host.Hosts.last_agent_env.javaProcs;
 
 
       javaProcs.forEach(function (process) {
       javaProcs.forEach(function (process) {
-
-        //todo: to be removed after check in new API
-        if (process.hadoop) {
-
-          warning = warnings.findProperty('name', (process.command.substr(0, 15) + '...'));
-          if (warning) {
-            warning.hosts.push(_host.Hosts.host_name);
-            warning.onSingleHost = false;
-          } else {
-            warning = {
-              name: (process.command.substr(0, 15) + '...'),
-              hosts: [_host.Hosts.host_name],
-              category: 'processes',
-              user: process.user,
-              pid: process.pid,
-              command: process.command,
-              onSingleHost: true
-            }
-            warnings.push(warning);
+        warning = warnings.findProperty('name', (process.command.substr(0, 15) + '...'));
+        if (warning) {
+          warning.hosts.push(_host.Hosts.host_name);
+          warning.onSingleHost = false;
+        } else {
+          warning = {
+            name: (process.command.substr(0, 15) + '...'),
+            hosts: [_host.Hosts.host_name],
+            category: 'processes',
+            user: process.user,
+            pid: process.pid,
+            command: process.command,
+            onSingleHost: true
           }
           }
-          host.warnings.push(warning);
+          warnings.push(warning);
         }
         }
+        host.warnings.push(warning);
       }, this);
       }, this);
 
 
       //parse all service warnings for host
       //parse all service warnings for host
@@ -852,6 +835,9 @@ App.WizardStep3Controller = Em.Controller.extend({
       onSecondary: function() {
       onSecondary: function() {
         self.rerunChecks();
         self.rerunChecks();
       },
       },
+      didInsertElement: function () {
+        this.fitHeight();
+      },
 
 
       footerClass: Ember.View.extend({
       footerClass: Ember.View.extend({
         template: Ember.Handlebars.compile([
         template: Ember.Handlebars.compile([
@@ -898,6 +884,14 @@ App.WizardStep3Controller = Em.Controller.extend({
 
 
       bodyClass: Ember.View.extend({
       bodyClass: Ember.View.extend({
         templateName: require('templates/wizard/step3_host_warnings_popup'),
         templateName: require('templates/wizard/step3_host_warnings_popup'),
+        classNames: ['host-check'],
+        didInsertElement: function () {
+          Ember.run.next(this, function () {
+            $(this.get('content').filterProperty('isCollapsed').map(function (cat) {
+              return '#' + cat.category
+            }).join(',')).hide();
+          })
+        }.observes('content'),
         warningsByHost: function () {
         warningsByHost: function () {
           return App.router.get('wizardStep3Controller.warningsByHost');
           return App.router.get('wizardStep3Controller.warningsByHost');
         }.property('App.router.wizardStep3Controller.warningsByHost'),
         }.property('App.router.wizardStep3Controller.warningsByHost'),
@@ -910,44 +904,68 @@ App.WizardStep3Controller = Em.Controller.extend({
         category: 'All Hosts',
         category: 'All Hosts',
         content: function () {
         content: function () {
           var categoryWarnings = this.get('warningsByHost').findProperty('name', this.get('category')).warnings;
           var categoryWarnings = this.get('warningsByHost').findProperty('name', this.get('category')).warnings;
+          var processesIssues = categoryWarnings.filterProperty('category', 'processes');
+          var packagesIssues = categoryWarnings.filterProperty('category', 'packages');
+          var fileFoldersIssues = categoryWarnings.filterProperty('category', 'fileFolders');
+          var servicesIssues = categoryWarnings.filterProperty('category', 'services');
+          var usersIssues = categoryWarnings.filterProperty('category', 'users');
           return [
           return [
             {
             {
-              warnings: categoryWarnings.filterProperty('category', 'processes'),
-              title: Em.I18n.t('installer.step3.hostWarningsPopup.processes'),
+              warnings: processesIssues,
+              title: Em.I18n.t('installer.step3.hostWarningsPopup.process') + ' ' + Em.I18n.t('installer.step3.hostWarningsPopup.issue' + (processesIssues.length !== 1 ? 's' : '')),
               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'
+              emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.processes'),
+              action: Em.I18n.t('installer.step3.hostWarningsPopup.action.running'),
+              category: 'process',
+              isCollapsed: !processesIssues.length
             },
             },
             {
             {
-              warnings: categoryWarnings.filterProperty('category', 'packages'),
-              title: Em.I18n.t('installer.step3.hostWarningsPopup.packages'),
+              warnings: packagesIssues,
+              title: Em.I18n.t('installer.step3.hostWarningsPopup.package') + ' ' + Em.I18n.t('installer.step3.hostWarningsPopup.issue' + (packagesIssues.length !== 1 ? 's' : '')),
               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'
+              emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.packages'),
+              action: Em.I18n.t('installer.step3.hostWarningsPopup.action.installed'),
+              category: 'package',
+              isCollapsed: !packagesIssues.length
             },
             },
             {
             {
-              warnings: categoryWarnings.filterProperty('category', 'fileFolders'),
-              title: Em.I18n.t('installer.step3.hostWarningsPopup.fileFolders'),
+              warnings: fileFoldersIssues,
+              title: Em.I18n.t('installer.step3.hostWarningsPopup.fileAndFolder') + ' ' + Em.I18n.t('installer.step3.hostWarningsPopup.issue' + (fileFoldersIssues.length !== 1 ? 's' : '')),
               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'
+              emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.filesAndFolders'),
+              action: Em.I18n.t('installer.step3.hostWarningsPopup.action.exists'),
+              category: 'fileFolders',
+              isCollapsed: !fileFoldersIssues.length
             },
             },
             {
             {
-              warnings: categoryWarnings.filterProperty('category', 'services'),
-              title: Em.I18n.t('installer.step3.hostWarningsPopup.services'),
+              warnings: servicesIssues,
+              title: Em.I18n.t('installer.step3.hostWarningsPopup.service') + ' ' + Em.I18n.t('installer.step3.hostWarningsPopup.issue' + (servicesIssues.length !== 1 ? 's' : '')),
               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'
+              emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.services'),
+              action: Em.I18n.t('installer.step3.hostWarningsPopup.action.notRunning'),
+              category: 'service',
+              isCollapsed: !servicesIssues.length
             },
             },
             {
             {
-              warnings: categoryWarnings.filterProperty('category', 'users'),
-              title: Em.I18n.t('installer.step3.hostWarningsPopup.users'),
+              warnings: usersIssues,
+              title: Em.I18n.t('installer.step3.hostWarningsPopup.user') + ' ' + Em.I18n.t('installer.step3.hostWarningsPopup.issue' + (usersIssues.length !== 1 ? 's' : '')),
               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'
+              emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.users'),
+              action: Em.I18n.t('installer.step3.hostWarningsPopup.action.exists'),
+              category: 'user',
+              isCollapsed: !usersIssues.length
             }
             }
           ]
           ]
         }.property('category', 'warningsByHost'),
         }.property('category', 'warningsByHost'),
+        onToggleBlock: function (category) {
+          this.$('#' + category.context.category).toggle('blind', 500);
+          category.context.isCollapsed = !category.context.isCollapsed;
+        },
         warningsSummary: function () {
         warningsSummary: function () {
           var warnings = this.get('warnings');
           var warnings = this.get('warnings');
           var warningsByHost = self.get('warningsByHost').slice();
           var warningsByHost = self.get('warningsByHost').slice();

+ 17 - 6
ambari-web/app/messages.js

@@ -330,17 +330,28 @@ Em.I18n.translations = {
   'installer.step3.hostWarningsPopup.report.folder': '\\ /folder',
   '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.process':'process',
   'installer.step3.hostWarningsPopup.processes.message':'The following processes should not be running',
   'installer.step3.hostWarningsPopup.processes.message':'The following processes should not be running',
-  'installer.step3.hostWarningsPopup.fileFolders':'file and folder issues',
+  'installer.step3.hostWarningsPopup.fileAndFolder':'file and folder',
   'installer.step3.hostWarningsPopup.fileFolders.message':'The following files and folders should not exist',
   'installer.step3.hostWarningsPopup.fileFolders.message':'The following files and folders should not exist',
-  'installer.step3.hostWarningsPopup.packages':'package issues',
+  'installer.step3.hostWarningsPopup.package':'package',
   'installer.step3.hostWarningsPopup.packages.message':'The following packages should be uninstalled',
   'installer.step3.hostWarningsPopup.packages.message':'The following packages should be uninstalled',
-  'installer.step3.hostWarningsPopup.users':'user issues',
+  'installer.step3.hostWarningsPopup.user':'user',
   'installer.step3.hostWarningsPopup.users.message':'The following users should be removed',
   'installer.step3.hostWarningsPopup.users.message':'The following users should be removed',
-  'installer.step3.hostWarningsPopup.services':'service issues',
+  'installer.step3.hostWarningsPopup.service':'service',
   'installer.step3.hostWarningsPopup.services.message':'The following services should be up',
   'installer.step3.hostWarningsPopup.services.message':'The following services should be up',
-  'installer.step3.hostWarningsPopup.exist':'Exist on',
+  'installer.step3.hostWarningsPopup.issue':'issue',
+  'installer.step3.hostWarningsPopup.issues':'issues',
+  'installer.step3.hostWarningsPopup.emptyMessage':'There were no unwanted',
+  'installer.step3.hostWarningsPopup.empty.filesAndFolders':'files and folders',
+  'installer.step3.hostWarningsPopup.empty.processes':'processes',
+  'installer.step3.hostWarningsPopup.empty.packages':'packages',
+  'installer.step3.hostWarningsPopup.empty.users':'users',
+  'installer.step3.hostWarningsPopup.empty.services':'services',
+  'installer.step3.hostWarningsPopup.action.exists':'Exists on',
+  'installer.step3.hostWarningsPopup.action.notRunning':'Not running on',
+  'installer.step3.hostWarningsPopup.action.installed':'Installed on',
+  'installer.step3.hostWarningsPopup.action.running':'Running on',
   'installer.step3.hostWarningsPopup.host':'host',
   'installer.step3.hostWarningsPopup.host':'host',
   'installer.step3.hostWarningsPopup.hosts':'hosts',
   'installer.step3.hostWarningsPopup.hosts':'hosts',
   'installer.step3.hostWarningsPopup.rerunChecks':'Rerun Checks',
   'installer.step3.hostWarningsPopup.rerunChecks':'Rerun Checks',

+ 0 - 5
ambari-web/app/styles/application.less

@@ -2584,15 +2584,10 @@ table.graphs {
   }
   }
   .warnings-list {
   .warnings-list {
     .block {
     .block {
-      margin-bottom: 5px;
-      border: 2px solid;
-      border-radius: 4px;
       .title {
       .title {
-        padding: 3px;
         padding-left: 15px;
         padding-left: 15px;
       }
       }
       table {
       table {
-        border-top: 1px solid;
         width: 100%;
         width: 100%;
         td, th {
         td, th {
           text-align: left;
           text-align: left;

+ 32 - 25
ambari-web/app/templates/wizard/step3_host_warnings_popup.hbs

@@ -43,17 +43,21 @@
       {{/if}}
       {{/if}}
       &nbsp;{{view.warningsSummary}}</span>
       &nbsp;{{view.warningsSummary}}</span>
   </div>
   </div>
-  <div class="content-area">
-    <div class="warnings-list">
-      {{#each category in view.content}}
-        <div class="block">
-          <div class="title">
-            {{#if category.warnings.length}}
-            <i class="icon-warning-sign"></i>
-            {{else}}
-            <i class="icon-ok"></i>
-            {{/if}}
-            &nbsp;{{category.warnings.length}} {{category.title}}</div>
+  <div class="accordion warnings-list" id="accordion2">
+    {{#each category in view.content}}
+    <div class="accordion-group block">
+      <div class="accordion-heading title">
+        <a class="accordion-toggle" {{action onToggleBlock category}}>
+          {{#if category.warnings.length}}
+          <i class="icon-warning-sign"></i>
+          {{else}}
+          <i class="icon-ok"></i>
+          {{/if}}
+          &nbsp;{{category.warnings.length}} {{category.title}}
+        </a>
+      </div>
+      <div id="{{unbound category.category}}" class="accordion-body collapse in">
+        <div class="accordion-inner">
           {{#if category.warnings.length}}
           {{#if category.warnings.length}}
           <table>
           <table>
             <thead>
             <thead>
@@ -66,25 +70,28 @@
             </thead>
             </thead>
             <tbody>
             <tbody>
             {{#each warning in category.warnings}}
             {{#each warning in category.warnings}}
-              <tr>
-                <td>{{warning.name}}</td>
-                <td>{{t installer.step3.hostWarningsPopup.exist}}
-                  <a>
-                    {{warning.hosts.length}}
-                    {{#if warning.onSingleHost}}
-                      {{t installer.step3.hostWarningsPopup.host}}
-                    {{else}}
-                      {{t installer.step3.hostWarningsPopup.hosts}}
-                    {{/if}}
-                  </a>
-                </td>
-              </tr>
+            <tr>
+              <td>{{warning.name}}</td>
+              <td>{{category.action}}
+                <a href="javascript:void(null);">
+                  {{warning.hosts.length}}
+                  {{#if warning.onSingleHost}}
+                  {{t installer.step3.hostWarningsPopup.host}}
+                  {{else}}
+                  {{t installer.step3.hostWarningsPopup.hosts}}
+                  {{/if}}
+                </a>
+              </td>
+            </tr>
             {{/each}}
             {{/each}}
             </tbody>
             </tbody>
           </table>
           </table>
+          {{else}}
+          {{t installer.step3.hostWarningsPopup.emptyMessage}} {{category.emptyName}}
           {{/if}}
           {{/if}}
         </div>
         </div>
-      {{/each}}
+      </div>
     </div>
     </div>
+    {{/each}}
   </div>
   </div>
 </div>
 </div>

+ 1 - 1
ambari-web/app/views/common/modal_popup.js

@@ -97,7 +97,7 @@ App.ModalPopup = Ember.View.extend({
       'marginTop': 0
       'marginTop': 0
     });
     });
 
 
-    block.css('max-height', $(window).height() - top * 2 - 100);
+    block.css('max-height', $(window).height() - top * 2 - (popup.height() - block.height()));
   }
   }
 });
 });