From 54e3fd15dc6594a0995cb81850948d15c643a592 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Tue, 5 Sep 2023 08:34:15 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(parameterComponent):=20fix?= =?UTF-8?q?=20incorrect=20type=20check=20for=20dict=20and=20keypair=20comp?= =?UTF-8?q?onents=20in=20ParameterComponent=20=F0=9F=90=9B=20fix(dictCompo?= =?UTF-8?q?nent):=20fix=20import=20statement=20for=20DictComponentType=20i?= =?UTF-8?q?n=20dictComponent=20=F0=9F=90=9B=20fix(keypairListComponent):?= =?UTF-8?q?=20fix=20import=20statement=20for=20KeyPairListComponentType=20?= =?UTF-8?q?in=20keypairListComponent=20=F0=9F=90=9B=20fix(EditNodeModal):?= =?UTF-8?q?=20fix=20incorrect=20type=20check=20for=20dict=20and=20keypair?= =?UTF-8?q?=20components=20in=20EditNodeModal=20=F0=9F=90=9B=20fix(types):?= =?UTF-8?q?=20rename=20KeyPairListComponent=20to=20KeyPairListComponentTyp?= =?UTF-8?q?e=20and=20add=20DictComponentType?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GenericNode/components/parameterComponent/index.tsx | 4 ++-- src/frontend/src/components/dictComponent/index.tsx | 4 ++-- .../src/components/keypairListComponent/index.tsx | 4 ++-- src/frontend/src/modals/EditNodeModal/index.tsx | 4 ++-- src/frontend/src/types/components/index.ts | 9 ++++++++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index 81a821266..c5623d3fa 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -241,7 +241,7 @@ export default function ParameterComponent({ !optionalHandle ? ( <> ) - : left === true && type === "str" ? ( + : left === true && type === "dict" ? (
) - : left === true && type === "dict" ? ( + : left === true && type === "keypair" ? (
{ if (disabled) { onChange([""]); diff --git a/src/frontend/src/components/keypairListComponent/index.tsx b/src/frontend/src/components/keypairListComponent/index.tsx index 87cad64d0..26e6d7f46 100644 --- a/src/frontend/src/components/keypairListComponent/index.tsx +++ b/src/frontend/src/components/keypairListComponent/index.tsx @@ -1,5 +1,5 @@ import { useEffect } from "react"; -import { KeyPairListComponent } from "../../types/components"; +import { KeyPairListComponentType } from "../../types/components"; import _ from "lodash"; import { TypeModal } from "../../constants/enums"; @@ -14,7 +14,7 @@ export default function KeypairListComponent({ disabled, editNode = false, duplicateKey -}: KeyPairListComponent): JSX.Element { +}: KeyPairListComponentType): JSX.Element { useEffect(() => { if (disabled) { onChange([""]); diff --git a/src/frontend/src/modals/EditNodeModal/index.tsx b/src/frontend/src/modals/EditNodeModal/index.tsx index 85a149db8..437cdf232 100644 --- a/src/frontend/src/modals/EditNodeModal/index.tsx +++ b/src/frontend/src/modals/EditNodeModal/index.tsx @@ -206,7 +206,7 @@ const EditNodeModal = forwardRef( /> ) : myData.node?.template[templateParam] - .type === "str" ? ( + .type === "dict" ? (
) : myData.node?.template[templateParam] - .type === "dict" ? ( + .type === "keypair" ? (
void; disabled: boolean; @@ -62,6 +62,13 @@ export type KeyPairListComponent = { duplicateKey?: boolean; }; +export type DictComponentType = { + value: any; + onChange: (value: string[]) => void; + disabled: boolean; + editNode?: boolean; +}; + export type TextAreaComponentType = { field_name?: string; nodeClass?: APIClassType;