Skip to content

Commit 6c6a98f

Browse files
spacing
1 parent 6b7af64 commit 6c6a98f

File tree

1 file changed

+74
-68
lines changed
  • src/pages/tenant/standards/compare

1 file changed

+74
-68
lines changed

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

Lines changed: 74 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ const Page = () => {
8080

8181
if (selectedTemplate && comparisonApi.isSuccess && comparisonApi.data) {
8282
const tenantData = comparisonApi.data;
83-
83+
8484
// Find the current tenant's data by matching tenantFilter with currentTenant
85-
const currentTenantObj = tenantData.find(t => t.tenantFilter === currentTenant);
85+
const currentTenantObj = tenantData.find((t) => t.tenantFilter === currentTenant);
8686
const currentTenantData = currentTenantObj ? currentTenantObj.standardsResults || [] : [];
87-
87+
8888
const allStandards = [];
8989
if (selectedTemplate.standards) {
9090
Object.entries(selectedTemplate.standards).forEach(([standardKey, standardConfig]) => {
@@ -99,33 +99,38 @@ const Page = () => {
9999

100100
// Determine compliance status
101101
let isCompliant = false;
102-
102+
103103
// Check if the standard is directly in the tenant object (like "standards.AuditLog": true)
104-
const standardIdWithoutPrefix = standardId.replace('standards.', '');
104+
const standardIdWithoutPrefix = standardId.replace("standards.", "");
105105
const directStandardValue = currentTenantObj?.[standardId];
106-
106+
107107
// Special case for boolean standards that are true in the tenant
108108
if (directStandardValue === true) {
109109
// If the standard is directly in the tenant and is true, it's compliant
110110
isCompliant = true;
111111
} else if (directStandardValue !== undefined) {
112112
// For non-boolean values, use strict equality
113-
isCompliant = JSON.stringify(directStandardValue) === JSON.stringify(standardSettings);
113+
isCompliant =
114+
JSON.stringify(directStandardValue) === JSON.stringify(standardSettings);
114115
} else if (currentTenantStandard) {
115116
// Fall back to the previous logic if the standard is not directly in the tenant object
116-
if (typeof standardSettings === 'boolean' && standardSettings === true) {
117+
if (typeof standardSettings === "boolean" && standardSettings === true) {
117118
isCompliant = currentTenantStandard.value === true;
118119
} else {
119-
isCompliant = JSON.stringify(currentTenantStandard.value) === JSON.stringify(standardSettings);
120+
isCompliant =
121+
JSON.stringify(currentTenantStandard.value) === JSON.stringify(standardSettings);
120122
}
121123
}
122124

123125
// Use the direct standard value from the tenant object if it exists
124-
126+
125127
allStandards.push({
126128
standardId,
127129
standardName: standardInfo?.label || standardKey,
128-
currentTenantValue: directStandardValue !== undefined ? directStandardValue : currentTenantStandard?.value,
130+
currentTenantValue:
131+
directStandardValue !== undefined
132+
? directStandardValue
133+
: currentTenantStandard?.value,
129134
standardValue: standardSettings,
130135
complianceStatus: isCompliant ? "Compliant" : "Non-Compliant",
131136
complianceDetails: standardInfo?.docsDescription || standardInfo?.helpText || "",
@@ -396,7 +401,7 @@ const Page = () => {
396401
</Typography>
397402
<Typography variant="body2">
398403
{typeof value === "object" && value !== null
399-
? (value.label || JSON.stringify(value))
404+
? value.label || JSON.stringify(value)
400405
: value === true
401406
? "Enabled"
402407
: value === false
@@ -407,27 +412,27 @@ const Page = () => {
407412
))
408413
) : (
409414
<Typography variant="body2">
410-
{standard.standardValue === true
411-
? (
412-
<Alert severity="success" sx={{ mt: 1 }}>
413-
This setting is configured correctly
414-
</Alert>
415-
)
416-
: standard.standardValue === false
417-
? (
418-
<Alert severity="warning" sx={{ mt: 1 }}>
419-
This setting is not configured correctly
420-
</Alert>
421-
)
422-
: standard.standardValue !== undefined
423-
? typeof standard.standardValue === "object"
424-
? "No settings configured"
425-
: String(standard.standardValue)
426-
: (
427-
<Alert severity="info" sx={{ mt: 1 }}>
428-
This setting is not configured, or data has not been collected. If you are getting this after data collection, the tenant might not be licensed for this feature
429-
</Alert>
430-
)}
415+
{standard.standardValue === true ? (
416+
<Alert severity="success" sx={{ mt: 1 }}>
417+
This setting is configured correctly
418+
</Alert>
419+
) : standard.standardValue === false ? (
420+
<Alert severity="warning" sx={{ mt: 1 }}>
421+
This setting is not configured correctly
422+
</Alert>
423+
) : standard.standardValue !== undefined ? (
424+
typeof standard.standardValue === "object" ? (
425+
"No settings configured"
426+
) : (
427+
String(standard.standardValue)
428+
)
429+
) : (
430+
<Alert severity="info" sx={{ mt: 1 }}>
431+
This setting is not configured, or data has not been collected.
432+
If you are getting this after data collection, the tenant might
433+
not be licensed for this feature
434+
</Alert>
435+
)}
431436
</Typography>
432437
)}
433438
</Box>
@@ -547,23 +552,27 @@ const Page = () => {
547552
<Typography
548553
variant="body2"
549554
sx={{
550-
color: standard.complianceStatus === "Compliant"
551-
? "success.main"
552-
: (isDifferent ? "error.main" : "inherit"),
553-
fontWeight: standard.complianceStatus !== "Compliant" && isDifferent
554-
? "medium"
555-
: "inherit",
555+
color:
556+
standard.complianceStatus === "Compliant"
557+
? "success.main"
558+
: isDifferent
559+
? "error.main"
560+
: "inherit",
561+
fontWeight:
562+
standard.complianceStatus !== "Compliant" && isDifferent
563+
? "medium"
564+
: "inherit",
556565
}}
557566
>
558567
{standard.complianceStatus === "Compliant" && value === true
559568
? "Compliant"
560-
: (typeof value === "object" && value !== null
561-
? (value.label || JSON.stringify(value))
562-
: value === true
563-
? "Enabled"
564-
: value === false
565-
? "Disabled"
566-
: String(value))}
569+
: typeof value === "object" && value !== null
570+
? value.label || JSON.stringify(value)
571+
: value === true
572+
? "Enabled"
573+
: value === false
574+
? "Disabled"
575+
: String(value)}
567576
</Typography>
568577
</Box>
569578
);
@@ -579,30 +588,27 @@ const Page = () => {
579588
? "success.main"
580589
: "error.main",
581590
fontWeight:
582-
standard.complianceStatus !== "Compliant"
583-
? "medium"
584-
: "inherit",
591+
standard.complianceStatus !== "Compliant" ? "medium" : "inherit",
585592
}}
586593
>
587-
{standard.complianceStatus === "Compliant" && standard.currentTenantValue === true
588-
? (
589-
<Alert severity="success" sx={{ mt: 1 }}>
590-
This setting is configured correctly
591-
</Alert>
592-
)
593-
: standard.currentTenantValue === false
594-
? (
595-
<Alert severity="warning" sx={{ mt: 1 }}>
596-
This setting is not configured correctly
597-
</Alert>
598-
)
599-
: (standard.currentTenantValue !== undefined
600-
? String(standard.currentTenantValue)
601-
: (
602-
<Alert severity="info" sx={{ mt: 1 }}>
603-
This setting is not configured, or data has not been collected. If you are getting this after data collection, the tenant might not be licensed for this feature
604-
</Alert>
605-
))}
594+
{standard.complianceStatus === "Compliant" &&
595+
standard.currentTenantValue === true ? (
596+
<Alert severity="success" sx={{ mt: 1 }}>
597+
This setting is configured correctly
598+
</Alert>
599+
) : standard.currentTenantValue === false ? (
600+
<Alert severity="warning" sx={{ mt: 1 }}>
601+
This setting is not configured correctly
602+
</Alert>
603+
) : standard.currentTenantValue !== undefined ? (
604+
String(standard.currentTenantValue)
605+
) : (
606+
<Alert severity="info" sx={{ mt: 1 }}>
607+
This setting is not configured, or data has not been collected. If you
608+
are getting this after data collection, the tenant might not be licensed
609+
for this feature
610+
</Alert>
611+
)}
606612
</Typography>
607613
)}
608614
</Box>

0 commit comments

Comments
 (0)