diff --git a/src/frontend/src/CustomNodes/GenericNode/components/NodeInputField/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/NodeInputField/index.tsx index b5e4c73ea..7e3096408 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/NodeInputField/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/NodeInputField/index.tsx @@ -14,6 +14,7 @@ import { import { scapedJSONStringfy } from "../../../../utils/reactflowUtils"; import useFetchDataOnMount from "../../../hooks/use-fetch-data-on-mount"; import useHandleOnNewValue from "../../../hooks/use-handle-new-value"; +import NodeInputInfo from "../NodeInputInfo"; import HandleRenderComponent from "../handleRenderComponent"; export default function NodeInputField({ @@ -31,7 +32,6 @@ export default function NodeInputField({ showNode, }: NodeInputFieldComponentType): JSX.Element { const ref = useRef(null); - const infoHtml = useRef(null); const nodes = useFlowStore((state) => state.nodes); const edges = useFlowStore((state) => state.edges); const myData = useTypesStore((state) => state.data); @@ -57,19 +57,6 @@ export default function NodeInputField({ useFetchDataOnMount(data.node!, handleNodeClass, name, postTemplateValue); - useEffect(() => { - // @ts-ignore - infoHtml.current = ( -
- {info.split("\n").map((line, index) => ( -

- {line} -

- ))} -
- ); - }, [info]); - useEffect(() => { if (optionalHandle && optionalHandle.length === 0) { optionalHandle = null; @@ -77,24 +64,29 @@ export default function NodeInputField({ }, [optionalHandle]); const displayHandle = - !LANGFLOW_SUPPORTED_TYPES.has(type ?? "") || optionalHandle; + !LANGFLOW_SUPPORTED_TYPES.has(type ?? "") || + (optionalHandle && optionalHandle.length > 0); + + const Handle = ( + + ); return !showNode ? ( displayHandle ? ( - + Handle ) : ( <> ) @@ -125,7 +117,7 @@ export default function NodeInputField({
{info !== "" && ( - + }> {/* put div to avoid bug that does not display tooltip */}
- {(Array.isArray(displayHandle) - ? displayHandle.length > 0 - : displayHandle) && ( - - )} + + {displayHandle && Handle} {data.node?.template[name] !== undefined && (
+ {info.split("\n").map((line, index) => ( +

+ {line} +

+ ))} +
+ ); +} diff --git a/src/frontend/src/CustomNodes/GenericNode/components/NodeOutputfield/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/NodeOutputfield/index.tsx index bb12627b8..ed8bc3aa2 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/NodeOutputfield/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/NodeOutputfield/index.tsx @@ -85,12 +85,10 @@ export default function NodeOutputField({ function handleOutputWShortcut() { if (!displayOutputPreview || unknownOutput) return; - if (isThereModal() && !openOutputModal) return; if (selected) { setOpenOutputModal((state) => !state); } } - const output = useShortcutsStore((state) => state.output); useHotkeys(output, handleOutputWShortcut, { preventDefault }); @@ -123,7 +121,7 @@ export default function NodeOutputField({ } }, [disabledOutput]); - return !showNode ? ( + const Handle = ( + ); + + return !showNode ? ( + Handle ) : (
- + + {data.node?.frozen && (
-
- + )}
- + +
- - {openOutputModal && ( - - )} + {Handle} ); diff --git a/src/frontend/src/CustomNodes/GenericNode/components/outputModal/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/outputModal/index.tsx index c8fdfa1a9..f8496e1ea 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/outputModal/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/outputModal/index.tsx @@ -5,14 +5,14 @@ import BaseModal from "../../../../modals/baseModal"; import SwitchOutputView from "./components/switchOutputView"; export default function OutputModal({ - open, - setOpen, nodeId, outputName, + children, + disabled, }): JSX.Element { const [activeTab, setActiveTab] = useState<"Outputs" | "Logs">("Outputs"); return ( - +
Component Output @@ -37,13 +37,8 @@ export default function OutputModal({ type={activeTab} /> - -
- -
-
+ + {children} ); } diff --git a/src/frontend/src/modals/baseModal/index.tsx b/src/frontend/src/modals/baseModal/index.tsx index 29919d82e..947b70d4d 100644 --- a/src/frontend/src/modals/baseModal/index.tsx +++ b/src/frontend/src/modals/baseModal/index.tsx @@ -88,7 +88,8 @@ const Footer: React.FC<{ dataTestId?: string; onClick?: () => void; }; -}> = ({ children, submit }) => { + close?: boolean; +}> = ({ children, submit, close }) => { return (
{submit ? ( @@ -115,6 +116,11 @@ const Footer: React.FC<{ ) : ( <>{children && children} )} + {close && ( + + + + )}
); };