Skip to content

Commit 9f3f8dd

Browse files
committed
Fixes lint
1 parent bb62009 commit 9f3f8dd

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Alert, AlertIcon, Button, DataTable, Result, Skeleton } from '@redpanda
1414
import { SkipIcon } from 'components/icons';
1515
import { useMemo } from 'react';
1616

17-
import { Quota_ValueType } from '../../../protogen/redpanda/api/dataplane/v1/quota_pb';
17+
import { type Quota_Value, Quota_ValueType } from '../../../protogen/redpanda/api/dataplane/v1/quota_pb';
1818
import { listQuotas } from '../../../protogen/redpanda/api/dataplane/v1/quota-QuotaService_connectquery';
1919
import { InfoText } from '../../../utils/tsx-utils';
2020
import { prettyBytes, prettyNumber } from '../../../utils/utils';
@@ -25,17 +25,23 @@ const QuotasList = () => {
2525
const { data, error, isLoading } = useQuery(listQuotas, {});
2626

2727
const quotasData = useMemo(() => {
28-
if (!data?.quotas) return [];
28+
if (!data?.quotas) {
29+
return [];
30+
}
2931

3032
return data.quotas.map((entry) => {
3133
const entityType = entry.entity?.entityType;
3234
const entityName = entry.entity?.entityName;
3335

3436
// Map entity type to display string
3537
let displayType: 'client-id' | 'user' | 'ip' | 'unknown' = 'unknown';
36-
if (entityType === 1) displayType = 'client-id';
37-
else if (entityType === 3) displayType = 'user';
38-
else if (entityType === 4) displayType = 'ip';
38+
if (entityType === 1) {
39+
displayType = 'client-id';
40+
} else if (entityType === 3) {
41+
displayType = 'user';
42+
} else if (entityType === 4) {
43+
displayType = 'ip';
44+
}
3945

4046
return {
4147
eqKey: `${entityType}-${entityName}`,
@@ -57,7 +63,7 @@ const QuotasList = () => {
5763
);
5864
};
5965

60-
const formatRate = (values: (typeof quotasData)[0]['values'], valueType: Quota_ValueType) => {
66+
const formatRate = (values: Quota_Value[], valueType: Quota_ValueType) => {
6167
const value = values.find((v) => v.valueType === valueType)?.value;
6268
return value ? (
6369
prettyNumber(value)
@@ -125,7 +131,7 @@ const QuotasList = () => {
125131
eqKey: string;
126132
entityType: 'client-id' | 'user' | 'ip' | 'unknown';
127133
entityName?: string | undefined;
128-
values: Array<{ valueType: Quota_ValueType; value: number }>;
134+
values: Quota_Value[];
129135
}>
130136
columns={[
131137
{

frontend/src/routes/quotas.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ export const Route = createFileRoute('/quotas')({
2323
});
2424

2525
function QuotasWrapper() {
26-
return <QuotasList matchedPath="/quotas" />;
26+
return <QuotasList />;
2727
}

0 commit comments

Comments
 (0)