You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2017/10/02 20:39:42 UTC

[31/50] [abbrv] ambari git commit: AMBARI-22094 Install Wizard: refactor stack versions step. (atkach)

AMBARI-22094 Install Wizard: refactor stack versions step. (atkach)


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

Branch: refs/heads/branch-feature-AMBARI-20859
Commit: f5f888cd7e7297e514537ce4754397590a0dc62f
Parents: 504094e
Author: Andrii Tkach <at...@apache.org>
Authored: Fri Sep 29 17:44:37 2017 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Fri Sep 29 17:44:37 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/installer.js       |  8 ++---
 ambari-web/app/styles/stack_versions.less     |  2 --
 ambari-web/test/controllers/installer_test.js | 37 ++++++++++++++++------
 3 files changed, 30 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f5f888cd/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js
index 4c12a5b..3c50b26 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -930,9 +930,9 @@ App.InstallerController = App.WizardController.extend(App.Persist, {
         callback: function () {
           var dfd = $.Deferred();
 
-          this.loadStacks().always(function() {
+          this.loadStacks().done(function(stacksLoaded) {
             App.router.get('clusterController').loadAmbariProperties().always(function() {
-              dfd.resolve();
+              dfd.resolve(stacksLoaded);
             });
           });
 
@@ -946,9 +946,7 @@ App.InstallerController = App.WizardController.extend(App.Persist, {
 
           if (!stacksLoaded) {
             $.when.apply(this, this.loadStacksVersions()).done(function () {
-              Em.run.later('sync', function() {
-                dfd.resolve(stacksLoaded);
-              }, 1000);
+              dfd.resolve(true);
             });
           } else {
             dfd.resolve(stacksLoaded);

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5f888cd/ambari-web/app/styles/stack_versions.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/stack_versions.less b/ambari-web/app/styles/stack_versions.less
index 0221311..28a3239 100644
--- a/ambari-web/app/styles/stack_versions.less
+++ b/ambari-web/app/styles/stack_versions.less
@@ -468,8 +468,6 @@
   }
   .task-list-main-wrap i {
     font-size: 16px;
-    color: #0088cc;
-    margin-right: 3px;
   }
   ul.failed-info-list {
     max-height: 500px;

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5f888cd/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 bc91a8e..65a1e5c 100644
--- a/ambari-web/test/controllers/installer_test.js
+++ b/ambari-web/test/controllers/installer_test.js
@@ -460,35 +460,52 @@ describe('App.InstallerController', function () {
       var checker = {
         loadStacks: function() {
           return {
-            always: function() {
-              loadStacks = true;
+            done: function(callback) {
+              callback(true);
             }
           };
         }
       };
 
       beforeEach(function () {
+        sinon.spy(checker, 'loadStacks');
         installerController.loadMap['1'][0].callback.call(checker);
       });
 
-      it('stack info is loaded', function () {
-        expect(loadStacks).to.be.true;
+      afterEach(function() {
+        checker.loadStacks.restore();
+      });
+
+      it('should call loadStacks, stack info not loaded', function () {
+        expect(checker.loadStacks.calledOnce).to.be.true;
       });
     });
 
-    describe ('Should load stacks async', function() {
-      var loadStacksVersions = false;
+    describe('Should load stacks async', function() {
       var checker = {
-        loadStacksVersions: function() {
-          loadStacksVersions = true;
-        }
+        loadStacksVersions: Em.K
       };
 
+      beforeEach(function () {
+        sinon.spy(checker, 'loadStacksVersions');
+      });
+
+      afterEach(function() {
+        checker.loadStacksVersions.restore();
+      });
+
       it('stack versions are loaded', function () {
         installerController.loadMap['1'][1].callback.call(checker, true).then(function(data){
           expect(data).to.be.true;
         });
-        expect(loadStacksVersions).to.be.false;
+        expect(checker.loadStacksVersions.called).to.be.false;
+      });
+
+      it('should call loadStacksVersions, stack versions not loaded', function () {
+        installerController.loadMap['1'][1].callback.call(checker, false).then(function(data){
+          expect(data).to.be.true;
+        });
+        expect(checker.loadStacksVersions.calledOnce).to.be.true;
       });
     });