Skip to content

Commit 0955dd6

Browse files
Fix i18next issues in governance page (stolostron#3477)
Signed-off-by: yiraeChristineKim <yikim@redhat.com>
1 parent 2e6bfdc commit 0955dd6

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export default function PoliciesPage() {
164164
const statusB = itemB.policy.spec.disabled === true ? t('Disabled') : t('Enabled')
165165
return compareStrings(statusA, statusB)
166166
},
167-
cell: handleStatusCell,
167+
cell: (item: PolicyTableItem) => handleStatusCell(item, t),
168168
id: 'status',
169169
order: 3,
170170
isDefault: false,
@@ -249,7 +249,8 @@ export default function PoliciesPage() {
249249
unauthorizedMessage,
250250
setDrawerContext,
251251
setModal,
252-
canCreatePolicyAutomation
252+
canCreatePolicyAutomation,
253+
t
253254
),
254255
id: 'automation',
255256
order: 8,
@@ -295,7 +296,7 @@ export default function PoliciesPage() {
295296
},
296297
{
297298
header: t('policy.table.actionGroup.status'),
298-
cell: handleActionGroupCell,
299+
cell: (item: PolicyTableItem) => handleActionGroupCell(item, t),
299300
},
300301
],
301302
[t]

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

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { PolicyAutomation, PolicySet } from '../../../resources'
44
import { PolicyTableItem } from './Policies'
55
import { NavigationPath } from '../../../NavigationPath'
66
import { Link } from 'react-router-dom'
7-
import { t } from 'i18next'
87
import { PolicySetList } from '../common/util'
98
import moment from 'moment'
109
import { PolicyActionDropdown } from '../components/PolicyActionDropdown'
1110
import { AcmButton } from '../../../ui-components/AcmButton'
1211
import { AutomationDetailsSidebar } from '../components/AutomationDetailsSidebar'
1312
import { ButtonVariant } from '@patternfly/react-core'
13+
import { TFunction } from 'react-i18next'
1414

1515
export function handleNameCell(item: PolicyTableItem) {
1616
return (
@@ -29,7 +29,7 @@ export function handleNameCell(item: PolicyTableItem) {
2929
)
3030
}
3131

32-
export function handleStatusCell(item: PolicyTableItem) {
32+
export function handleStatusCell(item: PolicyTableItem, t: TFunction<string, undefined>) {
3333
const disabled: string = t('Disabled')
3434
const enabled: string = t('Enabled')
3535
return <span>{item.policy.spec.disabled === true ? disabled : enabled}</span>
@@ -58,7 +58,7 @@ export function handleBtnCell(item: PolicyTableItem, setModal: (modal: React.Rea
5858
return <PolicyActionDropdown setModal={setModal} item={item} isKebab={true} />
5959
}
6060

61-
export function handleActionGroupCell(item: PolicyTableItem) {
61+
export function handleActionGroupCell(item: PolicyTableItem, t: TFunction<string, undefined>) {
6262
const disabled: string = t('policy.table.actionGroup.status.disabled')
6363
const enabled: string = t('policy.table.actionGroup.status.enabled')
6464
return <span>{item.policy.spec.disabled === true ? disabled : enabled}</span>
@@ -71,7 +71,8 @@ export function handleAutomationCell(
7171
unauthorizedMessage: string,
7272
setDrawerContext: any,
7373
setModal: any,
74-
canCreatePolicyAutomation: boolean
74+
canCreatePolicyAutomation: boolean,
75+
t: TFunction<string, undefined>
7576
) {
7677
const policyAutomationMatch = policyAutomations.find(
7778
(pa: PolicyAutomation) => pa.spec.policyRef === item.policy.metadata.name

0 commit comments

Comments
 (0)