Browse Source

Merge pull request #4683 from GordonSmith/HPCC-9732

HPCC-9732 WUQueryWidget ignores "Cluster=" params

Reviewed-By: Miguel Vazquez <miguel.vazquez@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 years ago
parent
commit
282b98fae5

+ 1 - 2
esp/files/scripts/DFUSearchWidget.js

@@ -31,7 +31,6 @@ define([
 
     "hpcc/ECLSourceWidget",
     "hpcc/TargetSelectWidget",
-    "hpcc/SampleSelectWidget",
     "hpcc/GraphWidget",
     "hpcc/ResultsWidget",
     "hpcc/InfoGridWidget",
@@ -40,7 +39,7 @@ define([
     "dojo/text!../templates/DFUSearchWidget.html"
 ], function (declare, xhr, dom,
                 _LayoutWidget, _TemplatedMixin, _WidgetsInTemplateMixin, BorderContainer, TabContainer, ContentPane, Toolbar, Textarea, TitlePane, registry,
-                EclSourceWidget, TargetSelectWidget, SampleSelectWidget, GraphWidget, ResultsWidget, InfoGridWidget, Workunit,
+                EclSourceWidget, TargetSelectWidget, GraphWidget, ResultsWidget, InfoGridWidget, Workunit,
                 template) {
     return declare("DFUSearchWidget", [_LayoutWidget, _TemplatedMixin, _WidgetsInTemplateMixin], {
         templateString: template,

+ 6 - 4
esp/files/scripts/ECLPlaygroundWidget.js

@@ -30,7 +30,6 @@ define([
 
     "hpcc/ECLSourceWidget",
     "hpcc/TargetSelectWidget",
-    "hpcc/SampleSelectWidget",
     "hpcc/GraphWidget",
     "hpcc/ECLPlaygroundResultsWidget",
     "hpcc/ESPWorkunit",
@@ -38,7 +37,7 @@ define([
     "dojo/text!../templates/ECLPlaygroundWidget.html"
 ], function (declare, xhr, lang, dom, query,
                 _LayoutWidget, _TemplatedMixin, _WidgetsInTemplateMixin, BorderContainer, TabContainer, ContentPane, registry,
-                EclSourceWidget, TargetSelectWidget, SampleSelectWidget, GraphWidget, ResultsWidget, ESPWorkunit,
+                EclSourceWidget, TargetSelectWidget, GraphWidget, ResultsWidget, ESPWorkunit,
                 template) {
     return declare("ECLPlaygroundWidget", [_LayoutWidget, _TemplatedMixin, _WidgetsInTemplateMixin], {
         templateString: template,
@@ -116,7 +115,7 @@ define([
                 this.watchWU();
             } else {
                 this.initSamples();
-                this.graphControl.watchSelect(this.sampleSelectWidget.selectControl);
+                this.graphControl.watchSelect(this.sampleSelectWidget);
             }
             this.graphControl.watchSplitter(this.borderContainer.getSplitter("right"));
             this.graphControl.watchSplitter(this.borderContainer.getSplitter("bottom"));
@@ -129,7 +128,10 @@ define([
                 context.resetPage();
                 context.editorControl.setText(eclText);
             };
-            this.sampleSelectWidget.load();
+            this.sampleSelectWidget.init({
+                ECLSamples: true,
+                Target: "default.ecl"
+            });
         },
 
         initEditor: function () {

+ 0 - 67
esp/files/scripts/SampleSelectControl.js

@@ -1,67 +0,0 @@
-/*##############################################################################
-#    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/xhr",
-    "dojo/data/ItemFileReadStore",
-    "dijit/form/Select"
-], function (declare, xhr, ItemFileReadStore, Select) {
-    return declare(null, {
-        id: null,
-        samplesURL: null,
-        selectControl: null,
-
-        onNewSelection: function (eclText) {
-        },
-
-        constructor: function (args) {
-            if (args) {
-                declare.safeMixin(this, args);
-            }
-            var sampleStore = new dojo.data.ItemFileReadStore({
-                url: this.samplesURL
-            });
-
-            var context = this;
-            this.selectControl = new dijit.form.Select({
-                name: this.id,
-                store: sampleStore,
-                value: "default.ecl",
-                maxHeight: 480,
-                style: {
-                    padding: 0
-                },
-                onChange: function () {
-                    var filename = dijit.byId(this.id).get("value");
-                    xhr.get({
-                        url: "ecl/" + filename,
-                        handleAs: "text",
-                        load: function (eclText) {
-                            context.onNewSelection(eclText);
-                        },
-                        error: function () {
-                        }
-                    });
-                }
-            }, this.id);
-            try {
-                this.selectControl.startup();
-            } catch (e) {
-            }
-        }
-
-    });
-});

+ 0 - 81
esp/files/scripts/SampleSelectWidget.js

@@ -1,81 +0,0 @@
-/*##############################################################################
-#    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.
-############################################################################## */
-require([
-    "dojo/_base/declare",
-    "dojo/_base/xhr",
-    "dojo/dom",
-
-    "dijit/layout/_LayoutWidget",
-    "dijit/_TemplatedMixin",
-    "dijit/_WidgetsInTemplateMixin",
-    "dijit/form/Select",
-    "dijit/registry",
-
-    "dojo/text!./templates/SampleSelectWidget.html"
-], function (declare, xhr, dom,
-                    _LayoutWidget, _TemplatedMixin, _WidgetsInTemplateMixin, Select, registry,
-                    template) {
-    return declare("SampleSelectWidget", [_LayoutWidget, _TemplatedMixin, _WidgetsInTemplateMixin], {
-        templateString: template,
-        baseClass: "SampleSelectWidget",
-
-        selectControl: null,
-        _value: "",
-
-        postCreate: function (args) {
-            this.inherited(arguments);
-            this._initControls();
-        },
-
-        resize: function (args) {
-            this.inherited(arguments);
-        },
-
-        layout: function (args) {
-            this.inherited(arguments);
-        },
-
-        //  Implementation  ---
-        _initControls: function () {
-            this.selectControl = registry.byId(this.id + "SampleSelect");
-            this.selectControl.maxHeight = 480;
-        },
-
-        load: function () {
-            var sampleStore = new dojo.data.ItemFileReadStore({
-                url: "ecl/ECLPlaygroundSamples.json"
-            });
-            this.selectControl.setStore(sampleStore);
-            var context = this;
-            this.selectControl.onChange = function () {
-                var filename = this.getValue();
-                xhr.get({
-                    url: "ecl/" + filename,
-                    handleAs: "text",
-                    load: function (eclText) {
-                        context.onNewSelection(eclText);
-                    },
-                    error: function () {
-                    }
-                });
-            };
-            this.selectControl.set("value", "default.ecl");
-        },
-
-        onNewSelection: function (eclText) {
-        }
-    });
-});

+ 64 - 90
esp/files/scripts/TargetSelectWidget.js

@@ -17,65 +17,41 @@ require([
     "dojo/_base/declare",
     "dojo/_base/lang",
     "dojo/_base/array",
+    "dojo/_base/xhr",
+    "dojo/data/ItemFileReadStore",
+    "dojo/on",
     "dojo/dom",
 
-    "dijit/layout/_LayoutWidget",
-    "dijit/_TemplatedMixin",
-    "dijit/_WidgetsInTemplateMixin",
     "dijit/form/Select",
     "dijit/registry",
 
     "hpcc/WsTopology",
     "hpcc/WsWorkunits",
-    "hpcc/FileSpray",
-
-    "dojo/text!./templates/TargetSelectWidget.html"
-], function (declare, lang, arrayUtil, dom,
-    _LayoutWidget, _TemplatedMixin, _WidgetsInTemplateMixin, Select, registry,
-    WsTopology, WsWorkunits, FileSpray,
-    template) {
-    return declare("TargetSelectWidget", [_LayoutWidget, _TemplatedMixin, _WidgetsInTemplateMixin], {
-        templateString: template,
-        baseClass: "TargetSelectWidget",
-
-        targetSelectControl: null,
-        name: "",
-        _value: "",
-
-        postCreate: function (args) {
-            this.inherited(arguments);
-            this._initControls();
-        },
+    "hpcc/FileSpray"
+], function (declare, lang, arrayUtil, xhr, ItemFileReadStore, on, dom,
+    Select, registry,
+    WsTopology, WsWorkunits, FileSpray) {
+    return declare("TargetSelectWidget", Select, {
 
-        resize: function (args) {
-            this.inherited(arguments);
-        },
-
-        layout: function (args) {
-            this.inherited(arguments);
-        },
+        loading: false,
+        defaultValue: "",
 
         //  Implementation  ---
-        _initControls: function () {
-            var context = this;
-            this.targetSelectControl = registry.byId(this.id + "TargetSelect");
-            this.targetSelectControl.onChange = function () {
-                context.onChange(this.get("value"));
-            };
-        },
-
         init: function (params) {
             if (this.initalized)
                 return;
             this.initalized = true;
-            this.targetSelectControl.options = [];
+            this.loading = true;
+            this.options = [];
 
             if (params.Target) {
-                this._value = params.Target;
+                this.defaultValue = params.Target;
+                this.set("value", params.Target);
             }
+
             if (params.includeBlank) {
                 this.includeBlank = params.includeBlank;
-                this.targetSelectControl.options.push({
+                this.options.push({
                     label: "&nbsp;",
                     value: ""
                 });
@@ -88,6 +64,8 @@ require([
                 this.loadWUState();
             } else if (params.DFUState === true) {
                 this.loadDFUState();
+            } else if (params.ECLSamples === true) {
+                this.loadECLSamples();
             } else {
                 this.loadTargets();
             }
@@ -98,50 +76,25 @@ require([
             }
         },
 
-        onChange: function (target) {
-            this._value = target;
-            this._valueItem = null;
-            var context = this;
-            var idx = arrayUtil.forEach(this.targetSelectControl.options, function(item, idx) {
-                if (item.value === context._value) {
-                    context._valueItem = item;
-                }
-            });
-            if (this.callback) {
-                this.callback(this._value, this._valueItem);
-            }
-        },
-
-        setValue: function (target) {
-            if (target !== null && this._value != target) {
-                this._value = target;
-                this.targetSelectControl.set("value", target);
-            }
-        },
-
         _setValueAttr: function (target) {
-            if (target === null) {
+            if (target === null)
                 target = "";
-            }
-            if (target !== null && this._value != target) {
-                this._value = target;
-                this.targetSelectControl.set("value", target);
-            }
-        },
-
-        getValue: function () {
-            return this._value;
+            this.inherited(arguments);
         },
 
         _getValueAttr: function () {
-            return this._value;
+            if (this.loading)
+                return this.defaultValue;
+
+            return this.value;
         },
 
-        resetDefaultSelection: function () {
-            if (this._value == "") {
-                this._value = this.targetSelectControl.options[0].value;
+        _postLoad: function () {
+            if (this.defaultValue == "") {
+                this.defaultValue = this.options[0].value;
             }
-            this.targetSelectControl.set("value", this._value);
+            this.set("value", this.defaultValue);
+            this.loading = false;
         },
 
         loadDropZones: function () {
@@ -151,13 +104,13 @@ require([
                     if (lang.exists("TpServiceQueryResponse.ServiceList.TpDropZones.TpDropZone", response)) {
                         var targetData = response.TpServiceQueryResponse.ServiceList.TpDropZones.TpDropZone;
                         for (var i = 0; i < targetData.length; ++i) {
-                            context.targetSelectControl.options.push({
+                            context.options.push({
                                 label: targetData[i].Name,
                                 value: targetData[i].Name,
                                 machine: targetData[i].TpMachines.TpMachine[0]
                             });
                         }
-                        context.resetDefaultSelection();
+                        context._postLoad();
                     }
                 }
             });
@@ -170,12 +123,12 @@ require([
                     if (lang.exists("TpGroupQueryResponse.TpGroups.TpGroup", response)) {
                         var targetData = response.TpGroupQueryResponse.TpGroups.TpGroup;
                         for (var i = 0; i < targetData.length; ++i) {
-                            context.targetSelectControl.options.push({
+                            context.options.push({
                                 label: targetData[i].Name,
                                 value: targetData[i].Name
                             });
                         }
-                        context.resetDefaultSelection();
+                        context._postLoad();
                     }
                 }
             });
@@ -183,34 +136,34 @@ require([
 
         loadWUState: function() {
             for (var key in WsWorkunits.States) {
-                this.targetSelectControl.options.push({
+                this.options.push({
                     label: WsWorkunits.States[key],
                     value: WsWorkunits.States[key]
                 });
             }
-            this.resetDefaultSelection();
+            this._postLoad();
         },
 
         loadDFUState: function () {
             for (var key in FileSpray.States) {
-                this.targetSelectControl.options.push({
+                this.options.push({
                     label: FileSpray.States[key],
                     value: FileSpray.States[key]
                 });
             }
-            this.resetDefaultSelection();
+            this._postLoad();
         },
 
         LogicalFileSearchType: function() {
-            this.targetSelectControl.options.push({
+            this.options.push({
                 label: "Created",
                 value: "Created"
             });
-            this.targetSelectControl.options.push({
+            this.options.push({
                 label: "Used",
                 value: "Referenced"
             });
-            this.resetDefaultSelection();
+            this._postLoad();
         },
 
         loadTargets: function () {
@@ -221,7 +174,7 @@ require([
                     var targetData = response.TpLogicalClusterQueryResponse.TpLogicalClusters.TpLogicalCluster;
                     var has_hthor = false;
                     for (var i = 0; i < targetData.length; ++i) {
-                        context.targetSelectControl.options.push({
+                        context.options.push({
                             label: targetData[i].Name,
                             value: targetData[i].Name
                         });
@@ -234,12 +187,33 @@ require([
                         if (has_hthor) {
                             context._value = "hthor";
                         } else {
-                            context._value = context.targetSelectControl.options[0].value;
+                            context._value = context.options[0].value;
                         }
                     }
-                    context.resetDefaultSelection();
                 }
+                context._postLoad();
+            });
+        },
+
+        loadECLSamples: function () {
+            var sampleStore = new ItemFileReadStore({
+                url: "ecl/ECLPlaygroundSamples.json"
+            });
+            this.setStore(sampleStore);
+            var context = this;
+            this.on("change", function (evt) {
+                var filename = this.get("value");
+                xhr.get({
+                    url: "ecl/" + filename,
+                    handleAs: "text",
+                    load: function (eclText) {
+                        context.onNewSelection(eclText);
+                    },
+                    error: function () {
+                    }
+                });
             });
+            context._postLoad();
         }
     });
 });

+ 1 - 2
esp/files/scripts/WUDetailsWidget.js

@@ -37,7 +37,6 @@ define([
     "hpcc/ESPWorkunit",
     "hpcc/ECLSourceWidget",
     "hpcc/TargetSelectWidget",
-    "hpcc/SampleSelectWidget",
     "hpcc/GraphsWidget",
     "hpcc/ResultsWidget",
     "hpcc/SourceFilesWidget",
@@ -59,7 +58,7 @@ define([
 ], function (declare, dom, domAttr, domClass, query, Memory, Observable,
                 _TemplatedMixin, _WidgetsInTemplateMixin, registry,
                 OnDemandGrid, Keyboard, Selection, selector, ColumnResizer, DijitRegistry,
-                _TabContainerWidget, ESPWorkunit, EclSourceWidget, TargetSelectWidget, SampleSelectWidget, GraphsWidget, ResultsWidget, SourceFilesWidget, InfoGridWidget, LogsWidget, TimingPageWidget, ECLPlaygroundWidget,
+                _TabContainerWidget, ESPWorkunit, EclSourceWidget, TargetSelectWidget, GraphsWidget, ResultsWidget, SourceFilesWidget, InfoGridWidget, LogsWidget, TimingPageWidget, ECLPlaygroundWidget,
                 template) {
     return declare("WUDetailsWidget", [_TabContainerWidget, _TemplatedMixin, _WidgetsInTemplateMixin], {
         templateString: template,

+ 1 - 0
esp/files/scripts/WUQueryWidget.js

@@ -377,6 +377,7 @@ define([
                 allowSelectAll: true,
                 deselectOnRefresh: false,
                 store: store,
+                query: this.getFilter(),
                 rowsPerPage: 50,
                 pagingLinks: 1,
                 pagingTextBox: true,

+ 2 - 1
esp/files/templates/ECLPlaygroundWidget.html

@@ -5,7 +5,8 @@
                 ECL Playground
             </div>
             <div style="float: right; display: inline-block; vertical-align: middle">
-                <div id="${id}SampleSelect" style="display: inline-block; vertical-align: middle" data-dojo-type="SampleSelectWidget">
+                <label id="${id}SampleSelectLabel" for="${id}SampleSelect">Sample:</label>
+                <div id="${id}SampleSelect" style="display: inline-block; vertical-align: middle" data-dojo-type="TargetSelectWidget">
                 </div>
             </div>
         </div>

+ 0 - 5
esp/files/templates/SampleSelectWidget.html

@@ -1,5 +0,0 @@
-<div class="${baseClass}">
-    <label id="${id}SampleSelectLabel" for="${id}SampleSelect">Sample:</label>
-    <div id="${id}SampleSelect" data-dojo-type="dijit.form.Select">
-    </div>
-</div>

+ 0 - 5
esp/files/templates/TargetSelectWidget.html

@@ -1,5 +0,0 @@
-<div class="${baseClass}">
-    <!--<label id="${id}TargetSelectLabel" for="${id}TargetSelect">Target:</label>-->
-    <div id="${id}TargetSelect" name="${name}" data-dojo-type="dijit.form.Select">
-    </div>
-</div>

+ 1 - 2
initfiles/componentfiles/configxml/plugin.xsd

@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
 <!--
 ################################################################################
 #    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
@@ -15,8 +16,6 @@
 #    limitations under the License.
 ################################################################################
 -->
-
-<?xml version="1.0" encoding="UTF-8"?>
 <!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by Rajeev Moondhra (Seisint, Inc.) -->
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
     <xs:include schemaLocation="environment.xsd"/>