/*############################################################################## # 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([ "exports", "dojo/_base/declare", "dojo/_base/array", "dojo/dom", "dojo/dom-attr", "dojo/dom-class", "dojo/dom-style", "dojo/query", "dijit/layout/BorderContainer", "dijit/layout/TabContainer", "dijit/layout/ContentPane", "dijit/Toolbar", "dijit/form/Textarea", "dijit/TitlePane", "dijit/registry", "dijit/ProgressBar", "hpcc/_TabContainerWidget", "hpcc/FileSpray", "hpcc/ESPDFUWorkunit", "hpcc/ECLSourceWidget", "hpcc/LFDetailsWidget", "dojo/text!../templates/DFUWUDetailsWidget.html", "dojox/layout/TableContainer" ], function (exports, declare, arrayUtil, dom, domAttr, domClass, domStyle, query, BorderContainer, TabContainer, ContentPane, Toolbar, Textarea, TitlePane, registry, ProgressBar, _TabContainerWidget, FileSpray, ESPDFUWorkunit, ECLSourceWidget, LFDetailsWidget, template) { exports.fixCircularDependency = declare("DFUWUDetailsWidget", [_TabContainerWidget], { templateString: template, baseClass: "DFUWUDetailsWidget", summaryWidget: null, xmlWidget: null, wu: null, loaded: false, buildRendering: function (args) { this.inherited(arguments); }, postCreate: function (args) { this.inherited(arguments); this.summaryWidget = registry.byId(this.id + "_Summary"); this.xmlWidget = registry.byId(this.id + "_XML"); var stateOptions = []; for (var key in FileSpray.States) { stateOptions.push({ label: FileSpray.States[key], value: FileSpray.States[key] }); } var stateSelect = registry.byId(this.id + "StateMessage"); stateSelect.addOption(stateOptions); }, getTitle: function () { return "DFU Workunit"; }, // Hitched actions --- _onRefresh: function (event) { this.wu.refresh(true); }, _onSave: function (event) { var protectedCheckbox = registry.byId(this.id + "isProtected"); var context = this; this.wu.update({ JobName: dom.byId(context.id + "JobName").value, isProtected: protectedCheckbox.get("value") }, null); }, _onDelete: function (event) { this.wu.doDelete(); }, _onAbort: function (event) { this.wu.abort(); }, _onResubmit: function (event) { var context = this; this.wu.resubmit(); }, _onModify: function (event) { //TODO }, // Implementation --- init: function (params) { if (this.inherited(arguments)) return; //dom.byId("showWuid").innerHTML = params.Wuid; if (params.Wuid) { this.summaryWidget.set("title", params.Wuid); dom.byId(this.id + "Wuid").innerHTML = params.Wuid; this.clearInput(); this.wu = ESPDFUWorkunit.Get(params.Wuid); var data = this.wu.getData(); for (key in data) { this.updateInput(key, null, data[key]); } var context = this; this.wu.watch(function (name, oldValue, newValue) { context.updateInput(name, oldValue, newValue); }); this.wu.refresh(); } this.selectChild(this.summaryWidget, true); }, initTab: function () { if (!this.wu) { return } var currSel = this.getSelectedChild(); if (!currSel.initalized) { if (currSel.id == this.summaryWidget.id) { } else if (currSel.id == this.xmlWidget.id) { var context = this; this.wu.fetchXML(function (response) { context.xmlWidget.init({ ECL: response }); }); } else { currSel.init(currSel._hpccParams); } } }, objectToText: function (obj) { var text = "" for (var key in obj) { text += "