Skip to content

Commit da361e4

Browse files
committed
front: fix max infras in the list
1 parent adee9dc commit da361e4

File tree

4 files changed

+52
-8
lines changed

4 files changed

+52
-8
lines changed

editoast/openapi.yaml

+18-2
Original file line numberDiff line numberDiff line change
@@ -2486,6 +2486,22 @@ paths:
24862486
description: Check if Editoast is running correctly
24872487
/infra/:
24882488
get:
2489+
parameters:
2490+
- description: Page number
2491+
in: query
2492+
name: page
2493+
schema:
2494+
default: 1
2495+
minimum: 1
2496+
type: integer
2497+
- description: Number of elements by page
2498+
in: query
2499+
name: page_size
2500+
schema:
2501+
default: 25
2502+
maximum: 10000
2503+
minimum: 1
2504+
type: integer
24892505
responses:
24902506
'200':
24912507
content:
@@ -2505,8 +2521,8 @@ paths:
25052521
- next
25062522
- previous
25072523
type: object
2508-
description: The infra list
2509-
summary: List all available infra
2524+
description: The infras list
2525+
summary: Paginated list of all available infras
25102526
tags:
25112527
- infra
25122528
post:

editoast/openapi_legacy.yaml

+18-2
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,26 @@ paths:
173173
get:
174174
tags:
175175
- infra
176-
summary: List all available infra
176+
summary: Paginated list of all available infras
177+
parameters:
178+
- description: Page number
179+
in: query
180+
name: page
181+
schema:
182+
default: 1
183+
minimum: 1
184+
type: integer
185+
- description: Number of elements by page
186+
in: query
187+
name: page_size
188+
schema:
189+
default: 25
190+
maximum: 10000
191+
minimum: 1
192+
type: integer
177193
responses:
178194
200:
179-
description: The infra list
195+
description: The infras list
180196
content:
181197
application/json:
182198
schema:

front/src/common/InfraSelector/InfraSelectorModal.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ const InfraSelectorModal = ({
2424
const [filter, setFilter] = useState('');
2525
const [filteredInfrasList, setFilteredInfrasList] = useState<Infra[]>([]);
2626
const [editionMode, setEditionMode] = useState(false);
27-
const { data: infrasList, isSuccess, isLoading } = osrdEditoastApi.useGetInfraQuery();
27+
const {
28+
data: infrasList,
29+
isSuccess,
30+
isLoading,
31+
} = osrdEditoastApi.useGetInfraQuery({ pageSize: 1000 });
2832

2933
const debouncedFilter = useDebounce(filter, 250);
3034

front/src/common/api/osrdEditoastApi.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ const injectedRtkApi = api
7272
query: () => ({ url: `/health/` }),
7373
}),
7474
getInfra: build.query<GetInfraApiResponse, GetInfraApiArg>({
75-
query: () => ({ url: `/infra/` }),
75+
query: (queryArg) => ({
76+
url: `/infra/`,
77+
params: { page: queryArg.page, page_size: queryArg.pageSize },
78+
}),
7679
providesTags: ['infra'],
7780
}),
7881
postInfra: build.mutation<PostInfraApiResponse, PostInfraApiArg>({
@@ -649,13 +652,18 @@ export type GetElectricalProfileSetByIdLevelOrderApiArg = {
649652
};
650653
export type GetHealthApiResponse = unknown;
651654
export type GetHealthApiArg = void;
652-
export type GetInfraApiResponse = /** status 200 The infra list */ {
655+
export type GetInfraApiResponse = /** status 200 The infras list */ {
653656
count: number;
654657
next: any;
655658
previous: any;
656659
results?: Infra[];
657660
};
658-
export type GetInfraApiArg = void;
661+
export type GetInfraApiArg = {
662+
/** Page number */
663+
page?: number;
664+
/** Number of elements by page */
665+
pageSize?: number;
666+
};
659667
export type PostInfraApiResponse = /** status 201 The created infra */ Infra;
660668
export type PostInfraApiArg = {
661669
/** Name of the infra to create */

0 commit comments

Comments
 (0)