ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject ambari git commit: AMBARI-9833. UI should get information about repos and packages for HostCheck from custom action. (akovalenko)
Date Fri, 27 Feb 2015 16:48:02 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 74b4287f9 -> 9cbaab8dd


AMBARI-9833. UI should get information about repos and packages for HostCheck from custom
action. (akovalenko)


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

Branch: refs/heads/trunk
Commit: 9cbaab8dd2dd9538fba1510191b4e549add1d79e
Parents: 74b4287
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Fri Feb 27 18:05:54 2015 +0200
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Fri Feb 27 18:47:07 2015 +0200

----------------------------------------------------------------------
 .../app/controllers/wizard/step3_controller.js  | 26 ++++--
 ambari-web/app/styles/application.less          |  3 +
 .../test/controllers/wizard/step3_test.js       | 96 ++++++++------------
 3 files changed, 62 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9cbaab8d/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 2c545c1..b07391a 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -94,6 +94,12 @@ App.WizardStep3Controller = Em.Controller.extend({
   hasMoreRegisteredHosts: false,
 
   /**
+   * Contain data about installed packages on hosts
+   * @type {Array}
+   */
+  hostsPackagesData: [],
+
+  /**
    * List of installed hostnames
    * @type {string[]}
    */
@@ -863,13 +869,13 @@ App.WizardStep3Controller = Em.Controller.extend({
     if (App.get('testMode')) {
       this.getHostInfo();
     } else {
-      var data = this.getDataForCheckRequest("last_agent_env_check", false);
+      var data = this.getDataForCheckRequest("last_agent_env_check,installed_packages,existing_repos",
false);
       data ? this.requestToPerformHostCheck(data) : this.stopHostCheck();
     }
   },
 
   /**
-   * set all fields from which depends runnig host check to true value
+   * set all fields from which depends running host check to true value
    * which force finish checking;
    */
   stopHostCheck: function() {
@@ -961,7 +967,7 @@ App.WizardStep3Controller = Em.Controller.extend({
     var requestId = this.get("requestId");
     var checker = setTimeout(function () {
       if (self.get('stopChecking') == true) {
-        clearInterval(checker);
+        clearTimeout(checker);
       } else {
         App.ajax.send({
           name: 'preinstalled.checks.tasks',
@@ -990,7 +996,13 @@ App.WizardStep3Controller = Em.Controller.extend({
     if (["FAILED", "COMPLETED", "TIMEDOUT"].contains(data.Requests.request_status)) {
       if (data.Requests.inputs.indexOf("last_agent_env_check") != -1) {
         this.set('stopChecking', true);
-         this.getHostInfo();
+        this.set('hostsPackagesData', data.tasks.map(function (task) {
+          return {
+            hostName: Em.get(task, 'Tasks.host_name'),
+            installedPackages: Em.get(task, 'Tasks.structured_out.installed_packages')
+          }
+        }));
+        this.getHostInfo();
       } else if (data.Requests.inputs.indexOf("host_resolution_check") != -1) {
         this.parseHostNameResolution(data);
         this.getGeneralHostCheck();
@@ -1424,6 +1436,7 @@ App.WizardStep3Controller = Em.Controller.extend({
       usersWarnings: {},
       alternativeWarnings: {}
     };
+    var hostsPackagesData = this.get('hostsPackagesData');
 
     data.items.sortPropertyLight('Hosts.host_name').forEach(function (_host) {
       var host = {
@@ -1458,8 +1471,9 @@ App.WizardStep3Controller = Em.Controller.extend({
       }, this);
 
       //parse all package warnings for host
-      if (_host.Hosts.last_agent_env.installedPackages) {
-        _host.Hosts.last_agent_env.installedPackages.forEach(function (_package) {
+      var hostPackagesData = hostsPackagesData.findProperty('hostName', _host.Hosts.host_name);
+      if (hostPackagesData) {
+        hostPackagesData.installedPackages.forEach(function (_package) {
           warning = warningCategories.packagesWarnings[_package.name];
           if (warning) {
             warning.hosts.push(_host.Hosts.host_name);

http://git-wip-us.apache.org/repos/asf/ambari/blob/9cbaab8d/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 478d54c..73fc94e 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -3254,6 +3254,9 @@ table.graphs {
     margin-top: 10px;
     }
   }
+  .icon-warning-sign {
+    color: @health-status-yellow;
+  }
 }
 
 .host-checks-update {

http://git-wip-us.apache.org/repos/asf/ambari/blob/9cbaab8d/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 9846b69..5e3841c 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -1409,62 +1409,6 @@ describe('App.WizardStep3Controller', function () {
           ])
         },
         {
-          m: 'parse installedPackages',
-          tests: Em.A([
-            {
-              items: [
-                {Hosts: {host_name: 'c1', last_agent_env: {installedPackages: []}}}
-              ],
-              m: 'empty installedPackages',
-              e: {
-                warnings: [],
-                warningsByHost: [0]
-              }
-            },
-            {
-              items: [
-                {Hosts: {host_name: 'c1', last_agent_env: {installedPackages: [
-                  {name: 'n1'}
-                ]}}}
-              ],
-              m: 'not empty installedPackages',
-              e: {
-                warnings: [
-                  {
-                    name: 'n1',
-                    hosts: ['c1'],
-                    onSingleHost: true,
-                    category: 'packages'
-                  }
-                ],
-                warningsByHost: [1]
-              }
-            },
-            {
-              items: [
-                {Hosts: {host_name: 'c1', last_agent_env: {installedPackages: [
-                  {name: 'n1'}
-                ]}}},
-                {Hosts: {host_name: 'c2', last_agent_env: {installedPackages: [
-                  {name: 'n1'}
-                ]}}}
-              ],
-              m: 'not empty installedPackages on two hosts',
-              e: {
-                warnings: [
-                  {
-                    name: 'n1',
-                    hosts: ['c1', 'c2'],
-                    onSingleHost: false,
-                    category: 'packages'
-                  }
-                ],
-                warningsByHost: [1]
-              }
-            }
-          ])
-        },
-        {
           m: 'parse hostHealth.liveServices',
           tests: Em.A([
             {
@@ -2523,12 +2467,50 @@ describe('App.WizardStep3Controller', function () {
       Requests: {
         request_status: "COMPLETED",
         inputs: "last_agent_env_check"
-      }
+      },
+      tasks: [
+        {
+          Tasks: {
+            host_name: 'h1',
+            structured_out: {
+              "installed_packages": [
+                {
+                  "version": "b1",
+                  "name": "n1",
+                  "repoName": "r1"
+                },
+                {
+                  "version": "b2",
+                  "name": "n2",
+                  "repoName": "r2"
+                }
+              ]
+            }
+          }
+        }
+      ]
     };
     it('run getHostInfo', function() {
       c.getHostCheckTasksSuccess(lastAgentEnvCheckComplete);
       expect(c.get('stopChecking')).to.be.true;
       expect(c.getHostInfo.calledOnce).to.be.true;
+      expect(c.get('hostsPackagesData')).eql([
+        {
+          hostName: 'h1',
+          installedPackages: [
+            {
+              "version": "b1",
+              "name": "n1",
+              "repoName": "r1"
+            },
+            {
+              "version": "b2",
+              "name": "n2",
+              "repoName": "r2"
+            }
+          ]
+        }
+      ]);
     });
 
   });


Mime
View raw message