|
1 | 1 | import { Layout as DashboardLayout } from "/src/layouts/index.js";
|
2 | 2 | import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx";
|
| 3 | +import { TrashIcon } from "@heroicons/react/24/outline"; |
| 4 | +import { getCippTranslation } from "../../../../utils/get-cipp-translation"; |
| 5 | +import { getCippFormatting } from "../../../../utils/get-cipp-formatting"; |
| 6 | +import { CippPropertyListCard } from "../../../../components/CippCards/CippPropertyListCard"; |
3 | 7 |
|
4 | 8 | const Page = () => {
|
5 | 9 | const pageTitle = "Mailbox Rules";
|
| 10 | + const simpleColumns = ["Name", "Priority", "Enabled", "UserPrincipalName", "From"]; |
| 11 | + const actions = [ |
| 12 | + { |
| 13 | + label: "Remove Mailbox Rule", |
| 14 | + type: "GET", |
| 15 | + icon: <TrashIcon />, |
| 16 | + url: "/api/ExecRemoveMailboxRule", |
| 17 | + data: { ruleId: "Identity", userPrincipalName: "UserPrincipalName" }, |
| 18 | + confirmText: "Are you sure you want to remove this mailbox rule?", |
| 19 | + multiPost: false, |
| 20 | + }, |
| 21 | + ]; |
6 | 22 |
|
7 |
| - return <CippTablePage title={pageTitle} apiUrl="/api/ListMailboxRules" />; |
| 23 | + const offCanvas = { |
| 24 | + children: (data) => { |
| 25 | + const keys = Object.keys(data).filter( |
| 26 | + (key) => !key.includes("@odata") && !key.includes("@data") |
| 27 | + ); |
| 28 | + const properties = []; |
| 29 | + keys.forEach((key) => { |
| 30 | + if (data[key] && data[key].length > 0) { |
| 31 | + properties.push({ |
| 32 | + label: getCippTranslation(key), |
| 33 | + value: getCippFormatting(data[key], key), |
| 34 | + }); |
| 35 | + } |
| 36 | + }); |
| 37 | + return ( |
| 38 | + <CippPropertyListCard |
| 39 | + cardSx={{ p: 0, m: -2 }} |
| 40 | + title="Rule Details" |
| 41 | + propertyItems={properties} |
| 42 | + actionItems={actions} |
| 43 | + /> |
| 44 | + ); |
| 45 | + }, |
| 46 | + }; |
| 47 | + return ( |
| 48 | + <CippTablePage |
| 49 | + title={pageTitle} |
| 50 | + apiUrl="/api/ListMailboxRules" |
| 51 | + simpleColumns={simpleColumns} |
| 52 | + offCanvas={offCanvas} |
| 53 | + actions={actions} |
| 54 | + /> |
| 55 | + ); |
8 | 56 | };
|
9 | 57 |
|
10 | 58 | Page.getLayout = (page) => <DashboardLayout>{page}</DashboardLayout>;
|
|
0 commit comments