99 * by the Apache License, Version 2.0
1010 */
1111
12- import { create } from '@bufbuild/protobuf' ;
13- import { useQuery } from '@connectrpc/connect-query' ;
1412import { Alert , AlertIcon , Button , DataTable , Result , Skeleton } from '@redpanda-data/ui' ;
1513import { useNavigate , useSearch } from '@tanstack/react-router' ;
1614import { SkipIcon } from 'components/icons' ;
17- import { Link } from 'components/redpanda-ui/components/typography' ;
15+ import { Link , Text } from 'components/redpanda-ui/components/typography' ;
1816import { useMemo } from 'react' ;
1917
18+ import { useListQuotas } from '../../../hooks/use-list-quotas' ;
2019import {
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' ;
2824import { InfoText } from '../../../utils/tsx-utils' ;
2925import { prettyBytes , prettyNumber } from '../../../utils/utils' ;
3026import 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-
5246const 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 >
0 commit comments