File tree Expand file tree Collapse file tree
frontend/testing-view/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ export interface FilteringSlice {
6868 category : BoardName ,
6969 ) => number ;
7070 getTotalCount : ( scope : FilterScope ) => number ;
71+ isAllSelected : ( scope : FilterScope ) => boolean ;
7172 getSelectionState : ( scope : FilterScope , category : BoardName ) => CheckboxState ;
7273
7374 /** Virtualization & Expansion */
@@ -336,6 +337,10 @@ export const createFilteringSlice: StateCreator<
336337 const catalog = get ( ) . getCatalog ( scope ) ;
337338 return Object . values ( catalog ) . reduce ( ( acc , items ) => acc + items . length , 0 ) ;
338339 } ,
340+ isAllSelected : ( scope ) => {
341+ const total = get ( ) . getTotalCount ( scope ) ;
342+ return total > 0 && get ( ) . getFilteredCount ( scope ) === total ;
343+ } ,
339344
340345 getSelectionState : ( scope , category ) => {
341346 const selectedCount = get ( ) . getFilteredCountByCategory ( scope , category ) ;
Original file line number Diff line number Diff line change @@ -24,6 +24,11 @@ export function useTransformedBoards(
2424 )
2525 return ;
2626
27+ const store = useStore . getState ( ) ;
28+ const wasAllCommands = store . isAllSelected ( "commands" ) ;
29+ const wasAllTelemetry = store . isAllSelected ( "telemetry" ) ;
30+ const wasAllLogs = store . isAllSelected ( "logs" ) ;
31+
2732 setTelemetryCatalog ( transformedBoards . telemetryCatalog ) ;
2833 setCommandsCatalog ( transformedBoards . commandsCatalog ) ;
2934 setBoards ( Array . from ( transformedBoards . boards ) ) ;
@@ -33,7 +38,12 @@ export function useTransformedBoards(
3338 const hasCommandsData =
3439 Object . keys ( transformedBoards . commandsCatalog ) . length > 0 ;
3540
36- if ( hasTelemetryData && hasCommandsData ) initializeWorkspaceFilters ( ) ;
41+ if ( hasTelemetryData && hasCommandsData ) {
42+ initializeWorkspaceFilters ( ) ;
43+ if ( wasAllCommands ) useStore . getState ( ) . selectAllFilters ( "commands" ) ;
44+ if ( wasAllTelemetry ) useStore . getState ( ) . selectAllFilters ( "telemetry" ) ;
45+ if ( wasAllLogs ) useStore . getState ( ) . selectAllFilters ( "logs" ) ;
46+ }
3747 } , [
3848 transformedBoards ,
3949 setTelemetryCatalog ,
You can’t perform that action at this time.
0 commit comments