From 437729db978ad80aa49237f369f96c1790ccfd18 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 1 Aug 2025 18:36:18 +0800 Subject: [PATCH] feat: support var arrs --- .../variable-inspect/value-content.tsx | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/web/app/components/workflow/variable-inspect/value-content.tsx b/web/app/components/workflow/variable-inspect/value-content.tsx index 42bd0d5cde..a3ede311c4 100644 --- a/web/app/components/workflow/variable-inspect/value-content.tsx +++ b/web/app/components/workflow/variable-inspect/value-content.tsx @@ -37,6 +37,7 @@ const ValueContent = ({ const [editorHeight, setEditorHeight] = useState(0) const showTextEditor = currentVar.value_type === 'secret' || currentVar.value_type === 'string' || currentVar.value_type === 'number' const showBoolEditor = typeof currentVar.value === 'boolean' + const showBoolArrayEditor = Array.isArray(currentVar.value) && currentVar.value.every(v => typeof v === 'boolean') const isSysFiles = currentVar.type === VarInInspectType.system && currentVar.name === 'files' const showJSONEditor = !isSysFiles && (currentVar.value_type === 'object' || currentVar.value_type === 'array[string]' || currentVar.value_type === 'array[number]' || currentVar.value_type === 'array[object]' || currentVar.value_type === 'array[any]') const showFileEditor = isSysFiles || currentVar.value_type === 'file' || currentVar.value_type === 'array[file]' @@ -182,7 +183,7 @@ const ValueContent = ({ {showBoolEditor && (
{ setValue(newValue) debounceValueChange(currentVar.id, newValue) @@ -190,6 +191,24 @@ const ValueContent = ({ />
)} + { + showBoolArrayEditor && ( +
+ {currentVar.value.map((v: boolean, i: number) => ( + { + const newArray = [...(currentVar.value as boolean[])] + newArray[i] = newValue + setValue(newArray) + debounceValueChange(currentVar.id, newArray) + }} + /> + ))} +
+ ) + } {showJSONEditor && (