Skip to content

Commit 5bfaafe

Browse files
updates to actions
1 parent f2a0cb1 commit 5bfaafe

File tree

4 files changed

+143
-2
lines changed

4 files changed

+143
-2
lines changed

src/pages/tenant/standards/manage-drift/compare.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
Close,
2828
Search,
2929
FactCheck,
30+
PlayArrow,
3031
} from "@mui/icons-material";
3132
import { ArrowLeftIcon } from "@mui/x-date-pickers";
3233
import standards from "/src/data/standards.json";
@@ -549,8 +550,36 @@ const Page = () => {
549550
noConfirm: true,
550551
customFunction: () => {
551552
comparisonApi.refetch();
553+
templateDetails.refetch();
552554
},
553555
},
556+
...(templateId
557+
? [
558+
{
559+
label: "Run Standard Now (Currently Selected Tenant only)",
560+
type: "GET",
561+
url: "/api/ExecStandardsRun",
562+
icon: <PlayArrow />,
563+
data: {
564+
TemplateId: templateId,
565+
},
566+
confirmText: "Are you sure you want to force a run of this standard?",
567+
multiPost: false,
568+
},
569+
{
570+
label: "Run Standard Now (All Tenants in Template)",
571+
type: "GET",
572+
url: "/api/ExecStandardsRun",
573+
icon: <PlayArrow />,
574+
data: {
575+
TemplateId: templateId,
576+
tenantFilter: "allTenants",
577+
},
578+
confirmText: "Are you sure you want to force a run of this standard?",
579+
multiPost: false,
580+
},
581+
]
582+
: []),
554583
];
555584

556585
return (

src/pages/tenant/standards/manage-drift/history.js

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { HeaderedTabbedLayout } from "/src/layouts/HeaderedTabbedLayout";
66
import { CippChartCard } from "/src/components/CippCards/CippChartCard";
77
import { ApiGetCall } from "/src/api/ApiCall";
88
import { useRouter } from "next/router";
9-
import { Policy } from "@mui/icons-material";
9+
import { Policy, Sync, PlayArrow } from "@mui/icons-material";
1010
import tabOptions from "./tabOptions.json";
1111

1212
const Page = () => {
@@ -70,6 +70,45 @@ const Page = () => {
7070
},
7171
];
7272

73+
// Actions for the ActionsMenu
74+
const actions = [
75+
{
76+
label: "Refresh Data",
77+
icon: <Sync />,
78+
noConfirm: true,
79+
customFunction: () => {
80+
driftHistoryData.refetch();
81+
},
82+
},
83+
...(templateId
84+
? [
85+
{
86+
label: "Run Standard Now (Currently Selected Tenant only)",
87+
type: "GET",
88+
url: "/api/ExecStandardsRun",
89+
icon: <PlayArrow />,
90+
data: {
91+
TemplateId: templateId,
92+
},
93+
confirmText: "Are you sure you want to force a run of this standard?",
94+
multiPost: false,
95+
},
96+
{
97+
label: "Run Standard Now (All Tenants in Template)",
98+
type: "GET",
99+
url: "/api/ExecStandardsRun",
100+
icon: <PlayArrow />,
101+
data: {
102+
TemplateId: templateId,
103+
tenantFilter: "allTenants",
104+
},
105+
confirmText: "Are you sure you want to force a run of this standard?",
106+
multiPost: false,
107+
},
108+
]
109+
: []),
110+
];
111+
73112
const title = "Manage Drift";
74113
const subtitle = [
75114
{
@@ -84,6 +123,9 @@ const Page = () => {
84123
title={title}
85124
subtitle={subtitle}
86125
backUrl="/tenant/standards/list-standards"
126+
actions={actions}
127+
actionsData={{}}
128+
isFetching={driftHistoryData.isLoading}
87129
>
88130
<Box sx={{ py: 2 }}>
89131
<Stack spacing={4}>

src/pages/tenant/standards/manage-drift/policies-deployed.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
Devices,
99
ExpandMore,
1010
Sync,
11+
PlayArrow,
1112
} from "@mui/icons-material";
1213
import {
1314
Box,
@@ -243,6 +244,33 @@ const PoliciesDeployedPage = () => {
243244
driftApi.refetch();
244245
},
245246
},
247+
...(templateId
248+
? [
249+
{
250+
label: "Run Standard Now (Currently Selected Tenant only)",
251+
type: "GET",
252+
url: "/api/ExecStandardsRun",
253+
icon: <PlayArrow />,
254+
data: {
255+
TemplateId: templateId,
256+
},
257+
confirmText: "Are you sure you want to force a run of this standard?",
258+
multiPost: false,
259+
},
260+
{
261+
label: "Run Standard Now (All Tenants in Template)",
262+
type: "GET",
263+
url: "/api/ExecStandardsRun",
264+
icon: <PlayArrow />,
265+
data: {
266+
TemplateId: templateId,
267+
tenantFilter: "allTenants",
268+
},
269+
confirmText: "Are you sure you want to force a run of this standard?",
270+
multiPost: false,
271+
},
272+
]
273+
: []),
246274
];
247275
const title = "Manage Drift";
248276
const subtitle = [

src/pages/tenant/standards/manage-drift/recover-policies.js

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Layout as DashboardLayout } from "/src/layouts/index.js";
22
import { useSettings } from "/src/hooks/use-settings";
33
import { useRouter } from "next/router";
4-
import { Policy, Restore, ExpandMore } from "@mui/icons-material";
4+
import { Policy, Restore, ExpandMore, Sync, PlayArrow } from "@mui/icons-material";
55
import {
66
Box,
77
Stack,
@@ -77,6 +77,45 @@ const RecoverPoliciesPage = () => {
7777
});
7878
};
7979

80+
// Actions for the ActionsMenu
81+
const actions = [
82+
{
83+
label: "Refresh Data",
84+
icon: <Sync />,
85+
noConfirm: true,
86+
customFunction: () => {
87+
// Refresh any relevant data here
88+
},
89+
},
90+
...(templateId
91+
? [
92+
{
93+
label: "Run Standard Now (Currently Selected Tenant only)",
94+
type: "GET",
95+
url: "/api/ExecStandardsRun",
96+
icon: <PlayArrow />,
97+
data: {
98+
TemplateId: templateId,
99+
},
100+
confirmText: "Are you sure you want to force a run of this standard?",
101+
multiPost: false,
102+
},
103+
{
104+
label: "Run Standard Now (All Tenants in Template)",
105+
type: "GET",
106+
url: "/api/ExecStandardsRun",
107+
icon: <PlayArrow />,
108+
data: {
109+
TemplateId: templateId,
110+
tenantFilter: "allTenants",
111+
},
112+
confirmText: "Are you sure you want to force a run of this standard?",
113+
multiPost: false,
114+
},
115+
]
116+
: []),
117+
];
118+
80119
const title = "Manage Drift";
81120
const subtitle = [
82121
{
@@ -91,6 +130,9 @@ const RecoverPoliciesPage = () => {
91130
title={title}
92131
subtitle={subtitle}
93132
backUrl="/tenant/standards/list-standards"
133+
actions={actions}
134+
actionsData={{}}
135+
isFetching={recoverApi.isPending}
94136
>
95137
<CippHead title="Recover Policies" />
96138
<Box sx={{ py: 2 }}>

0 commit comments

Comments
 (0)