🐛 fix(parameterComponent): fix incorrect type check for dict and keypair components in ParameterComponent

🐛 fix(dictComponent): fix import statement for DictComponentType in dictComponent
🐛 fix(keypairListComponent): fix import statement for KeyPairListComponentType in keypairListComponent
🐛 fix(EditNodeModal): fix incorrect type check for dict and keypair components in EditNodeModal
🐛 fix(types): rename KeyPairListComponent to KeyPairListComponentType and add DictComponentType
This commit is contained in:
Cristhian Zanforlin Lousa 2023-09-05 08:34:15 -03:00
commit 54e3fd15dc
5 changed files with 16 additions and 9 deletions

View file

@ -241,7 +241,7 @@ export default function ParameterComponent({
!optionalHandle ? ( !optionalHandle ? (
<></> <></>
) )
: left === true && type === "str" ? ( : left === true && type === "dict" ? (
<div className="mt-2 w-full"> <div className="mt-2 w-full">
<DictComponent <DictComponent
disabled={disabled} disabled={disabled}
@ -253,7 +253,7 @@ export default function ParameterComponent({
/> />
</div> </div>
) )
: left === true && type === "dict" ? ( : left === true && type === "keypair" ? (
<div className="mt-2 w-full"> <div className="mt-2 w-full">
<KeypairListComponent <KeypairListComponent
disabled={disabled} disabled={disabled}

View file

@ -1,5 +1,5 @@
import { useEffect } from "react"; import { useEffect } from "react";
import { KeyPairListComponent } from "../../types/components"; import { DictComponentType } from "../../types/components";
import { classNames } from "../../utils/utils"; import { classNames } from "../../utils/utils";
import { Input } from "../ui/input"; import { Input } from "../ui/input";
@ -10,7 +10,7 @@ export default function DictComponent({
onChange, onChange,
disabled, disabled,
editNode = false, editNode = false,
}: KeyPairListComponent): JSX.Element { }: DictComponentType): JSX.Element {
useEffect(() => { useEffect(() => {
if (disabled) { if (disabled) {
onChange([""]); onChange([""]);

View file

@ -1,5 +1,5 @@
import { useEffect } from "react"; import { useEffect } from "react";
import { KeyPairListComponent } from "../../types/components"; import { KeyPairListComponentType } from "../../types/components";
import _ from "lodash"; import _ from "lodash";
import { TypeModal } from "../../constants/enums"; import { TypeModal } from "../../constants/enums";
@ -14,7 +14,7 @@ export default function KeypairListComponent({
disabled, disabled,
editNode = false, editNode = false,
duplicateKey duplicateKey
}: KeyPairListComponent): JSX.Element { }: KeyPairListComponentType): JSX.Element {
useEffect(() => { useEffect(() => {
if (disabled) { if (disabled) {
onChange([""]); onChange([""]);

View file

@ -206,7 +206,7 @@ const EditNodeModal = forwardRef(
/> />
) )
: myData.node?.template[templateParam] : myData.node?.template[templateParam]
.type === "str" ? ( .type === "dict" ? (
<div className="mt-2 w-full"> <div className="mt-2 w-full">
<DictComponent <DictComponent
disabled={disabled} disabled={disabled}
@ -219,7 +219,7 @@ const EditNodeModal = forwardRef(
</div> </div>
) )
: myData.node?.template[templateParam] : myData.node?.template[templateParam]
.type === "dict" ? ( .type === "keypair" ? (
<div className="mt-2 w-full"> <div className="mt-2 w-full">
<KeypairListComponent <KeypairListComponent
disabled={disabled} disabled={disabled}

View file

@ -54,7 +54,7 @@ export type InputListComponentType = {
editNode?: boolean; editNode?: boolean;
}; };
export type KeyPairListComponent = { export type KeyPairListComponentType = {
value: any; value: any;
onChange: (value: string[]) => void; onChange: (value: string[]) => void;
disabled: boolean; disabled: boolean;
@ -62,6 +62,13 @@ export type KeyPairListComponent = {
duplicateKey?: boolean; duplicateKey?: boolean;
}; };
export type DictComponentType = {
value: any;
onChange: (value: string[]) => void;
disabled: boolean;
editNode?: boolean;
};
export type TextAreaComponentType = { export type TextAreaComponentType = {
field_name?: string; field_name?: string;
nodeClass?: APIClassType; nodeClass?: APIClassType;