diff --git a/package-lock.json b/package-lock.json index 4682c00..e0f9ad0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.6", "dependencies": { "@madie/cql-antlr-parser": "^1.0.9", - "@madie/madie-design-system": "^1.2.37", + "@madie/madie-design-system": "^1.2.39", "@material-ui/core": "^4.12.4", "@mui/icons-material": "^5.5.1", "@mui/lab": "^5.0.0-alpha.73", @@ -3600,9 +3600,9 @@ } }, "node_modules/@madie/madie-design-system": { - "version": "1.2.37", - "resolved": "https://registry.npmjs.org/@madie/madie-design-system/-/madie-design-system-1.2.37.tgz", - "integrity": "sha512-sIz3pN+gM0iXA64t4TUxmipsK4gIPHWI2auMVaaQt7fJvrjldpTuldzVmRjhbWwLsqWTJ1Ms86aLCQc9MIrUkA==", + "version": "1.2.39", + "resolved": "https://registry.npmjs.org/@madie/madie-design-system/-/madie-design-system-1.2.39.tgz", + "integrity": "sha512-3ywRn6h571yNgnskL3jhJB5WFfFLmWI3pdleiHSo7LT+aV6FHkmOJhLeaQFt07BG74vT2bG6MHyCmvJFpzhB/Q==", "license": "CC0-1.0", "dependencies": { "@cmsgov/design-system": "^5.0.2", @@ -9909,9 +9909,9 @@ } }, "node_modules/express": { - "version": "4.21.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.21.1.tgz", - "integrity": "sha512-YSFlK1Ee0/GC8QaO91tHcDxJiE/X4FbpAyQWkxAvG6AXCuR65YzK8ua6D9hvi/TzUfZMpc+BwuM1IPw8fmQBiQ==", + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", "dev": true, "license": "MIT", "dependencies": { @@ -9934,7 +9934,7 @@ "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.10", + "path-to-regexp": "0.1.12", "proxy-addr": "~2.0.7", "qs": "6.13.0", "range-parser": "~1.2.1", @@ -9949,6 +9949,10 @@ }, "engines": { "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/express/node_modules/cookie": { @@ -15265,9 +15269,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "funding": [ { "type": "github", @@ -15947,9 +15951,9 @@ "license": "ISC" }, "node_modules/path-to-regexp": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", - "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==", + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", "dev": true, "license": "MIT" }, diff --git a/package.json b/package.json index ffe9f10..00ce1e8 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ }, "dependencies": { "@madie/cql-antlr-parser": "^1.0.9", - "@madie/madie-design-system": "^1.2.37", + "@madie/madie-design-system": "^1.2.39", "@material-ui/core": "^4.12.4", "@mui/icons-material": "^5.5.1", "@mui/lab": "^5.0.0-alpha.73", diff --git a/src/AceEditor/madie-ace-editor.tsx b/src/AceEditor/madie-ace-editor.tsx index d375fe6..4c7bd71 100644 --- a/src/AceEditor/madie-ace-editor.tsx +++ b/src/AceEditor/madie-ace-editor.tsx @@ -47,6 +47,7 @@ export interface EditorPropsType { ) => void; handleDeleteLibrary?: (lib: SelectedLibrary) => void; handleApplyFunction?: (funct: Funct) => void; + handleFunctionDelete?: (funct: any) => void; parseDebounceTime?: number; inboundAnnotations?: Ace.Annotation[]; inboundErrorMarkers?: Ace.MarkerLike[]; diff --git a/src/CqlBuilderPanel/CqlBuilderPanel.tsx b/src/CqlBuilderPanel/CqlBuilderPanel.tsx index fda312e..3d33bf2 100644 --- a/src/CqlBuilderPanel/CqlBuilderPanel.tsx +++ b/src/CqlBuilderPanel/CqlBuilderPanel.tsx @@ -37,6 +37,7 @@ export default function CqlBuilderPanel({ handleDefinitionEdit, handleDefinitionDelete, handleApplyFunction, + handleFunctionDelete, resetCql, getCqlDefinitionReturnTypes, makeExpanded, @@ -244,6 +245,7 @@ export default function CqlBuilderPanel({ cqlBuilderLookupsTypes={cqlBuilderLookupsTypes} canEdit={canEdit} handleApplyFunction={handleApplyFunction} + handleFunctionDelete={handleFunctionDelete} loading={loading} cql={measureStoreCql} isCQLUnchanged={isCQLUnchanged} diff --git a/src/CqlBuilderPanel/functionsSection/FunctionsSection.test.tsx b/src/CqlBuilderPanel/functionsSection/FunctionsSection.test.tsx index 50c4cf5..a1eeb52 100644 --- a/src/CqlBuilderPanel/functionsSection/FunctionsSection.test.tsx +++ b/src/CqlBuilderPanel/functionsSection/FunctionsSection.test.tsx @@ -85,7 +85,7 @@ describe("FunctionsSection", () => { const editButon0 = screen.getByTestId("edit-button-0"); userEvent.click(editButon0); expect(screen.getByTestId("discard-dialog")).toBeInTheDocument(); - expect(screen.getByText("Discard Changes?")).toBeInTheDocument(); + expect(screen.getByText("You have unsaved changes.")).toBeInTheDocument(); const cancelBtn = screen.getByTestId("discard-dialog-cancel-button"); const discardBtn = screen.getByTestId("discard-dialog-continue-button"); expect(cancelBtn).toBeInTheDocument(); @@ -139,7 +139,7 @@ describe("FunctionsSection", () => { const editButon0 = screen.getByTestId("edit-button-0"); userEvent.click(editButon0); expect(screen.getByTestId("discard-dialog")).toBeInTheDocument(); - expect(screen.getByText("Discard Changes?")).toBeInTheDocument(); + expect(screen.getByText("You have unsaved changes.")).toBeInTheDocument(); const cancelBtn = screen.getByTestId("discard-dialog-cancel-button"); expect(cancelBtn).toBeInTheDocument(); userEvent.click(cancelBtn); diff --git a/src/CqlBuilderPanel/functionsSection/FunctionsSection.tsx b/src/CqlBuilderPanel/functionsSection/FunctionsSection.tsx index 2aef264..64c1c51 100644 --- a/src/CqlBuilderPanel/functionsSection/FunctionsSection.tsx +++ b/src/CqlBuilderPanel/functionsSection/FunctionsSection.tsx @@ -10,12 +10,13 @@ import { CqlAntlr } from "@madie/cql-antlr-parser/dist/src"; export interface FunctionProps { canEdit: boolean; handleApplyFunction?: Function; + handleFunctionDelete?: Function; loading: boolean; cqlBuilderLookupsTypes?: CqlBuilderLookup; cql: string; isCQLUnchanged: boolean; functions?: FunctionLookup[]; - resetCql?: Function; + resetCql: Function; } const getArgumentNames = (logic: string) => { @@ -30,6 +31,7 @@ export default function FunctionsSection({ isCQLUnchanged, cqlBuilderLookupsTypes, resetCql, + handleFunctionDelete, loading, }: FunctionProps) { const [activeTab, setActiveTab] = useState("function"); @@ -96,6 +98,7 @@ export default function FunctionsSection({ cql={cql} resetCql={resetCql} handleApplyFunction={handleApplyFunction} + handleFunctionDelete={handleFunctionDelete} /> )} diff --git a/src/CqlBuilderPanel/functionsSection/functions/Functions.test.tsx b/src/CqlBuilderPanel/functionsSection/functions/Functions.test.tsx index 4894eb7..67b3e1c 100644 --- a/src/CqlBuilderPanel/functionsSection/functions/Functions.test.tsx +++ b/src/CqlBuilderPanel/functionsSection/functions/Functions.test.tsx @@ -2,7 +2,10 @@ import * as React from "react"; import { render, waitFor, act, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import Functions from "./Functions"; -import { FunctionLookup } from "../../../model/CqlBuilderLookup"; +import { + FunctionLookup, + CqlBuilderLookup, +} from "../../../model/CqlBuilderLookup"; const saveFunctions = [ { @@ -20,7 +23,30 @@ const saveFunctions = [ "Enc4 Encounter", ], }, -]; +] as unknown as FunctionLookup[]; + +const cqlBuilderLookupsTypes = { + parameters: [], + definitions: [], + functions: [], + fluentFunctions: [ + { + name: "isFinishedEncounter", + libraryName: null, + libraryAlias: null, + logic: + "define fluent function \"isFinishedEncounter\"(Enc Encounter):\n(Enc E where E.status = 'finished') is not null", + comment: "", + isFluent: "Yes", + argumentNames: [ + "Enc1 Encounter", + "Enc2 Encounter", + "Enc3 Encounter", + "Enc4 Encounter", + ], + }, + ], +} as unknown as CqlBuilderLookup; const testFunctions = [ { @@ -79,7 +105,11 @@ const testFunctions = [ isFluent: "Yes", argumentNames: ["Enc Encounter"], }, -]; +] as unknown as FunctionLookup[]; + +const handleApplyFunction = jest.fn(); +const handleFunctionDelete = jest.fn(); +const resetCql = jest.fn(); describe("Saved Functions Component tests", () => { it("Should render saved Functions", async () => { @@ -89,6 +119,11 @@ describe("Saved Functions Component tests", () => { loading={false} functions={saveFunctions} isCQLUnchanged={false} + handleApplyFunction={handleApplyFunction} + handleFunctionDelete={handleFunctionDelete} + cqlBuilderLookupsTypes={cqlBuilderLookupsTypes} + cql="test cql" + resetCql={resetCql} /> ); @@ -123,6 +158,11 @@ describe("Saved Functions Component tests", () => { loading={true} functions={saveFunctions} isCQLUnchanged={false} + handleApplyFunction={handleApplyFunction} + handleFunctionDelete={handleFunctionDelete} + cqlBuilderLookupsTypes={cqlBuilderLookupsTypes} + cql="test cql" + resetCql={resetCql} /> ); expect(screen.getByTitle("loading")).toBeInTheDocument(); @@ -135,6 +175,11 @@ describe("Saved Functions Component tests", () => { loading={false} functions={[]} isCQLUnchanged={false} + handleApplyFunction={handleApplyFunction} + handleFunctionDelete={handleFunctionDelete} + cqlBuilderLookupsTypes={cqlBuilderLookupsTypes} + cql="test cql" + resetCql={resetCql} /> ); @@ -150,6 +195,11 @@ describe("Saved Functions Component tests", () => { loading={false} functions={saveFunctions} isCQLUnchanged={false} + handleApplyFunction={handleApplyFunction} + handleFunctionDelete={handleFunctionDelete} + cqlBuilderLookupsTypes={cqlBuilderLookupsTypes} + cql="test cql" + resetCql={resetCql} /> ); expect(screen.queryByTestId("functions-actions")).not.toBeInTheDocument(); @@ -162,6 +212,11 @@ describe("Saved Functions Component tests", () => { loading={false} functions={testFunctions} isCQLUnchanged={false} + handleApplyFunction={handleApplyFunction} + handleFunctionDelete={handleFunctionDelete} + cqlBuilderLookupsTypes={cqlBuilderLookupsTypes} + cql="test cql" + resetCql={resetCql} /> ); @@ -193,6 +248,11 @@ describe("Saved Functions Component tests", () => { loading={false} functions={testFunctions} isCQLUnchanged={false} + handleApplyFunction={handleApplyFunction} + handleFunctionDelete={handleFunctionDelete} + cqlBuilderLookupsTypes={cqlBuilderLookupsTypes} + cql="test cql" + resetCql={resetCql} /> ); @@ -217,4 +277,278 @@ describe("Saved Functions Component tests", () => { expect(screen.getByText("Test Function 6")).toBeInTheDocument(); }); }); + + it("Should bring up confirm delete dialog when clicked delete button", async () => { + render( + + ); + + await waitFor(() => { + const table = screen.getByRole("table"); + const rows = table.querySelectorAll("tbody tr"); + rows.forEach((row, index) => { + const columns = row.querySelectorAll("td"); + const rowText = Array.from(columns).map((c) => c.textContent?.trim()); + expect(rowText[0]).toEqual("isFinishedEncounter"); + expect(rowText[1]).toEqual("Yes"); + expect(rowText[2]).toContain("Enc1 Encounter"); + expect(rowText[2]).toContain("Enc2 Encounter..."); + }); + }); + + const deleteBtn = screen.getByTestId("delete-button-0"); + expect(deleteBtn).toBeInTheDocument(); + userEvent.click(deleteBtn); + + expect(screen.getByTestId("delete-dialog")).toBeInTheDocument(); + expect(screen.getByText("delete this Function")).toBeInTheDocument(); + const deleteCancelBtn = screen.getByTestId("delete-dialog-cancel-button"); + expect(deleteCancelBtn).toBeInTheDocument(); + const deleteContinueBtn = screen.getByTestId( + "delete-dialog-continue-button" + ); + expect(deleteContinueBtn).toBeInTheDocument(); + + userEvent.click(deleteCancelBtn); + expect(handleFunctionDelete).not.toBeCalled(); + }); + + it("Should delete function", async () => { + render( + + ); + + await waitFor(() => { + const table = screen.getByRole("table"); + const rows = table.querySelectorAll("tbody tr"); + rows.forEach((row, index) => { + const columns = row.querySelectorAll("td"); + const rowText = Array.from(columns).map((c) => c.textContent?.trim()); + expect(rowText[0]).toEqual("isFinishedEncounter"); + expect(rowText[1]).toEqual("Yes"); + expect(rowText[2]).toContain("Enc1 Encounter"); + expect(rowText[2]).toContain("Enc2 Encounter..."); + }); + }); + + const deleteBtn = screen.getByTestId("delete-button-0"); + expect(deleteBtn).toBeInTheDocument(); + userEvent.click(deleteBtn); + + expect(screen.getByTestId("delete-dialog")).toBeInTheDocument(); + expect(screen.getByText("delete this Function")).toBeInTheDocument(); + const deleteCancelBtn = screen.getByTestId("delete-dialog-cancel-button"); + expect(deleteCancelBtn).toBeInTheDocument(); + const deleteContinueBtn = screen.getByTestId( + "delete-dialog-continue-button" + ); + expect(deleteContinueBtn).toBeInTheDocument(); + + userEvent.click(deleteContinueBtn); + expect(handleFunctionDelete).toBeCalled(); + }); + + it("Should bring up discard dialog when clicked delete button", async () => { + render( + + ); + + await waitFor(() => { + const table = screen.getByRole("table"); + const rows = table.querySelectorAll("tbody tr"); + rows.forEach((row, index) => { + const columns = row.querySelectorAll("td"); + const rowText = Array.from(columns).map((c) => c.textContent?.trim()); + expect(rowText[0]).toEqual("isFinishedEncounter"); + expect(rowText[1]).toEqual("Yes"); + expect(rowText[2]).toContain("Enc1 Encounter"); + expect(rowText[2]).toContain("Enc2 Encounter..."); + }); + }); + + const deleteBtn = screen.getByTestId("delete-button-0"); + expect(deleteBtn).toBeInTheDocument(); + userEvent.click(deleteBtn); + + expect(screen.getByTestId("discard-dialog")).toBeInTheDocument(); + expect(screen.getByText("You have unsaved changes.")).toBeInTheDocument(); + const discardCancelBtn = screen.getByTestId("discard-dialog-cancel-button"); + expect(discardCancelBtn).toBeInTheDocument(); + const discardContinueBtn = screen.getByTestId( + "discard-dialog-continue-button" + ); + expect(discardContinueBtn).toBeInTheDocument(); + + const closeBtn = screen.getByTestId("close-button"); + userEvent.click(closeBtn); + + await waitFor(() => { + expect(screen.queryByTestId("discard-dialog")).not.toBeInTheDocument(); + }); + }); + + it("Should bring up delete dialog when clicked discard continue button", async () => { + render( + + ); + + await waitFor(() => { + const table = screen.getByRole("table"); + const rows = table.querySelectorAll("tbody tr"); + rows.forEach((row, index) => { + const columns = row.querySelectorAll("td"); + const rowText = Array.from(columns).map((c) => c.textContent?.trim()); + expect(rowText[0]).toEqual("isFinishedEncounter"); + expect(rowText[1]).toEqual("Yes"); + expect(rowText[2]).toContain("Enc1 Encounter"); + expect(rowText[2]).toContain("Enc2 Encounter..."); + }); + }); + + const deleteBtn = screen.getByTestId("delete-button-0"); + expect(deleteBtn).toBeInTheDocument(); + userEvent.click(deleteBtn); + + expect(screen.getByTestId("discard-dialog")).toBeInTheDocument(); + expect(screen.getByText("You have unsaved changes.")).toBeInTheDocument(); + const discardCancelBtn = screen.getByTestId("discard-dialog-cancel-button"); + expect(discardCancelBtn).toBeInTheDocument(); + const discardContinueBtn = screen.getByTestId( + "discard-dialog-continue-button" + ); + expect(discardContinueBtn).toBeInTheDocument(); + + userEvent.click(discardContinueBtn); + expect(screen.getByTestId("delete-dialog")).toBeInTheDocument(); + expect(screen.getByText("delete this Function")).toBeInTheDocument(); + }); + + it("Should bring up edit dialog", async () => { + render( + + ); + + await waitFor(() => { + const table = screen.getByRole("table"); + const rows = table.querySelectorAll("tbody tr"); + rows.forEach((row, index) => { + const columns = row.querySelectorAll("td"); + const rowText = Array.from(columns).map((c) => c.textContent?.trim()); + expect(rowText[0]).toEqual("isFinishedEncounter"); + expect(rowText[1]).toEqual("Yes"); + expect(rowText[2]).toContain("Enc1 Encounter"); + expect(rowText[2]).toContain("Enc2 Encounter..."); + }); + }); + + const editBtn = screen.getByTestId("edit-button-0"); + expect(editBtn).toBeInTheDocument(); + userEvent.click(editBtn); + + expect(screen.getByTestId("edit-parameter-dialog")).toBeInTheDocument(); + + const closeBtn = screen.getByTestId("close-button"); + userEvent.click(closeBtn); + + await waitFor(() => { + expect( + screen.queryByTestId("edit-parameter-dialog") + ).not.toBeInTheDocument(); + }); + }); + + it("Should bring up discard dialog when there is cql change and user clicks Edit button", async () => { + render( + + ); + + await waitFor(() => { + const table = screen.getByRole("table"); + const rows = table.querySelectorAll("tbody tr"); + rows.forEach((row, index) => { + const columns = row.querySelectorAll("td"); + const rowText = Array.from(columns).map((c) => c.textContent?.trim()); + expect(rowText[0]).toEqual("isFinishedEncounter"); + expect(rowText[1]).toEqual("Yes"); + expect(rowText[2]).toContain("Enc1 Encounter"); + expect(rowText[2]).toContain("Enc2 Encounter..."); + }); + }); + + const editBtn = screen.getByTestId("edit-button-0"); + expect(editBtn).toBeInTheDocument(); + userEvent.click(editBtn); + + expect(screen.getByTestId("discard-dialog")).toBeInTheDocument(); + expect(screen.getByText("You have unsaved changes.")).toBeInTheDocument(); + const discardCancelBtn = screen.getByTestId("discard-dialog-cancel-button"); + expect(discardCancelBtn).toBeInTheDocument(); + const discardContinueBtn = screen.getByTestId( + "discard-dialog-continue-button" + ); + expect(discardContinueBtn).toBeInTheDocument(); + + userEvent.click(discardContinueBtn); + expect(screen.getByTestId("edit-parameter-dialog")).toBeInTheDocument(); + }); }); diff --git a/src/CqlBuilderPanel/functionsSection/functions/Functions.tsx b/src/CqlBuilderPanel/functionsSection/functions/Functions.tsx index e98f4c3..54351d7 100644 --- a/src/CqlBuilderPanel/functionsSection/functions/Functions.tsx +++ b/src/CqlBuilderPanel/functionsSection/functions/Functions.tsx @@ -17,7 +17,7 @@ import BorderColorOutlinedIcon from "@mui/icons-material/BorderColorOutlined"; import Skeleton from "@mui/material/Skeleton"; import { Pagination, - MadieDiscardDialog, + MadieConfirmDialog, } from "@madie/madie-design-system/dist/react"; import EditFunctionDialog from "../EditFunctionDialog"; import Tooltip from "@mui/material/Tooltip"; @@ -44,8 +44,9 @@ const Functions = ({ functions, isCQLUnchanged, resetCql, - cqlBuilderLookupsTypes, handleApplyFunction, + handleFunctionDelete, + cqlBuilderLookupsTypes, }: FunctionProps) => { // pagination utilities const [totalPages, setTotalPages] = useState(0); @@ -54,6 +55,16 @@ const Functions = ({ const [visibleFunctions, setVisibleFunctions] = useState( [] ); + + const [selectedFunction, setSelectedFunction] = useState(); + const [deleteDialogOpen, setDeleteDialogOpen] = useState(false); + const [discardDialog, setDiscardDialog] = useState({ + open: false, + operation: null, + }); + const [editFunctionDialogOpen, setEditFunctionDialogOpen] = + useState(); + const [offset, setOffset] = useState(0); const [currentLimit, setCurrentLimit] = useState(5); const [currentPage, setCurrentPage] = useState(1); @@ -72,15 +83,6 @@ const Functions = ({ managePagination(); }, [functions, currentPage, currentLimit]); - // edit dialog utilities - const [discardDialog, setDiscardDialog] = useState({ - open: false, - operation: null, - }); - const [editFunctionDialogOpen, setEditFunctionDialogOpen] = - useState(); - const [deleteDialogOpen, setDeleteDialogOpen] = useState(false); - const [selectedFunction, setSelectedFunction] = useState(); const handleFunctionEdit = () => {}; // table data const data = visibleFunctions; @@ -149,7 +151,14 @@ const Functions = ({ "data-testid": `delete-button-${row.cell.row.id}`, "aria-label": `delete-button-${row.cell.row.id}`, size: "small", - onClick: (e) => {}, + onClick: (e) => { + setSelectedFunction(table.getRow(row.cell.row.id).original); + if (!isCQLUnchanged) { + setDiscardDialog({ open: true, operation: "delete" }); + } else { + setDeleteDialogOpen(true); + } + }, }} > @@ -284,8 +293,15 @@ const Functions = ({ hidePrevButton={!canGoPrev} /> - { resetCql(); if (discardDialog?.operation === "edit") { @@ -294,6 +310,12 @@ const Functions = ({ operation: "edit", }); setEditFunctionDialogOpen(true); + } else if (discardDialog?.operation === "delete") { + setDiscardDialog({ + open: false, + operation: "delete", + }); + setDeleteDialogOpen(true); } }} onClose={() => { @@ -304,6 +326,27 @@ const Functions = ({ }} /> + { + handleFunctionDelete({ + functionName: selectedFunction.name, + comment: selectedFunction.comment, + functionsArguments: selectedFunction.arguments, + fluentFunction: selectedFunction.isFluent === "Yes" ? true : false, + expressionValue: selectedFunction.logic, + expression: selectedFunction.logic, + }); + setDeleteDialogOpen(false); + }} + onClose={() => setDeleteDialogOpen(false)} + action="delete" + dialogTitle="Are you sure?" + name={"delete this Function"} + warning={"This action cannot be undone!"} + continueText="Yes, Delete" + /> +