@@ -183,42 +183,63 @@ export const Table: React.FC<TableProps> = ({
183183 // console.log(check, '333');
184184 useEffect ( ( ) => {
185185 // console.log(locationPath.pathname.split('/')[4], 'locationPath1');
186- setItemPerPage ( DEFAULT_ITEMS_PER_PAGE ) ;
186+ setItemPerPage ( itemPerPage ) ;
187+ if ( filters ) {
188+ setPageIndex ( 0 ) ;
189+ }
187190 switch ( componentName ) {
188191 case 'stacks' :
189192 if ( CheckIfRun ) {
190- dispatchStackRunsData ( id , 1 , 5 , filters as any , activeSorting ) ;
193+ dispatchStackRunsData (
194+ id ,
195+ 1 ,
196+ itemPerPage ,
197+ filters as any ,
198+ activeSorting ,
199+ ) ;
191200 break ;
192201 } else {
193- dispatchStackData ( 1 , 5 , filters as any , activeSorting ) ;
202+ dispatchStackData ( 1 , itemPerPage , filters as any , activeSorting ) ;
194203 break ;
195204 }
196205 case 'components' :
197206 if ( CheckIfRun ) {
198207 dispatchStackComponentRunsData (
199208 id ,
200209 1 ,
201- 5 ,
210+ itemPerPage ,
202211 filters as any ,
203212 activeSorting ,
204213 ) ;
205214 break ;
206215 } else {
207- dispatchStackComponentsData ( 1 , 5 , filters as any , activeSorting ) ;
216+ dispatchStackComponentsData (
217+ 1 ,
218+ itemPerPage ,
219+ filters as any ,
220+ activeSorting ,
221+ ) ;
208222 break ;
209223 }
210224 case 'pipelines' :
211225 if ( CheckIfRun ) {
212- dispatchPipelineRunsData ( id , 1 , 5 , filters as any , activeSorting ) ;
226+ dispatchPipelineRunsData (
227+ id ,
228+ 1 ,
229+ itemPerPage ,
230+ filters as any ,
231+ activeSorting ,
232+ ) ;
213233 break ;
214234 } else {
235+ console . log ( itemPerPage , 'itemPerPage' ) ;
215236 if ( ! renderAfterRow ) break ;
216- dispatchPipelineData ( 1 , 5 , filters as any , activeSorting ) ;
237+ dispatchPipelineData ( 1 , itemPerPage , filters as any , activeSorting ) ;
217238 break ;
218239 }
219240
220241 case 'all-runs' :
221- dispatchAllrunsData ( 1 , 5 , filters as any , activeSorting ) ;
242+ dispatchAllrunsData ( 1 , itemPerPage , filters as any , activeSorting ) ;
222243 break ;
223244
224245 default :
@@ -252,7 +273,7 @@ export const Table: React.FC<TableProps> = ({
252273 < tr className = { showHeader ? styles . tableHeaderRow : '' } >
253274 { headerCols . map ( ( headerCol : HeaderCol , index : number , i ) => (
254275 < th
255- className = { styles . tableHeadingTh }
276+ className = { styles . tableHeadingTh }
256277 style = { {
257278 width : headerCol . width ,
258279 color : '#424240' ,
@@ -261,8 +282,12 @@ export const Table: React.FC<TableProps> = ({
261282 } }
262283 key = { index }
263284 >
264- < Box style = { { backgroundColor : '#f6f67' } } paddingVertical = { showHeader ? 'sm' : null } paddingLeft = "lg" >
265- { headerCol . render && headerCol . render ( ) }
285+ < Box
286+ style = { { backgroundColor : '#f6f67' } }
287+ paddingVertical = { showHeader ? 'sm' : null }
288+ paddingLeft = "lg"
289+ >
290+ { headerCol . render && headerCol . render ( ) }
266291 </ Box >
267292 </ th >
268293 ) ) }
@@ -284,7 +309,9 @@ export const Table: React.FC<TableProps> = ({
284309 styles . tableRow ,
285310 trOnClick && styles . clickableTableRow ,
286311 ) }
287- style = { { backgroundColor : index % 2 !== 0 ? '#F5F3F9' : 'white' } }
312+ style = { {
313+ backgroundColor : index % 2 !== 0 ? '#F5F3F9' : 'white' ,
314+ } }
288315 key = { index }
289316 >
290317 { headerCols . map ( ( headerCol : HeaderCol , index : number ) => (
@@ -295,7 +322,7 @@ export const Table: React.FC<TableProps> = ({
295322 >
296323 < Box paddingVertical = "sm" paddingLeft = "lg" >
297324 < Truncate maxLines = { 1 } >
298- { headerCol . renderRow ( headerRow ) }
325+ { headerCol . renderRow ( headerRow ) }
299326 </ Truncate >
300327 </ Box >
301328 </ td >
0 commit comments