All files / ee/app/assets/javascripts/filtered_search filtered_search_token_keys_epics.js

0% Statements 0/6
0% Branches 0/2
100% Functions 0/0
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88                                                                                                                                                                               
import FilteredSearchTokenKeys from '~/filtered_search/filtered_search_token_keys';
import { __ } from '~/locale';
import {
  TOKEN_TITLE_AUTHOR,
  TOKEN_TITLE_LABEL,
  TOKEN_TITLE_MY_REACTION,
  TOKEN_TYPE_AUTHOR,
  TOKEN_TYPE_LABEL,
  TOKEN_TYPE_MY_REACTION,
} from '~/vue_shared/components/filtered_search_bar/constants';
 
const tokenKeys = [
  {
    formattedKey: TOKEN_TITLE_AUTHOR,
    key: TOKEN_TYPE_AUTHOR,
    type: 'string',
    param: 'username',
    symbol: '@',
    icon: 'pencil',
    tag: '@author',
  },
  {
    formattedKey: TOKEN_TITLE_LABEL,
    key: TOKEN_TYPE_LABEL,
    type: 'array',
    param: 'name[]',
    symbol: '~',
    icon: 'labels',
    tag: '~label',
  },
];
 
if (gon.current_user_id) {
  // Appending tokenkeys only logged-in
  tokenKeys.push({
    formattedKey: TOKEN_TITLE_MY_REACTION,
    key: TOKEN_TYPE_MY_REACTION,
    type: 'string',
    param: 'emoji',
    symbol: '',
    icon: 'thumb-up',
    tag: 'emoji',
  });
}
 
const alternativeTokenKeys = [
  {
    formattedKey: TOKEN_TITLE_LABEL,
    key: TOKEN_TYPE_LABEL,
    type: 'string',
    param: 'name',
    symbol: '~',
  },
];
 
const conditions = [
  {
    url: 'label_name[]=No+Label',
    tokenKey: TOKEN_TYPE_LABEL,
    value: 'none',
    operator: '=',
  },
  {
    url: 'not[label_name][]=No+Label',
    tokenKey: TOKEN_TYPE_LABEL,
    value: 'none',
    operator: '!=',
  },
  {
    url: 'my_reaction_emoji=None',
    tokenKey: TOKEN_TYPE_MY_REACTION,
    value: __('None'),
  },
  {
    url: 'my_reaction_emoji=Any',
    tokenKey: TOKEN_TYPE_MY_REACTION,
    value: __('Any'),
  },
];
 
const EpicsFilteredSearchTokenKeysEE = new FilteredSearchTokenKeys(
  [...tokenKeys],
  alternativeTokenKeys,
  [...conditions],
);
 
export default EpicsFilteredSearchTokenKeysEE;