You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jl...@apache.org on 2017/10/09 06:01:30 UTC

[32/50] [abbrv] ambari git commit: AMBARI-22146. New stack versions shown as 'Not installed' on 0 hosts (alexantonenko)

AMBARI-22146. New stack versions shown as 'Not installed' on 0 hosts (alexantonenko)


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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: 9adfcdcbd9b0f01b1576254bc209b1ce64b7d63f
Parents: d5dd193
Author: Alex Antonenko <aa...@hortonworks.com>
Authored: Thu Oct 5 21:56:31 2017 +0300
Committer: Alex Antonenko <aa...@hortonworks.com>
Committed: Thu Oct 5 21:56:31 2017 +0300

----------------------------------------------------------------------
 .../app/models/stack_version/repository_version.js      |  2 +-
 .../models/stack_version/repository_version_test.js     | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9adfcdcb/ambari-web/app/models/stack_version/repository_version.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_version/repository_version.js b/ambari-web/app/models/stack_version/repository_version.js
index 51b9ab8..d40b4f2 100644
--- a/ambari-web/app/models/stack_version/repository_version.js
+++ b/ambari-web/app/models/stack_version/repository_version.js
@@ -64,7 +64,7 @@ App.RepositoryVersion = DS.Model.extend({
    * @type {Array}
    */
   notInstalledHosts: function () {
-    return Array.isArray(this.get('stackVersion.notInstalledHosts'))
+    return this.get('stackVersion.notInstalledHosts').length || this.get('stackVersion.installedHosts').length || this.get('stackVersion.currentHosts').length
           ? this.get('stackVersion.notInstalledHosts')
           : App.get('allHostNames');
   }.property('stackVersion.notInstalledHosts'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/9adfcdcb/ambari-web/test/models/stack_version/repository_version_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/stack_version/repository_version_test.js b/ambari-web/test/models/stack_version/repository_version_test.js
index bbb98a3..2bd30de 100644
--- a/ambari-web/test/models/stack_version/repository_version_test.js
+++ b/ambari-web/test/models/stack_version/repository_version_test.js
@@ -51,15 +51,21 @@ describe('App.RepositoryVersion', function () {
       App.get.restore();
     });
 
-    it("stackVersion is null", function() {
-      model.set('stackVersion', null);
+    it("all states empty", function() {
+      model.set('stackVersion', Em.Object.create({
+        installedHosts: [],
+        notInstalledHosts: [],
+        currentHosts: []
+      }));
       model.propertyDidChange('notInstalledHosts');
       expect(model.get('notInstalledHosts')).to.eql(['host1']);
     });
 
     it("stackVersion has notInstalledHosts array", function() {
       model.set('stackVersion', Em.Object.create({
-        notInstalledHosts: ['host2']
+        installedHosts: [],
+        notInstalledHosts: ['host2'],
+        currentHosts: []
       }));
       model.propertyDidChange('notInstalledHosts');
       expect(model.get('notInstalledHosts')).to.eql(['host2']);