@@ -98,14 +98,34 @@ const Page = () => {
9898 ) ;
9999
100100 // Determine compliance status
101- const isCompliant =
102- currentTenantStandard &&
103- JSON . stringify ( currentTenantStandard . value ) === JSON . stringify ( standardSettings ) ;
101+ let isCompliant = false ;
102+
103+ // Check if the standard is directly in the tenant object (like "standards.AuditLog": true)
104+ const standardIdWithoutPrefix = standardId . replace ( 'standards.' , '' ) ;
105+ const directStandardValue = currentTenantObj ?. [ standardId ] ;
106+
107+ // Special case for boolean standards that are true in the tenant
108+ if ( directStandardValue === true ) {
109+ // If the standard is directly in the tenant and is true, it's compliant
110+ isCompliant = true ;
111+ } else if ( directStandardValue !== undefined ) {
112+ // For non-boolean values, use strict equality
113+ isCompliant = JSON . stringify ( directStandardValue ) === JSON . stringify ( standardSettings ) ;
114+ } else if ( currentTenantStandard ) {
115+ // Fall back to the previous logic if the standard is not directly in the tenant object
116+ if ( typeof standardSettings === 'boolean' && standardSettings === true ) {
117+ isCompliant = currentTenantStandard . value === true ;
118+ } else {
119+ isCompliant = JSON . stringify ( currentTenantStandard . value ) === JSON . stringify ( standardSettings ) ;
120+ }
121+ }
104122
123+ // Use the direct standard value from the tenant object if it exists
124+
105125 allStandards . push ( {
106126 standardId,
107127 standardName : standardInfo ?. label || standardKey ,
108- currentTenantValue : currentTenantStandard ?. value ,
128+ currentTenantValue : directStandardValue !== undefined ? directStandardValue : currentTenantStandard ?. value ,
109129 standardValue : standardSettings ,
110130 complianceStatus : isCompliant ? "Compliant" : "Non-Compliant" ,
111131 complianceDetails : standardInfo ?. docsDescription || standardInfo ?. helpText || "" ,
@@ -375,8 +395,8 @@ const Page = () => {
375395 { key } :
376396 </ Typography >
377397 < Typography variant = "body2" >
378- { typeof value === "object"
379- ? value . label || JSON . stringify ( value )
398+ { typeof value === "object" && value !== null
399+ ? ( value . label || JSON . stringify ( value ) )
380400 : value === true
381401 ? "Enabled"
382402 : value === false
@@ -511,17 +531,23 @@ const Page = () => {
511531 < Typography
512532 variant = "body2"
513533 sx = { {
514- color : isDifferent ? "error.main" : "inherit" ,
515- fontWeight : isDifferent ? "medium" : "inherit" ,
534+ color : standard . complianceStatus === "Compliant"
535+ ? "success.main"
536+ : ( isDifferent ? "error.main" : "inherit" ) ,
537+ fontWeight : standard . complianceStatus !== "Compliant" && isDifferent
538+ ? "medium"
539+ : "inherit" ,
516540 } }
517541 >
518- { typeof value === "object"
519- ? value . label || JSON . stringify ( value )
520- : value === true
521- ? "Enabled"
522- : value === false
523- ? "Disabled"
524- : String ( value ) }
542+ { standard . complianceStatus === "Compliant" && value === true
543+ ? "Compliant"
544+ : ( typeof value === "object" && value !== null
545+ ? ( value . label || JSON . stringify ( value ) )
546+ : value === true
547+ ? "Enabled"
548+ : value === false
549+ ? "Disabled"
550+ : String ( value ) ) }
525551 </ Typography >
526552 </ Box >
527553 ) ;
@@ -533,18 +559,20 @@ const Page = () => {
533559 sx = { {
534560 whiteSpace : "pre-wrap" ,
535561 color :
536- standard . currentTenantValue !== standard . standardValue
537- ? "error .main"
538- : "inherit " ,
562+ standard . complianceStatus === "Compliant"
563+ ? "success .main"
564+ : "error.main " ,
539565 fontWeight :
540- standard . currentTenantValue !== standard . standardValue
566+ standard . complianceStatus !== "Compliant"
541567 ? "medium"
542568 : "inherit" ,
543569 } }
544570 >
545- { standard . currentTenantValue !== undefined
546- ? String ( standard . currentTenantValue )
547- : "Not configured" }
571+ { standard . complianceStatus === "Compliant" && standard . currentTenantValue === true
572+ ? "Compliant"
573+ : ( standard . currentTenantValue !== undefined
574+ ? String ( standard . currentTenantValue )
575+ : "Not configured" ) }
548576 </ Typography >
549577 ) }
550578 </ Box >
0 commit comments