Skip to content

Commit f1b37ec

Browse files
authoredAug 20, 2024
Remove details JSON from policy details page (stolostron#3775)
Refs: - https://issues.redhat.com/browse/ACM-13330 Signed-off-by: Justin Kulikauskas <jkulikau@redhat.com>
1 parent 2a6f7cc commit f1b37ec

File tree

2 files changed

+0
-30
lines changed

2 files changed

+0
-30
lines changed
 

‎frontend/src/routes/Governance/policies/policy-details/PolicyTemplateDetails.tsx

-15
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,6 @@ export function PolicyTemplateDetails(
9191
}
9292
}, [])
9393

94-
let details = '-'
95-
if (template?.status?.compliancyDetails) {
96-
details = template?.status?.compliancyDetails
97-
} else if (template?.status?.violations) {
98-
details = template?.status?.violations
99-
} else if (template?.status?.conditions) {
100-
// Find the 'Compliant' condition from the list of conditions
101-
const cond = template.status.conditions.find((c: any) => c.type === 'Compliant')
102-
details = cond?.message || '-'
103-
}
104-
10594
const descriptionItems = [
10695
{
10796
key: t('Name'),
@@ -119,10 +108,6 @@ export function PolicyTemplateDetails(
119108
key: t('API groups'),
120109
value: template?.apiVersion ?? '-',
121110
},
122-
{
123-
key: t('Details'),
124-
value: JSON.stringify(details),
125-
},
126111
]
127112

128113
const relatedResourceColumns = useMemo(

‎frontend/src/routes/Governance/policies/policy-details/PolicyTemplateDetailsPage.test.tsx

-15
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,6 @@ describe('Policy Template Details Page', () => {
345345

346346
await waitForText('test-cluster')
347347
await waitForText('ConfigurationPolicy')
348-
await waitForText(
349-
'[{"Compliant":"Compliant","Validity":{},"conditions":[{"lastTransitionTime":"2022-02-22T13:32:41Z","message":"namespaces [test] found as specified, therefore this Object template is compliant","reason":"K8s `must have` object already exists","status":"True","type":"notification"}]}]'
350-
)
351348

352349
// wait for template yaml to load correctly
353350
await waitForText('ConfigurationPolicy YAML')
@@ -440,9 +437,6 @@ describe('Policy Template Details Page', () => {
440437
// Ensure the hosting cluster name isn't shown as the cluster name
441438
await waitForText(clusterName)
442439
await waitForText('ConfigurationPolicy')
443-
await waitForText(
444-
'[{"Compliant":"Compliant","Validity":{},"conditions":[{"lastTransitionTime":"2022-02-22T13:32:41Z","message":"namespaces [test] found as specified, therefore this Object template is compliant","reason":"K8s `must have` object already exists","status":"True","type":"notification"}]}]'
445-
)
446440
const viewYamlLink = screen.getByText('View YAML')
447441
expect(viewYamlLink.getAttribute('href')).toEqual(
448442
`/multicloud/search/resources/yaml?cluster=${clusterName}&kind=Namespace&apiversion=v1&name=test`
@@ -571,9 +565,6 @@ describe('Policy Template Details Page', () => {
571565
// Verify the template description section
572566
await waitForText('ns-must-have-gk', true)
573567
await waitForText('K8sRequiredLabels')
574-
screen.getByText(
575-
/\[\{"enforcementaction":"warn","group":"","kind":"namespace","message":"you must provide labels: \{\\"gatekeeper\\"\}","name":"default","version":"v1"\},\{"enforcementaction":"warn","group":"","kind":"namespace","message":"you must provide labels: \{\\"gatekeeper\\"\}","name":"default-broker","version":"v1"\}\]/i
576-
)
577568

578569
const row = screen.getByRole('row', {
579570
name: /default-broker - namespace v1 violations you must provide labels: \{"gatekeeper"\} view yaml/i,
@@ -614,9 +605,6 @@ describe('Policy Template Details Page', () => {
614605
// Verify the template description section
615606
await waitForText('oppol-no-group', true)
616607
await waitForText('OperatorPolicy')
617-
screen.getByText(
618-
/Compliant; the OperatorGroup matches what is required by the policy, the Subscription matches what is required by the policy, no InstallPlans requiring approval were found, ClusterServiceVersion - install strategy completed with no errors, all operator Deployments have their minimum availability, CatalogSource was found/i
619-
)
620608

621609
const row = screen.getByRole('row', {
622610
name: /Deployment Available/i,
@@ -766,9 +754,6 @@ describe('Policy Template Details Page', () => {
766754
// Verify the template description section
767755
await waitForText('oppol-no-group', true)
768756
await waitForText('OperatorPolicy')
769-
screen.getByText(
770-
/Compliant; the OperatorGroup matches what is required by the policy, the Subscription matches what is required by the policy, no InstallPlans requiring approval were found, ClusterServiceVersion - install strategy completed with no errors, all operator Deployments have their minimum availability, CatalogSource was found/i
771-
)
772757

773758
// Verify that 'Inapplicable' is displayed for certain relatedObjects
774759
await waitForText('Inapplicable', true)

0 commit comments

Comments
 (0)
Failed to load comments.