Skip to content

Commit 4dd09ff

Browse files
ref: STORIF-187 - Pagination removed from quotas.
1 parent bc68b80 commit 4dd09ff

File tree

3 files changed

+7
-52
lines changed

3 files changed

+7
-52
lines changed

packages/manager/src/features/Account/Quotas/QuotasTable/QuotasTable.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Dialog, ErrorState } from '@linode/ui';
22
import { useNavigate } from '@tanstack/react-router';
33
import * as React from 'react';
44

5-
import { PaginationFooter } from 'src/components/PaginationFooter/PaginationFooter';
65
import { Table } from 'src/components/Table/Table';
76
import { TableBody } from 'src/components/TableBody';
87
import { TableCell } from 'src/components/TableCell/TableCell';
@@ -46,16 +45,12 @@ export const QuotasTable = (props: QuotasTableProps) => {
4645

4746
const {
4847
data: quotasWithUsage,
49-
quotas,
5048
errorMessage: quotasErrorMessage,
5149
queries: quotaUsageQueries,
5250
isFetching: isFetchingQuotas,
53-
pagination,
5451
} = useGetQuotas(
5552
selectedLocation?.value,
5653
selectedService.value,
57-
'/quotas',
58-
`${collectionName}-table`,
5954
collectionName,
6055
isGlobalScope ? true : hasSelectedLocation
6156
);
@@ -137,18 +132,6 @@ export const QuotasTable = (props: QuotasTableProps) => {
137132
</TableBody>
138133
</Table>
139134

140-
{selectedLocation && !isFetchingQuotas && (
141-
<PaginationFooter
142-
count={quotas?.results ?? 0}
143-
eventCategory="quotas_table"
144-
handlePageChange={pagination.handlePageChange}
145-
handleSizeChange={pagination.handlePageSizeChange}
146-
page={pagination.page}
147-
pageSize={pagination.pageSize}
148-
sx={{ '&.MuiBox-root': { marginTop: 0 } }}
149-
/>
150-
)}
151-
152135
<Dialog
153136
onClose={() => setSupportModalOpen(false)}
154137
open={supportModalOpen}
Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,19 @@
1-
import { quotaQueries, useQueries, useQuotasQuery } from '@linode/queries';
1+
import { quotaQueries, useAllQuotasQuery, useQueries } from '@linode/queries';
22
import * as React from 'react';
33

44
import {
55
getQuotasFilters,
66
getQuotaVisibilityFilter,
77
} from 'src/features/Account/Quotas/utils';
8-
import { usePaginationV2 } from 'src/hooks/usePaginationV2';
98

109
import type { Filter, QuotaType } from '@linode/api-v4';
11-
import type { ToSubOptions } from '@tanstack/react-router';
1210

1311
export const useGetQuotas = (
1412
selectedLocation: string,
1513
selectedService: QuotaType,
16-
currentRoute: ToSubOptions['to'],
17-
paginationPreferenceKey: string,
1814
collectionName: string,
1915
enabled = true
2016
) => {
21-
const pagination = usePaginationV2({
22-
currentRoute,
23-
initialPage: 1,
24-
preferenceKey: paginationPreferenceKey,
25-
});
26-
2717
const filters: Filter = getQuotasFilters({
2818
location: { label: '', value: selectedLocation },
2919
service: { label: '', value: selectedService },
@@ -36,24 +26,15 @@ export const useGetQuotas = (
3626
error: quotasError,
3727
isError: isQuotasError,
3828
isFetching: isFetchingQuotas,
39-
} = useQuotasQuery(
40-
selectedService,
41-
collectionName,
42-
{
43-
page: pagination.page,
44-
page_size: pagination.pageSize,
45-
},
46-
filters,
47-
enabled
48-
);
29+
} = useAllQuotasQuery(selectedService, collectionName, {}, filters, enabled);
4930

5031
// Quota Usage Queries
5132
// For each quota with has_usage == true,
5233
// fetch the usage in parallel
5334
// This will only fetch for the paginated set
5435
const quotaIdsHavingUsage =
55-
quotas?.data
56-
.filter(
36+
quotas
37+
?.filter(
5738
(quota) => quota.has_usage === true || quota.has_usage === undefined
5839
)
5940
.map((quota) => quota.quota_id) ?? [];
@@ -66,8 +47,8 @@ export const useGetQuotas = (
6647
// Combine the quotas with their usage
6748
const filteredQuotasWithUsage = React.useMemo(
6849
() =>
69-
quotas?.data
70-
.filter((quota) => visiblityFilter.isVisible(quota))
50+
quotas
51+
?.filter((quota) => visiblityFilter.isVisible(quota))
7152
.map((quota, index) => ({
7253
...quota,
7354
usage: quotaUsageQueries?.[index]?.data,
@@ -77,14 +58,12 @@ export const useGetQuotas = (
7758

7859
return {
7960
data: filteredQuotasWithUsage,
80-
quotas,
8161
queries: quotaUsageQueries,
8262
errorMessage:
8363
(quotasError && quotasError[0]?.reason) ||
8464
quotaUsageQueries.find((query) => query.isError)?.error.message,
8565
isError: isQuotasError || quotaUsageQueries.some((query) => query.isError),
8666
isFetching:
8767
isFetchingQuotas || quotaUsageQueries.some((query) => query.isFetching),
88-
pagination,
8968
};
9069
};

packages/manager/src/features/ObjectStorage/SummaryLanding/Partials/EndpointSummaryRow.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,7 @@ export const EndpointSummaryRow = ({ endpoint }: Props) => {
1919
data: quotaWithUsage,
2020
isFetching,
2121
isError,
22-
} = useGetQuotas(
23-
endpoint,
24-
'object-storage',
25-
'/object-storage/summary',
26-
'object-storage-summary-table',
27-
'quotas',
28-
Boolean(endpoint)
29-
);
22+
} = useGetQuotas(endpoint, 'object-storage', 'quotas', Boolean(endpoint));
3023

3124
if (isFetching) {
3225
return <TableRowLoading columns={3} />;

0 commit comments

Comments
 (0)