@@ -162,7 +162,12 @@ export const Table: React.FC<TableProps> = ({
162162 // itemsPerPage: itemPerPage,
163163 // items: tableRows,
164164 // });
165- const isValidFilter = filters ?. map ( ( f ) => f . value ) . join ( '' ) ;
165+
166+ const isValidFilterFroValue : any = filters ?. map ( ( f ) => f . value ) . join ( '' ) ;
167+ const isValidFilterForCategory : any =
168+ isValidFilterFroValue && filters ?. map ( ( f ) => f . type . value ) . join ( '' ) ;
169+ const checkValidFilter = isValidFilterFroValue + isValidFilterForCategory ;
170+ console . log ( checkValidFilter , 'checkValidFilter' ) ;
166171
167172 const { dispatchStackData } = callActionForStacksForPagination ( ) ;
168173 const {
@@ -192,82 +197,84 @@ export const Table: React.FC<TableProps> = ({
192197 if ( filters ) {
193198 setPageIndex ( 0 ) ;
194199 }
195- switch ( componentName ) {
196- case 'stacks' :
197- if ( CheckIfRun ) {
198- dispatchStackRunsData (
199- id ,
200- 1 ,
201- itemPerPage ,
202- filters as any ,
203- activeSorting ,
204- ) ;
205- break ;
206- } else {
207- dispatchStackData ( 1 , itemPerPage , filters as any , activeSorting ) ;
208- break ;
209- }
210- case 'components' :
211- if ( CheckIfRun ) {
212- dispatchStackComponentRunsData (
213- id ,
214- 1 ,
215- itemPerPage ,
216- filters as any ,
217- activeSorting ,
218- ) ;
219- break ;
220- } else {
221- dispatchStackComponentsData (
222- 1 ,
223- itemPerPage ,
224- filters as any ,
225- activeSorting ,
226- ) ;
227- break ;
228- }
229- case 'pipelines' :
230- if ( CheckIfRun ) {
231- dispatchPipelineRunsData (
232- id ,
233- 1 ,
234- itemPerPage ,
235- filters as any ,
236- activeSorting ,
237- ) ;
238- break ;
239- } else {
240- console . log ( itemPerPage , 'itemPerPage' ) ;
241- if ( ! renderAfterRow ) break ;
242- dispatchPipelineData ( 1 , itemPerPage , filters as any , activeSorting ) ;
243- break ;
244- }
200+ if ( checkValidFilter ) {
201+ switch ( componentName ) {
202+ case 'stacks' :
203+ if ( CheckIfRun ) {
204+ dispatchStackRunsData (
205+ id ,
206+ 1 ,
207+ itemPerPage ,
208+ filters as any ,
209+ activeSorting ,
210+ ) ;
211+ break ;
212+ } else {
213+ dispatchStackData ( 1 , itemPerPage , filters as any , activeSorting ) ;
214+ break ;
215+ }
216+ case 'components' :
217+ if ( CheckIfRun ) {
218+ dispatchStackComponentRunsData (
219+ id ,
220+ 1 ,
221+ itemPerPage ,
222+ filters as any ,
223+ activeSorting ,
224+ ) ;
225+ break ;
226+ } else {
227+ dispatchStackComponentsData (
228+ 1 ,
229+ itemPerPage ,
230+ filters as any ,
231+ activeSorting ,
232+ ) ;
233+ break ;
234+ }
235+ case 'pipelines' :
236+ if ( CheckIfRun ) {
237+ dispatchPipelineRunsData (
238+ id ,
239+ 1 ,
240+ itemPerPage ,
241+ filters as any ,
242+ activeSorting ,
243+ ) ;
244+ break ;
245+ } else {
246+ console . log ( itemPerPage , 'itemPerPage' ) ;
247+ if ( ! renderAfterRow ) break ;
248+ dispatchPipelineData ( 1 , itemPerPage , filters as any , activeSorting ) ;
249+ break ;
250+ }
245251
246- case 'all-runs' :
247- dispatchAllrunsData ( 1 , itemPerPage , filters as any , activeSorting ) ;
248- break ;
252+ case 'all-runs' :
253+ dispatchAllrunsData ( 1 , itemPerPage , filters as any , activeSorting ) ;
254+ break ;
249255
250- default :
251- break ;
252- }
253- if ( locationPath . pathname . split ( '/' ) [ 2 ] === 'organization' ) {
254- // debugger;
255- setFetchingMembers ( true ) ;
256- dispatch (
257- organizationActions . getMembers ( {
258- page : 1 ,
259- size : ITEMS_PER_PAGE ? ITEMS_PER_PAGE : DEFAULT_ITEMS_PER_PAGE ,
260- sort_by : activeSorting ,
261- onSuccess : ( ) => setFetchingMembers ( false ) ,
262- onFailure : ( ) => setFetchingMembers ( false ) ,
263- } ) ,
264- ) ;
256+ default :
257+ break ;
258+ }
259+ if ( locationPath . pathname . split ( '/' ) [ 2 ] === 'organization' ) {
260+ // debugger;
261+ setFetchingMembers ( true ) ;
262+ dispatch (
263+ organizationActions . getMembers ( {
264+ page : 1 ,
265+ size : ITEMS_PER_PAGE ? ITEMS_PER_PAGE : DEFAULT_ITEMS_PER_PAGE ,
266+ sort_by : activeSorting ,
267+ onSuccess : ( ) => setFetchingMembers ( false ) ,
268+ onFailure : ( ) => setFetchingMembers ( false ) ,
269+ } ) ,
270+ ) ;
271+ }
265272 }
266273
267274 // eslint-disable-next-line react-hooks/exhaustive-deps
268275 } , [
269276 checkForLocationPath ,
270- isValidFilter ,
277+ checkValidFilter ,
271278 activeSorting ,
272279 activeSortingDirection ,
273280 ] ) ;
0 commit comments