You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2018/05/23 13:10:16 UTC

[ambari] branch trunk updated: AMBARI-23935 ambari ui fails to load due to js error

This is an automated email from the ASF dual-hosted git repository.

atkach pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new a031dba  AMBARI-23935 ambari ui fails to load due to js error
a031dba is described below

commit a031dba6e3bf355786a2ed70904d8eda6b883cce
Author: Andrii Tkach <at...@apache.org>
AuthorDate: Wed May 23 14:06:04 2018 +0300

    AMBARI-23935 ambari ui fails to load due to js error
---
 ambari-web/app/controllers/global/cluster_controller.js              | 3 +++
 .../app/controllers/main/admin/stack_and_upgrade_controller.js       | 5 ++++-
 .../test/controllers/main/admin/stack_and_upgrade_controller_test.js | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index ba9034e..63b16f8 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -65,6 +65,8 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
 
   isServiceContentFullyLoaded: Em.computed.and('isServiceMetricsLoaded', 'isComponentsStateLoaded', 'isComponentsConfigLoaded'),
 
+  isStackVersionsLoaded: false,
+
   clusterName: Em.computed.alias('App.clusterName'),
 
   updateLoadStatus: function (item) {
@@ -355,6 +357,7 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
         upgradeController.loadCompatibleVersions();
         upgradeController.updateCurrentStackVersion();
         App.set('stackVersionsAvailable', App.StackVersion.find().content.length > 0);
+        self.set('isStackVersionsLoaded', true);
       });
     });
   },
diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
index 55ac6d0..dbad1dc 100644
--- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -2194,6 +2194,9 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
    * it should be fetched from the repo which corresponds to the desiredRepositoryVersionId of the service
    */
   getServiceVersionFromRepo: function () {
+    if (!App.router.get('clusterController.isLoaded') || !App.router.get('clusterController.isStackVersionsLoaded')) {
+      return;
+    }
 
     var currentStackName = App.get('currentStackName');
     var currentStackVersionNumber = App.get('currentStackVersionNumber');
@@ -2226,6 +2229,6 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       }
       map[serviceName] = serviceVersion;
     });
-  }.observes('App.router.clusterController.isLoaded')
+  }.observes('App.router.clusterController.isLoaded', 'App.router.clusterController.isStackVersionsLoaded')
 
 });
diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
index ff0f3be..9cd79fe 100644
--- a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
@@ -3485,6 +3485,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       App.Service.find.restore();
       App.StackService.find.restore();
       App.RepositoryVersion.find.restore();
+      App.router.get.restore();
       controller.set('serviceVersionsMap', {});
     });
 
@@ -3494,6 +3495,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         sinon.stub(App.Service, 'find').returns(item.services);
         sinon.stub(App.StackService, 'find').returns(item.stackServices);
         sinon.stub(App.RepositoryVersion, 'find').returns(item.repoVersions);
+        sinon.stub(App.router, 'get').returns(true);
         controller.getServiceVersionFromRepo();
         expect(controller.get('serviceVersionsMap')).to.be.eql(item.expected);
       });

-- 
To stop receiving notification emails like this one, please contact
atkach@apache.org.