Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}).then(lang.hitch(this, function (response) {
var data = [];
if (lang.exists("TpLogFileResponse.LogData", response)) {
this.lastPage = response.TpLogFileResponse.LogData;
this.emit("pageLoaded", this.lastPage);
arrayUtil.forEach(response.TpLogFileResponse.LogData.split("\n"), function (item, idx) {
if (options.start === 0 || idx > 0) {
// Throw away first line as it will probably only be a partial line ---
var itemParts = item.split(" ");
var lineNo, date, time, pid, tid, details;
if (itemParts.length) lineNo = nextItem(itemParts);
if (itemParts.length) date = nextItem(itemParts);
if (itemParts.length) time = nextItem(itemParts);
if (itemParts.length) pid = nextItem(itemParts);
if (itemParts.length) tid = nextItem(itemParts);
if (itemParts.length) details = itemParts.join(" ");
data.push({
__hpcc_id: response.TpLogFileResponse.PageNumber + "_" + idx,
lineNo: lineNo,
}).then(function (response) {
if (lang.exists("WUInfoResponse.Workunit", response)) {
if (!args.onGetText && lang.exists("WUInfoResponse.Workunit.Query", response)) {
// A truncated version of ECL just causes issues ---
delete response.WUInfoResponse.Workunit.Query;
}
if (lang.exists("WUInfoResponse.ResultViews", response) && lang.exists("WUInfoResponse.Workunit.Results", response)) {
lang.mixin(response.WUInfoResponse.Workunit.Results, {
ResultViews: response.WUInfoResponse.ResultViews
});
}
if (args.onGetWUExceptions && !lang.exists("WUInfoResponse.Workunit.Exceptions.ECLException", response)) {
lang.mixin(response.WUInfoResponse.Workunit, {
Exceptions: {
ECLException: []
}
})
}
context.updateData(response.WUInfoResponse.Workunit);
if (args.onGetText) {
args.onGetText(lang.exists("Query.Text", context) ? context.Query.Text : "");
}
isWorkunit() {
return lang.exists("params.Wuid", this);
}
isWorkunit() {
return lang.exists("params.Wuid", this);
}
_StateIDSetter: function (StateID) {
this.StateID = StateID;
var actionEx = lang.exists("ActionEx", this) ? this.ActionEx : null;
this.set("hasCompleted", WsWorkunits.isComplete(this.StateID, actionEx));
},
_ActionExSetter: function (ActionEx) {
WsDfu.DFUArrayAction([this], "Delete").then(function (response) {
if (lang.exists("DFUArrayActionResponse.ActionResults.DFUActionInfo", response) &&
response.DFUArrayActionResponse.ActionResults.DFUActionInfo.length &&
!response.DFUArrayActionResponse.ActionResults.DFUActionInfo[0].Failed) {
context.updateData({ StateID: 999, State: "deleted" })
} else {
context.refresh();
}
});
},
}).then(function (response) {
context.main.setMessage("");
if (lang.exists("WUQueryGetGraphResponse.Graphs.ECLGraphEx", response)) {
if (response.WUQueryGetGraphResponse.Graphs.ECLGraphEx.length > 0) {
context.loadGraphFromXGMML(response.WUQueryGetGraphResponse.Graphs.ECLGraphEx[0].Graph);
}
}
});
}
isQuery() {
return lang.exists("params.QueryId", this);
}
}).then(function (response) {
if (lang.exists("GetDFUWorkunitResponse.result", response)) {
context.updateData(response.GetDFUWorkunitResponse.result);
if (args.onAfterSend) {
args.onAfterSend(context);
}
}
});
},
preProcessResponse: function (response, request) {
if (response.Total === -1 || response.Total === 9223372036854776000 || response.Total === Number.MAX_VALUE) {
response.Total = response.Start + response.Count + 1000;
}
if (lang.exists("Result.Row", response)) {
var context = this;
var retVal = context._structure ? this.formatRows(context._structure, response.Result.Row) : response.Result.Row;
arrayUtil.forEach(retVal, function (item, index) {
item.__hpcc_rowNum = request.Start + index + 1;
item.__hpcc_id = context.idPrefix + "_" + item.__hpcc_rowNum;
});
response.Result = retVal;
}
},
formatRows: function (columns, rows) {