Skip to content

Commit dd419a2

Browse files
Fix: Copilot suggested fixes
- Pending UI filter now sends only backend-supported CREATED. - Rows-per-page options are centralized in portal/frontend/src/features/consent-registry/constants.ts and reused by both URL parsing and the table. - Revocation dialog fallback strings now match the English i18n resources.
1 parent f541c9d commit dd419a2

5 files changed

Lines changed: 30 additions & 10 deletions

File tree

portal/frontend/src/features/consent-registry/ConsentRegistryPage.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import ConsentApprovalDialog from './components/ConsentApprovalDialog'
2525
import ConsentRegistryFilters from './components/ConsentRegistryFilters'
2626
import ConsentRegistryTable from './components/ConsentRegistryTable'
2727
import ConsentRevocationDialog from './components/ConsentRevocationDialog'
28+
import { CONSENT_REGISTRY_ROWS_PER_PAGE_OPTIONS } from './constants'
2829
import type { ConsentRegistryFilters as ConsentRegistryFiltersModel } from '../../types/consent'
2930
import {
3031
useApproveConsentMutation,
@@ -52,7 +53,6 @@ const FILTER_STATUS_VALUES: ConsentRegistryFiltersModel['status'][] = [
5253
const TABLE_SKELETON_DEBOUNCE_MS = 50
5354
const DEFAULT_PAGE = 0
5455
const DEFAULT_ROWS_PER_PAGE = 10
55-
const ROWS_PER_PAGE_VALUES = [5, 10, 25] as const
5656

5757
function isValidFilterStatus(value: string): value is ConsentRegistryFiltersModel['status'] {
5858
return FILTER_STATUS_VALUES.includes(value as ConsentRegistryFiltersModel['status'])
@@ -84,7 +84,9 @@ function getRowsPerPageFromSearchParams(searchParams: URLSearchParams): number {
8484
const rowsPerPageParam = searchParams.get('rowsPerPage')
8585
const rowsPerPage = rowsPerPageParam ? Number(rowsPerPageParam) : Number.NaN
8686

87-
return ROWS_PER_PAGE_VALUES.includes(rowsPerPage as (typeof ROWS_PER_PAGE_VALUES)[number])
87+
return CONSENT_REGISTRY_ROWS_PER_PAGE_OPTIONS.includes(
88+
rowsPerPage as (typeof CONSENT_REGISTRY_ROWS_PER_PAGE_OPTIONS)[number],
89+
)
8890
? rowsPerPage
8991
: DEFAULT_ROWS_PER_PAGE
9092
}

portal/frontend/src/features/consent-registry/components/ConsentRegistryTable.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { useTranslation } from 'react-i18next'
3333
import { Link as RouterLink, useNavigate } from 'react-router-dom'
3434
import type { ConsentRecord } from '../../../types/consent'
3535
import { formatEpochTimestamp, formatIsoDateTime } from '../../../utils/dateTime'
36+
import { CONSENT_REGISTRY_ROWS_PER_PAGE_OPTIONS } from '../constants'
3637
import { getConsentStatusChipColor, getConsentStatusLabelKey } from '../utils/statusChip'
3738

3839
interface ConsentRegistryTableProps {
@@ -150,8 +151,6 @@ function ConsentRegistryTable({
150151
}))
151152
}, [sortedRows])
152153

153-
const rowsPerPageOptions: number[] = [5, 10, 25]
154-
155154
const selectedRowIds: readonly string[] = []
156155
const isPurposesPopoverOpen = Boolean(purposesPopoverAnchor)
157156

@@ -488,7 +487,7 @@ function ConsentRegistryTable({
488487
count={totalCount}
489488
page={page}
490489
rowsPerPage={rowsPerPage}
491-
rowsPerPageOptions={rowsPerPageOptions}
490+
rowsPerPageOptions={[...CONSENT_REGISTRY_ROWS_PER_PAGE_OPTIONS]}
492491
onPageChange={(_, nextPage) => {
493492
onPageChange(nextPage)
494493
}}

portal/frontend/src/features/consent-registry/components/ConsentRevocationDialog.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function ConsentRevocationDialog({
7575
<Typography variant="body2" color="text.secondary">
7676
{t(
7777
'consentRegistry.modals.revocation.message',
78-
'Are you sure you want to revoke all data permissions?',
78+
'Are you sure you want to revoke consent?',
7979
)}
8080
</Typography>
8181
<Typography variant="caption" color="text.secondary" sx={{ fontWeight: 300 }}>
@@ -116,7 +116,7 @@ function ConsentRevocationDialog({
116116
<Typography variant="body2" color="text.secondary">
117117
{t(
118118
'consentRegistry.modals.revocation.note',
119-
'This action revokes both mandatory and optional data permissions for this consent.',
119+
'This action revokes both mandatory and optional consents granted for all associated purposes.',
120120
)}
121121
</Typography>
122122
</Box>
@@ -137,10 +137,10 @@ function ConsentRevocationDialog({
137137
<Button fullWidth color="error" variant="contained" disabled={loading} onClick={onConfirm}>
138138
{loading
139139
? t('consentRegistry.modals.actions.processing', 'Processing...')
140-
: t('consentRegistry.modals.revocation.confirm', 'Revoke All Data')}
140+
: t('consentRegistry.modals.revocation.confirm', 'Revoke Consents')}
141141
</Button>
142142
<Button fullWidth variant="outlined" disabled={loading} onClick={onClose}>
143-
{t('consentRegistry.modals.revocation.cancel', 'Keep Permissions')}
143+
{t('consentRegistry.modals.revocation.cancel', 'Cancel')}
144144
</Button>
145145
</DialogActions>
146146
</Dialog>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3+
*
4+
* WSO2 LLC. licenses this file to you under the Apache License,
5+
* Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an
13+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
* KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations
16+
* under the License.
17+
*/
18+
19+
export const CONSENT_REGISTRY_ROWS_PER_PAGE_OPTIONS = [5, 10, 25] as const

portal/frontend/src/features/consent-registry/hooks/useConsentQueries.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function toListParams(
6565
): ConsentListQueryParams {
6666
const statusFilterMap: Record<Exclude<ConsentRegistryFilters['status'], 'All'>, string> = {
6767
Active: 'ACTIVE',
68-
Pending: 'CREATED,PENDING',
68+
Pending: 'CREATED',
6969
Rejected: 'REJECTED',
7070
Revoked: 'REVOKED',
7171
Expired: 'EXPIRED',

0 commit comments

Comments
 (0)