Commit f80a4f60 authored by Nathan Friend's avatar Nathan Friend

Merge branch 'cngo-extract-i18n-and-update-filtered-search-constants' into 'master'

Update filtered search constants and extract i18n

See merge request gitlab-org/gitlab!61375
parents 8d03fe1b 45789e94
...@@ -38,8 +38,19 @@ import { ...@@ -38,8 +38,19 @@ import {
} from '~/issues_list/utils'; } from '~/issues_list/utils';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { convertObjectPropsToCamelCase, getParameterByName } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase, getParameterByName } from '~/lib/utils/common_utils';
import { __ } from '~/locale'; import {
import { DEFAULT_NONE_ANY } from '~/vue_shared/components/filtered_search_bar/constants'; DEFAULT_NONE_ANY,
OPERATOR_IS_ONLY,
TOKEN_TITLE_ASSIGNEE,
TOKEN_TITLE_AUTHOR,
TOKEN_TITLE_CONFIDENTIAL,
TOKEN_TITLE_EPIC,
TOKEN_TITLE_ITERATION,
TOKEN_TITLE_LABEL,
TOKEN_TITLE_MILESTONE,
TOKEN_TITLE_MY_REACTION,
TOKEN_TITLE_WEIGHT,
} from '~/vue_shared/components/filtered_search_bar/constants';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
import EmojiToken from '~/vue_shared/components/filtered_search_bar/tokens/emoji_token.vue'; import EmojiToken from '~/vue_shared/components/filtered_search_bar/tokens/emoji_token.vue';
import EpicToken from '~/vue_shared/components/filtered_search_bar/tokens/epic_token.vue'; import EpicToken from '~/vue_shared/components/filtered_search_bar/tokens/epic_token.vue';
...@@ -178,7 +189,7 @@ export default { ...@@ -178,7 +189,7 @@ export default {
const tokens = [ const tokens = [
{ {
type: 'author_username', type: 'author_username',
title: __('Author'), title: TOKEN_TITLE_AUTHOR,
icon: 'pencil', icon: 'pencil',
token: AuthorToken, token: AuthorToken,
dataType: 'user', dataType: 'user',
...@@ -188,7 +199,7 @@ export default { ...@@ -188,7 +199,7 @@ export default {
}, },
{ {
type: 'assignee_username', type: 'assignee_username',
title: __('Assignee'), title: TOKEN_TITLE_ASSIGNEE,
icon: 'user', icon: 'user',
token: AuthorToken, token: AuthorToken,
dataType: 'user', dataType: 'user',
...@@ -198,7 +209,7 @@ export default { ...@@ -198,7 +209,7 @@ export default {
}, },
{ {
type: 'milestone', type: 'milestone',
title: __('Milestone'), title: TOKEN_TITLE_MILESTONE,
icon: 'clock', icon: 'clock',
token: MilestoneToken, token: MilestoneToken,
unique: true, unique: true,
...@@ -207,7 +218,7 @@ export default { ...@@ -207,7 +218,7 @@ export default {
}, },
{ {
type: 'labels', type: 'labels',
title: __('Label'), title: TOKEN_TITLE_LABEL,
icon: 'labels', icon: 'labels',
token: LabelToken, token: LabelToken,
defaultLabels: [], defaultLabels: [],
...@@ -215,23 +226,23 @@ export default { ...@@ -215,23 +226,23 @@ export default {
}, },
{ {
type: 'my_reaction_emoji', type: 'my_reaction_emoji',
title: __('My-Reaction'), title: TOKEN_TITLE_MY_REACTION,
icon: 'thumb-up', icon: 'thumb-up',
token: EmojiToken, token: EmojiToken,
unique: true, unique: true,
operators: [{ value: '=', description: __('is') }], operators: OPERATOR_IS_ONLY,
fetchEmojis: this.fetchEmojis, fetchEmojis: this.fetchEmojis,
}, },
{ {
type: 'confidential', type: 'confidential',
title: __('Confidential'), title: TOKEN_TITLE_CONFIDENTIAL,
icon: 'eye-slash', icon: 'eye-slash',
token: GlFilteredSearchToken, token: GlFilteredSearchToken,
unique: true, unique: true,
operators: [{ value: '=', description: __('is') }], operators: OPERATOR_IS_ONLY,
options: [ options: [
{ icon: 'eye-slash', value: 'yes', title: __('Yes') }, { icon: 'eye-slash', value: 'yes', title: this.$options.i18n.confidentialYes },
{ icon: 'eye', value: 'no', title: __('No') }, { icon: 'eye', value: 'no', title: this.$options.i18n.confidentialNo },
], ],
}, },
]; ];
...@@ -239,7 +250,7 @@ export default { ...@@ -239,7 +250,7 @@ export default {
if (this.projectIterationsPath) { if (this.projectIterationsPath) {
tokens.push({ tokens.push({
type: 'iteration', type: 'iteration',
title: __('Iteration'), title: TOKEN_TITLE_ITERATION,
icon: 'iteration', icon: 'iteration',
token: IterationToken, token: IterationToken,
unique: true, unique: true,
...@@ -250,7 +261,7 @@ export default { ...@@ -250,7 +261,7 @@ export default {
if (this.groupEpicsPath) { if (this.groupEpicsPath) {
tokens.push({ tokens.push({
type: 'epic_id', type: 'epic_id',
title: __('Epic'), title: TOKEN_TITLE_EPIC,
icon: 'epic', icon: 'epic',
token: EpicToken, token: EpicToken,
unique: true, unique: true,
...@@ -261,7 +272,7 @@ export default { ...@@ -261,7 +272,7 @@ export default {
if (this.hasIssueWeightsFeature) { if (this.hasIssueWeightsFeature) {
tokens.push({ tokens.push({
type: 'weight', type: 'weight',
title: __('Weight'), title: TOKEN_TITLE_WEIGHT,
icon: 'weight', icon: 'weight',
token: WeightToken, token: WeightToken,
unique: true, unique: true,
...@@ -371,7 +382,7 @@ export default { ...@@ -371,7 +382,7 @@ export default {
this.exportCsvPathWithQuery = this.getExportCsvPathWithQuery(); this.exportCsvPathWithQuery = this.getExportCsvPathWithQuery();
}) })
.catch(() => { .catch(() => {
createFlash({ message: __('An error occurred while loading issues') }); createFlash({ message: this.$options.i18n.errorFetchingIssues });
}) })
.finally(() => { .finally(() => {
this.isLoading = false; this.isLoading = false;
...@@ -382,10 +393,10 @@ export default { ...@@ -382,10 +393,10 @@ export default {
}, },
getStatus(issue) { getStatus(issue) {
if (issue.closedAt && issue.movedToId) { if (issue.closedAt && issue.movedToId) {
return __('CLOSED (MOVED)'); return this.$options.i18n.closedMoved;
} }
if (issue.closedAt) { if (issue.closedAt) {
return __('CLOSED'); return this.$options.i18n.closed;
} }
return undefined; return undefined;
}, },
...@@ -474,7 +485,7 @@ export default { ...@@ -474,7 +485,7 @@ export default {
<issuable-list <issuable-list
:namespace="projectPath" :namespace="projectPath"
recent-searches-storage-key="issues" recent-searches-storage-key="issues"
:search-input-placeholder="__('Search or filter results…')" :search-input-placeholder="$options.i18n.searchPlaceholder"
:search-tokens="searchTokens" :search-tokens="searchTokens"
:initial-filter-value="filterTokens" :initial-filter-value="filterTokens"
:sort-options="sortOptions" :sort-options="sortOptions"
...@@ -525,7 +536,7 @@ export default { ...@@ -525,7 +536,7 @@ export default {
:disabled="isBulkEditButtonDisabled" :disabled="isBulkEditButtonDisabled"
@click="handleBulkUpdateClick" @click="handleBulkUpdateClick"
> >
{{ __('Edit issues') }} {{ $options.i18n.editIssues }}
</gl-button> </gl-button>
<gl-button v-if="showNewIssueLink" :href="newIssuePath" variant="confirm"> <gl-button v-if="showNewIssueLink" :href="newIssuePath" variant="confirm">
{{ $options.i18n.newIssueLabel }} {{ $options.i18n.newIssueLabel }}
...@@ -545,7 +556,7 @@ export default { ...@@ -545,7 +556,7 @@ export default {
v-if="issuable.mergeRequestsCount" v-if="issuable.mergeRequestsCount"
v-gl-tooltip v-gl-tooltip
class="gl-display-none gl-sm-display-block" class="gl-display-none gl-sm-display-block"
:title="__('Related merge requests')" :title="$options.i18n.relatedMergeRequests"
data-testid="issuable-mr" data-testid="issuable-mr"
> >
<gl-icon name="merge-request" /> <gl-icon name="merge-request" />
...@@ -555,7 +566,7 @@ export default { ...@@ -555,7 +566,7 @@ export default {
v-if="issuable.upvotes" v-if="issuable.upvotes"
v-gl-tooltip v-gl-tooltip
class="gl-display-none gl-sm-display-block" class="gl-display-none gl-sm-display-block"
:title="__('Upvotes')" :title="$options.i18n.upvotes"
data-testid="issuable-upvotes" data-testid="issuable-upvotes"
> >
<gl-icon name="thumb-up" /> <gl-icon name="thumb-up" />
...@@ -565,7 +576,7 @@ export default { ...@@ -565,7 +576,7 @@ export default {
v-if="issuable.downvotes" v-if="issuable.downvotes"
v-gl-tooltip v-gl-tooltip
class="gl-display-none gl-sm-display-block" class="gl-display-none gl-sm-display-block"
:title="__('Downvotes')" :title="$options.i18n.downvotes"
data-testid="issuable-downvotes" data-testid="issuable-downvotes"
> >
<gl-icon name="thumb-down" /> <gl-icon name="thumb-down" />
......
...@@ -3,6 +3,8 @@ import { ...@@ -3,6 +3,8 @@ import {
FILTER_ANY, FILTER_ANY,
FILTER_CURRENT, FILTER_CURRENT,
FILTER_NONE, FILTER_NONE,
OPERATOR_IS,
OPERATOR_IS_NOT,
} from '~/vue_shared/components/filtered_search_bar/constants'; } from '~/vue_shared/components/filtered_search_bar/constants';
// Maps sort order as it appears in the URL query to API `order_by` and `sort` params. // Maps sort order as it appears in the URL query to API `order_by` and `sort` params.
...@@ -60,6 +62,13 @@ export const availableSortOptionsJira = [ ...@@ -60,6 +62,13 @@ export const availableSortOptionsJira = [
export const i18n = { export const i18n = {
calendarLabel: __('Subscribe to calendar'), calendarLabel: __('Subscribe to calendar'),
closed: __('CLOSED'),
closedMoved: __('CLOSED (MOVED)'),
confidentialNo: __('No'),
confidentialYes: __('Yes'),
downvotes: __('Downvotes'),
editIssues: __('Edit issues'),
errorFetchingIssues: __('An error occurred while loading issues'),
jiraIntegrationMessage: s__( jiraIntegrationMessage: s__(
'JiraService|%{jiraDocsLinkStart}Enable the Jira integration%{jiraDocsLinkEnd} to view your Jira issues in GitLab.', 'JiraService|%{jiraDocsLinkStart}Enable the Jira integration%{jiraDocsLinkEnd} to view your Jira issues in GitLab.',
), ),
...@@ -82,8 +91,11 @@ export const i18n = { ...@@ -82,8 +91,11 @@ export const i18n = {
noIssuesSignedOutTitle: __('There are no issues to show'), noIssuesSignedOutTitle: __('There are no issues to show'),
noSearchResultsDescription: __('To widen your search, change or remove filters above'), noSearchResultsDescription: __('To widen your search, change or remove filters above'),
noSearchResultsTitle: __('Sorry, your filter produced no results'), noSearchResultsTitle: __('Sorry, your filter produced no results'),
relatedMergeRequests: __('Related merge requests'),
reorderError: __('An error occurred while reordering issues.'), reorderError: __('An error occurred while reordering issues.'),
rssLabel: __('Subscribe to RSS feed'), rssLabel: __('Subscribe to RSS feed'),
searchPlaceholder: __('Search or filter results…'),
upvotes: __('Upvotes'),
}; };
export const JIRA_IMPORT_SUCCESS_ALERT_HIDE_MAP_KEY = 'jira-import-success-alert-hide-map'; export const JIRA_IMPORT_SUCCESS_ALERT_HIDE_MAP_KEY = 'jira-import-success-alert-hide-map';
...@@ -246,10 +258,6 @@ export const urlSortParams = { ...@@ -246,10 +258,6 @@ export const urlSortParams = {
export const MAX_LIST_SIZE = 10; export const MAX_LIST_SIZE = 10;
export const FILTERED_SEARCH_TERM = 'filtered-search-term';
export const OPERATOR_IS = '=';
export const OPERATOR_IS_NOT = '!=';
export const NORMAL_FILTER = 'normalFilter'; export const NORMAL_FILTER = 'normalFilter';
export const SPECIAL_FILTER = 'specialFilter'; export const SPECIAL_FILTER = 'specialFilter';
export const SPECIAL_FILTER_VALUES = [FILTER_NONE, FILTER_ANY, FILTER_CURRENT]; export const SPECIAL_FILTER_VALUES = [FILTER_NONE, FILTER_ANY, FILTER_CURRENT];
......
...@@ -4,7 +4,6 @@ import { ...@@ -4,7 +4,6 @@ import {
CREATED_DESC, CREATED_DESC,
DUE_DATE_ASC, DUE_DATE_ASC,
DUE_DATE_DESC, DUE_DATE_DESC,
FILTERED_SEARCH_TERM,
filters, filters,
LABEL_PRIORITY_DESC, LABEL_PRIORITY_DESC,
MILESTONE_DUE_ASC, MILESTONE_DUE_ASC,
...@@ -23,6 +22,7 @@ import { ...@@ -23,6 +22,7 @@ import {
WEIGHT_DESC, WEIGHT_DESC,
} from '~/issues_list/constants'; } from '~/issues_list/constants';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { FILTERED_SEARCH_TERM } from '~/vue_shared/components/filtered_search_bar/constants';
export const getSortKey = (sort) => export const getSortKey = (sort) =>
Object.keys(urlSortParams).find((key) => urlSortParams[key].sort === sort); Object.keys(urlSortParams).find((key) => urlSortParams[key].sort === sort);
......
<script> <script>
import { GlFilteredSearch } from '@gitlab/ui'; import { GlFilteredSearch } from '@gitlab/ui';
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import { __, s__ } from '~/locale'; import { s__ } from '~/locale';
import DateTimePicker from '~/vue_shared/components/date_time_picker/date_time_picker.vue'; import DateTimePicker from '~/vue_shared/components/date_time_picker/date_time_picker.vue';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import { timeRanges } from '~/vue_shared/constants'; import { timeRanges } from '~/vue_shared/constants';
import { TOKEN_TYPE_POD_NAME } from '../constants'; import { TOKEN_TYPE_POD_NAME } from '../constants';
import TokenWithLoadingState from './tokens/token_with_loading_state.vue'; import TokenWithLoadingState from './tokens/token_with_loading_state.vue';
...@@ -54,7 +55,7 @@ export default { ...@@ -54,7 +55,7 @@ export default {
type: TOKEN_TYPE_POD_NAME, type: TOKEN_TYPE_POD_NAME,
title: s__('Environments|Pod name'), title: s__('Environments|Pod name'),
token: TokenWithLoadingState, token: TokenWithLoadingState,
operators: [{ value: '=', description: __('is'), default: 'true' }], operators: OPERATOR_IS_ONLY,
unique: true, unique: true,
options: this.podOptions, options: this.podOptions,
loading: this.logs.isLoading, loading: this.logs.isLoading,
......
...@@ -5,6 +5,7 @@ import { getParameterByName, urlParamsToObject } from '~/lib/utils/common_utils' ...@@ -5,6 +5,7 @@ import { getParameterByName, urlParamsToObject } from '~/lib/utils/common_utils'
import { setUrlParams } from '~/lib/utils/url_utility'; import { setUrlParams } from '~/lib/utils/url_utility';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import { SEARCH_TOKEN_TYPE, SORT_PARAM } from '~/members/constants'; import { SEARCH_TOKEN_TYPE, SORT_PARAM } from '~/members/constants';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue';
export default { export default {
...@@ -17,7 +18,7 @@ export default { ...@@ -17,7 +18,7 @@ export default {
title: s__('Members|2FA'), title: s__('Members|2FA'),
token: GlFilteredSearchToken, token: GlFilteredSearchToken,
unique: true, unique: true,
operators: [{ value: '=', description: 'is' }], operators: OPERATOR_IS_ONLY,
options: [ options: [
{ value: 'enabled', title: s__('Members|Enabled') }, { value: 'enabled', title: s__('Members|Enabled') },
{ value: 'disabled', title: s__('Members|Disabled') }, { value: 'disabled', title: s__('Members|Disabled') },
...@@ -30,7 +31,7 @@ export default { ...@@ -30,7 +31,7 @@ export default {
title: s__('Members|Membership'), title: s__('Members|Membership'),
token: GlFilteredSearchToken, token: GlFilteredSearchToken,
unique: true, unique: true,
operators: [{ value: '=', description: 'is' }], operators: OPERATOR_IS_ONLY,
options: [ options: [
{ value: 'exclude', title: s__('Members|Direct') }, { value: 'exclude', title: s__('Members|Direct') },
{ value: 'only', title: s__('Members|Inherited') }, { value: 'only', title: s__('Members|Inherited') },
......
<script> <script>
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import { __, s__ } from '~/locale'; import { s__ } from '~/locale';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import RegistrySearch from '~/vue_shared/components/registry/registry_search.vue'; import RegistrySearch from '~/vue_shared/components/registry/registry_search.vue';
import UrlSync from '~/vue_shared/components/url_sync.vue'; import UrlSync from '~/vue_shared/components/url_sync.vue';
import { sortableFields } from '../utils'; import { sortableFields } from '../utils';
...@@ -14,7 +15,7 @@ export default { ...@@ -14,7 +15,7 @@ export default {
title: s__('PackageRegistry|Type'), title: s__('PackageRegistry|Type'),
unique: true, unique: true,
token: PackageTypeToken, token: PackageTypeToken,
operators: [{ value: '=', description: __('is'), default: 'true' }], operators: OPERATOR_IS_ONLY,
}, },
], ],
components: { RegistrySearch, UrlSync }, components: { RegistrySearch, UrlSync },
......
<script> <script>
import { GlFilteredSearch } from '@gitlab/ui'; import { GlFilteredSearch } from '@gitlab/ui';
import { map } from 'lodash'; import { map } from 'lodash';
import { __, s__ } from '~/locale'; import { s__ } from '~/locale';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import PipelineBranchNameToken from './tokens/pipeline_branch_name_token.vue'; import PipelineBranchNameToken from './tokens/pipeline_branch_name_token.vue';
import PipelineStatusToken from './tokens/pipeline_status_token.vue'; import PipelineStatusToken from './tokens/pipeline_status_token.vue';
import PipelineTagNameToken from './tokens/pipeline_tag_name_token.vue'; import PipelineTagNameToken from './tokens/pipeline_tag_name_token.vue';
...@@ -43,7 +44,7 @@ export default { ...@@ -43,7 +44,7 @@ export default {
title: s__('Pipeline|Trigger author'), title: s__('Pipeline|Trigger author'),
unique: true, unique: true,
token: PipelineTriggerAuthorToken, token: PipelineTriggerAuthorToken,
operators: [{ value: '=', description: __('is'), default: 'true' }], operators: OPERATOR_IS_ONLY,
projectId: this.projectId, projectId: this.projectId,
}, },
{ {
...@@ -52,7 +53,7 @@ export default { ...@@ -52,7 +53,7 @@ export default {
title: s__('Pipeline|Branch name'), title: s__('Pipeline|Branch name'),
unique: true, unique: true,
token: PipelineBranchNameToken, token: PipelineBranchNameToken,
operators: [{ value: '=', description: __('is'), default: 'true' }], operators: OPERATOR_IS_ONLY,
projectId: this.projectId, projectId: this.projectId,
disabled: this.selectedTypes.includes(this.$options.tagType), disabled: this.selectedTypes.includes(this.$options.tagType),
}, },
...@@ -62,7 +63,7 @@ export default { ...@@ -62,7 +63,7 @@ export default {
title: s__('Pipeline|Tag name'), title: s__('Pipeline|Tag name'),
unique: true, unique: true,
token: PipelineTagNameToken, token: PipelineTagNameToken,
operators: [{ value: '=', description: __('is'), default: 'true' }], operators: OPERATOR_IS_ONLY,
projectId: this.projectId, projectId: this.projectId,
disabled: this.selectedTypes.includes(this.$options.branchType), disabled: this.selectedTypes.includes(this.$options.branchType),
}, },
...@@ -72,7 +73,7 @@ export default { ...@@ -72,7 +73,7 @@ export default {
title: s__('Pipeline|Status'), title: s__('Pipeline|Status'),
unique: true, unique: true,
token: PipelineStatusToken, token: PipelineStatusToken,
operators: [{ value: '=', description: __('is'), default: 'true' }], operators: OPERATOR_IS_ONLY,
}, },
]; ];
}, },
......
/* eslint-disable @gitlab/require-i18n-strings */
import { __ } from '~/locale'; import { __ } from '~/locale';
export const DEBOUNCE_DELAY = 200; export const DEBOUNCE_DELAY = 200;
...@@ -7,6 +6,12 @@ export const FILTER_NONE = 'None'; ...@@ -7,6 +6,12 @@ export const FILTER_NONE = 'None';
export const FILTER_ANY = 'Any'; export const FILTER_ANY = 'Any';
export const FILTER_CURRENT = 'Current'; export const FILTER_CURRENT = 'Current';
export const OPERATOR_IS = '=';
export const OPERATOR_IS_TEXT = __('is');
export const OPERATOR_IS_NOT = '!=';
export const OPERATOR_IS_ONLY = [{ value: OPERATOR_IS, description: OPERATOR_IS_TEXT }];
export const DEFAULT_LABEL_NONE = { value: FILTER_NONE, text: __(FILTER_NONE) }; export const DEFAULT_LABEL_NONE = { value: FILTER_NONE, text: __(FILTER_NONE) };
export const DEFAULT_LABEL_ANY = { value: FILTER_ANY, text: __(FILTER_ANY) }; export const DEFAULT_LABEL_ANY = { value: FILTER_ANY, text: __(FILTER_ANY) };
export const DEFAULT_NONE_ANY = [DEFAULT_LABEL_NONE, DEFAULT_LABEL_ANY]; export const DEFAULT_NONE_ANY = [DEFAULT_LABEL_NONE, DEFAULT_LABEL_ANY];
...@@ -15,15 +20,26 @@ export const DEFAULT_ITERATIONS = DEFAULT_NONE_ANY.concat([ ...@@ -15,15 +20,26 @@ export const DEFAULT_ITERATIONS = DEFAULT_NONE_ANY.concat([
{ value: FILTER_CURRENT, text: __(FILTER_CURRENT) }, { value: FILTER_CURRENT, text: __(FILTER_CURRENT) },
]); ]);
export const DEFAULT_LABELS = [{ value: 'No label', text: __('No label') }]; export const DEFAULT_LABELS = [{ value: 'No label', text: __('No label') }]; // eslint-disable-line @gitlab/require-i18n-strings
export const DEFAULT_MILESTONES = DEFAULT_NONE_ANY.concat([ export const DEFAULT_MILESTONES = DEFAULT_NONE_ANY.concat([
{ value: 'Upcoming', text: __('Upcoming') }, { value: 'Upcoming', text: __('Upcoming') }, // eslint-disable-line @gitlab/require-i18n-strings
{ value: 'Started', text: __('Started') }, { value: 'Started', text: __('Started') }, // eslint-disable-line @gitlab/require-i18n-strings
]); ]);
export const SortDirection = { export const SortDirection = {
descending: 'descending', descending: 'descending',
ascending: 'ascending', ascending: 'ascending',
}; };
/* eslint-enable @gitlab/require-i18n-strings */
export const FILTERED_SEARCH_TERM = 'filtered-search-term';
export const TOKEN_TITLE_AUTHOR = __('Author');
export const TOKEN_TITLE_ASSIGNEE = __('Assignee');
export const TOKEN_TITLE_MILESTONE = __('Milestone');
export const TOKEN_TITLE_LABEL = __('Label');
export const TOKEN_TITLE_MY_REACTION = __('My-Reaction');
export const TOKEN_TITLE_CONFIDENTIAL = __('Confidential');
export const TOKEN_TITLE_ITERATION = __('Iteration');
export const TOKEN_TITLE_EPIC = __('Epic');
export const TOKEN_TITLE_WEIGHT = __('Weight');
...@@ -4,6 +4,7 @@ import Api from '~/api'; ...@@ -4,6 +4,7 @@ import Api from '~/api';
import { updateHistory, setUrlParams } from '~/lib/utils/url_utility'; import { updateHistory, setUrlParams } from '~/lib/utils/url_utility';
import { __ } from '~/locale'; import { __ } from '~/locale';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
import { initialPaginationState, defaultI18n, defaultPageSize } from './constants'; import { initialPaginationState, defaultI18n, defaultPageSize } from './constants';
...@@ -105,7 +106,7 @@ export default { ...@@ -105,7 +106,7 @@ export default {
unique: true, unique: true,
symbol: '@', symbol: '@',
token: AuthorToken, token: AuthorToken,
operators: [{ value: '=', description: __('is'), default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchPath: this.projectPath, fetchPath: this.projectPath,
fetchAuthors: Api.projectUsers.bind(Api), fetchAuthors: Api.projectUsers.bind(Api),
}, },
...@@ -116,7 +117,7 @@ export default { ...@@ -116,7 +117,7 @@ export default {
unique: true, unique: true,
symbol: '@', symbol: '@',
token: AuthorToken, token: AuthorToken,
operators: [{ value: '=', description: __('is'), default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchPath: this.projectPath, fetchPath: this.projectPath,
fetchAuthors: Api.projectUsers.bind(Api), fetchAuthors: Api.projectUsers.bind(Api),
}, },
......
<script> <script>
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { import { DEFAULT_NONE_ANY } from '~/vue_shared/components/filtered_search_bar/constants';
DEFAULT_LABEL_NONE,
DEFAULT_LABEL_ANY,
} from '~/vue_shared/components/filtered_search_bar/constants';
import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue';
import { import {
prepareTokens, prepareTokens,
...@@ -50,7 +47,7 @@ export default { ...@@ -50,7 +47,7 @@ export default {
title: __('Label'), title: __('Label'),
type: 'labels', type: 'labels',
token: LabelToken, token: LabelToken,
defaultLabels: [DEFAULT_LABEL_NONE, DEFAULT_LABEL_ANY], defaultLabels: DEFAULT_NONE_ANY,
initialLabels: this.labelsData, initialLabels: this.labelsData,
unique: false, unique: false,
symbol: '~', symbol: '~',
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { import {
DEFAULT_LABEL_NONE, OPERATOR_IS_ONLY,
DEFAULT_LABEL_ANY, DEFAULT_NONE_ANY,
} from '~/vue_shared/components/filtered_search_bar/constants'; } from '~/vue_shared/components/filtered_search_bar/constants';
import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue';
import { import {
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
initialMilestones: this.milestonesData, initialMilestones: this.milestonesData,
unique: true, unique: true,
symbol: '%', symbol: '%',
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchMilestones: this.fetchMilestones, fetchMilestones: this.fetchMilestones,
}, },
{ {
...@@ -57,11 +57,11 @@ export default { ...@@ -57,11 +57,11 @@ export default {
title: __('Label'), title: __('Label'),
type: 'labels', type: 'labels',
token: LabelToken, token: LabelToken,
defaultLabels: [DEFAULT_LABEL_NONE, DEFAULT_LABEL_ANY], defaultLabels: DEFAULT_NONE_ANY,
initialLabels: this.labelsData, initialLabels: this.labelsData,
unique: false, unique: false,
symbol: '~', symbol: '~',
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchLabels: this.fetchLabels, fetchLabels: this.fetchLabels,
}, },
{ {
...@@ -71,7 +71,7 @@ export default { ...@@ -71,7 +71,7 @@ export default {
token: AuthorToken, token: AuthorToken,
initialAuthors: this.authorsData, initialAuthors: this.authorsData,
unique: true, unique: true,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchAuthors: this.fetchAuthors, fetchAuthors: this.fetchAuthors,
}, },
{ {
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
defaultAuthors: [], defaultAuthors: [],
initialAuthors: this.assigneesData, initialAuthors: this.assigneesData,
unique: false, unique: false,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchAuthors: this.fetchAssignees, fetchAuthors: this.fetchAssignees,
}, },
]; ];
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { import {
DEFAULT_LABEL_NONE, OPERATOR_IS_ONLY,
DEFAULT_LABEL_ANY, DEFAULT_NONE_ANY,
} from '~/vue_shared/components/filtered_search_bar/constants'; } from '~/vue_shared/components/filtered_search_bar/constants';
import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue';
import { import {
...@@ -47,7 +47,7 @@ export default { ...@@ -47,7 +47,7 @@ export default {
token: BranchToken, token: BranchToken,
initialBranches: this.branchesData, initialBranches: this.branchesData,
unique: true, unique: true,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchBranches: this.fetchBranches, fetchBranches: this.fetchBranches,
}, },
{ {
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
token: BranchToken, token: BranchToken,
initialBranches: this.branchesData, initialBranches: this.branchesData,
unique: true, unique: true,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchBranches: this.fetchBranches, fetchBranches: this.fetchBranches,
}, },
{ {
...@@ -68,7 +68,7 @@ export default { ...@@ -68,7 +68,7 @@ export default {
initialMilestones: this.milestonesData, initialMilestones: this.milestonesData,
unique: true, unique: true,
symbol: '%', symbol: '%',
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchMilestones: this.fetchMilestones, fetchMilestones: this.fetchMilestones,
}, },
{ {
...@@ -76,11 +76,11 @@ export default { ...@@ -76,11 +76,11 @@ export default {
title: __('Label'), title: __('Label'),
type: 'labels', type: 'labels',
token: LabelToken, token: LabelToken,
defaultLabels: [DEFAULT_LABEL_NONE, DEFAULT_LABEL_ANY], defaultLabels: DEFAULT_NONE_ANY,
initialLabels: this.labelsData, initialLabels: this.labelsData,
unique: false, unique: false,
symbol: '~', symbol: '~',
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchLabels: this.fetchLabels, fetchLabels: this.fetchLabels,
}, },
{ {
...@@ -91,7 +91,7 @@ export default { ...@@ -91,7 +91,7 @@ export default {
defaultAuthors: [], defaultAuthors: [],
initialAuthors: this.authorsData, initialAuthors: this.authorsData,
unique: true, unique: true,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchAuthors: this.fetchAuthors, fetchAuthors: this.fetchAuthors,
}, },
{ {
...@@ -102,7 +102,7 @@ export default { ...@@ -102,7 +102,7 @@ export default {
defaultAuthors: [], defaultAuthors: [],
initialAuthors: this.assigneesData, initialAuthors: this.assigneesData,
unique: false, unique: false,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchAuthors: this.fetchAssignees, fetchAuthors: this.fetchAssignees,
}, },
]; ];
......
import { __, s__ } from '~/locale'; import { s__ } from '~/locale';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import GroupToken from './components/tokens/group_token.vue'; import GroupToken from './components/tokens/group_token.vue';
import MemberToken from './components/tokens/member_token.vue'; import MemberToken from './components/tokens/member_token.vue';
import ProjectToken from './components/tokens/project_token.vue'; import ProjectToken from './components/tokens/project_token.vue';
import UserToken from './components/tokens/user_token.vue'; import UserToken from './components/tokens/user_token.vue';
const DEFAULT_TOKEN_OPTIONS = { const DEFAULT_TOKEN_OPTIONS = {
operators: [{ value: '=', description: __('is'), default: 'true' }], operators: OPERATOR_IS_ONLY,
unique: true, unique: true,
}; };
......
...@@ -8,7 +8,10 @@ import { updateHistory, setUrlParams } from '~/lib/utils/url_utility'; ...@@ -8,7 +8,10 @@ import { updateHistory, setUrlParams } from '~/lib/utils/url_utility';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
import { DEFAULT_LABEL_ANY } from '~/vue_shared/components/filtered_search_bar/constants'; import {
DEFAULT_LABEL_ANY,
OPERATOR_IS_ONLY,
} from '~/vue_shared/components/filtered_search_bar/constants';
import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
...@@ -286,7 +289,7 @@ export default { ...@@ -286,7 +289,7 @@ export default {
unique: false, unique: false,
symbol: '@', symbol: '@',
token: AuthorToken, token: AuthorToken,
operators: [{ value: '=', description: __('is'), default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchPath: this.projectPath, fetchPath: this.projectPath,
fetchAuthors: Api.projectUsers.bind(Api), fetchAuthors: Api.projectUsers.bind(Api),
}, },
...@@ -296,7 +299,7 @@ export default { ...@@ -296,7 +299,7 @@ export default {
title: __('Status'), title: __('Status'),
unique: true, unique: true,
token: StatusToken, token: StatusToken,
operators: [{ value: '=', description: __('is'), default: 'true' }], operators: OPERATOR_IS_ONLY,
}, },
]; ];
}, },
......
import { s__, __ } from '~/locale'; import { s__ } from '~/locale';
/* /*
Update the counterparts in roadmap.scss when making changes. Update the counterparts in roadmap.scss when making changes.
...@@ -71,11 +71,6 @@ export const EPIC_LEVEL_MARGIN = { ...@@ -71,11 +71,6 @@ export const EPIC_LEVEL_MARGIN = {
4: 'ml-10', 4: 'ml-10',
}; };
export const FilterTokenOperators = [
{ value: '=', description: __('is'), default: 'true' },
// { value: '!=', description: __('is not') },
];
export const EPICS_LIMIT_DISMISSED_COOKIE_NAME = 'epics_limit_warning_dismissed'; export const EPICS_LIMIT_DISMISSED_COOKIE_NAME = 'epics_limit_warning_dismissed';
export const EPICS_LIMIT_DISMISSED_COOKIE_TIMEOUT = 365; export const EPICS_LIMIT_DISMISSED_COOKIE_TIMEOUT = 365;
...@@ -5,14 +5,13 @@ import axios from '~/lib/utils/axios_utils'; ...@@ -5,14 +5,13 @@ import axios from '~/lib/utils/axios_utils';
import { joinPaths } from '~/lib/utils/url_utility'; import { joinPaths } from '~/lib/utils/url_utility';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
import EmojiToken from '~/vue_shared/components/filtered_search_bar/tokens/emoji_token.vue'; import EmojiToken from '~/vue_shared/components/filtered_search_bar/tokens/emoji_token.vue';
import EpicToken from '~/vue_shared/components/filtered_search_bar/tokens/epic_token.vue'; import EpicToken from '~/vue_shared/components/filtered_search_bar/tokens/epic_token.vue';
import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue'; import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue';
import MilestoneToken from '~/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue'; import MilestoneToken from '~/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue';
import { FilterTokenOperators } from '../constants';
export default { export default {
inject: ['groupFullPath', 'groupMilestonesPath', 'listEpicsPath'], inject: ['groupFullPath', 'groupMilestonesPath', 'listEpicsPath'],
computed: { computed: {
...@@ -52,7 +51,7 @@ export default { ...@@ -52,7 +51,7 @@ export default {
unique: true, unique: true,
symbol: '@', symbol: '@',
token: AuthorToken, token: AuthorToken,
operators: FilterTokenOperators, operators: OPERATOR_IS_ONLY,
fetchAuthors: Api.users.bind(Api), fetchAuthors: Api.users.bind(Api),
}, },
{ {
...@@ -62,7 +61,7 @@ export default { ...@@ -62,7 +61,7 @@ export default {
unique: false, unique: false,
symbol: '~', symbol: '~',
token: LabelToken, token: LabelToken,
operators: FilterTokenOperators, operators: OPERATOR_IS_ONLY,
fetchLabels: (search = '') => { fetchLabels: (search = '') => {
const params = { const params = {
only_group_labels: true, only_group_labels: true,
...@@ -86,7 +85,7 @@ export default { ...@@ -86,7 +85,7 @@ export default {
unique: true, unique: true,
symbol: '%', symbol: '%',
token: MilestoneToken, token: MilestoneToken,
operators: FilterTokenOperators, operators: OPERATOR_IS_ONLY,
fetchMilestones: (search = '') => { fetchMilestones: (search = '') => {
return axios.get(this.groupMilestonesPath).then(({ data }) => { return axios.get(this.groupMilestonesPath).then(({ data }) => {
// TODO: Remove below condition check once either of the following is supported. // TODO: Remove below condition check once either of the following is supported.
...@@ -107,7 +106,7 @@ export default { ...@@ -107,7 +106,7 @@ export default {
title: __('Confidential'), title: __('Confidential'),
unique: true, unique: true,
token: GlFilteredSearchToken, token: GlFilteredSearchToken,
operators: FilterTokenOperators, operators: OPERATOR_IS_ONLY,
options: [ options: [
{ icon: 'eye-slash', value: true, title: __('Yes') }, { icon: 'eye-slash', value: true, title: __('Yes') },
{ icon: 'eye', value: false, title: __('No') }, { icon: 'eye', value: false, title: __('No') },
...@@ -120,7 +119,7 @@ export default { ...@@ -120,7 +119,7 @@ export default {
unique: true, unique: true,
symbol: '&', symbol: '&',
token: EpicToken, token: EpicToken,
operators: FilterTokenOperators, operators: OPERATOR_IS_ONLY,
idProperty: 'iid', idProperty: 'iid',
defaultEpics: [], defaultEpics: [],
fetchEpics: (search = '') => { fetchEpics: (search = '') => {
...@@ -140,7 +139,7 @@ export default { ...@@ -140,7 +139,7 @@ export default {
title: __('My-Reaction'), title: __('My-Reaction'),
unique: true, unique: true,
token: EmojiToken, token: EmojiToken,
operators: FilterTokenOperators, operators: OPERATOR_IS_ONLY,
fetchEmojis: (search = '') => { fetchEmojis: (search = '') => {
return axios return axios
.get(`${gon.relative_url_root || ''}/-/autocomplete/award_emojis`) .get(`${gon.relative_url_root || ''}/-/autocomplete/award_emojis`)
......
...@@ -9,6 +9,7 @@ import { urlParamsToObject } from '~/lib/utils/common_utils'; ...@@ -9,6 +9,7 @@ import { urlParamsToObject } from '~/lib/utils/common_utils';
import { updateHistory, setUrlParams } from '~/lib/utils/url_utility'; import { updateHistory, setUrlParams } from '~/lib/utils/url_utility';
import { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue'; import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue';
...@@ -197,7 +198,7 @@ export default { ...@@ -197,7 +198,7 @@ export default {
unique: true, unique: true,
symbol: '@', symbol: '@',
token: AuthorToken, token: AuthorToken,
operators: [{ value: '=', description: __('is'), default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchPath: this.projectFullPath, fetchPath: this.projectFullPath,
fetchAuthors: Api.projectUsers.bind(Api), fetchAuthors: Api.projectUsers.bind(Api),
}, },
...@@ -208,7 +209,7 @@ export default { ...@@ -208,7 +209,7 @@ export default {
unique: false, unique: false,
symbol: '~', symbol: '~',
token: LabelToken, token: LabelToken,
operators: [{ value: '=', description: __('is'), default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchLabels: (search = '') => { fetchLabels: (search = '') => {
const params = { const params = {
include_ancestor_groups: true, include_ancestor_groups: true,
......
...@@ -3,6 +3,7 @@ import { shallowMount } from '@vue/test-utils'; ...@@ -3,6 +3,7 @@ import { shallowMount } from '@vue/test-utils';
import AuditEventsFilter from 'ee/audit_events/components/audit_events_filter.vue'; import AuditEventsFilter from 'ee/audit_events/components/audit_events_filter.vue';
import { AVAILABLE_TOKEN_TYPES } from 'ee/audit_events/constants'; import { AVAILABLE_TOKEN_TYPES } from 'ee/audit_events/constants';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
describe('AuditEventsFilter', () => { describe('AuditEventsFilter', () => {
let wrapper; let wrapper;
...@@ -38,7 +39,7 @@ describe('AuditEventsFilter', () => { ...@@ -38,7 +39,7 @@ describe('AuditEventsFilter', () => {
expect(getAvailableTokenProps(type)).toMatchObject({ expect(getAvailableTokenProps(type)).toMatchObject({
title, title,
unique: true, unique: true,
operators: [expect.objectContaining({ value: '=' })], operators: OPERATOR_IS_ONLY,
}); });
}); });
}); });
......
import StatusToken from 'ee/requirements/components/tokens/status_token.vue'; import StatusToken from 'ee/requirements/components/tokens/status_token.vue';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
export const mockUserPermissions = { export const mockUserPermissions = {
...@@ -161,7 +162,7 @@ export const mockAuthorToken = { ...@@ -161,7 +162,7 @@ export const mockAuthorToken = {
unique: false, unique: false,
symbol: '@', symbol: '@',
token: AuthorToken, token: AuthorToken,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchPath: 'gitlab-org/gitlab-shell', fetchPath: 'gitlab-org/gitlab-shell',
fetchAuthors: expect.any(Function), fetchAuthors: expect.any(Function),
}; };
...@@ -172,7 +173,7 @@ export const mockStatusToken = { ...@@ -172,7 +173,7 @@ export const mockStatusToken = {
title: 'Status', title: 'Status',
unique: true, unique: true,
token: StatusToken, token: StatusToken,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
}; };
/* /*
......
...@@ -10,6 +10,7 @@ import { mockSortedBy, mockTimeframeInitialDate } from 'ee_jest/roadmap/mock_dat ...@@ -10,6 +10,7 @@ import { mockSortedBy, mockTimeframeInitialDate } from 'ee_jest/roadmap/mock_dat
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import { visitUrl, mergeUrlParams, updateHistory } from '~/lib/utils/url_utility'; import { visitUrl, mergeUrlParams, updateHistory } from '~/lib/utils/url_utility';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
import EmojiToken from '~/vue_shared/components/filtered_search_bar/tokens/emoji_token.vue'; import EmojiToken from '~/vue_shared/components/filtered_search_bar/tokens/emoji_token.vue';
...@@ -163,7 +164,7 @@ describe('RoadmapFilters', () => { ...@@ -163,7 +164,7 @@ describe('RoadmapFilters', () => {
]; ];
let filteredSearchBar; let filteredSearchBar;
const operators = [{ value: '=', description: 'is', default: 'true' }]; const operators = OPERATOR_IS_ONLY;
const filterTokens = [ const filterTokens = [
{ {
......
import { OPERATOR_IS, OPERATOR_IS_NOT } from '~/issues_list/constants'; import {
OPERATOR_IS,
OPERATOR_IS_NOT,
} from '~/vue_shared/components/filtered_search_bar/constants';
export const locationSearch = [ export const locationSearch = [
'?search=find+issues', '?search=find+issues',
......
...@@ -4,6 +4,7 @@ import { convertToFixedRange } from '~/lib/utils/datetime_range'; ...@@ -4,6 +4,7 @@ import { convertToFixedRange } from '~/lib/utils/datetime_range';
import LogAdvancedFilters from '~/logs/components/log_advanced_filters.vue'; import LogAdvancedFilters from '~/logs/components/log_advanced_filters.vue';
import { TOKEN_TYPE_POD_NAME } from '~/logs/constants'; import { TOKEN_TYPE_POD_NAME } from '~/logs/constants';
import { createStore } from '~/logs/stores'; import { createStore } from '~/logs/stores';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import { defaultTimeRange } from '~/vue_shared/constants'; import { defaultTimeRange } from '~/vue_shared/constants';
import { mockPods, mockSearch } from '../mock_data'; import { mockPods, mockSearch } from '../mock_data';
...@@ -77,7 +78,7 @@ describe('LogAdvancedFilters', () => { ...@@ -77,7 +78,7 @@ describe('LogAdvancedFilters', () => {
expect(getSearchToken(TOKEN_TYPE_POD_NAME)).toMatchObject({ expect(getSearchToken(TOKEN_TYPE_POD_NAME)).toMatchObject({
title: 'Pod name', title: 'Pod name',
unique: true, unique: true,
operators: [expect.objectContaining({ value: '=' })], operators: OPERATOR_IS_ONLY,
}); });
}); });
......
...@@ -3,6 +3,7 @@ import { shallowMount, createLocalVue } from '@vue/test-utils'; ...@@ -3,6 +3,7 @@ import { shallowMount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import MembersFilteredSearchBar from '~/members/components/filter_sort/members_filtered_search_bar.vue'; import MembersFilteredSearchBar from '~/members/components/filter_sort/members_filtered_search_bar.vue';
import { MEMBER_TYPES } from '~/members/constants'; import { MEMBER_TYPES } from '~/members/constants';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue';
const localVue = createLocalVue(); const localVue = createLocalVue();
...@@ -65,7 +66,7 @@ describe('MembersFilteredSearchBar', () => { ...@@ -65,7 +66,7 @@ describe('MembersFilteredSearchBar', () => {
title: '2FA', title: '2FA',
token: GlFilteredSearchToken, token: GlFilteredSearchToken,
unique: true, unique: true,
operators: [{ value: '=', description: 'is' }], operators: OPERATOR_IS_ONLY,
options: [ options: [
{ value: 'enabled', title: 'Enabled' }, { value: 'enabled', title: 'Enabled' },
{ value: 'disabled', title: 'Disabled' }, { value: 'disabled', title: 'Disabled' },
...@@ -99,7 +100,7 @@ describe('MembersFilteredSearchBar', () => { ...@@ -99,7 +100,7 @@ describe('MembersFilteredSearchBar', () => {
title: 'Membership', title: 'Membership',
token: GlFilteredSearchToken, token: GlFilteredSearchToken,
unique: true, unique: true,
operators: [{ value: '=', description: 'is' }], operators: OPERATOR_IS_ONLY,
options: [ options: [
{ value: 'exclude', title: 'Direct' }, { value: 'exclude', title: 'Direct' },
{ value: 'only', title: 'Inherited' }, { value: 'only', title: 'Inherited' },
......
...@@ -4,6 +4,7 @@ import MockAdapter from 'axios-mock-adapter'; ...@@ -4,6 +4,7 @@ import MockAdapter from 'axios-mock-adapter';
import Api from '~/api'; import Api from '~/api';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import PipelinesFilteredSearch from '~/pipelines/components/pipelines_list/pipelines_filtered_search.vue'; import PipelinesFilteredSearch from '~/pipelines/components/pipelines_list/pipelines_filtered_search.vue';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import { users, mockSearch, branches, tags } from '../mock_data'; import { users, mockSearch, branches, tags } from '../mock_data';
describe('Pipelines filtered search', () => { describe('Pipelines filtered search', () => {
...@@ -57,7 +58,7 @@ describe('Pipelines filtered search', () => { ...@@ -57,7 +58,7 @@ describe('Pipelines filtered search', () => {
title: 'Trigger author', title: 'Trigger author',
unique: true, unique: true,
projectId: '21', projectId: '21',
operators: [expect.objectContaining({ value: '=' })], operators: OPERATOR_IS_ONLY,
}); });
expect(findBranchToken()).toMatchObject({ expect(findBranchToken()).toMatchObject({
...@@ -66,7 +67,7 @@ describe('Pipelines filtered search', () => { ...@@ -66,7 +67,7 @@ describe('Pipelines filtered search', () => {
title: 'Branch name', title: 'Branch name',
unique: true, unique: true,
projectId: '21', projectId: '21',
operators: [expect.objectContaining({ value: '=' })], operators: OPERATOR_IS_ONLY,
}); });
expect(findStatusToken()).toMatchObject({ expect(findStatusToken()).toMatchObject({
...@@ -74,7 +75,7 @@ describe('Pipelines filtered search', () => { ...@@ -74,7 +75,7 @@ describe('Pipelines filtered search', () => {
icon: 'status', icon: 'status',
title: 'Status', title: 'Status',
unique: true, unique: true,
operators: [expect.objectContaining({ value: '=' })], operators: OPERATOR_IS_ONLY,
}); });
expect(findTagToken()).toMatchObject({ expect(findTagToken()).toMatchObject({
...@@ -82,7 +83,7 @@ describe('Pipelines filtered search', () => { ...@@ -82,7 +83,7 @@ describe('Pipelines filtered search', () => {
icon: 'tag', icon: 'tag',
title: 'Tag name', title: 'Tag name',
unique: true, unique: true,
operators: [expect.objectContaining({ value: '=' })], operators: OPERATOR_IS_ONLY,
}); });
}); });
......
import { GlFilteredSearchToken } from '@gitlab/ui'; import { GlFilteredSearchToken } from '@gitlab/ui';
import { mockLabels } from 'jest/vue_shared/components/sidebar/labels_select_vue/mock_data'; import { mockLabels } from 'jest/vue_shared/components/sidebar/labels_select_vue/mock_data';
import Api from '~/api'; import Api from '~/api';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
import BranchToken from '~/vue_shared/components/filtered_search_bar/tokens/branch_token.vue'; import BranchToken from '~/vue_shared/components/filtered_search_bar/tokens/branch_token.vue';
import EmojiToken from '~/vue_shared/components/filtered_search_bar/tokens/emoji_token.vue'; import EmojiToken from '~/vue_shared/components/filtered_search_bar/tokens/emoji_token.vue';
...@@ -84,7 +85,7 @@ export const mockBranchToken = { ...@@ -84,7 +85,7 @@ export const mockBranchToken = {
title: 'Source Branch', title: 'Source Branch',
unique: true, unique: true,
token: BranchToken, token: BranchToken,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchBranches: Api.branches.bind(Api), fetchBranches: Api.branches.bind(Api),
}; };
...@@ -95,7 +96,7 @@ export const mockAuthorToken = { ...@@ -95,7 +96,7 @@ export const mockAuthorToken = {
unique: false, unique: false,
symbol: '@', symbol: '@',
token: AuthorToken, token: AuthorToken,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchPath: 'gitlab-org/gitlab-test', fetchPath: 'gitlab-org/gitlab-test',
fetchAuthors: Api.projectUsers.bind(Api), fetchAuthors: Api.projectUsers.bind(Api),
}; };
...@@ -116,7 +117,7 @@ export const mockLabelToken = { ...@@ -116,7 +117,7 @@ export const mockLabelToken = {
unique: false, unique: false,
symbol: '~', symbol: '~',
token: LabelToken, token: LabelToken,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchLabels: () => Promise.resolve(mockLabels), fetchLabels: () => Promise.resolve(mockLabels),
}; };
...@@ -127,7 +128,7 @@ export const mockMilestoneToken = { ...@@ -127,7 +128,7 @@ export const mockMilestoneToken = {
unique: true, unique: true,
symbol: '%', symbol: '%',
token: MilestoneToken, token: MilestoneToken,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchMilestones: () => Promise.resolve({ data: mockMilestones }), fetchMilestones: () => Promise.resolve({ data: mockMilestones }),
}; };
...@@ -138,7 +139,7 @@ export const mockEpicToken = { ...@@ -138,7 +139,7 @@ export const mockEpicToken = {
unique: true, unique: true,
symbol: '&', symbol: '&',
token: EpicToken, token: EpicToken,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
idProperty: 'iid', idProperty: 'iid',
fetchEpics: () => Promise.resolve({ data: mockEpics }), fetchEpics: () => Promise.resolve({ data: mockEpics }),
}; };
...@@ -149,7 +150,7 @@ export const mockReactionEmojiToken = { ...@@ -149,7 +150,7 @@ export const mockReactionEmojiToken = {
title: 'My-Reaction', title: 'My-Reaction',
unique: true, unique: true,
token: EmojiToken, token: EmojiToken,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchEmojis: () => Promise.resolve(mockEmojis), fetchEmojis: () => Promise.resolve(mockEmojis),
}; };
...@@ -159,7 +160,7 @@ export const mockMembershipToken = { ...@@ -159,7 +160,7 @@ export const mockMembershipToken = {
title: 'Membership', title: 'Membership',
token: GlFilteredSearchToken, token: GlFilteredSearchToken,
unique: true, unique: true,
operators: [{ value: '=', description: 'is' }], operators: OPERATOR_IS_ONLY,
options: [ options: [
{ value: 'exclude', title: 'Direct' }, { value: 'exclude', title: 'Direct' },
{ value: 'only', title: 'Inherited' }, { value: 'only', title: 'Inherited' },
......
...@@ -11,8 +11,8 @@ import { deprecatedCreateFlash as createFlash } from '~/flash'; ...@@ -11,8 +11,8 @@ import { deprecatedCreateFlash as createFlash } from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { import {
DEFAULT_LABEL_NONE,
DEFAULT_LABEL_ANY, DEFAULT_LABEL_ANY,
DEFAULT_NONE_ANY,
} from '~/vue_shared/components/filtered_search_bar/constants'; } from '~/vue_shared/components/filtered_search_bar/constants';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
...@@ -159,7 +159,7 @@ describe('AuthorToken', () => { ...@@ -159,7 +159,7 @@ describe('AuthorToken', () => {
}); });
it('renders provided defaultAuthors as suggestions', async () => { it('renders provided defaultAuthors as suggestions', async () => {
const defaultAuthors = [DEFAULT_LABEL_NONE, DEFAULT_LABEL_ANY]; const defaultAuthors = DEFAULT_NONE_ANY;
wrapper = createComponent({ wrapper = createComponent({
active: true, active: true,
config: { ...mockAuthorToken, defaultAuthors }, config: { ...mockAuthorToken, defaultAuthors },
......
...@@ -10,10 +10,7 @@ import waitForPromises from 'helpers/wait_for_promises'; ...@@ -10,10 +10,7 @@ import waitForPromises from 'helpers/wait_for_promises';
import createFlash from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { import { DEFAULT_NONE_ANY } from '~/vue_shared/components/filtered_search_bar/constants';
DEFAULT_LABEL_NONE,
DEFAULT_LABEL_ANY,
} from '~/vue_shared/components/filtered_search_bar/constants';
import BranchToken from '~/vue_shared/components/filtered_search_bar/tokens/branch_token.vue'; import BranchToken from '~/vue_shared/components/filtered_search_bar/tokens/branch_token.vue';
import { mockBranches, mockBranchToken } from '../mock_data'; import { mockBranches, mockBranchToken } from '../mock_data';
...@@ -137,7 +134,7 @@ describe('BranchToken', () => { ...@@ -137,7 +134,7 @@ describe('BranchToken', () => {
}); });
describe('template', () => { describe('template', () => {
const defaultBranches = [DEFAULT_LABEL_NONE, DEFAULT_LABEL_ANY]; const defaultBranches = DEFAULT_NONE_ANY;
async function showSuggestions() { async function showSuggestions() {
const tokenSegments = wrapper.findAll(GlFilteredSearchTokenSegment); const tokenSegments = wrapper.findAll(GlFilteredSearchTokenSegment);
const suggestionsSegment = tokenSegments.at(2); const suggestionsSegment = tokenSegments.at(2);
......
...@@ -13,6 +13,7 @@ import axios from '~/lib/utils/axios_utils'; ...@@ -13,6 +13,7 @@ import axios from '~/lib/utils/axios_utils';
import { import {
DEFAULT_LABEL_NONE, DEFAULT_LABEL_NONE,
DEFAULT_LABEL_ANY, DEFAULT_LABEL_ANY,
DEFAULT_NONE_ANY,
} from '~/vue_shared/components/filtered_search_bar/constants'; } from '~/vue_shared/components/filtered_search_bar/constants';
import EmojiToken from '~/vue_shared/components/filtered_search_bar/tokens/emoji_token.vue'; import EmojiToken from '~/vue_shared/components/filtered_search_bar/tokens/emoji_token.vue';
...@@ -137,7 +138,7 @@ describe('EmojiToken', () => { ...@@ -137,7 +138,7 @@ describe('EmojiToken', () => {
}); });
describe('template', () => { describe('template', () => {
const defaultEmojis = [DEFAULT_LABEL_NONE, DEFAULT_LABEL_ANY]; const defaultEmojis = DEFAULT_NONE_ANY;
beforeEach(async () => { beforeEach(async () => {
wrapper = createComponent({ wrapper = createComponent({
......
...@@ -16,8 +16,7 @@ import axios from '~/lib/utils/axios_utils'; ...@@ -16,8 +16,7 @@ import axios from '~/lib/utils/axios_utils';
import { import {
DEFAULT_LABELS, DEFAULT_LABELS,
DEFAULT_LABEL_NONE, DEFAULT_NONE_ANY,
DEFAULT_LABEL_ANY,
} from '~/vue_shared/components/filtered_search_bar/constants'; } from '~/vue_shared/components/filtered_search_bar/constants';
import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue'; import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue';
...@@ -176,7 +175,7 @@ describe('LabelToken', () => { ...@@ -176,7 +175,7 @@ describe('LabelToken', () => {
}); });
describe('template', () => { describe('template', () => {
const defaultLabels = [DEFAULT_LABEL_NONE, DEFAULT_LABEL_ANY]; const defaultLabels = DEFAULT_NONE_ANY;
beforeEach(async () => { beforeEach(async () => {
wrapper = createComponent({ value: { data: `"${mockRegularLabel.title}"` } }); wrapper = createComponent({ value: { data: `"${mockRegularLabel.title}"` } });
......
import { GlAlert, GlBadge, GlPagination, GlTabs, GlTab } from '@gitlab/ui'; import { GlAlert, GlBadge, GlPagination, GlTabs, GlTab } from '@gitlab/ui';
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants';
import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
import PageWrapper from '~/vue_shared/components/paginated_table_with_search_and_tabs/paginated_table_with_search_and_tabs.vue'; import PageWrapper from '~/vue_shared/components/paginated_table_with_search_and_tabs/paginated_table_with_search_and_tabs.vue';
...@@ -291,7 +292,7 @@ describe('AlertManagementEmptyState', () => { ...@@ -291,7 +292,7 @@ describe('AlertManagementEmptyState', () => {
unique: true, unique: true,
symbol: '@', symbol: '@',
token: AuthorToken, token: AuthorToken,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchPath: '/link', fetchPath: '/link',
fetchAuthors: expect.any(Function), fetchAuthors: expect.any(Function),
}, },
...@@ -302,7 +303,7 @@ describe('AlertManagementEmptyState', () => { ...@@ -302,7 +303,7 @@ describe('AlertManagementEmptyState', () => {
unique: true, unique: true,
symbol: '@', symbol: '@',
token: AuthorToken, token: AuthorToken,
operators: [{ value: '=', description: 'is', default: 'true' }], operators: OPERATOR_IS_ONLY,
fetchPath: '/link', fetchPath: '/link',
fetchAuthors: expect.any(Function), fetchAuthors: expect.any(Function),
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment