@@ -37,8 +37,9 @@ namespace tf_dashboard_common {
37
37
computed : 'computeNamesMatchingRegex(names.*, _regex)' ,
38
38
} , // Runs that match the regex
39
39
selectionState : {
40
- // if a name is explicitly enabled, True, if explicitly disabled, False.
41
- // if undefined, default value (enable for first k names, disable after).
40
+ // If a name is explicitly enabled by user gesture, True, if explicitly
41
+ // disabled, False. If undefined, default value (enable for first k
42
+ // names, disable after).
42
43
type : Object ,
43
44
notify : true ,
44
45
value : ( ) => ( { } ) ,
@@ -168,28 +169,16 @@ namespace tf_dashboard_common {
168
169
return this . outSelected . indexOf ( item ) != - 1 ;
169
170
} ,
170
171
toggleAll : function ( ) {
171
- var anyToggledOn = this . namesMatchingRegex . some (
172
- ( n ) => this . selectionState [ n ]
173
- ) ;
174
-
175
- var selectionStateIsDefault =
176
- Object . keys ( this . selectionState ) . length == 0 ;
177
-
178
- var defaultOff =
179
- this . namesMatchingRegex . length > this . maxRunsToEnableByDefault ;
180
- // We have names toggled either if some were explicitly toggled on, or if
181
- // we are in the default state, and there are few enough that we default
182
- // to toggling on.
183
- anyToggledOn = anyToggledOn || ( selectionStateIsDefault && ! defaultOff ) ;
184
-
185
172
// If any are toggled on, we turn everything off. Or, if none are toggled
186
173
// on, we turn everything on.
187
-
188
- var newRunsDisabled = { } ;
189
- this . names . forEach ( function ( n ) {
190
- newRunsDisabled [ n ] = ! anyToggledOn ;
174
+ const anyToggledOn = this . namesMatchingRegex . some ( ( name ) =>
175
+ this . outSelected . includes ( name )
176
+ ) ;
177
+ const newSelectionState = { } ;
178
+ this . names . forEach ( ( n ) => {
179
+ newSelectionState [ n ] = ! anyToggledOn ;
191
180
} ) ;
192
- this . selectionState = newRunsDisabled ;
181
+ this . selectionState = newSelectionState ;
193
182
} ,
194
183
} ) ;
195
184
} // namespace tf_dashboard_common
0 commit comments