Commit da361e4 1 parent adee9dc commit da361e4 Copy full SHA for da361e4
File tree 4 files changed +52
-8
lines changed
4 files changed +52
-8
lines changed Original file line number Diff line number Diff line change @@ -2486,6 +2486,22 @@ paths:
2486
2486
description : Check if Editoast is running correctly
2487
2487
/infra/ :
2488
2488
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
2489
2505
responses :
2490
2506
' 200 ' :
2491
2507
content :
@@ -2505,8 +2521,8 @@ paths:
2505
2521
- next
2506
2522
- previous
2507
2523
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
2510
2526
tags :
2511
2527
- infra
2512
2528
post :
Original file line number Diff line number Diff line change @@ -173,10 +173,26 @@ paths:
173
173
get :
174
174
tags :
175
175
- 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
177
193
responses :
178
194
200 :
179
- description : The infra list
195
+ description : The infras list
180
196
content :
181
197
application/json :
182
198
schema :
Original file line number Diff line number Diff line change @@ -24,7 +24,11 @@ const InfraSelectorModal = ({
24
24
const [ filter , setFilter ] = useState ( '' ) ;
25
25
const [ filteredInfrasList , setFilteredInfrasList ] = useState < Infra [ ] > ( [ ] ) ;
26
26
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 } ) ;
28
32
29
33
const debouncedFilter = useDebounce ( filter , 250 ) ;
30
34
Original file line number Diff line number Diff line change @@ -72,7 +72,10 @@ const injectedRtkApi = api
72
72
query : ( ) => ( { url : `/health/` } ) ,
73
73
} ) ,
74
74
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
+ } ) ,
76
79
providesTags : [ 'infra' ] ,
77
80
} ) ,
78
81
postInfra : build . mutation < PostInfraApiResponse , PostInfraApiArg > ( {
@@ -649,13 +652,18 @@ export type GetElectricalProfileSetByIdLevelOrderApiArg = {
649
652
} ;
650
653
export type GetHealthApiResponse = unknown ;
651
654
export type GetHealthApiArg = void ;
652
- export type GetInfraApiResponse = /** status 200 The infra list */ {
655
+ export type GetInfraApiResponse = /** status 200 The infras list */ {
653
656
count : number ;
654
657
next : any ;
655
658
previous : any ;
656
659
results ?: Infra [ ] ;
657
660
} ;
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
+ } ;
659
667
export type PostInfraApiResponse = /** status 201 The created infra */ Infra ;
660
668
export type PostInfraApiArg = {
661
669
/** Name of the infra to create */
You can’t perform that action at this time.
0 commit comments