Browse Source

HPCC-10419 Add Query Test Pages to new ECL Watch

Add missing files.

Fixes HPCC-10419

Signed-off-by: Gordon Smith <gordon.smith@lexisnexis.com>
Gordon Smith 11 năm trước cách đây
mục cha
commit
7ed5bb452f

+ 5 - 3
esp/files/scripts/ESPQuery.js

@@ -26,9 +26,9 @@ define([
     "hpcc/WsWorkunits",
     "hpcc/ESPRequest",
     "hpcc/ESPUtil",
-    "hpcc/ESPResult"
+    "hpcc/ESPWorkunit"
 ], function (declare, arrayUtil, lang, Deferred, ObjectStore, QueryResults, Observable, Stateful,
-        WsWorkunits, ESPRequest, ESPUtil, ESPResult) {
+        WsWorkunits, ESPRequest, ESPUtil, ESPWorkunit) {
 
     var _logicalFiles = {};
 
@@ -101,7 +101,9 @@ define([
                 }
             });
         },
-
+        getWorkunit: function() {
+            return ESPWorkunit.Get(this.Wuid);
+        },
         doAction: function (action) {
             var context = this;
             return WsWorkunits.WUQuerysetQueryAction([{

+ 69 - 0
esp/files/scripts/IFrameWidget.js

@@ -0,0 +1,69 @@
+/*##############################################################################
+#   HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+############################################################################## */
+define([
+    "dojo/_base/declare",
+    "dojo/dom-construct",
+
+    "dijit/registry",
+
+    "hpcc/_Widget",
+
+    "dojo/text!../templates/IFrameWidget.html",
+
+    "dijit/layout/BorderContainer",
+    "dijit/Toolbar",
+    "dijit/ToolbarSeparator",
+    "dijit/form/Button",
+    "dijit/layout/ContentPane"
+], function (declare, domConstruct,
+                registry,
+                _Widget,
+                template) {
+    return declare("IFrameWidget", [_Widget], {
+        templateString: template,
+        baseClass: "IFrameWidget",
+
+        postCreate: function (args) {
+            this.inherited(arguments);
+            this.borderContainer = registry.byId(this.id + "BorderContainer");
+            this.contentPane = registry.byId(this.id + "ContentPane");
+        },
+
+        resize: function (args) {
+            this.inherited(arguments);
+            if (this.borderContainer) {
+                this.borderContainer.resize();
+            }
+        },
+
+        //  Hitched actions  ---
+        _onRefresh: function (event) {
+            this.contentPane.set("content", domConstruct.create("iframe", {
+                id: this.id + "IFrame",
+                src: this.params.src,
+                style: "border:1px solid lightgray; width: 100%; height: 100%"
+            }));
+        },
+
+        //  Implementation  ---
+        init: function (params) {
+            if (this.inherited(arguments))
+                return;
+
+            this._onRefresh();
+        }
+    });
+});

+ 144 - 0
esp/files/scripts/QueryTestWidget.js

@@ -0,0 +1,144 @@
+/*##############################################################################
+#   HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+############################################################################## */
+define([
+    "dojo/_base/declare",
+    "dojo/_base/array",
+
+    "dijit/registry",
+
+    "hpcc/_TabContainerWidget",
+    "hpcc/WsTopology",
+    "hpcc/ESPQuery",
+
+    "dijit/layout/BorderContainer",
+    "dijit/layout/TabContainer",
+    "dijit/layout/ContentPane",
+
+    "dojo/text!../templates/QueryTestWidget.html"
+
+], function (declare, arrayUtil,
+            registry,
+            _TabContainerWidget, WsTopology, ESPQuery,
+            BorderContainer, TabContainer, ContentPane,
+            template) {
+    return declare("QueryTestWidget", [_TabContainerWidget], {
+        templateString: template,
+        baseClass: "QueryTestWidget",
+        
+        initalized: false,
+        soapTab: null,
+        jsonTab: null,
+        requestTab: null,
+        responseTab: null,
+        requestSchemaTab: null,
+        responseSchemaTab: null,
+        wsdlTab: null,
+        paramXmlTab: null,
+        formTab: null,
+        linksTab: null,
+
+        postCreate: function (args) {
+            this.inherited(arguments);
+            this.soapTab = registry.byId(this.id + "_SOAP");
+            this.jsonTab = registry.byId(this.id + "_JSON");
+            this.wsdlTab = registry.byId(this.id + "_WSDL");
+            this.requestSchemaTab = registry.byId(this.id + "_RequestSchema");
+            this.responseSchemaTab = registry.byId(this.id + "ResponseSchema");
+            this.requestTab = registry.byId(this.id + "_Request");
+            this.responseTab = registry.byId(this.id + "_Response");
+            this.paramXmlTab = registry.byId(this.id + "_ParamXML");
+            this.formTab = registry.byId(this.id + "_Form");
+            this.linksTab = registry.byId(this.id + "_Links");
+        },
+
+        //  Hitched actions  ---
+        _onRefresh: function () {
+        },
+
+        //  Implementation  ---
+        init: function (params) {
+            if (this.inherited(arguments))
+                return;
+
+            this.query = ESPQuery.Get(params.QueryId);
+
+            this.selectChild(this.soapTab, true);
+        },
+
+        setContent: function (target, type, postfix) {
+            var context = this;
+            WsTopology.GetWsEclIFrameURL(type).then(function (response) {
+                var src = response + encodeURIComponent(context.params.QuerySet + "/" + context.params.QueryId + (postfix ? postfix : ""));
+                target.set("content", dojo.create("iframe", {
+                    src: src,
+                    style: "border:1px solid lightgray; width: 100%; height: 100%"
+                }));
+            });
+        },
+
+        initTab: function () {
+            var currSel = this.getSelectedChild();
+            if (!currSel.initalized) {
+                if (currSel.id === this.id + "_SOAP") {
+                    //  .../WsEcl/forms/soap/query/roxie/countydeeds.1
+                    this.setContent(currSel, "forms/soap");
+                } else if (currSel.id === this.id + "_JSON") {
+                    //  .../WsEcl/forms/json/query/roxie/countydeeds.1
+                    this.setContent(currSel, "forms/json");
+                } else if (currSel.id === this.id + "_WSDL") {
+                    //  .../WsEcl/definitions/query/roxie/countydeeds.1/main/countydeeds.1.wsdl?display
+                    this.setContent(currSel, "definitions", "/main/" + this.params.QueryId + ".wsdl?display");
+                } else if (currSel.id === this.id + "_RequestSchema") {
+                    //  .../WsEcl/definitions/query/roxie/countydeeds.1/main/countydeeds.1.xsd?display
+                    this.setContent(currSel, "definitions", "/main/" + this.params.QueryId + ".xsd?display");
+                } else if (currSel.id === this.id + "_ResponseSchemaBorder") {
+                    var wu = this.query.getWorkunit();
+                    var context = this;
+                    wu.fetchResults(function (response) {
+                        arrayUtil.forEach(response, function (item, idx) {
+                            var responseSchema = new ContentPane({
+                                id: context.id + "ResponseSchema" + item.Name,
+                                title: item.Name,
+                                closable: false
+                            });
+                            context.responseSchemaTab.addChild(responseSchema);
+                            //  .../WsEcl/definitions/query/roxie/countydeeds.1/result/jo_orig.xsd?display
+                            context.setContent(responseSchema, "definitions", "/result/" + item.Name + ".xsd?display");
+                        });
+                    });
+                } else if (currSel.id === this.id + "_Request") {
+                    // .../WsEcl/example/request/query/roxie/countydeeds.1?display
+                    this.setContent(currSel, "example/request", "?display");
+                } else if (currSel.id === this.id + "_Response") {
+                    //  .../WsEcl/example/response/query/roxie/countydeeds.1?display
+                    this.setContent(currSel, "example/response", "?display");
+                } else if (currSel.id === this.id + "_ParamXML") {
+                    //  .../WsEcl/definitions/query/roxie/countydeeds.1/resource/soap/countydeeds.1.xml?display
+                    this.setContent(currSel, "definitions", "/resource/soap/" + this.params.QueryId + ".xml?display");
+                } else if (currSel.id === this.id + "_Form") {
+                    //  .../WsEcl/forms/ecl/query/roxie/countydeeds.1
+                    this.setContent(currSel, "forms/ecl");
+                } else if (currSel.id === this.id + "_Links") {
+                    //  .../WsEcl/links/query/roxie/countydeeds.1
+                    this.setContent(currSel, "links");
+                } else if (currSel.init) {
+                    currSel.init(this.params);
+                }
+                currSel.initalized = true;
+            }
+        }
+    });
+});

+ 14 - 0
esp/files/scripts/WsTopology.js

@@ -70,6 +70,20 @@ define([
             }
             return deferred.promise;
         },
+        WsEclIFrameURL: "",
+        GetWsEclIFrameURL: function (type) {
+            var deferred = new Deferred();
+            if (this.WsEclIFrameURL === "") {
+                var context = this;
+                this.GetESPServiceBaseURL("ws_ecl").then(function (response) {
+                    context.WsEclIFrameURL = response + "/esp/files/stub.htm?Widget=IFrameWidget&src=" + encodeURIComponent("/WsEcl/");
+                    deferred.resolve(context.WsEclIFrameURL + encodeURIComponent(type + "/query/"));
+                });
+            } else {
+                deferred.resolve(this.WsEclIFrameURL + encodeURIComponent(type + "/query/"));
+            }
+            return deferred.promise;
+        },
         TpTargetClusterQuery: function (params) {
             return ESPRequest.send("WsTopology", "TpTargetClusterQuery", params);
         },

+ 11 - 0
esp/files/templates/IFrameWidget.html

@@ -0,0 +1,11 @@
+<div class="${baseClass}">
+    <div id="${id}BorderContainer" class="${baseClass}BorderContainer" style="width: 100%; height: 100%;" data-dojo-type="dijit.layout.BorderContainer">
+        <div id="${id}Toolbar" class="topPanel" data-dojo-props="region: 'top'" data-dojo-type="dijit.Toolbar">
+            <div id="${id}Refresh" data-dojo-attach-event="onClick:_onRefresh" data-dojo-props="iconClass:'iconRefresh'" data-dojo-type="dijit.form.Button">Reset</div>
+            <span data-dojo-type="dijit.ToolbarSeparator"></span>
+            <div id="${id}NewPage" class="right" data-dojo-attach-event="onClick:_onNewPage" data-dojo-props="iconClass:'iconNewPage', showLabel:false" data-dojo-type="dijit.form.Button">Open in New Page</div>
+        </div>
+        <div id="${id}ContentPane" style="border:0px; padding: 0px; border-color:none; overflow:hidden" data-dojo-props="region: 'center'" data-dojo-type="dijit.layout.ContentPane">
+        </div>
+    </div>
+</div>

+ 28 - 0
esp/files/templates/QueryTestWidget.html

@@ -0,0 +1,28 @@
+<div class="${baseClass}">
+    <div id="${id}BorderContainer" class="${baseClass}BorderContainer" style="width: 100%; height: 100%;" data-dojo-type="dijit.layout.BorderContainer">
+        <div id="${id}TabContainer" data-dojo-props="region: 'center', tabPosition: 'top'" style="width: 100%; height: 100%" data-dojo-type="dijit.layout.TabContainer">
+            <div id="${id}_SOAP" title="SOAP" data-dojo-type="dijit.layout.ContentPane">
+            </div>
+            <div id="${id}_JSON" title="JSON" data-dojo-type="dijit.layout.ContentPane">
+            </div>
+            <div id="${id}_WSDL" title="WSDL" data-dojo-type="dijit.layout.ContentPane">
+            </div>
+            <div id="${id}_RequestSchema" title="Request Schema" data-dojo-type="dijit.layout.ContentPane">
+            </div>
+            <div id="${id}_ResponseSchemaBorder" title="Response Schema" style="width: 100%; height: 100%;" data-dojo-type="dijit.layout.BorderContainer">
+                <div id="${id}ResponseSchema" data-dojo-props="region: 'center', tabPosition: 'top'" style="width: 100%; height: 100%" data-dojo-type="dijit.layout.TabContainer">
+                </div>
+            </div>
+            <div id="${id}_Request" title="Sample Request" data-dojo-type="dijit.layout.ContentPane">
+            </div>
+            <div id="${id}_Response" title="Sample Response" data-dojo-type="dijit.layout.ContentPane">
+            </div>
+            <div id="${id}_ParamXML" title="Parameter XML" data-dojo-type="dijit.layout.ContentPane">
+            </div>
+            <div id="${id}_Form" title="Legacy Form" data-dojo-type="dijit.layout.ContentPane">
+            </div>
+            <div id="${id}_Links" title="Links" data-dojo-type="dijit.layout.ContentPane">
+            </div>
+        </div>
+    </div>
+</div>