diff --git a/src/frontend/src/components/fetchErrorComponent/index.tsx b/src/frontend/src/components/fetchErrorComponent/index.tsx index 956de6270..0e403c504 100644 --- a/src/frontend/src/components/fetchErrorComponent/index.tsx +++ b/src/frontend/src/components/fetchErrorComponent/index.tsx @@ -1,7 +1,6 @@ import BaseModal from "../../modals/baseModal"; import { fetchErrorComponentType } from "../../types/components"; import IconComponent from "../genericIconComponent"; -import { Button } from "../ui/button"; export default function FetchErrorComponent({ message, @@ -12,7 +11,14 @@ export default function FetchErrorComponent({ }: fetchErrorComponentType) { return ( <> - + { + setRetry(); + }} + >
- -
- -
-
+ ); diff --git a/src/frontend/src/modals/IOModal/index.tsx b/src/frontend/src/modals/IOModal/index.tsx index 82350b57e..4d7453619 100644 --- a/src/frontend/src/modals/IOModal/index.tsx +++ b/src/frontend/src/modals/IOModal/index.tsx @@ -3,7 +3,6 @@ import AccordionComponent from "../../components/accordionComponent"; import IconComponent from "../../components/genericIconComponent"; import ShadTooltip from "../../components/shadTooltipComponent"; import { Badge } from "../../components/ui/badge"; -import { Button } from "../../components/ui/button"; import { Tabs, TabsContent, @@ -121,6 +120,7 @@ export default function IOModal({ open={open} setOpen={setOpen} disable={disable} + onSubmit={() => sendMessage(1)} > {children} {/* TODO ADAPT TO ALL TYPES OF INPUTS AND OUTPUTS */} @@ -371,13 +371,10 @@ export default function IOModal({
{!haveChat ? ( - -
- -
-
+ ), + }} + /> ) : ( <> )} diff --git a/src/frontend/src/modals/baseModal/index.tsx b/src/frontend/src/modals/baseModal/index.tsx index aefb8c4d1..a899bd071 100644 --- a/src/frontend/src/modals/baseModal/index.tsx +++ b/src/frontend/src/modals/baseModal/index.tsx @@ -16,6 +16,7 @@ import { } from "../../components/ui/dialog-with-no-close"; import { DialogClose } from "@radix-ui/react-dialog"; +import ForwardedIconComponent from "../../components/genericIconComponent"; import { Button } from "../../components/ui/button"; import { modalHeaderType } from "../../types/components"; import { cn } from "../../utils/utils"; @@ -65,7 +66,12 @@ const Header: React.FC<{ children: ReactNode; description: string | null }> = ({ const Footer: React.FC<{ children?: ReactNode; - submit?: { label: string; icon?: ReactNode }; + submit?: { + label: string; + icon?: ReactNode; + loading?: boolean; + disabled?: boolean; + }; }> = ({ children, submit }) => { return submit ? (
@@ -76,9 +82,26 @@ const Footer: React.FC<{ Cancel -
@@ -242,7 +265,7 @@ function BaseModal({ event.preventDefault(); onSubmit(); }} - className="flex flex-col gap-4" + className="flex flex-col gap-6" >
{ setMyData(data); }} + onSubmit={() => { + setNode(data.id, (old) => ({ + ...old, + data: { + ...old.data, + node: myData.node, + }, + })); + setOpen(false); + }} > <> @@ -608,26 +617,7 @@ const EditNodeModal = forwardRef(
- - - +
); }, diff --git a/src/frontend/src/modals/exportModal/index.tsx b/src/frontend/src/modals/exportModal/index.tsx index 9eca267e8..4951dace6 100644 --- a/src/frontend/src/modals/exportModal/index.tsx +++ b/src/frontend/src/modals/exportModal/index.tsx @@ -1,7 +1,6 @@ import { ReactNode, forwardRef, useEffect, useState } from "react"; import EditFlowSettings from "../../components/editFlowSettingsComponent"; import IconComponent from "../../components/genericIconComponent"; -import { Button } from "../../components/ui/button"; import { Checkbox } from "../../components/ui/checkbox"; import { API_WARNING_NOTICE_ALERT } from "../../constants/alerts_constants"; import { @@ -30,7 +29,43 @@ const ExportModal = forwardRef( const [open, setOpen] = useState(false); return ( - + { + if (checked) { + downloadFlow( + { + id: currentFlow!.id, + data: currentFlow!.data!, + description, + name, + last_tested_version: version, + is_component: false, + }, + name!, + description, + ); + setNoticeData({ + title: API_WARNING_NOTICE_ALERT, + }); + } else + downloadFlow( + removeApiKeys({ + id: currentFlow!.id, + data: currentFlow!.data!, + description, + name, + last_tested_version: version, + is_component: false, + }), + name!, + description, + ); + setOpen(false); + }} + > {props.children} Export @@ -64,47 +99,9 @@ const ExportModal = forwardRef( - - - + ); - } + }, ); export default ExportModal; diff --git a/src/frontend/src/modals/flowSettingsModal/index.tsx b/src/frontend/src/modals/flowSettingsModal/index.tsx index 1daeb0fe1..467a43ebc 100644 --- a/src/frontend/src/modals/flowSettingsModal/index.tsx +++ b/src/frontend/src/modals/flowSettingsModal/index.tsx @@ -41,7 +41,12 @@ export default function FlowSettingsModal({ }, [flows]); return ( - + Settings @@ -56,15 +61,12 @@ export default function FlowSettingsModal({ /> - - - + ); } diff --git a/src/frontend/src/modals/shareModal/index.tsx b/src/frontend/src/modals/shareModal/index.tsx index a2c2f88d0..f8f8ea447 100644 --- a/src/frontend/src/modals/shareModal/index.tsx +++ b/src/frontend/src/modals/shareModal/index.tsx @@ -1,4 +1,3 @@ -import { Loader2 } from "lucide-react"; import { ReactNode, useEffect, useMemo, useState } from "react"; import EditFlowSettings from "../../components/editFlowSettingsComponent"; import IconComponent from "../../components/genericIconComponent"; @@ -202,6 +201,18 @@ export default function ShareModal({ size="smaller-h-full" open={(!disabled && open) ?? internalOpen} setOpen={setOpen ?? internalSetOpen} + onSubmit={() => { + const isNameAvailable = !unavaliableNames.some( + (element) => element.name === name, + ); + + if (isNameAvailable) { + handleShareComponent(); + (setOpen || internalSetOpen)(false); + } else { + setOpenConfirmationModal(true); + } + }} > {children ? children : <>} @@ -250,8 +261,15 @@ export default function ShareModal({ - -
+ + <> {!is_component && ( -
+
<>{modalConfirmation}