Use short variables for direct input data

This commit is contained in:
Jan Oberhauser
2020-09-22 11:31:48 +02:00
parent f3b136abee
commit 24c95c4f09

View File

@@ -250,7 +250,7 @@ export default mixins(
* @returns * @returns
* @memberof Workflow * @memberof Workflow
*/ */
getNodeOutputData (runData: IRunData, nodeName: string, filterText: string, itemIndex = 0, runIndex = 0, inputName = 'main', outputIndex = 0): IVariableSelectorOption[] | null { getNodeOutputData (runData: IRunData, nodeName: string, filterText: string, itemIndex = 0, runIndex = 0, inputName = 'main', outputIndex = 0, useShort = false): IVariableSelectorOption[] | null {
if (!runData.hasOwnProperty(nodeName)) { if (!runData.hasOwnProperty(nodeName)) {
// No data found for node // No data found for node
return null; return null;
@@ -291,9 +291,12 @@ export default mixins(
// Get json data // Get json data
if (outputData.hasOwnProperty('json')) { if (outputData.hasOwnProperty('json')) {
const jsonPropertyPrefix = useShort === true ? '$json' : `$node["${nodeName}"].json`;
const jsonDataOptions: IVariableSelectorOption[] = []; const jsonDataOptions: IVariableSelectorOption[] = [];
for (const propertyName of Object.keys(outputData.json)) { for (const propertyName of Object.keys(outputData.json)) {
jsonDataOptions.push.apply(jsonDataOptions, this.jsonDataToFilterOption(outputData.json[propertyName], `$node["${nodeName}"].json`, propertyName, filterText)); jsonDataOptions.push.apply(jsonDataOptions, this.jsonDataToFilterOption(outputData.json[propertyName], jsonPropertyPrefix, propertyName, filterText));
} }
if (jsonDataOptions.length) { if (jsonDataOptions.length) {
@@ -308,6 +311,9 @@ export default mixins(
// Get binary data // Get binary data
if (outputData.hasOwnProperty('binary')) { if (outputData.hasOwnProperty('binary')) {
const binaryPropertyPrefix = useShort === true ? '$binary' : `$node["${nodeName}"].binary`;
const binaryData = []; const binaryData = [];
let binaryPropertyData = []; let binaryPropertyData = [];
@@ -326,7 +332,7 @@ export default mixins(
binaryPropertyData.push( binaryPropertyData.push(
{ {
name: propertyName, name: propertyName,
key: `$node["${nodeName}"].binary.${dataPropertyName}.${propertyName}`, key: `${binaryPropertyPrefix}.${dataPropertyName}.${propertyName}`,
value: outputData.binary![dataPropertyName][propertyName], value: outputData.binary![dataPropertyName][propertyName],
}, },
); );
@@ -336,7 +342,7 @@ export default mixins(
binaryData.push( binaryData.push(
{ {
name: dataPropertyName, name: dataPropertyName,
key: `$node["${nodeName}"].binary.${dataPropertyName}`, key: `${binaryPropertyPrefix}.${dataPropertyName}`,
options: this.sortOptions(binaryPropertyData), options: this.sortOptions(binaryPropertyData),
allowParentSelect: true, allowParentSelect: true,
}, },
@@ -347,7 +353,7 @@ export default mixins(
returnData.push( returnData.push(
{ {
name: 'Binary', name: 'Binary',
key: `$node["${nodeName}"].binary`, key: binaryPropertyPrefix,
options: this.sortOptions(binaryData), options: this.sortOptions(binaryData),
allowParentSelect: true, allowParentSelect: true,
}, },
@@ -474,7 +480,7 @@ export default mixins(
// (example "IF" node. If node is connected to "true" or to "false" output) // (example "IF" node. If node is connected to "true" or to "false" output)
const outputIndex = this.workflow.getNodeConnectionOutputIndex(activeNode.name, parentNode[0], 'main'); const outputIndex = this.workflow.getNodeConnectionOutputIndex(activeNode.name, parentNode[0], 'main');
tempOutputData = this.getNodeOutputData(runData, parentNode[0], filterText, itemIndex, 0, 'main', outputIndex) as IVariableSelectorOption[]; tempOutputData = this.getNodeOutputData(runData, parentNode[0], filterText, itemIndex, 0, 'main', outputIndex, true) as IVariableSelectorOption[];
if (tempOutputData) { if (tempOutputData) {
if (JSON.stringify(tempOutputData).length < 102400) { if (JSON.stringify(tempOutputData).length < 102400) {