瀏覽代碼

HPCC-7899 Add Z.A.P button

Add the ability to give users the option of
submitting a Zipped Analysis Package on Workunit
Details pages.

Signed-off by: Miguel Vazquez miguel.vazquez@lexisnexis.com

Signed-off-by: Miguel Vazquez <miguel.vazquez@lexisnexis.com>
Miguel Vazquez 11 年之前
父節點
當前提交
3763678627

+ 6 - 0
esp/files/css/hpcc.css

@@ -376,6 +376,12 @@ hr.dashedLine {
     cursor: pointer;
 }
 
+.iconZap{
+    background-image: url("../img/zap.png"); 
+    width: 16px;
+    height: 16px;
+    display: inline-block;
+}
 /*###############################*/
 #appLayout {
     height: 100%;

二進制
esp/files/img/zap.png


+ 62 - 14
esp/files/scripts/WUDetailsWidget.js

@@ -1,22 +1,25 @@
 /*##############################################################################
-#	HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
+#   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
+#   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
+#      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.
+#   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",
+    "dojo/dom-form",
+    "dojo/_base/lang",
     "dojo/dom-attr",
+    "dojo/request/iframe",
     "dojo/dom-class",
     "dojo/query",
     "dojo/store/Memory",
@@ -33,6 +36,7 @@ define([
 
     "hpcc/_TabContainerWidget",
     "hpcc/ESPWorkunit",
+    "hpcc/ESPRequest",
     "hpcc/ECLSourceWidget",
     "hpcc/TargetSelectWidget",
     "hpcc/GraphsWidget",
@@ -42,22 +46,30 @@ define([
     "hpcc/LogsWidget",
     "hpcc/TimingPageWidget",
     "hpcc/ECLPlaygroundWidget",
+    "hpcc/WsWorkunits",
 
     "dojo/text!../templates/WUDetailsWidget.html",
 
     "dijit/layout/BorderContainer",
     "dijit/layout/TabContainer",
     "dijit/layout/ContentPane",
+    "dijit/form/Form",
     "dijit/form/Textarea",
     "dijit/form/Button",
     "dijit/Toolbar",
     "dijit/TooltipDialog",
-    "dijit/TitlePane"
-], function (declare, dom, domAttr, domClass, query, Memory, Observable,
+    "dijit/TitlePane",
+    "dijit/form/TextBox",
+    "dijit/Dialog",
+    "dijit/form/SimpleTextarea",
+
+    "dojox/layout/TableContainer"
+], function (declare, dom, domForm, lang, domAttr, iframe, domClass, query, Memory, Observable,
                 registry,
                 OnDemandGrid, Keyboard, Selection, selector, ColumnResizer, DijitRegistry,
-                _TabContainerWidget, ESPWorkunit, EclSourceWidget, TargetSelectWidget, GraphsWidget, ResultsWidget, SourceFilesWidget, InfoGridWidget, LogsWidget, TimingPageWidget, ECLPlaygroundWidget,
+                _TabContainerWidget, ESPWorkunit, ESPRequest, EclSourceWidget, TargetSelectWidget, GraphsWidget, ResultsWidget, SourceFilesWidget, InfoGridWidget, LogsWidget, TimingPageWidget, ECLPlaygroundWidget, WsWorkunits,
                 template) {
+    var uniqueID = 0;
     return declare("WUDetailsWidget", [_TabContainerWidget], {
         templateString: template,
         baseClass: "WUDetailsWidget",
@@ -81,6 +93,10 @@ define([
         publishForm: null,
 
         wu: null,
+        buildVersion: null,
+        espIPAddress: null,
+        thorIPAddress: null,
+
         prevState: "",
 
         postCreate: function (args) {
@@ -123,6 +139,10 @@ define([
             return "ECL Workunit Details";
         },
 
+        _onCancelDialog: function (){
+            registry.byId(this.id + "ZapDialog").hide();
+        }, 
+
         //  Hitched actions  ---
         _onSave: function (event) {
             var protectedCheckbox = registry.byId(this.id + "Protected");
@@ -161,6 +181,34 @@ define([
             }
         },
 
+        onZapReport: function (event) {
+            var context = this;
+            WsWorkunits.WUGetBugReportInfo({
+                request: {
+                    WUID: this.wu.Wuid
+                }
+            }).then(function (response) {
+                registry.byId(context.id + "ZapDialog").show();
+                if (lang.exists("WUGetBugReportInfoResponse", response)) {
+                    context.updateInput("ZapWUID", null, response.WUGetBugReportInfoResponse.WUID);
+                    context.updateInput("BuildVersion", null, response.WUGetBugReportInfoResponse.BuildVersion);
+                    context.updateInput("ESPIPAddress", null, response.WUGetBugReportInfoResponse.ESPIPAddress);
+                    context.updateInput("ThorIPAddress", null, response.WUGetBugReportInfoResponse.ThorIPAddress);
+                    
+                    context.buildVersion = response.WUGetBugReportInfoResponse.BuildVersion;
+                    context.espIPAddress = response.WUGetBugReportInfoResponse.ESPIPAddress;
+                    context.thorIPAddress = response.WUGetBugReportInfoResponse.ThorIPAddress;
+                }                
+            });
+        },
+
+        onZapSubmit: function (event) {
+            var frame = iframe.create("ZapDownload" + uniqueID++);
+            var url = ESPRequest.getBaseURL("WsWorkunits") + "/WUReportBug?WUID=" + this.wu.Wuid + "&ESPIPAddress=" + this.espIPAddress + "&ThorIPAddress=" + this.thorIPAddress + "&BuildVersion=" + encodeURIComponent(this.buildVersion);
+            iframe.setSrc(frame, url, true);
+            registry.byId(this.id + "ZapDialog").hide();
+        },
+
         //  Implementation  ---
         init: function (params) {
             if (this.inherited(arguments))
@@ -396,4 +444,4 @@ define([
         monitorWorkunit: function (response) {
         }
     });
-});
+});

+ 4 - 0
esp/files/scripts/WsWorkunits.js

@@ -65,6 +65,10 @@ define([
             return ESPRequest.send("WsWorkunits", "WUQueryDetails", params);
         },
 
+        WUGetBugReportInfo: function (params) {
+            return ESPRequest.send("WsWorkunits", "WUGetBugReportInfo", params);
+        },
+
         WUQuerysetAliasAction: function (selection, action) {
             var requests = [];
             arrayUtil.forEach(selection, function (item, idx) {

+ 18 - 1
esp/files/templates/WUDetailsWidget.html

@@ -30,6 +30,8 @@
                         </div>
                     </div>
                     <span data-dojo-type="dijit.ToolbarSeparator"></span>
+                    <div id="${id}ZapReport" data-dojo-attach-event="onClick:onZapReport" data-dojo-props="iconClass:'iconZap'" title="Zipped Analysis Package" data-dojo-type="dijit.form.Button">Z.A.P</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 data-dojo-props="region: 'center'" data-dojo-type="dijit.layout.ContentPane">
@@ -104,4 +106,19 @@
             </div>
         </div>
     </div>
-</div>
+    <div id="${id}ZapDialog" data-dojo-type="dijit.Dialog" title="Zipped Analysis Package">
+        <div id="${id}ZapForm" style="width:400px" data-dojo-type="dijit.form.Form">
+            <div data-dojo-props="cols:2" data-dojo-type="dojox.layout.TableContainer">
+                <input id="${id}ZapWUID" title="WUID:" name="WUID" colspan="2" data-dojo-props="trim: true, readonly: true," data-dojo-type="dijit.form.TextBox" />
+                <input id="${id}BuildVersion" title="ESP&nbsp;Build&nbsp;Version:" name="BuildVersion" colspan="2" data-dojo-props="trim: true, readonly: true," data-dojo-type="dijit.form.TextBox" />
+                <input id="${id}ESPIPAddress" title="ESP&nbsp;Network&nbsp;Address:" name="ESPIPAddress" colspan="2" data-dojo-props="trim: true, readonly: true," data-dojo-type="dijit.form.TextBox" />
+                <input id="${id}ThorIPAddress" title="Thor&nbsp;Network&nbsp;Address:" name="ThorIPAddress" colspan="2" data-dojo-props="trim: true, readonly: true," data-dojo-type="dijit.form.TextBox" />
+                <input id="${id}ZapDescription" title="Description:" cols="22" colspan="2" data-dojo-type="dijit.form.SimpleTextarea"/>
+                <input id="${id}WarnHistory" title="History:" cols="22" colspan="2" data-dojo-type="dijit.form.SimpleTextarea"/>
+                <input id="${id}WarnTimings" title="Timings:" cols="22" colspan="2" data-dojo-type="dijit.form.SimpleTextarea"/>
+            </div>
+            <button id="${id}onZapSubmit" class="bottomFormButtons" data-dojo-attach-event="onClick:onZapSubmit" data-dojo-type="dijit.form.Button">Apply</button>
+            <button class="bottomFormButtons" data-dojo-attach-event="onClick:_onCancelDialog" data-dojo-type="dijit.form.Button">Cancel</button>
+        </div>
+    </div>
+</div>