Skip to content

Commit 833334f

Browse files
committed
Addressed PR comments
1 parent c4812be commit 833334f

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

frontend/src/components/pages/quotas/quotas-list.tsx

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,18 @@
99
* by the Apache License, Version 2.0
1010
*/
1111

12-
import { create } from '@bufbuild/protobuf';
13-
import { useQuery } from '@connectrpc/connect-query';
1412
import { Alert, AlertIcon, Button, DataTable, Result, Skeleton } from '@redpanda-data/ui';
1513
import { useNavigate, useSearch } from '@tanstack/react-router';
1614
import { SkipIcon } from 'components/icons';
17-
import { Link } from 'components/redpanda-ui/components/typography';
15+
import { Link, Text } from 'components/redpanda-ui/components/typography';
1816
import { useMemo } from 'react';
1917

18+
import { useListQuotas } from '../../../hooks/use-list-quotas';
2019
import {
21-
ListQuotasRequestSchema,
2220
Quota_EntityType,
2321
type Quota_Value,
2422
Quota_ValueType,
2523
} from '../../../protogen/redpanda/api/dataplane/v1/quota_pb';
26-
import { listQuotas } from '../../../protogen/redpanda/api/dataplane/v1/quota-QuotaService_connectquery';
27-
import { MAX_PAGE_SIZE } from '../../../react-query/react-query.utils';
2824
import { InfoText } from '../../../utils/tsx-utils';
2925
import { prettyBytes, prettyNumber } from '../../../utils/utils';
3026
import PageContent from '../../misc/page-content';
@@ -47,14 +43,10 @@ const mapEntityTypeToDisplay = (entityType: Quota_EntityType): 'client-id' | 'us
4743
}
4844
};
4945

50-
const request = create(ListQuotasRequestSchema, { pageSize: MAX_PAGE_SIZE });
51-
5246
const QuotasList = () => {
5347
const navigate = useNavigate({ from: '/quotas' });
5448
const search = useSearch({ from: '/quotas' });
55-
const { data, error, isLoading } = useQuery(listQuotas, request, {
56-
refetchOnMount: 'always',
57-
});
49+
const { data, error, isLoading } = useListQuotas();
5850

5951
const quotasData = useMemo(() => {
6052
if (!data?.quotas) {
@@ -107,7 +99,6 @@ const QuotasList = () => {
10799
}
108100

109101
if (error) {
110-
console.error('[QuotasList] Error fetching quotas:', error.message, error);
111102
const isPermissionError = error.message.includes('permission') || error.message.includes('forbidden');
112103

113104
if (isPermissionError) {
@@ -123,11 +114,11 @@ const QuotasList = () => {
123114
status={403}
124115
title="Forbidden"
125116
userMessage={
126-
<p>
117+
<Text>
127118
You are not allowed to view this page.
128119
<br />
129120
Contact the administrator if you think this is an error.
130-
</p>
121+
</Text>
131122
}
132123
/>
133124
</Section>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Copyright 2026 Redpanda Data, Inc.
3+
*
4+
* Use of this software is governed by the Business Source License
5+
* included in the file https://github.com/redpanda-data/redpanda/blob/dev/licenses/bsl.md
6+
*
7+
* As of the Change Date specified in that file, in accordance with
8+
* the Business Source License, use of this software will be governed
9+
* by the Apache License, Version 2.0
10+
*/
11+
12+
import { create } from '@bufbuild/protobuf';
13+
import { useQuery } from '@connectrpc/connect-query';
14+
15+
import { ListQuotasRequestSchema } from '../protogen/redpanda/api/dataplane/v1/quota_pb';
16+
import { listQuotas } from '../protogen/redpanda/api/dataplane/v1/quota-QuotaService_connectquery';
17+
import { MAX_PAGE_SIZE } from '../react-query/react-query.utils';
18+
19+
const request = create(ListQuotasRequestSchema, { pageSize: MAX_PAGE_SIZE });
20+
21+
export const useListQuotas = () =>
22+
useQuery(listQuotas, request, {
23+
refetchOnMount: 'always',
24+
});

0 commit comments

Comments
 (0)