diff --git a/packages/toolkit/package.json b/packages/toolkit/package.json index d1090f0188..c4c7c65b2b 100644 --- a/packages/toolkit/package.json +++ b/packages/toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@instill-ai/toolkit", - "version": "0.80.4-rc.11", + "version": "0.80.4-rc.13", "description": "Instill AI's frontend toolkit", "repository": "https://github.com/instill-ai/design-system.git", "bugs": "https://github.com/instill-ai/design-system/issues", diff --git a/packages/toolkit/src/components/card-pipeline/Head.tsx b/packages/toolkit/src/components/card-pipeline/Head.tsx index 107ec10927..4c11958ed8 100644 --- a/packages/toolkit/src/components/card-pipeline/Head.tsx +++ b/packages/toolkit/src/components/card-pipeline/Head.tsx @@ -64,7 +64,7 @@ export const Head = ({
{
({ accessToken: store.accessToken, enabledQuery: store.enabledQuery, }); -export const Head = () => { +type HeadProps = { + handleVersion: (version: string) => void; + currentVersion: string; +}; + +export const Head = (props: HeadProps) => { const { accessToken, enabledQuery } = useInstillStore(useShallow(selector)); + + const { currentVersion, handleVersion } = props; + const router = useRouter(); const { id, entity } = router.query; const [selectedTab, setSelectedTab] = React.useState>("overview"); + const [isOpen, setIsOpen] = React.useState(false); + const entityObject = useEntity(); const user = useUser({ @@ -75,6 +92,29 @@ export const Head = () => { enabledQuery: enabledQuery && entityObject.isSuccess, }); + const deletePipeline = useDeleteUserPipeline(); + async function handleDeletePipeline() { + try { + await deletePipeline.mutateAsync({ + pipelineName: pipeline.data?.name || "", + accessToken: accessToken ? accessToken : null, + }); + + toast({ + title: "Pipeline deleted", + variant: "alert-success", + size: "large", + }); + router.push(`/${entityObject.entity}/pipelines`); + } catch (error) { + toastInstillError({ + title: "Something went wrong when delete the pipeline", + error, + toast, + }); + } + } + return (