All files / ee/app/assets/javascripts/analytics/code_review_analytics filtered_search_code_review_analytics.js

0% Statements 0/6
100% Branches 0/0
0% Functions 0/2
0% Lines 0/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36                                                                       
import FilteredSearchManager from 'ee_else_ce/filtered_search/filtered_search_manager';
import { queryToObject } from '~/lib/utils/url_utility';
import { __ } from '~/locale';
import CodeReviewAnalyticsFilteredSearchTokenKeys from './code_review_analytics_filtered_search_token_keys';
import store from './store';
import transformFilters from './utils';
 
export default class FilteredSearchCodeReviewAnalytics extends FilteredSearchManager {
  constructor() {
    super({
      page: 'code_reviews',
      isGroupDecendent: true,
      stateFiltersSelector: '.issues-state-filters',
      isGroup: true,
      useDefaultState: false,
      filteredSearchTokenKeys: CodeReviewAnalyticsFilteredSearchTokenKeys,
      placeholder: __('Filter results...'),
    });
 
    this.isHandledAsync = true;
  }
 
  /**
   * Updates filters in code review analytics store
   */
  updateObject = (path) => {
    const filters = queryToObject(path, { gatherArrays: true });
    const { selectedLabels: selectedLabelList, selectedMilestone } = transformFilters(filters);
 
    store.dispatch('filters/setFilters', {
      selectedLabelList,
      selectedMilestone,
    });
  };
}