File tree 2 files changed +37
-2
lines changed
theia-extensions/viewer-prototype/src/browser/trace-viewer
2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -194,11 +194,17 @@ export class TraceViewerToolbarContribution implements TabBarToolbarContribution
194
194
< div id = "trace.viewer.toolbar.filter" className = "fa fa-filter" title = "Markers filter" onClick = { async ( event : React . MouseEvent ) => {
195
195
const toDisposeOnHide = new DisposableCollection ( ) ;
196
196
const menuPath = TraceViewerToolbarMenus . MARKER_CATEGORIES_MENU ;
197
- let index = 0 ;
197
+ let index = 1 ;
198
198
const traceViewerWidget = widget as TraceViewerWidget ;
199
199
const markerCategories = traceViewerWidget . getMarkerCategories ( ) ;
200
+ let selectAll = true ;
200
201
markerCategories . forEach ( ( categoryInfo , categoryName ) => {
201
202
const toggleInd = categoryInfo . toggleInd ;
203
+
204
+ if ( ! toggleInd ) {
205
+ selectAll = false ;
206
+ }
207
+
202
208
index += 1 ;
203
209
toDisposeOnHide . push ( this . menus . registerMenuAction ( menuPath , {
204
210
label : categoryName ,
@@ -216,6 +222,22 @@ export class TraceViewerToolbarContribution implements TabBarToolbarContribution
216
222
} ) ) ;
217
223
} ) ;
218
224
225
+ toDisposeOnHide . push ( this . menus . registerMenuAction ( menuPath , {
226
+ label : 'Select all' ,
227
+ commandId : 'Select all' + index . toString ( ) ,
228
+ order : '0' ,
229
+ } ) ) ;
230
+ toDisposeOnHide . push ( this . commands . registerCommand ( {
231
+ id : 'Select all' + index . toString ( ) ,
232
+ label : 'Select all'
233
+ } , {
234
+ execute : ( ) => {
235
+ traceViewerWidget . updateAllMarkerCategoryState ( ! selectAll ) ;
236
+ return ;
237
+ } ,
238
+ isToggled : ( ) => selectAll ,
239
+ } ) ) ;
240
+
219
241
return this . contextMenuRenderer . render ( {
220
242
menuPath,
221
243
args : [ ] ,
Original file line number Diff line number Diff line change @@ -499,7 +499,7 @@ export class TraceViewerWidget extends ReactWidget implements StatefulWidget {
499
499
return this . toolbarMarkerCategoriesMap ;
500
500
}
501
501
502
- updateMarkerCategoryState ( categoryName : string ) : void {
502
+ updateMarkerCategoryState ( categoryName : string , skipUpdate ?: boolean ) : void {
503
503
const toggledmarkerCategory = this . toolbarMarkerCategoriesMap . get ( categoryName ) ;
504
504
if ( toggledmarkerCategory ) {
505
505
const categoryCount = toggledmarkerCategory ?. categoryCount ;
@@ -513,6 +513,19 @@ export class TraceViewerWidget extends ReactWidget implements StatefulWidget {
513
513
this . selectedMarkerCategoriesMap . set ( outputId , selectedMarkerCategories ) ;
514
514
} ) ;
515
515
}
516
+ if ( ! skipUpdate ) {
517
+ this . update ( ) ;
518
+ }
519
+ }
520
+
521
+ updateAllMarkerCategoryState ( selectAll : boolean ) : void {
522
+ const markerCategories = this . getMarkerCategories ( ) ;
523
+ for ( const [ key , value ] of markerCategories ) {
524
+ if ( value . toggleInd === selectAll ) {
525
+ continue ;
526
+ }
527
+ this . updateMarkerCategoryState ( key , true ) ;
528
+ }
516
529
this . update ( ) ;
517
530
}
518
531
You can’t perform that action at this time.
0 commit comments