+ {/** Using in-line styling since scss can't support dynamic values*/}
+
+
+
+
+ >
+ );
+}
diff --git a/public/pages/workflow_detail/workspace_edge/index.ts b/public/pages/workflow_detail/workspace_edge/index.ts
new file mode 100644
index 00000000..a1b34598
--- /dev/null
+++ b/public/pages/workflow_detail/workspace_edge/index.ts
@@ -0,0 +1,6 @@
+/*
+ * Copyright OpenSearch Contributors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+export { DeletableEdge } from './deletable_edge';
diff --git a/public/store/context/react_flow_context_provider.tsx b/public/store/context/react_flow_context_provider.tsx
index 8434e358..73ef1cce 100644
--- a/public/store/context/react_flow_context_provider.tsx
+++ b/public/store/context/react_flow_context_provider.tsx
@@ -4,6 +4,9 @@
*/
import React, { createContext, useState } from 'react';
+import { useDispatch } from 'react-redux';
+import { Edge } from 'reactflow';
+import { setDirty } from '../reducers';
const initialValues = {
reactFlowInstance: null,
@@ -23,6 +26,7 @@ export const rfContext = createContext(initialValues);
* nested child components.
*/
export function ReactFlowContextProvider({ children }: any) {
+ const dispatch = useDispatch();
const [reactFlowInstance, setReactFlowInstance] = useState(null);
const deleteNode = (nodeId: string) => {
@@ -31,8 +35,10 @@ export function ReactFlowContextProvider({ children }: any) {
};
const deleteEdge = (edgeId: string) => {
- // TODO: implement edge deletion
- // reactFlowInstance.setEdges(...)
+ reactFlowInstance.setEdges(
+ reactFlowInstance.getEdges().filter((edge: Edge) => edge.id !== edgeId)
+ );
+ dispatch(setDirty());
};
return (