Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename policy and ruleset into policy attachment and policy #897

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import KeyManagers from 'AppComponents/KeyManagers';
import AiVendors from 'AppComponents/AiVendors';
import ListRoles from 'AppComponents//RolePermissions/ListRoles.jsx';
import TenantConfSave from 'AppComponents/AdvancedSettings/TenantConfSave';
import PolicyAttachments from 'AppComponents/Governance/PolicyAttachments';
import Policies from 'AppComponents/Governance/Policies';
import RulesetCatalog from 'AppComponents/Governance/RulesetCatalog';
import Overview from 'AppComponents/Governance/Overview';
import BusinessIcon from '@mui/icons-material/Business';
import Organizations from 'AppComponents/Organizations/ListOrganizations';
Expand All @@ -48,7 +48,6 @@ import GamesIcon from '@mui/icons-material/Games';
import CategoryIcon from '@mui/icons-material/Category';
import BookmarksIcon from '@mui/icons-material/Bookmarks';
import PolicyIcon from '@mui/icons-material/Policy';
import RuleIcon from '@mui/icons-material/Rule';
import BarChartIcon from '@mui/icons-material/BarChart';
import BlockIcon from '@mui/icons-material/Block';
import AssignmentIcon from '@mui/icons-material/Assignment';
Expand Down Expand Up @@ -310,24 +309,24 @@ const RouteMenuMapping = (intl) => [
icon: <BarChartIcon />,
},
{
id: 'Policies',
id: 'Policy Attachments',
displayText: intl.formatMessage({
id: 'Base.RouteMenuMapping.governance.policies',
defaultMessage: 'Policies',
id: 'Base.RouteMenuMapping.governance.policyAttachments',
defaultMessage: 'Policy Attachments',
}),
path: '/governance/policies',
component: Policies,
path: '/governance/policy-attachments',
component: PolicyAttachments,
icon: <PolicyIcon />,
},
{
id: 'Ruleset Catalog',
id: 'Policies',
displayText: intl.formatMessage({
id: 'Base.RouteMenuMapping.ruleset.catalog',
defaultMessage: 'Ruleset Catalog',
id: 'Base.RouteMenuMapping.policies',
defaultMessage: 'Policies',
}),
path: '/governance/ruleset-catalog',
component: RulesetCatalog,
icon: <RuleIcon />,
path: '/governance/policies',
component: Policies,
icon: <PolicyIcon />,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import { FormattedMessage, useIntl } from 'react-intl';
import DonutChart from 'AppComponents/Shared/DonutChart';
import HourglassEmptyIcon from '@mui/icons-material/HourglassEmpty';
import RuleViolationSummary from './RuleViolationSummary';
import RulesetAdherenceSummaryTable from './RulesetAdherenceSummaryTable';
import PolicyAdherenceSummaryTable from './PolicyAdherenceSummaryTable';
import PolicyAttachmentAdherenceSummaryTable from './PolicyAttachmentAdherenceSummaryTable';

export default function Compliance(props) {
const intl = useIntl();
Expand All @@ -47,19 +47,19 @@ export default function Compliance(props) {
.then((response) => {
setArtifactName(response.body.info.name);
setComplianceStatus(response.body.status);
const rulesetMap = new Map();
const policyMap = new Map();

response.body.governedPolicies.forEach((policy) => {
policy.rulesetValidationResults.forEach((result) => {
// If ruleset not in map or if existing result is older, update the map
if (!rulesetMap.has(result.id)) {
rulesetMap.set(result.id, result);
response.body.governedPolicyAttachments.forEach((policyAttachment) => {
policyAttachment.policyValidationResults.forEach((result) => {
// If policy not in map or if existing result is older, update the map
if (!policyMap.has(result.id)) {
policyMap.set(result.id, result);
}
});
});

// Count statuses from unique rulesets
const counts = Array.from(rulesetMap.values()).reduce((acc, result) => {
// Count statuses from unique policies
const counts = Array.from(policyMap.values()).reduce((acc, result) => {
if (result.status === 'PASSED') acc.passed += 1;
if (result.status === 'FAILED') acc.failed += 1;
return acc;
Expand All @@ -69,7 +69,7 @@ export default function Compliance(props) {
})
.catch((error) => {
if (!abortController.signal.aborted) {
console.error('Error fetching ruleset adherence data:', error);
console.error('Error fetching policy adherence data:', error);
setStatusCounts({ passed: 0, failed: 0 });
setArtifactName('');
}
Expand Down Expand Up @@ -187,7 +187,7 @@ export default function Compliance(props) {
</Card>
</Grid>

{/* Policy Adherence Summary section */}
{/* Policy Attachment Adherence Summary section */}
<Grid item xs={12}>
<Card
elevation={3}
Expand All @@ -203,16 +203,16 @@ export default function Compliance(props) {
sx={{ fontWeight: 'bold', mb: 2 }}
>
<FormattedMessage
id='Governance.Overview.Compliance.policy.adherence.summary'
defaultMessage='Policy Adherence Summary'
id='Governance.Overview.Compliance.policyAttachment.adherence.summary'
defaultMessage='Policy Attachment Adherence Summary'
/>
</Typography>
<PolicyAdherenceSummaryTable artifactId={artifactId} />
<PolicyAttachmentAdherenceSummaryTable artifactId={artifactId} />
</CardContent>
</Card>
</Grid>

{/* Ruleset Adherence Summary section */}
{/* Policy Adherence Summary section */}
<Grid item xs={12} md={4}>
<Card elevation={3}>
<CardContent>
Expand All @@ -221,8 +221,8 @@ export default function Compliance(props) {
sx={{ fontWeight: 'bold', mb: 2 }}
>
<FormattedMessage
id='Governance.Overview.Compliance.ruleset.adherence'
defaultMessage='Ruleset Adherence'
id='Governance.Overview.Compliance.policy.adherence'
defaultMessage='Policy Adherence'
/>
</Typography>
<DonutChart
Expand Down Expand Up @@ -265,11 +265,11 @@ export default function Compliance(props) {
sx={{ fontWeight: 'bold', mb: 2 }}
>
<FormattedMessage
id='Governance.Overview.Compliance.ruleset.adherence.summary'
defaultMessage='Ruleset Adherence Summary'
id='Governance.Overview.Compliance.policy.adherence.summary'
defaultMessage='Policy Adherence Summary'
/>
</Typography>
<RulesetAdherenceSummaryTable artifactId={artifactId} />
<PolicyAdherenceSummaryTable artifactId={artifactId} />
</CardContent>
</Card>
</Grid>
Expand Down
Loading