Prechádzať zdrojové kódy

AMBARI-3324 UI optimization: constrain hostComponents model loading. (atkach)

atkach 11 rokov pred
rodič
commit
e18d93cbf6
1 zmenil súbory, kde vykonal 10 pridanie a 1 odobranie
  1. 10 1
      ambari-web/app/mappers/service_mapper.js

+ 10 - 1
ambari-web/app/mappers/service_mapper.js

@@ -261,6 +261,7 @@ App.servicesMapper = App.QuickDataMapper.create({
       var item;
       var currentHCWithComponentNames = {};
       var currentComponentNameHostNames = {};
+      var doHostComponentsLoad = false;
       oldHostComponents.forEach(function (item) {
         if (item && !hostComponentsMap[item.get('id')]) {
           item.deleteRecord();
@@ -276,6 +277,12 @@ App.servicesMapper = App.QuickDataMapper.create({
         }
       }, this);
 
+      for(var i in hostComponentsMap) {
+        if(!currentHCWithComponentNames[i]) {
+          doHostComponentsLoad = true;
+          break;
+        }
+      }
       result.forEach(function (item) {
         if (currentHCWithComponentNames[item.id] != null && 
             !currentComponentNameHostNames[item.component_name].contains(item.host_id)) {
@@ -283,7 +290,9 @@ App.servicesMapper = App.QuickDataMapper.create({
         }
       });
 
-      App.store.loadMany(this.get('model3'), result);
+      if (!App.router.get('clusterController.isLoaded') || doHostComponentsLoad) {
+        App.store.loadMany(this.get('model3'), result);
+      }
       for(var hostComponentId in hostComponentToActualConfigsMap){
         var hostComponentObj = App.HostComponent.find(hostComponentId);
         var actualConfigs = [];