浏览代码

HPCC-9765 Fetching list of possible targets is slow

Switched from TpTargetClusterQuery function to TpLogicalClusterQuery.

Fixes HPCC-9765

Signed-off-by: Gordon Smith <gordon.smith@lexisnexis.com>
Gordon Smith 12 年之前
父节点
当前提交
e1795bb000
共有 2 个文件被更改,包括 25 次插入23 次删除
  1. 19 20
      esp/files/scripts/TargetSelectWidget.js
  2. 6 3
      esp/files/scripts/WsTopology.js

+ 19 - 20
esp/files/scripts/TargetSelectWidget.js

@@ -215,30 +215,29 @@ require([
 
         loadTargets: function () {
             var context = this;
-            WsTopology.TpTargetClusterQuery({
-                load: function (response) {
-                    if (lang.exists("TpTargetClusterQueryResponse.TpTargetClusters.TpTargetCluster", response)) {
-                        var targetData = response.TpTargetClusterQueryResponse.TpTargetClusters.TpTargetCluster;
-                        var has_hthor = false;
-                        for (var i = 0; i < targetData.length; ++i) {
-                            context.targetSelectControl.options.push({
-                                label: targetData[i].Name,
-                                value: targetData[i].Name
-                            });
-                            if (targetData[i].Name == "hthor") {
-                                has_hthor = true;
-                            }
+            WsTopology.TpLogicalClusterQuery({
+            }).then(function (response) {
+                if (lang.exists("TpLogicalClusterQueryResponse.TpLogicalClusters.TpLogicalCluster", response)) {
+                    var targetData = response.TpLogicalClusterQueryResponse.TpLogicalClusters.TpLogicalCluster;
+                    var has_hthor = false;
+                    for (var i = 0; i < targetData.length; ++i) {
+                        context.targetSelectControl.options.push({
+                            label: targetData[i].Name,
+                            value: targetData[i].Name
+                        });
+                        if (targetData[i].Name == "hthor") {
+                            has_hthor = true;
                         }
+                    }
 
-                        if (!context.includeBlank && context._value == "") {
-                            if (has_hthor) {
-                                context._value = "hthor";
-                            } else {
-                                context._value = context.targetSelectControl.options[0].value;
-                            }
+                    if (!context.includeBlank && context._value == "") {
+                        if (has_hthor) {
+                            context._value = "hthor";
+                        } else {
+                            context._value = context.targetSelectControl.options[0].value;
                         }
-                        context.resetDefaultSelection();
                     }
+                    context.resetDefaultSelection();
                 }
             });
         }

+ 6 - 3
esp/files/scripts/WsTopology.js

@@ -30,13 +30,16 @@ define([
             lang.mixin(params.request, {
                 Type: "ALLSERVICES"
             });
-            ESPRequest.send("WsTopology", "TpServiceQuery", params);
+            return ESPRequest.send("WsTopology", "TpServiceQuery", params);
         },
         TpTargetClusterQuery: function (params) {
-            ESPRequest.send("WsTopology", "TpTargetClusterQuery", params);
+            return ESPRequest.send("WsTopology", "TpTargetClusterQuery", params);
         },
         TpGroupQuery: function (params) {
-            ESPRequest.send("WsTopology", "TpGroupQuery", params);
+            return ESPRequest.send("WsTopology", "TpGroupQuery", params);
+        },
+        TpLogicalClusterQuery: function (params) {
+            return ESPRequest.send("WsTopology", "TpLogicalClusterQuery", params);
         }
     };
 });