mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 00:54:06 -08:00
variable renaming
This commit is contained in:
parent
878220d7b6
commit
a25ef66744
|
@ -53,7 +53,7 @@ const ndvStore = useNDVStore();
|
||||||
const nodeTypesStore = useNodeTypesStore();
|
const nodeTypesStore = useNodeTypesStore();
|
||||||
const workflowsStore = useWorkflowsStore();
|
const workflowsStore = useWorkflowsStore();
|
||||||
const { getSchemaForExecutionData, filterSchema } = useDataSchema();
|
const { getSchemaForExecutionData, filterSchema } = useDataSchema();
|
||||||
const { closedNodes, flattSchema, flattMultipleSchema, toggleNode } = useFlattenSchema();
|
const { closedNodes, flattenSchema, flattenMultipleSchemas, toggleNode } = useFlattenSchema();
|
||||||
const { getNodeInputData } = useNodeHelpers();
|
const { getNodeInputData } = useNodeHelpers();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
@ -134,10 +134,12 @@ const nodeAdditionalInfo = (node: INodeUi) => {
|
||||||
return returnData.length ? `(${returnData.join(' | ')})` : '';
|
return returnData.length ? `(${returnData.join(' | ')})` : '';
|
||||||
};
|
};
|
||||||
|
|
||||||
const flattenedNodes = computed(() => flattMultipleSchema(nodesSchemas.value, nodeAdditionalInfo));
|
const flattenedNodes = computed(() =>
|
||||||
|
flattenMultipleSchemas(nodesSchemas.value, nodeAdditionalInfo),
|
||||||
|
);
|
||||||
|
|
||||||
const flattenNodeSchema = computed(() =>
|
const flattenNodeSchema = computed(() =>
|
||||||
nodeSchema.value ? flattSchema({ schema: nodeSchema.value, depth: 0, level: -1 }) : [],
|
nodeSchema.value ? flattenSchema({ schema: nodeSchema.value, depth: 0, level: -1 }) : [],
|
||||||
);
|
);
|
||||||
|
|
||||||
const items = computed(() =>
|
const items = computed(() =>
|
||||||
|
|
|
@ -251,7 +251,7 @@ export const useFlattenSchema = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const flattSchema = ({
|
const flattenSchema = ({
|
||||||
schema,
|
schema,
|
||||||
node = { name: '', type: '' },
|
node = { name: '', type: '' },
|
||||||
depth = 0,
|
depth = 0,
|
||||||
|
@ -296,7 +296,13 @@ export const useFlattenSchema = () => {
|
||||||
schema.value
|
schema.value
|
||||||
.map((item) => {
|
.map((item) => {
|
||||||
const itemPrefix = schema.type === 'array' ? schema.key : '';
|
const itemPrefix = schema.type === 'array' ? schema.key : '';
|
||||||
return flattSchema({ schema: item, node, depth, prefix: itemPrefix, level: level + 1 });
|
return flattenSchema({
|
||||||
|
schema: item,
|
||||||
|
node,
|
||||||
|
depth,
|
||||||
|
prefix: itemPrefix,
|
||||||
|
level: level + 1,
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.flat(),
|
.flat(),
|
||||||
);
|
);
|
||||||
|
@ -321,7 +327,7 @@ export const useFlattenSchema = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const flattMultipleSchema = (nodes: SchemaNode[], additionalInfo: (node: INodeUi) => string) =>
|
const flattenMultipleSchemas = (nodes: SchemaNode[], additionalInfo: (node: INodeUi) => string) =>
|
||||||
nodes.reduce<Renders[]>((acc, item, index) => {
|
nodes.reduce<Renders[]>((acc, item, index) => {
|
||||||
acc.push({
|
acc.push({
|
||||||
title: item.node.name,
|
title: item.node.name,
|
||||||
|
@ -346,9 +352,9 @@ export const useFlattenSchema = () => {
|
||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
acc.push(...flattSchema(item));
|
acc.push(...flattenSchema(item));
|
||||||
return acc;
|
return acc;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return { closedNodes, toggleNode, flattSchema, flattMultipleSchema };
|
return { closedNodes, toggleNode, flattenSchema, flattenMultipleSchemas };
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue