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-12277. UI: when installing out of development, two stacks are selected (akovalenko)
Date Fri, 03 Jul 2015 16:42:03 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 3fa75baff -> a0c99bb75


AMBARI-12277. UI: when installing out of development, two stacks are selected (akovalenko)


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

Branch: refs/heads/branch-2.1
Commit: a0c99bb7510c1f52d5e15092e36691cb2a3dd9a1
Parents: 3fa75ba
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Fri Jul 3 19:31:33 2015 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Fri Jul 3 19:31:54 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/installer.js       | 24 ++++++++++++++--------
 ambari-web/test/controllers/installer_test.js |  1 +
 2 files changed, 17 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a0c99bb7/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js
index afa6605..08c417c 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -281,10 +281,16 @@ App.InstallerController = App.WizardController.extend({
         error: 'loadStacksVersionsErrorCallback'
       }));
     }, this);
+    this.set('loadStacksRequestsCounter', requests.length);
     return requests;
   },
 
   /**
+   * Counter for counting number of successful requests to load stack versions
+   */
+  loadStacksRequestsCounter: 0,
+
+  /**
    * Parse loaded data and create array of stacks objects
    */
   loadStacksVersionsSuccessCallback: function (data) {
@@ -299,16 +305,18 @@ App.InstallerController = App.WizardController.extend({
       }, this);
     }
     App.stackMapper.map(data);
-    if (!isStacksExistInDb) {
-      var defaultStackVersion = App.Stack.find().findProperty('id', App.defaultStackVersion);
-      if (defaultStackVersion) {
-        defaultStackVersion.set('isSelected', true)
-      } else {
-        App.Stack.find().objectAt(0).set('isSelected', true);
+    if (!this.decrementProperty('loadStacksRequestsCounter')) {
+      if (!isStacksExistInDb) {
+        var defaultStackVersion = App.Stack.find().findProperty('id', App.defaultStackVersion);
+        if (defaultStackVersion) {
+          defaultStackVersion.set('isSelected', true)
+        } else {
+          App.Stack.find().objectAt(0).set('isSelected', true);
+        }
       }
+      this.set('content.stacks', App.Stack.find());
+      App.set('currentStackVersion', App.Stack.find().findProperty('isSelected').get('id'));
     }
-    this.set('content.stacks', App.Stack.find());
-    App.set('currentStackVersion', App.Stack.find().findProperty('isSelected').get('id'));
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/a0c99bb7/ambari-web/test/controllers/installer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/installer_test.js b/ambari-web/test/controllers/installer_test.js
index 0b7829a..49a8852 100644
--- a/ambari-web/test/controllers/installer_test.js
+++ b/ambari-web/test/controllers/installer_test.js
@@ -45,6 +45,7 @@ describe('App.InstallerController', function () {
       App.store.commit.restore();
     });
     it ('Correct data', function() {
+      installerController.set('loadStacksRequestsCounter', 1);
       installerController.loadStacksVersionsSuccessCallback(require('test/stack'));
       expect(installerController.get('content.stacks.length')).to.equal(2);
       expect(installerController.get('content.stacks').everyProperty('isSelected')).to.be.false;


Mime
View raw message