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

View file

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

View file

@ -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([""]);

View file

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

View file

@ -54,7 +54,7 @@ export type InputListComponentType = {
editNode?: boolean;
};
export type KeyPairListComponent = {
export type KeyPairListComponentType = {
value: any;
onChange: (value: string[]) => 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;