diff --git a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx index f5b521dd5..a0136ba85 100644 --- a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx @@ -1,4 +1,4 @@ -import { cloneDeep } from "lodash"; +import _, { cloneDeep } from "lodash"; import { useEffect, useState } from "react"; import ShadTooltip from "../../../../components/ShadTooltipComponent"; import CodeAreaComponent from "../../../../components/codeAreaComponent"; @@ -89,7 +89,7 @@ export default function NodeToolbarComponent({ }, [showModalAdvanced]); const updateNodeInternals = useUpdateNodeInternals(); - + const setLastCopiedSelection = useFlowStore(state => state.setLastCopiedSelection); useEffect(() => { setFlowComponent(createFlowComponent(cloneDeep(data), version)); }, [ @@ -143,6 +143,9 @@ export default function NodeToolbarComponent({ case "delete": deleteNode(data.id); break; + case "copy": + const node = nodes.filter(node => node.id === data.id) + setLastCopiedSelection({ nodes: _.cloneDeep(node), edges: [] }) } }; @@ -361,6 +364,22 @@ export default function NodeToolbarComponent({ ) )} + +
+ {" "} + Copy{" "} + + + C + +
+
{hasStore && ( diff --git a/src/frontend/src/stores/flowStore.ts b/src/frontend/src/stores/flowStore.ts index b8b2508ce..9db5c108f 100644 --- a/src/frontend/src/stores/flowStore.ts +++ b/src/frontend/src/stores/flowStore.ts @@ -9,7 +9,7 @@ import { applyNodeChanges, } from "reactflow"; import { create } from "zustand"; -import { FLOW_BUILD_SUCCESS_ALERT } from "../alerts_constants"; +import { FLOW_BUILD_SUCCESS_ALERT, MISSED_ERROR_ALERT } from "../alerts_constants"; import { BuildStatus } from "../constants/enums"; import { getFlowPool, updateFlowInDatabase } from "../controllers/API"; import { VertexBuildTypeAPI } from "../types/api"; @@ -385,7 +385,7 @@ const useFlowStore = create((set, get) => ({ ); if (errors.length > 0) { setErrorData({ - title: "Oops! Looks like you missed something", + title: MISSED_ERROR_ALERT, list: errors, }); get().setIsBuilding(false); diff --git a/src/frontend/src/utils/styleUtils.ts b/src/frontend/src/utils/styleUtils.ts index 2f9907965..62e1c6ec7 100644 --- a/src/frontend/src/utils/styleUtils.ts +++ b/src/frontend/src/utils/styleUtils.ts @@ -25,6 +25,7 @@ import { Code, Code2, Combine, + Command, Compass, Copy, Cpu, @@ -426,4 +427,5 @@ export const nodeIconsLucide: iconsType = { AlertCircle, Bot, Delete, + Command, };