Skip to content

Commit 54aaf90

Browse files
authored
policy csv out fix (stolostron#3785)
Signed-off-by: Randy Bruno Piverger <rbrunopi@redhat.com>
1 parent 6bdfd9f commit 54aaf90

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

frontend/src/routes/Governance/policies/Policies.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
Stack,
1717
StackItem,
1818
} from '@patternfly/react-core'
19+
import moment from 'moment'
1920
import { fitContent } from '@patternfly/react-table'
2021
import {
2122
AcmAlert,
@@ -258,7 +259,10 @@ export default function PoliciesPage() {
258259
order: 8,
259260
isDefault: false,
260261
exportContent: (item) => {
261-
return item.source ? item.source : '-'
262+
const policyAutomationMatch = policyAutomations.find(
263+
(pa: PolicyAutomation) => pa.spec.policyRef === item.policy.metadata.name
264+
)
265+
return policyAutomationMatch?.metadata.name ? policyAutomationMatch?.metadata.name : '-'
262266
},
263267
},
264268
{
@@ -269,6 +273,12 @@ export default function PoliciesPage() {
269273
order: 9,
270274
isDefault: false,
271275
isFirstVisitChecked: false,
276+
exportContent: (item) => {
277+
if (item.policy.metadata?.creationTimestamp) {
278+
return moment(new Date(item.policy.metadata?.creationTimestamp)).fromNow()
279+
}
280+
return '-'
281+
},
272282
},
273283
{
274284
header: '',

0 commit comments

Comments
 (0)