Skip to content

Commit 759ac1c

Browse files
authored
Merge pull request #195 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 1030632 + e654ad6 commit 759ac1c

File tree

3 files changed

+132
-62
lines changed

3 files changed

+132
-62
lines changed

src/components/CippWizard/CippWizardOffboarding.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const CippWizardOffboarding = (props) => {
1616
const disableForwarding = useWatch({ control: formControl.control, name: "disableForwarding" });
1717

1818
useEffect(() => {
19-
if (selectedUsers.length >= 4) {
19+
if (selectedUsers.length >= 3) {
2020
setShowAlert(true);
2121
formControl.setValue("Scheduled.enabled", true);
2222
}

src/pages/cipp/advanced/exchange-cmdlets.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
DialogTitle,
99
DialogContent,
1010
IconButton,
11+
Skeleton,
1112
} from "@mui/material";
1213
import { useForm } from "react-hook-form";
1314
import CippFormComponent from "/src/components/CippComponents/CippFormComponent";
@@ -130,7 +131,7 @@ const Page = () => {
130131
<CippDataTable
131132
title={pageTitle}
132133
simpleColumns={simpleColumns}
133-
data={searchResults?.Results}
134+
data={searchResults?.Results ?? []}
134135
isFetching={exchangeCmdlets.isPending}
135136
refreshFunction={onSubmit}
136137
actions={actions}
@@ -148,13 +149,17 @@ const Page = () => {
148149
</IconButton>
149150
</DialogTitle>
150151
<DialogContent dividers>
151-
<CippDataTable
152-
noCard={true}
153-
title="Permitted Roles"
154-
simpleColumns={roleColumns}
155-
data={roleDetails?.Results ?? []}
156-
isFetching={managementRole.isPending}
157-
/>
152+
{roleDetails.isPending ? (
153+
<Skeleton variant="rectangular" height={200} />
154+
) : (
155+
<CippDataTable
156+
noCard={true}
157+
title="Permitted Roles"
158+
simpleColumns={roleColumns}
159+
data={roleDetails?.data?.Results ?? []}
160+
isFetching={managementRole.isPending}
161+
/>
162+
)}
158163
</DialogContent>
159164
</Dialog>
160165
</Container>

src/pages/tenant/standards/compare/index.js

Lines changed: 118 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -101,58 +101,123 @@ const Page = () => {
101101
const allStandards = [];
102102
if (selectedTemplate.standards) {
103103
Object.entries(selectedTemplate.standards).forEach(([standardKey, standardConfig]) => {
104-
const standardId = `standards.${standardKey}`;
105-
const standardInfo = standards.find((s) => s.name === standardId);
106-
const standardSettings = standardConfig.standards?.[standardKey] || {};
107-
108-
// Find the tenant's value for this standard
109-
const currentTenantStandard = currentTenantData.find(
110-
(s) => s.standardId === standardId
111-
);
112-
113-
// Determine compliance status
114-
let isCompliant = false;
115-
116-
// Check if the standard is directly in the tenant object (like "standards.AuditLog": true)
117-
const standardIdWithoutPrefix = standardId.replace("standards.", "");
118-
const directStandardValue = currentTenantObj?.[standardId];
119-
120-
// Special case for boolean standards that are true in the tenant
121-
if (directStandardValue === true) {
122-
// If the standard is directly in the tenant and is true, it's compliant
123-
isCompliant = true;
124-
} else if (directStandardValue !== undefined) {
125-
// For non-boolean values, use strict equality
126-
isCompliant =
127-
JSON.stringify(directStandardValue) === JSON.stringify(standardSettings);
128-
} else if (currentTenantStandard) {
129-
// Fall back to the previous logic if the standard is not directly in the tenant object
130-
if (typeof standardSettings === "boolean" && standardSettings === true) {
131-
isCompliant = currentTenantStandard.value === true;
132-
} else {
104+
// Special handling for IntuneTemplate which is an array of items
105+
if (standardKey === "IntuneTemplate" && Array.isArray(standardConfig)) {
106+
// Process each IntuneTemplate item separately
107+
standardConfig.forEach((templateItem, index) => {
108+
const templateId = templateItem.TemplateList?.value;
109+
if (templateId) {
110+
const standardId = `standards.IntuneTemplate.${templateId}`;
111+
const standardInfo = standards.find((s) => s.name === `standards.IntuneTemplate`);
112+
113+
// Find the tenant's value for this specific template
114+
const currentTenantStandard = currentTenantData.find(
115+
(s) => s.standardId === standardId
116+
);
117+
118+
// Get the direct standard value from the tenant object
119+
const directStandardValue = currentTenantObj?.[standardId];
120+
121+
// Determine compliance status
122+
let isCompliant = false;
123+
124+
// For IntuneTemplate, the value is true if compliant, or an object with comparison data if not compliant
125+
if (directStandardValue === true) {
126+
isCompliant = true;
127+
} else if (
128+
directStandardValue !== undefined &&
129+
typeof directStandardValue !== "object"
130+
) {
131+
isCompliant = true;
132+
} else if (currentTenantStandard) {
133+
isCompliant = currentTenantStandard.value === true;
134+
}
135+
136+
// Create a standardValue object that contains the template settings
137+
const templateSettings = {
138+
templateId,
139+
Template: templateItem.TemplateList?.label || "Unknown Template",
140+
"Assign to": templateItem.AssignTo || "On",
141+
"Excluded Group": templateItem.excludeGroup || "",
142+
"Included Group": templateItem.customGroup || "",
143+
};
144+
145+
allStandards.push({
146+
standardId,
147+
standardName: `IntuneTemplate: ${
148+
templateItem.TemplateList?.label || templateId
149+
}`,
150+
currentTenantValue:
151+
directStandardValue !== undefined
152+
? directStandardValue
153+
: currentTenantStandard?.value,
154+
standardValue: templateSettings, // Use the template settings object instead of true
155+
complianceStatus: isCompliant ? "Compliant" : "Non-Compliant",
156+
complianceDetails:
157+
standardInfo?.docsDescription || standardInfo?.helpText || "",
158+
standardDescription: standardInfo?.helpText || "",
159+
standardImpact: standardInfo?.impact || "Medium Impact",
160+
standardImpactColour: standardInfo?.impactColour || "warning",
161+
templateName: selectedTemplate?.templateName || "Standard Template",
162+
templateActions: templateItem.action || [],
163+
});
164+
}
165+
});
166+
} else {
167+
// Regular handling for other standards
168+
const standardId = `standards.${standardKey}`;
169+
const standardInfo = standards.find((s) => s.name === standardId);
170+
const standardSettings = standardConfig.standards?.[standardKey] || {};
171+
172+
// Find the tenant's value for this standard
173+
const currentTenantStandard = currentTenantData.find(
174+
(s) => s.standardId === standardId
175+
);
176+
177+
// Determine compliance status
178+
let isCompliant = false;
179+
180+
// Check if the standard is directly in the tenant object (like "standards.AuditLog": true)
181+
const standardIdWithoutPrefix = standardId.replace("standards.", "");
182+
const directStandardValue = currentTenantObj?.[standardId];
183+
184+
// Special case for boolean standards that are true in the tenant
185+
if (directStandardValue === true) {
186+
// If the standard is directly in the tenant and is true, it's compliant
187+
isCompliant = true;
188+
} else if (directStandardValue !== undefined) {
189+
// For non-boolean values, use strict equality
133190
isCompliant =
134-
JSON.stringify(currentTenantStandard.value) === JSON.stringify(standardSettings);
191+
JSON.stringify(directStandardValue) === JSON.stringify(standardSettings);
192+
} else if (currentTenantStandard) {
193+
// Fall back to the previous logic if the standard is not directly in the tenant object
194+
if (typeof standardSettings === "boolean" && standardSettings === true) {
195+
isCompliant = currentTenantStandard.value === true;
196+
} else {
197+
isCompliant =
198+
JSON.stringify(currentTenantStandard.value) ===
199+
JSON.stringify(standardSettings);
200+
}
135201
}
136-
}
137202

138-
// Use the direct standard value from the tenant object if it exists
139-
140-
allStandards.push({
141-
standardId,
142-
standardName: standardId || standardKey,
143-
currentTenantValue:
144-
directStandardValue !== undefined
145-
? directStandardValue
146-
: currentTenantStandard?.value,
147-
standardValue: standardSettings,
148-
complianceStatus: isCompliant ? "Compliant" : "Non-Compliant",
149-
complianceDetails: standardInfo?.docsDescription || standardInfo?.helpText || "",
150-
standardDescription: standardInfo?.helpText || "",
151-
standardImpact: standardInfo?.impact || "Medium Impact",
152-
standardImpactColour: standardInfo?.impactColour || "warning",
153-
templateName: selectedTemplate.templateName || "Standard Template",
154-
templateActions: standardConfig.action || [],
155-
});
203+
// Use the direct standard value from the tenant object if it exists
204+
allStandards.push({
205+
standardId,
206+
standardName: standardId || standardKey,
207+
currentTenantValue:
208+
directStandardValue !== undefined
209+
? directStandardValue
210+
: currentTenantStandard?.value,
211+
standardValue: standardSettings,
212+
complianceStatus: isCompliant ? "Compliant" : "Non-Compliant",
213+
complianceDetails: standardInfo?.docsDescription || standardInfo?.helpText || "",
214+
standardDescription: standardInfo?.helpText || "",
215+
standardImpact: standardInfo?.impact || "Medium Impact",
216+
standardImpactColour: standardInfo?.impactColour || "warning",
217+
templateName: selectedTemplate.templateName || "Standard Template",
218+
templateActions: standardConfig.action || [],
219+
});
220+
}
156221
});
157222
}
158223

@@ -193,8 +258,8 @@ const Page = () => {
193258
<Stack direction="row" alignItems="space-between" spacing={2}>
194259
<Typography variant="h4" width={"100%"}>
195260
{
196-
templateDetails?.data?.filter((template) => template.GUID === templateId)[0]
197-
.templateName
261+
templateDetails?.data?.filter((template) => template.GUID === templateId)?.[0]
262+
?.templateName
198263
}
199264
</Typography>
200265
<Tooltip title="Refresh Data">
@@ -220,8 +285,8 @@ const Page = () => {
220285
</Stack>
221286
)}
222287
</Stack>
223-
{templateDetails?.data?.filter((template) => template.GUID === templateId)[0]
224-
.description && (
288+
{templateDetails?.data?.filter((template) => template.GUID === templateId)?.[0]
289+
?.description && (
225290
<Box
226291
sx={{
227292
"& a": {

0 commit comments

Comments
 (0)