Skip to content

Commit 4ed17a7

Browse files
committed
update mailbox rules
dynamically generate property list for offcanavas add remove mailbox rule action
1 parent c1835ad commit 4ed17a7

File tree

1 file changed

+49
-1
lines changed
  • src/pages/email/administration/mailbox-rules

1 file changed

+49
-1
lines changed

src/pages/email/administration/mailbox-rules/index.js

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,58 @@
11
import { Layout as DashboardLayout } from "/src/layouts/index.js";
22
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";
37

48
const Page = () => {
59
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+
];
622

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+
);
856
};
957

1058
Page.getLayout = (page) => <DashboardLayout>{page}</DashboardLayout>;

0 commit comments

Comments
 (0)