Skip to content

Commit 04928f2

Browse files
authored
Merge pull request #956 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 2d8cc12 + db7676f commit 04928f2

2 files changed

Lines changed: 74 additions & 8 deletions

File tree

  • src/pages

src/pages/identity/administration/jit-admin-templates/add.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ const Page = () => {
236236
validators={{ required: "Expiration action is required" }}
237237
/>
238238
</Grid>
239+
240+
<Grid size={{ md: 6, xs: 12 }}>
241+
<CippFormComponent
242+
type="autoComplete"
239243
fullWidth
240244
label="Default Notification Actions"
241245
name="defaultNotificationActions"

src/pages/tenant/manage/drift.js

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,17 @@ const ManageDriftPage = () => {
11341134
const handleDeviationAction = (action, deviation) => {
11351135
if (!deviation) return
11361136

1137+
const resolvedReceivedValue =
1138+
deviation.receivedValue ??
1139+
deviation.CurrentValue ??
1140+
deviation.currentValue ??
1141+
deviation.originalDeviation?.receivedValue ??
1142+
deviation.originalDeviation?.CurrentValue ??
1143+
deviation.originalDeviation?.currentValue ??
1144+
deviation.expectedValue ??
1145+
deviation.ExpectedValue ??
1146+
null
1147+
11371148
let status
11381149
let actionText
11391150
switch (action) {
@@ -1168,7 +1179,7 @@ const ManageDriftPage = () => {
11681179
{
11691180
standardName: deviation.standardName, // Use the standardName from the original deviation data
11701181
status: status,
1171-
receivedValue: deviation.receivedValue,
1182+
receivedValue: resolvedReceivedValue,
11721183
},
11731184
],
11741185
tenantFilter: tenantFilter,
@@ -1407,6 +1418,25 @@ const ManageDriftPage = () => {
14071418
),
14081419
}))
14091420

1421+
// Add action buttons to compliant/aligned items so previously denied and now compliant entries
1422+
// can be denied again or denied with remediation persistence.
1423+
const alignedItemsWithActions = allAlignedItems.map((item) => ({
1424+
...item,
1425+
cardLabelBoxActions: (
1426+
<Button
1427+
variant="outlined"
1428+
endIcon={<ExpandMore />}
1429+
onClick={(e) => {
1430+
e.stopPropagation()
1431+
handleMenuClick(e, `aligned-${item.id}`)
1432+
}}
1433+
size="small"
1434+
>
1435+
Actions
1436+
</Button>
1437+
),
1438+
}))
1439+
14101440
// Calculate compliance metrics for badges
14111441
// Accepted and Customer Specific deviations count as compliant since they are user-approved
14121442
// Denied deviations are included in total but not in compliant count (they haven't been fixed yet)
@@ -1485,7 +1515,7 @@ const ManageDriftPage = () => {
14851515
const filteredAcceptedItems = applyFilters(acceptedDeviationItemsWithActions)
14861516
const filteredCustomerSpecificItems = applyFilters(customerSpecificDeviationItemsWithActions)
14871517
const filteredDeniedItems = applyFilters(deniedDeviationItemsWithActions)
1488-
const filteredAlignedItems = applyFilters(allAlignedItems)
1518+
const filteredAlignedItems = applyFilters(alignedItemsWithActions)
14891519
const filteredLicenseSkippedItems = applyFilters(licenseSkippedItems)
14901520

14911521
// Helper function to render items grouped by category when category sort is active
@@ -1918,12 +1948,7 @@ const ManageDriftPage = () => {
19181948
<Typography variant="h6" sx={{ mb: 2 }}>
19191949
Compliant Standards
19201950
</Typography>
1921-
<CippBannerListCard
1922-
items={filteredAlignedItems}
1923-
isCollapsible={true}
1924-
layout={'single'}
1925-
isFetching={driftApi.isFetching}
1926-
/>
1951+
{renderItemsByCategory(filteredAlignedItems)}
19271952
</Box>
19281953
)}
19291954

@@ -2148,6 +2173,15 @@ const ManageDriftPage = () => {
21482173
open={Boolean(anchorEl[`denied-${item.id}`])}
21492174
onClose={() => handleMenuClose(`denied-${item.id}`)}
21502175
>
2176+
<MenuItem
2177+
onClick={() => {
2178+
handleDeviationAction('deny', item)
2179+
handleMenuClose(`denied-${item.id}`)
2180+
}}
2181+
>
2182+
<Error sx={{ mr: 1, color: 'error.main' }} />
2183+
Rerun standard to align with template
2184+
</MenuItem>
21512185
<MenuItem
21522186
onClick={() => {
21532187
handleDeviationAction('deny-remediate', item)
@@ -2178,6 +2212,34 @@ const ManageDriftPage = () => {
21782212
</Menu>
21792213
))}
21802214

2215+
{alignedItemsWithActions.map((item) => (
2216+
<Menu
2217+
key={`menu-aligned-${item.id}`}
2218+
anchorEl={anchorEl[`aligned-${item.id}`]}
2219+
open={Boolean(anchorEl[`aligned-${item.id}`])}
2220+
onClose={() => handleMenuClose(`aligned-${item.id}`)}
2221+
>
2222+
<MenuItem
2223+
onClick={() => {
2224+
handleDeviationAction('deny', item)
2225+
handleMenuClose(`aligned-${item.id}`)
2226+
}}
2227+
>
2228+
<Error sx={{ mr: 1, color: 'error.main' }} />
2229+
Rerun standard to align with template
2230+
</MenuItem>
2231+
<MenuItem
2232+
onClick={() => {
2233+
handleDeviationAction('deny-remediate', item)
2234+
handleMenuClose(`aligned-${item.id}`)
2235+
}}
2236+
>
2237+
<Cancel sx={{ mr: 1, color: 'error.main' }} />
2238+
Deny - Remediate to align with template
2239+
</MenuItem>
2240+
</Menu>
2241+
))}
2242+
21812243
{/* Hidden ExecutiveReportButton that gets triggered programmatically */}
21822244
<Box sx={{ position: 'absolute', top: -9999, left: -9999 }}>
21832245
<ExecutiveReportButton

0 commit comments

Comments
 (0)