ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [03/10] ambari git commit: AMBARI-18353. Ambari Dashboard UI does not load intermittently. (jaimin)
Date Mon, 12 Sep 2016 16:59:29 GMT
AMBARI-18353. Ambari Dashboard UI does not load intermittently. (jaimin)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 65530d315c79f1bd8f91c583b0c36ce4c18cc378
Parents: 2547d8f
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Sat Sep 10 10:26:01 2016 -0700
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Sat Sep 10 10:29:19 2016 -0700

----------------------------------------------------------------------
 ambari-web/app/mappers/service_mapper.js | 29 ++++++++++++++++++++++-----
 ambari-web/app/models/service.js         |  2 +-
 2 files changed, 25 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/65530d31/ambari-web/app/mappers/service_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_mapper.js b/ambari-web/app/mappers/service_mapper.js
index 9c21789..9a330f9 100644
--- a/ambari-web/app/mappers/service_mapper.js
+++ b/ambari-web/app/mappers/service_mapper.js
@@ -61,12 +61,31 @@ App.serviceMapper = App.QuickDataMapper.create({
       App.store.commit();
       this.set('initialAppLoad', true);
     }
-
-    for (var service in passiveStateMap) {
-      if (passiveStateMap.hasOwnProperty(service)) {
-        App.Service.find(service).set('passiveState', passiveStateMap[service]);
+    this.servicesLoading().done(function setMaintenanceState() {
+      for (var service in passiveStateMap) {
+        if (passiveStateMap.hasOwnProperty(service)) {
+          App.Service.find(service).set('passiveState', passiveStateMap[service]);
+        }
       }
-    }
+    });
+
     console.timeEnd("App.serviceMapper execution time");
+  },
+
+  servicesLoading: function () {
+    var dfd = $.Deferred();
+    var isAllServicesLoaded = App.store.findAll(App.Service).everyProperty('isLoaded', true);
+    if (isAllServicesLoaded) {
+      dfd.resolve();
+    } else {
+      var interval = setInterval(function checkIfServicesLoaded() {
+        var isAllServicesLoaded = App.store.findAll(App.Service).everyProperty('isLoaded',
true);
+        if (isAllServicesLoaded) {
+          dfd.resolve();
+          clearInterval(interval);
+        }
+      }, 5);
+    }
+    return dfd.promise();
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/65530d31/ambari-web/app/models/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service.js b/ambari-web/app/models/service.js
index c648e93..e9dc327 100644
--- a/ambari-web/app/models/service.js
+++ b/ambari-web/app/models/service.js
@@ -23,7 +23,7 @@ require('utils/config');
 App.Service = DS.Model.extend({
   serviceName: DS.attr('string'),
   displayName: Em.computed.formatRole('serviceName', true),
-  passiveState: DS.attr('string'),
+  passiveState: DS.attr('string', {defaultValue: "OFF"}),
   workStatus: DS.attr('string'),
   rand: DS.attr('string'),
   toolTipContent: DS.attr('string'),


Mime
View raw message