From bf83efa0e492a8f7c18feddb16960551d216e08f Mon Sep 17 00:00:00 2001 From: BNWEIN Date: Thu, 2 Jan 2025 16:28:54 +0000 Subject: [PATCH] Added Connection Filter added Connection Filter functionality to the front end. --- .vscode/settings.json | 1 + src/layouts/config.js | 4 +- .../email/connectionfilter/deploy/index.js | 17 ++++ .../list-connectionfilter/add.jsx | 87 +++++++++++++++++++ .../list-connectionfilter/index.js | 62 +++++++++++++ .../connectionfilter/list-templates/index.js | 59 +++++++++++++ 6 files changed, 229 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json create mode 100644 src/pages/email/connectionfilter/deploy/index.js create mode 100644 src/pages/email/connectionfilter/list-connectionfilter/add.jsx create mode 100644 src/pages/email/connectionfilter/list-connectionfilter/index.js create mode 100644 src/pages/email/connectionfilter/list-templates/index.js diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000000..9e26dfeeb6e6 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/layouts/config.js b/src/layouts/config.js index 1063c6e40e44..cbe431776ca3 100644 --- a/src/layouts/config.js +++ b/src/layouts/config.js @@ -378,7 +378,9 @@ export const nativeMenuItems = [ path: "/email/spamfilter", items: [ { title: "Spamfilter", path: "/email/spamfilter/list-spamfilter" }, - { title: "Templates", path: "/email/spamfilter/list-templates" }, + { title: "Spamfilter templates", path: "/email/spamfilter/list-templates" }, + { title: "Connection filter", path: "/email/connectionfilter/list-connectionfilter" }, + { title: "Connection filter templates", path: "/email/connectionfilter/list-templates" }, ], }, { diff --git a/src/pages/email/connectionfilter/deploy/index.js b/src/pages/email/connectionfilter/deploy/index.js new file mode 100644 index 000000000000..92cbabc77ae2 --- /dev/null +++ b/src/pages/email/connectionfilter/deploy/index.js @@ -0,0 +1,17 @@ + +import { Layout as DashboardLayout } from "/src/layouts/index.js"; + +const Page = () => { + const pageTitle = "Apply Spamfilter Template"; + + return ( +
+

{pageTitle}

+

This is a placeholder page for the apply spamfilter template section.

+
+ ); +}; + +Page.getLayout = (page) => {page}; + +export default Page; diff --git a/src/pages/email/connectionfilter/list-connectionfilter/add.jsx b/src/pages/email/connectionfilter/list-connectionfilter/add.jsx new file mode 100644 index 000000000000..c2e2c9a5785f --- /dev/null +++ b/src/pages/email/connectionfilter/list-connectionfilter/add.jsx @@ -0,0 +1,87 @@ +import React, { useEffect } from "react"; +import { Grid, Divider } from "@mui/material"; +import { useForm, useWatch } from "react-hook-form"; +import { Layout as DashboardLayout } from "/src/layouts/index.js"; +import CippFormPage from "/src/components/CippFormPages/CippFormPage"; +import CippFormComponent from "/src/components/CippComponents/CippFormComponent"; +import { CippFormTenantSelector } from "/src/components/CippComponents/CippFormTenantSelector"; + +const AddPolicy = () => { + const formControl = useForm({ + mode: "onChange", + defaultValues: { + selectedTenants: [], + TemplateList: null, + PowerShellCommand: "", + }, + }); + + const templateListVal = useWatch({ control: formControl.control, name: "TemplateList" }); + + useEffect(() => { + if (templateListVal?.value) { + formControl.setValue("PowerShellCommand", JSON.stringify(templateListVal?.value)); + } + }, [templateListVal, formControl]); + + return ( + + + + + + + + + {/* TemplateList */} + + option, + url: "/api/ListConnectionFilterTemplates", + }} + placeholder="Select a template or enter PowerShell JSON manually" + /> + + + + + + + + + + ); +}; + +AddPolicy.getLayout = (page) => {page}; + +export default AddPolicy; diff --git a/src/pages/email/connectionfilter/list-connectionfilter/index.js b/src/pages/email/connectionfilter/list-connectionfilter/index.js new file mode 100644 index 000000000000..cd6e9482ada8 --- /dev/null +++ b/src/pages/email/connectionfilter/list-connectionfilter/index.js @@ -0,0 +1,62 @@ +import { Layout as DashboardLayout } from "/src/layouts/index.js"; +import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx"; +import { Button } from "@mui/material"; +import Link from "next/link"; + +const Page = () => { + const pageTitle = "Connection Filters"; + + const actions = [ + { + label: "Create template based on rule", + type: "POST", + url: "/api/AddConnectionfilterTemplate", + dataFunction: (data) => { + return { ...data }; + }, + confirmText: "Are you sure you want to create a template based on this rule?", + }, + ]; + + const offCanvas = { + extendedInfoFields: [ + "DistinguishedName", + "DirectoryBasedEdgeBlockMode", + "ExchangeVersion", + "ExchangeObjectId", + "OrganizationalUnitRoot", + "WhenCreated", + "WhenChanged", + "Guid", + ], + actions: actions, + }; + + const simpleColumns = [ + "Name", + "IsDefault", + "IPAllowList", + "IPBlockList", + "EnableSafeList", + ]; + + return ( + + + + } + /> + ); +}; + +Page.getLayout = (page) => {page}; +export default Page; diff --git a/src/pages/email/connectionfilter/list-templates/index.js b/src/pages/email/connectionfilter/list-templates/index.js new file mode 100644 index 000000000000..acd7b58f0ac7 --- /dev/null +++ b/src/pages/email/connectionfilter/list-templates/index.js @@ -0,0 +1,59 @@ +import { Layout as DashboardLayout } from "/src/layouts/index.js"; +import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx"; +import { EyeIcon, TrashIcon } from "@heroicons/react/24/outline"; + +const Page = () => { + const pageTitle = "Connection filter Templates"; + + const actions = [ + { + label: "View Template", + icon: , // Placeholder for the view icon + color: "success", + offCanvas: true, + }, + { + label: "Delete Template", + type: "POST", + url: "/api/RemoveConnectionfilterTemplate", + data: { ID: "GUID" }, + confirmText: "Do you want to delete the template?", + icon: , // Placeholder for the delete icon + color: "danger", + }, + ]; + + const offCanvas = { + extendedInfoFields: [ + "name", + "IsDefault", + "IPAllowList", + "IPBlockList", + "EnableSafeList", + "GUID", + ], + actions: actions, + }; + + const simpleColumns = [ + "name", + "IsDefault", + "IPAllowList", + "IPBlockList", + "EnableSafeList", + "GUID", + ]; + + return ( + + ); +}; + +Page.getLayout = (page) => {page}; +export default Page;