Skip to content

Commit 278c641

Browse files
committed
Apply Keith's review changes && fix long group names being truncted
Signed-off-by: Atif Ali <atali@redhat.com>
1 parent 982c393 commit 278c641

File tree

3 files changed

+77
-19
lines changed

3 files changed

+77
-19
lines changed

src/gitops/components/project/ProjectRolesTab.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,23 @@ const formatPolicyDescription = (policy: string, t: (key: string) => string): Re
5252
</div>
5353
<div>
5454
<strong>{t('Policy Effect')}:</strong>{' '}
55-
{effect === 'allow' ? `✅ ${t('Allow')}` : `❌ ${t('Deny')}`}
55+
{effect === 'allow' ? (
56+
<>
57+
<i
58+
className="fas fa-check-circle"
59+
style={{ color: 'var(--pf-v5-global--success-color--100)' }}
60+
/>{' '}
61+
{t('Allow')}
62+
</>
63+
) : (
64+
<>
65+
<i
66+
className="fas fa-times-circle"
67+
style={{ color: 'var(--pf-v5-global--danger-color--100)' }}
68+
/>{' '}
69+
{t('Deny')}
70+
</>
71+
)}
5672
</div>
5773
</div>
5874
);
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.resource-allow-deny-list {
2+
width: 100%;
3+
display: block;
4+
overflow-x: auto;
5+
overflow-y: visible;
6+
7+
table {
8+
width: 100%;
9+
table-layout: auto;
10+
margin-bottom: 0;
11+
}
12+
13+
// Target PatternFly table cells directly - ensure text wraps instead of truncating
14+
tbody td.resource-allow-deny-list__kind,
15+
thead th.resource-allow-deny-list__kind {
16+
min-width: 80px;
17+
max-width: 45%;
18+
word-break: break-word !important;
19+
white-space: normal !important;
20+
overflow-wrap: break-word !important;
21+
overflow: visible !important;
22+
text-overflow: clip !important;
23+
}
24+
25+
tbody td.resource-allow-deny-list__group,
26+
thead th.resource-allow-deny-list__group {
27+
min-width: 120px;
28+
word-break: break-word !important;
29+
white-space: normal !important;
30+
overflow-wrap: break-word !important;
31+
overflow: visible !important;
32+
text-overflow: clip !important;
33+
}
34+
}

src/gitops/components/project/ResourceAllowDenyList.tsx

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import * as React from 'react';
22

3-
import { EmptyState, EmptyStateBody, PageSection } from '@patternfly/react-core';
3+
import { EmptyState, EmptyStateBody } from '@patternfly/react-core';
44
import { CubesIcon } from '@patternfly/react-icons';
55
import { Table, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';
66

77
import { ResourceAllowDeny } from '../../models/AppProjectModel';
88
import { useGitOpsTranslation } from '../../utils/hooks/useGitOpsTranslation';
99

10+
import './ResourceAllowDenyList.scss';
11+
1012
interface ResourceAllowDenyListProps {
1113
list?: ResourceAllowDeny[];
1214
}
@@ -17,30 +19,36 @@ const ResourceAllowDenyList: React.FC<ResourceAllowDenyListProps> = ({ list }) =
1719
const resourceList = list || [];
1820

1921
return (
20-
<PageSection>
22+
<>
2123
{resourceList.length > 0 ? (
22-
<Table aria-label="Resource Allow/Deny table" borders>
23-
<Thead>
24-
<Tr>
25-
<Th>{t('Kind')}</Th>
26-
<Th>{t('Group')}</Th>
27-
</Tr>
28-
</Thead>
29-
<Tbody>
30-
{resourceList.map((resource, index) => (
31-
<Tr key={index}>
32-
<Td dataLabel={t('Kind')}>{resource.kind || '-'}</Td>
33-
<Td dataLabel={t('Group')}>{resource.group || '-'}</Td>
24+
<div className="resource-allow-deny-list">
25+
<Table aria-label="Resource Allow/Deny table" borders>
26+
<Thead>
27+
<Tr>
28+
<Th className="resource-allow-deny-list__kind">{t('Kind')}</Th>
29+
<Th className="resource-allow-deny-list__group">{t('Group')}</Th>
3430
</Tr>
35-
))}
36-
</Tbody>
37-
</Table>
31+
</Thead>
32+
<Tbody>
33+
{resourceList.map((resource, index) => (
34+
<Tr key={index}>
35+
<Td dataLabel={t('Kind')} className="resource-allow-deny-list__kind">
36+
{resource.kind || '-'}
37+
</Td>
38+
<Td dataLabel={t('Group')} className="resource-allow-deny-list__group">
39+
{resource.group || '-'}
40+
</Td>
41+
</Tr>
42+
))}
43+
</Tbody>
44+
</Table>
45+
</div>
3846
) : (
3947
<EmptyState headingLevel="h4" icon={CubesIcon} titleText={t('No resources configured')}>
4048
<EmptyStateBody>{t('This list does not have any resources configured.')}</EmptyStateBody>
4149
</EmptyState>
4250
)}
43-
</PageSection>
51+
</>
4452
);
4553
};
4654

0 commit comments

Comments
 (0)