variable renaming

This commit is contained in:
r00gm 2024-11-12 15:37:26 +01:00
parent 878220d7b6
commit a25ef66744
No known key found for this signature in database
2 changed files with 16 additions and 8 deletions

View file

@ -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(() =>

View file

@ -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 };
}; };