Kaynağa Gözat

Merge pull request #9658 from GordonSmith/HPCC-17167

HPCC-17167 Replace dojo request

Reviewed-By: Miguel Vazquez <miguel.vazquez@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 7 yıl önce
ebeveyn
işleme
73e643bc3e

+ 11 - 18
esp/src/eclwatch/ESPRequest.js

@@ -19,13 +19,14 @@ define([
     "dojo/_base/lang",
     "dojo/_base/config",
     "dojo/_base/Deferred",
-    "dojo/request",
-    "dojo/request/script",
     "dojo/store/util/QueryResults",
     "dojo/store/Observable",
-    "dojo/topic"
+    "dojo/topic",
 
-], function (declare, arrayUtil, lang, config, Deferred, request, script, QueryResults, Observable, topic) {
+    "@hpcc-js/comms"
+
+], function (declare, arrayUtil, lang, config, Deferred, QueryResults, Observable, topic,
+    hpccComms) {
     var RequestHelper = declare(null, {
 
         serverIP: null,
@@ -64,6 +65,7 @@ define([
 
         _send: function(service, action, _params) {
             var params = lang.mixin({
+                request: {},
                 load: function (response) {
                 },
                 error: function (error) {
@@ -84,27 +86,18 @@ define([
 
             var retVal = null;
             if (this.isCrossSite()) {
-                retVal = script.get(this.getBaseURL(service) + "/" + action + postfix, {
-                    query: params.request,
-                    jsonp: "jsonp"
-                });
+                var transport = new hpccComms.Connection({ baseUrl: this.getBaseURL(service), type: hpccComms.RequestType.JSONP });
+                retVal = transport.send(action + postfix, params.request, handleAs === "text" ? hpccComms.ResponseType.TEXT : hpccComms.ResponseType.JSON);
             } else {
-                retVal = request.post(this.getBaseURL(service) + "/" + action + postfix, {
-                    data: params.request,
-                    handleAs: handleAs
-                });
+                var transport = new hpccComms.Connection({ baseUrl: this.getBaseURL(service) });
+                retVal = transport.send(action + postfix, params.request, handleAs === "text" ? hpccComms.ResponseType.TEXT : hpccComms.ResponseType.JSON);
             }
             return retVal.then(function (response) {
                 params.load(response);
                 return response;
-            },
-            function (error) {
+            }).catch(function(e) {
                 params.error(error);
                 return error;
-            },
-            function (event) {
-                params.event(event);
-                return event;
             });
         },
 

+ 3 - 1
esp/src/eclwatch/ESPResult.js

@@ -40,8 +40,10 @@ define([
                 return item;
             case "[object String]":
                 return entities.encode(item);
+            case "[object Undefined]":
+                return "";
             default:
-                console.log("Unknown cell type.")
+                console.log("Unknown cell type:  " + Object.prototype.toString.call(item))
         }
         return item;
     }

+ 2 - 0
esp/src/eclwatch/dojoConfig.js

@@ -25,12 +25,14 @@ function getConfig(env) {
             "@hpcc-js/api": baseUrl + "/node_modules/@hpcc-js/api/dist/api",
             "@hpcc-js/chart": baseUrl + "/node_modules/@hpcc-js/chart/dist/chart",
             "@hpcc-js/common": baseUrl + "/node_modules/@hpcc-js/common/dist/common",
+            "@hpcc-js/comms": baseUrl + "/node_modules/@hpcc-js/comms/dist/comms",
             "@hpcc-js/composite": baseUrl + "/node_modules/@hpcc-js/composite/dist/composite",
             "@hpcc-js/form": baseUrl + "/node_modules/@hpcc-js/form/dist/form",
             "@hpcc-js/graph": baseUrl + "/node_modules/@hpcc-js/graph/dist/graph",
             "@hpcc-js/layout": baseUrl + "/node_modules/@hpcc-js/layout/dist/layout",
             "@hpcc-js/map": baseUrl + "/node_modules/@hpcc-js/map/dist/map",
             "@hpcc-js/other": baseUrl + "/node_modules/@hpcc-js/other/dist/other",
+            "@hpcc-js/util": baseUrl + "/node_modules/@hpcc-js/util/dist/util",
             "@hpcc-js/TopoJSON": dojoRoot ? "/esp/files/dist/TopoJSON" : baseUrl + "/node_modules/@hpcc-js/map/TopoJSON",
             "clipboard": baseUrl + "/node_modules/clipboard/dist/clipboard",
             "codemirror": baseUrl + "/node_modules/codemirror",

Dosya farkı çok büyük olduğundan ihmal edildi
+ 731 - 147
esp/src/package-lock.json


+ 9 - 7
esp/src/package.json

@@ -20,13 +20,15 @@
   "main": "src/stub.js",
   "dependencies": {},
   "devDependencies": {
-    "@hpcc-js/common": "0.0.40",
-    "@hpcc-js/composite": "0.0.43",
-    "@hpcc-js/form": "0.0.42",
-    "@hpcc-js/graph": "0.0.41",
-    "@hpcc-js/layout": "0.0.40",
-    "@hpcc-js/map": "0.0.44",
-    "@hpcc-js/other": "0.0.40",
+    "@hpcc-js/chart": "0.0.44",
+    "@hpcc-js/common": "0.0.41",
+    "@hpcc-js/comms": "0.0.42",
+    "@hpcc-js/composite": "0.0.44",
+    "@hpcc-js/form": "0.0.43",
+    "@hpcc-js/graph": "0.0.42",
+    "@hpcc-js/layout": "0.0.41",
+    "@hpcc-js/map": "0.0.45",
+    "@hpcc-js/other": "0.0.41",
     "clipboard": "1.7.1",
     "codemirror": "5.31.0",
     "cpx": "1.5.0",