Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
processResponse(response, request, updates) {
const lowerResponse = {};
for (const responseKey in response) {
lowerResponse[responseKey.toLowerCase()] = response[responseKey];
}
const promises = [];
for (const key in this._outputs) {
const from = this._outputs[key].id;
if (Utility.exists(from, response)) {
if (!Utility.exists(from + _CHANGED, response) || (Utility.exists(from + _CHANGED, response) && response[from + _CHANGED].length && response[from + _CHANGED][0][from + _CHANGED])) {
promises.push(this._outputs[key].setData(response[from], updates));
} else {
// TODO - I Suspect there is a HIPIE/Roxie issue here (empty request)
promises.push(this._outputs[key].vizNotify(updates));
}
} else if (Utility.exists(from, lowerResponse)) {
console.log("DDL 'Datasource.From' case is Incorrect");
if (!Utility.exists(from + _CHANGED, lowerResponse) || (Utility.exists(from + _CHANGED, lowerResponse) && response[from + _CHANGED].length && lowerResponse[from + _CHANGED][0][from + _CHANGED])) {
promises.push(this._outputs[key].setData(lowerResponse[from], updates));
} else {
// TODO - I Suspect there is a HIPIE/Roxie issue here (empty request)
promises.push(this._outputs[key].vizNotify(updates));
}
} else {
const responseItems = [];
for (const responseKey2 in response) {
responseItems.push(responseKey2);
}
console.log("Unable to locate '" + from + "' in response {" + responseItems.join(", ") + "}");
}
}
return Promise.all(promises);
processResponse(response, request, updates) {
const lowerResponse = {};
for (const responseKey in response) {
lowerResponse[responseKey.toLowerCase()] = response[responseKey];
}
const promises = [];
for (const key in this._outputs) {
const from = this._outputs[key].id;
if (Utility.exists(from, response)) {
if (!Utility.exists(from + _CHANGED, response) || (Utility.exists(from + _CHANGED, response) && response[from + _CHANGED].length && response[from + _CHANGED][0][from + _CHANGED])) {
promises.push(this._outputs[key].setData(response[from], updates));
} else {
// TODO - I Suspect there is a HIPIE/Roxie issue here (empty request)
promises.push(this._outputs[key].vizNotify(updates));
}
} else if (Utility.exists(from, lowerResponse)) {
console.log("DDL 'Datasource.From' case is Incorrect");
if (!Utility.exists(from + _CHANGED, lowerResponse) || (Utility.exists(from + _CHANGED, lowerResponse) && response[from + _CHANGED].length && lowerResponse[from + _CHANGED][0][from + _CHANGED])) {
promises.push(this._outputs[key].setData(lowerResponse[from], updates));
} else {
// TODO - I Suspect there is a HIPIE/Roxie issue here (empty request)
promises.push(this._outputs[key].vizNotify(updates));
}
} else {
const responseItems = [];
for (const responseKey2 in response) {
for (const responseKey in response) {
lowerResponse[responseKey.toLowerCase()] = response[responseKey];
}
const promises = [];
for (const key in this._outputs) {
const from = this._outputs[key].id;
if (Utility.exists(from, response)) {
if (!Utility.exists(from + _CHANGED, response) || (Utility.exists(from + _CHANGED, response) && response[from + _CHANGED].length && response[from + _CHANGED][0][from + _CHANGED])) {
promises.push(this._outputs[key].setData(response[from], updates));
} else {
// TODO - I Suspect there is a HIPIE/Roxie issue here (empty request)
promises.push(this._outputs[key].vizNotify(updates));
}
} else if (Utility.exists(from, lowerResponse)) {
console.log("DDL 'Datasource.From' case is Incorrect");
if (!Utility.exists(from + _CHANGED, lowerResponse) || (Utility.exists(from + _CHANGED, lowerResponse) && response[from + _CHANGED].length && lowerResponse[from + _CHANGED][0][from + _CHANGED])) {
promises.push(this._outputs[key].setData(lowerResponse[from], updates));
} else {
// TODO - I Suspect there is a HIPIE/Roxie issue here (empty request)
promises.push(this._outputs[key].vizNotify(updates));
}
} else {
const responseItems = [];
for (const responseKey2 in response) {
responseItems.push(responseKey2);
}
console.log("Unable to locate '" + from + "' in response {" + responseItems.join(", ") + "}");
}
}
return Promise.all(promises);
}
processResponse(response, request, updates) {
const lowerResponse = {};
for (const responseKey in response) {
lowerResponse[responseKey.toLowerCase()] = response[responseKey];
}
const promises = [];
for (const key in this._outputs) {
const from = this._outputs[key].id;
if (Utility.exists(from, response)) {
if (!Utility.exists(from + _CHANGED, response) || (Utility.exists(from + _CHANGED, response) && response[from + _CHANGED].length && response[from + _CHANGED][0][from + _CHANGED])) {
promises.push(this._outputs[key].setData(response[from], updates));
} else {
// TODO - I Suspect there is a HIPIE/Roxie issue here (empty request)
promises.push(this._outputs[key].vizNotify(updates));
}
} else if (Utility.exists(from, lowerResponse)) {
console.log("DDL 'Datasource.From' case is Incorrect");
if (!Utility.exists(from + _CHANGED, lowerResponse) || (Utility.exists(from + _CHANGED, lowerResponse) && response[from + _CHANGED].length && lowerResponse[from + _CHANGED][0][from + _CHANGED])) {
promises.push(this._outputs[key].setData(lowerResponse[from], updates));
} else {
// TODO - I Suspect there is a HIPIE/Roxie issue here (empty request)
promises.push(this._outputs[key].vizNotify(updates));
}
} else {
const responseItems = [];
this.getVisualizationArray().forEach(function (visualization) {
// Clear all charts back to their default values ---
visualization.clear();
visualization.update();
if (state && state[visualization.id]) {
if (Utility.exists("source.mappings.mappings", visualization)) {
for (const key in visualization.source.mappings.mappings) {
if (state[visualization.id][visualization.source.mappings.mappings[key]]) {
visualization._widgetState.row[key] = state[visualization.id][visualization.source.mappings.mappings[key]];
visualization._widgetState.selected = true;
}
}
}
}
});
this.getVisualizationArray().forEach(function (visualization) {
this.loadWidget("../form/Slider", function (widget) {
try {
widget
.id(visualization.id)
;
if (visualization.range) {
let selectionLabel = "";
if (Utility.exists("events.click.updates", visualization) && visualization.events.click.updates.length) {
for (const key in visualization.events.click.updates[0].mappings) {
selectionLabel = key;
break;
}
}
widget
.low_default(+visualization.range[0])
.high_default(+visualization.range[1])
.step_default(+visualization.range[2])
.selectionLabel_default(selectionLabel)
.selectionLabel(selectionLabel)
;
}
} catch (e) {
console.log("Unexpected widget type: " + widget.classID());
}
}).then(function (response) {
let retVal = [];
if (Utility.exists("WUInfoResponse.Workunit.Results.ECLResult", response)) {
retVal = response.WUInfoResponse.Workunit.Results.ECLResult.map(function (result) {
return new WUResult(context.getUrl({ pathname: "WsWorkunits/" }), context._wuid, result.Name);
});
}
return retVal;
});
};
transport.fetchResults().then(function (response) {
if (Utility.exists(hipieResultName, response)) {
return transport.fetchResult(hipieResultName).then(function (ddlResponse) {
const json = ddlResponse[0][hipieResultName];
context.parse(json, function () {
callback(response);
});
}).catch(function (e) {
context.commsEvent(context, "error", hipieResultName, e);
});
}
}).catch(function (e) {
context.commsEvent(context, "error", "fetchResults", e);