|
@@ -15,108 +15,109 @@
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
############################################################################## */
|
|
|
define([
|
|
|
- "dojo/_base/config",
|
|
|
- "dojo/_base/declare",
|
|
|
- "dojo/_base/xhr",
|
|
|
- "hpcc/ESPBase"], function(baseConfig, declare, baseXhr, ESPBase) {
|
|
|
+ "dojo/_base/config",
|
|
|
+ "dojo/_base/declare",
|
|
|
+ "dojo/_base/xhr",
|
|
|
+ "hpcc/ESPBase"
|
|
|
+], function (baseConfig, declare, baseXhr, ESPBase) {
|
|
|
return declare(ESPBase, {
|
|
|
- wuid : "",
|
|
|
+ wuid: "",
|
|
|
|
|
|
- stateID : 0,
|
|
|
- state : "",
|
|
|
+ stateID: 0,
|
|
|
+ state: "",
|
|
|
|
|
|
text: "",
|
|
|
|
|
|
- resultCount : 0,
|
|
|
- results : [],
|
|
|
+ resultCount: 0,
|
|
|
+ results: [],
|
|
|
|
|
|
- graphNameIndex : [],
|
|
|
- graphs : [],
|
|
|
+ graphNameIndex: [],
|
|
|
+ graphs: [],
|
|
|
|
|
|
- exceptions : [],
|
|
|
- errors : [],
|
|
|
- timers : [],
|
|
|
+ exceptions: [],
|
|
|
+ errors: [],
|
|
|
+ timers: [],
|
|
|
|
|
|
- onCreate : function() {
|
|
|
+ onCreate: function () {
|
|
|
},
|
|
|
- onUpdate : function() {
|
|
|
+ onUpdate: function () {
|
|
|
},
|
|
|
- onSubmit : function() {
|
|
|
+ onSubmit: function () {
|
|
|
},
|
|
|
- onMonitor : function() {
|
|
|
+ onMonitor: function () {
|
|
|
},
|
|
|
- onComplete : function() {
|
|
|
+ onComplete: function () {
|
|
|
},
|
|
|
onGetText: function () {
|
|
|
},
|
|
|
- onGetInfo : function() {
|
|
|
+ onGetInfo: function () {
|
|
|
},
|
|
|
- onGetGraph : function(name) {
|
|
|
+ onGetGraph: function (name) {
|
|
|
},
|
|
|
- constructor : function(args) {
|
|
|
+ constructor: function (args) {
|
|
|
declare.safeMixin(this, args);
|
|
|
|
|
|
- if(!this.wuid) {
|
|
|
+ if (!this.wuid) {
|
|
|
this.create();
|
|
|
}
|
|
|
},
|
|
|
- isComplete : function() {
|
|
|
+ isComplete: function () {
|
|
|
switch (this.stateID) {
|
|
|
case '3':
|
|
|
- //WUStateCompleted:
|
|
|
+ //WUStateCompleted:
|
|
|
case '4':
|
|
|
- //WUStateFailed:
|
|
|
+ //WUStateFailed:
|
|
|
case '5':
|
|
|
- //WUStateArchived:
|
|
|
+ //WUStateArchived:
|
|
|
case '7':
|
|
|
//WUStateAborted:
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
|
},
|
|
|
- monitor : function() {
|
|
|
+ monitor: function () {
|
|
|
var request = {};
|
|
|
request['Wuid'] = this.wuid;
|
|
|
request['rawxml_'] = "1";
|
|
|
|
|
|
var context = this;
|
|
|
baseXhr.post({
|
|
|
- url : this.getBaseURL() + "/WUQuery",
|
|
|
- handleAs : "xml",
|
|
|
- content : request,
|
|
|
- load : function(xmlDom) {
|
|
|
+ url: this.getBaseURL() + "/WUQuery",
|
|
|
+ handleAs: "xml",
|
|
|
+ content: request,
|
|
|
+ load: function (xmlDom) {
|
|
|
context.stateID = context.parseKeyValue(xmlDom, "StateID");
|
|
|
context.state = context.parseKeyValue(xmlDom, "State");
|
|
|
context.onMonitor();
|
|
|
- if(!context.isComplete()) {
|
|
|
- setTimeout(function() {
|
|
|
+ if (!context.isComplete()) {
|
|
|
+ setTimeout(function () {
|
|
|
context.monitor();
|
|
|
}, 200);
|
|
|
}
|
|
|
},
|
|
|
- error : function() {
|
|
|
+ error: function () {
|
|
|
done = true;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- create : function(ecl, _sync) {
|
|
|
+ create: function (ecl, _sync) {
|
|
|
var request = {};
|
|
|
request['rawxml_'] = "1";
|
|
|
|
|
|
var context = this;
|
|
|
baseXhr.post({
|
|
|
- url : this.getBaseURL() + "/WUCreate",
|
|
|
- handleAs : "xml",
|
|
|
- content : request,
|
|
|
- load : function(xmlDom) {
|
|
|
+ url: this.getBaseURL() + "/WUCreate",
|
|
|
+ handleAs: "xml",
|
|
|
+ content: request,
|
|
|
+ load: function (xmlDom) {
|
|
|
context.wuid = context.parseKeyValue(xmlDom, "Wuid");
|
|
|
context.onCreate();
|
|
|
},
|
|
|
- error : function() {
|
|
|
+ error: function () {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- update : function(ecl, _sync) {
|
|
|
+ update: function (ecl, _sync) {
|
|
|
var request = {};
|
|
|
request['Wuid'] = this.wuid;
|
|
|
request['QueryText'] = ecl;
|
|
@@ -124,18 +125,18 @@ define([
|
|
|
|
|
|
var context = this;
|
|
|
baseXhr.post({
|
|
|
- url : this.getBaseURL() + "/WUUpdate",
|
|
|
- handleAs : "xml",
|
|
|
- content : request,
|
|
|
- sync : _sync,
|
|
|
- load : function(xmlDom) {
|
|
|
+ url: this.getBaseURL() + "/WUUpdate",
|
|
|
+ handleAs: "xml",
|
|
|
+ content: request,
|
|
|
+ sync: _sync,
|
|
|
+ load: function (xmlDom) {
|
|
|
context.onUpdate();
|
|
|
},
|
|
|
- error : function() {
|
|
|
+ error: function () {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- submit : function(target, _sync) {
|
|
|
+ submit: function (target, _sync) {
|
|
|
var request = {};
|
|
|
request['Wuid'] = this.wuid;
|
|
|
request['Cluster'] = target;
|
|
@@ -143,15 +144,15 @@ define([
|
|
|
|
|
|
var context = this;
|
|
|
baseXhr.post({
|
|
|
- url : this.getBaseURL() + "/WUSubmit",
|
|
|
- handleAs : "xml",
|
|
|
- content : request,
|
|
|
- sync : _sync,
|
|
|
- load : function(xmlDom) {
|
|
|
+ url: this.getBaseURL() + "/WUSubmit",
|
|
|
+ handleAs: "xml",
|
|
|
+ content: request,
|
|
|
+ sync: _sync,
|
|
|
+ load: function (xmlDom) {
|
|
|
context.onSubmit();
|
|
|
context.monitor();
|
|
|
},
|
|
|
- error : function() {
|
|
|
+ error: function () {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -203,12 +204,12 @@ define([
|
|
|
context.onGetInfo();
|
|
|
}, true, true, false, true, false, false, true, false, false, false, false);
|
|
|
},
|
|
|
- getGraphs : function() {
|
|
|
- for(var i = 0; i < this.graphs.length; ++i) {
|
|
|
+ getGraphs: function () {
|
|
|
+ for (var i = 0; i < this.graphs.length; ++i) {
|
|
|
this.getGraph(i);
|
|
|
}
|
|
|
},
|
|
|
- getGraph : function(idx, _sync) {
|
|
|
+ getGraph: function (idx, _sync) {
|
|
|
var request = {};
|
|
|
request['Wuid'] = this.wuid;
|
|
|
request['GraphName'] = this.graphs[idx].Name;
|
|
@@ -216,24 +217,24 @@ define([
|
|
|
|
|
|
var context = this;
|
|
|
baseXhr.post({
|
|
|
- url : this.getBaseURL() + "/WUGetGraph",
|
|
|
- handleAs : "xml",
|
|
|
- content : request,
|
|
|
- sync : _sync,
|
|
|
- load : function(xmlDom) {
|
|
|
+ url: this.getBaseURL() + "/WUGetGraph",
|
|
|
+ handleAs: "xml",
|
|
|
+ content: request,
|
|
|
+ sync: _sync,
|
|
|
+ load: function (xmlDom) {
|
|
|
context.graphs[idx].xgmml = context.parseKeyValue(xmlDom, "Graph");
|
|
|
context.onGetGraph(idx);
|
|
|
},
|
|
|
- error : function() {
|
|
|
+ error: function () {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- getResults : function() {
|
|
|
- for(var i = 0; i < this.results.length; ++i) {
|
|
|
+ getResults: function () {
|
|
|
+ for (var i = 0; i < this.results.length; ++i) {
|
|
|
this.getResult(i);
|
|
|
}
|
|
|
},
|
|
|
- getResult : function(idx, _sync) {
|
|
|
+ getResult: function (idx, _sync) {
|
|
|
var request = {};
|
|
|
request['Wuid'] = this.wuid;
|
|
|
request['Sequence'] = this.results[idx].Sequence;
|
|
@@ -243,38 +244,38 @@ define([
|
|
|
|
|
|
var context = this;
|
|
|
baseXhr.post({
|
|
|
- url : this.getBaseURL() + "/WUResult",
|
|
|
- handleAs : "xml",
|
|
|
- content : request,
|
|
|
- sync : _sync,
|
|
|
- load : function(xmlDom) {
|
|
|
+ url: this.getBaseURL() + "/WUResult",
|
|
|
+ handleAs: "xml",
|
|
|
+ content: request,
|
|
|
+ sync: _sync,
|
|
|
+ load: function (xmlDom) {
|
|
|
var name = context.parseKeyValue(xmlDom, "Name");
|
|
|
var resultDom = xmlDom.getElementsByTagName("Result");
|
|
|
- if(resultDom.length) {
|
|
|
+ if (resultDom.length) {
|
|
|
context.results[idx].dataset = context.parseDataset(resultDom[0], name, "Row");
|
|
|
}
|
|
|
context.onGetResult(idx);
|
|
|
},
|
|
|
- error : function() {
|
|
|
+ error: function () {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- getInfoFast : function(_sync) {
|
|
|
+ getInfoFast: function (_sync) {
|
|
|
var request = {};
|
|
|
request['Wuid'] = this.wuid;
|
|
|
request['rawxml_'] = "1";
|
|
|
|
|
|
var context = this;
|
|
|
baseXhr.post({
|
|
|
- url : this.getBaseURL() + "/WUQuery",
|
|
|
- handleAs : "xml",
|
|
|
- content : request,
|
|
|
- sync : _sync,
|
|
|
- load : function(xmlDom) {
|
|
|
+ url: this.getBaseURL() + "/WUQuery",
|
|
|
+ handleAs: "xml",
|
|
|
+ content: request,
|
|
|
+ sync: _sync,
|
|
|
+ load: function (xmlDom) {
|
|
|
context.stateID = context.parseKeyValue(xmlDom, "StateID");
|
|
|
context.state = context.parseKeyValue(xmlDom, "State");
|
|
|
},
|
|
|
- error : function() {
|
|
|
+ error: function () {
|
|
|
done = true;
|
|
|
}
|
|
|
});
|