@@ -15,7 +15,6 @@ const debug = require('debug')('mongodb-compass:stores:query');
15
15
// constants
16
16
const USER_TYPING_DEBOUNCE_MS = 100 ;
17
17
18
- const FEATURE_FLAG_REGEX = / ^ ( e n a b l e | d i s a b l e ) ( \w + ) \s * $ / ;
19
18
const RESET_STATE = 'reset' ;
20
19
const APPLY_STATE = 'apply' ;
21
20
@@ -40,17 +39,6 @@ const QueryStore = Reflux.createStore({
40
39
mixins : [ StateMixin . store ] ,
41
40
listenables : QueryAction ,
42
41
43
- init : function ( ) {
44
- // store valid feature flags to recognise in the filter box
45
- if ( _ . get ( app . preferences , 'serialize' ) ) {
46
- this . validFeatureFlags = _ . keys (
47
- _ . pick ( app . preferences . serialize ( ) , _ . isBoolean )
48
- ) ;
49
- } else {
50
- this . validFeatureFlags = [ ] ;
51
- }
52
- } ,
53
-
54
42
onActivated ( appRegistry ) {
55
43
this . QueryHistoryActions = appRegistry . getAction ( 'QueryHistory.Actions' ) ;
56
44
this . QueryHistoryActions . runQuery . listen ( this . autoPopulateQuery . bind ( this ) ) ;
@@ -123,9 +111,6 @@ const QueryStore = Reflux.createStore({
123
111
// query history view.
124
112
autoPopulated : false ,
125
113
126
- // was a feature flag recognised in the input
127
- featureFlag : false ,
128
-
129
114
// is the query bar component expanded or collapsed?
130
115
expanded : false ,
131
116
@@ -215,10 +200,8 @@ const QueryStore = Reflux.createStore({
215
200
setQueryString ( label , input , userTyping ) {
216
201
assert ( _ . includes ( QUERY_PROPERTIES , label ) ) ;
217
202
const validatedInput = this . _validateInput ( label , input ) ;
218
- const isFeatureFlag = Boolean ( this . _validateFeatureFlag ( input ) ) ;
219
203
220
204
const state = {
221
- featureFlag : isFeatureFlag ,
222
205
userTyping : Boolean ( userTyping )
223
206
} ;
224
207
state [ `${ label } String` ] = input ;
@@ -305,7 +288,6 @@ const QueryStore = Reflux.createStore({
305
288
if ( _ . has ( query , 'sample' ) ) {
306
289
this . toggleSample ( query . sample ) ;
307
290
}
308
- state . featureFlag = false ;
309
291
state . autoPopulated = autoPopulated ;
310
292
state . valid = valid ;
311
293
this . setState ( state ) ;
@@ -359,37 +341,6 @@ const QueryStore = Reflux.createStore({
359
341
) ;
360
342
} ,
361
343
362
- /**
363
- * validates if the input is a feature flag directive.
364
- *
365
- * @param {String } input The input to validate.
366
- *
367
- * @return {Boolean|MatchGroup } the regex match or false if invalid.
368
- */
369
- _validateFeatureFlag ( input ) {
370
- const match = input . match ( FEATURE_FLAG_REGEX ) ;
371
- if ( match && _ . contains ( this . validFeatureFlags , match [ 2 ] ) ) {
372
- return match ;
373
- }
374
- return false ;
375
- } ,
376
-
377
- /**
378
- * check if the filter input is really a feature flag directive, for example
379
- * `enable serverStats`. If so, set the feature flag accordingly.
380
- *
381
- * @return {Boolean } if it was a feature flag or not.
382
- */
383
- _checkFeatureFlagDirective ( ) {
384
- const match = this . _validateFeatureFlag ( this . state . filterString ) ;
385
- if ( match ) {
386
- app . preferences . save ( match [ 2 ] , match [ 1 ] === 'enable' ) ;
387
- debug ( 'feature flag %s %sd' , match [ 2 ] , match [ 1 ] ) ;
388
- return true ;
389
- }
390
- return false ;
391
- } ,
392
-
393
344
/**
394
345
* Sets the value for the given field on the filter.
395
346
*
@@ -627,14 +578,6 @@ const QueryStore = Reflux.createStore({
627
578
* apply the current (valid) query, and store it in `lastExecutedQuery`.
628
579
*/
629
580
apply ( ) {
630
- // if it's a feature flag directive, then we can just reset the query
631
- // to whatever was last executed.
632
- if ( this . _checkFeatureFlagDirective ( ) ) {
633
- this . setQuery ( this . state . lastExecutedQuery ) ;
634
- return ;
635
- }
636
- // otherwise, if the query validates ok, modify lastExecutedQuery (which
637
- // triggers the QueryChangedStore) and set the "apply" state.
638
581
if ( this . _validateQuery ( ) ) {
639
582
const registry = app . appRegistry ;
640
583
if ( registry ) {
0 commit comments