summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/runner/components/search_tokens/paused_token_config.js
blob: 97ee8ec3eefe4a03c6605c0312b5d8d6fa842916 (plain)
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
import { __ } from '~/locale';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import BaseToken from '~/vue_shared/components/filtered_search_bar/tokens/base_token.vue';
import { PARAM_KEY_PAUSED, I18N_PAUSED } from '../../constants';

const options = [
  { value: 'true', title: __('Yes') },
  { value: 'false', title: __('No') },
];

export const pausedTokenConfig = {
  icon: 'pause',
  title: I18N_PAUSED,
  type: PARAM_KEY_PAUSED,
  token: BaseToken,
  unique: true,
  options: options.map(({ value, title }) => ({
    value,
    // Replace whitespace with a special character to avoid
    // splitting this value.
    // Replacing in each option, as translations may also
    // contain spaces!
    // see: https://gitlab.com/gitlab-org/gitlab/-/issues/344142
    // see: https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1438
    title: title.replace(/\s/g, '\u00a0'),
  })),
  operators: OPERATOR_IS_ONLY,
};