2021-06-08 01:23:25 +05:30
import { _ _ , s _ _ } from '~/locale' ;
import {
FILTER _ANY ,
FILTER _CURRENT ,
FILTER _NONE ,
2021-10-27 15:23:28 +05:30
FILTER _STARTED ,
FILTER _UPCOMING ,
2021-06-08 01:23:25 +05:30
OPERATOR _IS ,
OPERATOR _IS _NOT ,
} from '~/vue_shared/components/filtered_search_bar/constants' ;
2020-07-28 23:09:34 +05:30
2019-12-26 22:10:19 +05:30
// Maps sort order as it appears in the URL query to API `order_by` and `sort` params.
const PRIORITY = 'priority' ;
const ASC = 'asc' ;
const DESC = 'desc' ;
const CREATED _AT = 'created_at' ;
const UPDATED _AT = 'updated_at' ;
const DUE _DATE = 'due_date' ;
const MILESTONE _DUE = 'milestone_due' ;
const POPULARITY = 'popularity' ;
const WEIGHT = 'weight' ;
const LABEL _PRIORITY = 'label_priority' ;
2021-11-11 11:23:49 +05:30
const TITLE = 'title' ;
2019-12-26 22:10:19 +05:30
export const RELATIVE _POSITION = 'relative_position' ;
export const LOADING _LIST _ITEMS _LENGTH = 8 ;
export const PAGE _SIZE = 20 ;
export const PAGE _SIZE _MANUAL = 100 ;
export const sortOrderMap = {
priority : { order _by : PRIORITY , sort : ASC } , // asc and desc are flipped for some reason
created _date : { order _by : CREATED _AT , sort : DESC } ,
created _asc : { order _by : CREATED _AT , sort : ASC } ,
updated _desc : { order _by : UPDATED _AT , sort : DESC } ,
updated _asc : { order _by : UPDATED _AT , sort : ASC } ,
milestone _due _desc : { order _by : MILESTONE _DUE , sort : DESC } ,
milestone : { order _by : MILESTONE _DUE , sort : ASC } ,
due _date _desc : { order _by : DUE _DATE , sort : DESC } ,
due _date : { order _by : DUE _DATE , sort : ASC } ,
popularity : { order _by : POPULARITY , sort : DESC } ,
popularity _asc : { order _by : POPULARITY , sort : ASC } ,
label _priority : { order _by : LABEL _PRIORITY , sort : ASC } , // asc and desc are flipped
relative _position : { order _by : RELATIVE _POSITION , sort : ASC } ,
weight _desc : { order _by : WEIGHT , sort : DESC } ,
weight : { order _by : WEIGHT , sort : ASC } ,
2021-11-11 11:23:49 +05:30
title : { order _by : TITLE , sort : ASC } ,
title _desc : { order _by : TITLE , sort : DESC } ,
2019-12-26 22:10:19 +05:30
} ;
2020-07-28 23:09:34 +05:30
export const availableSortOptionsJira = [
{
id : 1 ,
title : _ _ ( 'Created date' ) ,
sortDirection : {
descending : 'created_desc' ,
ascending : 'created_asc' ,
} ,
} ,
{
id : 2 ,
title : _ _ ( 'Last updated' ) ,
sortDirection : {
descending : 'updated_desc' ,
ascending : 'updated_asc' ,
} ,
} ,
] ;
2021-06-08 01:23:25 +05:30
export const i18n = {
calendarLabel : _ _ ( 'Subscribe to calendar' ) ,
closed : _ _ ( 'CLOSED' ) ,
closedMoved : _ _ ( 'CLOSED (MOVED)' ) ,
confidentialNo : _ _ ( 'No' ) ,
confidentialYes : _ _ ( 'Yes' ) ,
downvotes : _ _ ( 'Downvotes' ) ,
editIssues : _ _ ( 'Edit issues' ) ,
2021-09-30 23:02:18 +05:30
errorFetchingCounts : _ _ ( 'An error occurred while getting issue counts' ) ,
2021-06-08 01:23:25 +05:30
errorFetchingIssues : _ _ ( 'An error occurred while loading issues' ) ,
jiraIntegrationMessage : s _ _ (
'JiraService|%{jiraDocsLinkStart}Enable the Jira integration%{jiraDocsLinkEnd} to view your Jira issues in GitLab.' ,
) ,
jiraIntegrationSecondaryMessage : s _ _ ( 'JiraService|This feature requires a Premium plan.' ) ,
jiraIntegrationTitle : s _ _ ( 'JiraService|Using Jira for issue tracking?' ) ,
newIssueLabel : _ _ ( 'New issue' ) ,
noClosedIssuesTitle : _ _ ( 'There are no closed issues' ) ,
noOpenIssuesDescription : _ _ ( 'To keep this project going, create a new issue' ) ,
noOpenIssuesTitle : _ _ ( 'There are no open issues' ) ,
noIssuesSignedInDescription : _ _ (
'Issues can be bugs, tasks or ideas to be discussed. Also, issues are searchable and filterable.' ,
) ,
noIssuesSignedInTitle : _ _ (
'The Issue Tracker is the place to add things that need to be improved or solved in a project' ,
) ,
noIssuesSignedOutButtonText : _ _ ( 'Register / Sign In' ) ,
noIssuesSignedOutDescription : _ _ (
'The Issue Tracker is the place to add things that need to be improved or solved in a project. You can register or sign in to create issues for this project.' ,
) ,
noIssuesSignedOutTitle : _ _ ( 'There are no issues to show' ) ,
noSearchResultsDescription : _ _ ( 'To widen your search, change or remove filters above' ) ,
noSearchResultsTitle : _ _ ( 'Sorry, your filter produced no results' ) ,
relatedMergeRequests : _ _ ( 'Related merge requests' ) ,
reorderError : _ _ ( 'An error occurred while reordering issues.' ) ,
rssLabel : _ _ ( 'Subscribe to RSS feed' ) ,
2021-09-30 23:02:18 +05:30
searchPlaceholder : _ _ ( 'Search or filter results...' ) ,
2021-06-08 01:23:25 +05:30
upvotes : _ _ ( 'Upvotes' ) ,
} ;
2020-07-28 23:09:34 +05:30
export const JIRA _IMPORT _SUCCESS _ALERT _HIDE _MAP _KEY = 'jira-import-success-alert-hide-map' ;
2021-04-29 21:17:54 +05:30
2021-06-08 01:23:25 +05:30
export const PARAM _DUE _DATE = 'due_date' ;
export const PARAM _SORT = 'sort' ;
export const PARAM _STATE = 'state' ;
2021-10-27 15:23:28 +05:30
export const defaultPageSizeParams = {
2021-09-04 01:27:46 +05:30
firstPageSize : PAGE _SIZE ,
} ;
2021-10-27 15:23:28 +05:30
export const largePageSizeParams = {
firstPageSize : PAGE _SIZE _MANUAL ,
} ;
2021-06-08 01:23:25 +05:30
export const DUE _DATE _NONE = '0' ;
export const DUE _DATE _ANY = '' ;
export const DUE _DATE _OVERDUE = 'overdue' ;
export const DUE _DATE _WEEK = 'week' ;
export const DUE _DATE _MONTH = 'month' ;
export const DUE _DATE _NEXT _MONTH _AND _PREVIOUS _TWO _WEEKS = 'next_month_and_previous_two_weeks' ;
export const DUE _DATE _VALUES = [
DUE _DATE _NONE ,
DUE _DATE _ANY ,
DUE _DATE _OVERDUE ,
DUE _DATE _WEEK ,
DUE _DATE _MONTH ,
DUE _DATE _NEXT _MONTH _AND _PREVIOUS _TWO _WEEKS ,
] ;
2021-04-29 21:17:54 +05:30
export const BLOCKING _ISSUES _DESC = 'BLOCKING_ISSUES_DESC' ;
export const CREATED _ASC = 'CREATED_ASC' ;
export const CREATED _DESC = 'CREATED_DESC' ;
export const DUE _DATE _ASC = 'DUE_DATE_ASC' ;
export const DUE _DATE _DESC = 'DUE_DATE_DESC' ;
2021-09-30 23:02:18 +05:30
export const LABEL _PRIORITY _ASC = 'LABEL_PRIORITY_ASC' ;
2021-04-29 21:17:54 +05:30
export const LABEL _PRIORITY _DESC = 'LABEL_PRIORITY_DESC' ;
export const MILESTONE _DUE _ASC = 'MILESTONE_DUE_ASC' ;
export const MILESTONE _DUE _DESC = 'MILESTONE_DUE_DESC' ;
export const POPULARITY _ASC = 'POPULARITY_ASC' ;
export const POPULARITY _DESC = 'POPULARITY_DESC' ;
2021-09-30 23:02:18 +05:30
export const PRIORITY _ASC = 'PRIORITY_ASC' ;
2021-04-29 21:17:54 +05:30
export const PRIORITY _DESC = 'PRIORITY_DESC' ;
2021-09-30 23:02:18 +05:30
export const RELATIVE _POSITION _ASC = 'RELATIVE_POSITION_ASC' ;
2021-11-11 11:23:49 +05:30
export const TITLE _ASC = 'TITLE_ASC' ;
export const TITLE _DESC = 'TITLE_DESC' ;
2021-04-29 21:17:54 +05:30
export const UPDATED _ASC = 'UPDATED_ASC' ;
export const UPDATED _DESC = 'UPDATED_DESC' ;
export const WEIGHT _ASC = 'WEIGHT_ASC' ;
export const WEIGHT _DESC = 'WEIGHT_DESC' ;
2021-09-30 23:02:18 +05:30
const PRIORITY _ASC _SORT = 'priority_asc' ;
2021-06-08 01:23:25 +05:30
const CREATED _DATE _SORT = 'created_date' ;
const CREATED _ASC _SORT = 'created_asc' ;
const UPDATED _DESC _SORT = 'updated_desc' ;
const UPDATED _ASC _SORT = 'updated_asc' ;
const MILESTONE _SORT = 'milestone' ;
const MILESTONE _DUE _DESC _SORT = 'milestone_due_desc' ;
const DUE _DATE _DESC _SORT = 'due_date_desc' ;
2021-09-30 23:02:18 +05:30
const LABEL _PRIORITY _ASC _SORT = 'label_priority_asc' ;
2021-06-08 01:23:25 +05:30
const POPULARITY _ASC _SORT = 'popularity_asc' ;
const WEIGHT _DESC _SORT = 'weight_desc' ;
const BLOCKING _ISSUES _DESC _SORT = 'blocking_issues_desc' ;
2021-12-11 22:18:48 +05:30
const TITLE _ASC _SORT = 'title_asc' ;
2021-11-11 11:23:49 +05:30
const TITLE _DESC _SORT = 'title_desc' ;
2021-04-29 21:17:54 +05:30
2021-06-08 01:23:25 +05:30
export const urlSortParams = {
2021-09-30 23:02:18 +05:30
[ PRIORITY _ASC ] : PRIORITY _ASC _SORT ,
[ PRIORITY _DESC ] : PRIORITY ,
[ CREATED _ASC ] : CREATED _ASC _SORT ,
[ CREATED _DESC ] : CREATED _DATE _SORT ,
[ UPDATED _ASC ] : UPDATED _ASC _SORT ,
[ UPDATED _DESC ] : UPDATED _DESC _SORT ,
[ MILESTONE _DUE _ASC ] : MILESTONE _SORT ,
[ MILESTONE _DUE _DESC ] : MILESTONE _DUE _DESC _SORT ,
[ DUE _DATE _ASC ] : DUE _DATE ,
[ DUE _DATE _DESC ] : DUE _DATE _DESC _SORT ,
[ POPULARITY _ASC ] : POPULARITY _ASC _SORT ,
[ POPULARITY _DESC ] : POPULARITY ,
[ LABEL _PRIORITY _ASC ] : LABEL _PRIORITY _ASC _SORT ,
[ LABEL _PRIORITY _DESC ] : LABEL _PRIORITY ,
[ RELATIVE _POSITION _ASC ] : RELATIVE _POSITION ,
[ WEIGHT _ASC ] : WEIGHT ,
[ WEIGHT _DESC ] : WEIGHT _DESC _SORT ,
[ BLOCKING _ISSUES _DESC ] : BLOCKING _ISSUES _DESC _SORT ,
2021-12-11 22:18:48 +05:30
[ TITLE _ASC ] : TITLE _ASC _SORT ,
2021-11-11 11:23:49 +05:30
[ TITLE _DESC ] : TITLE _DESC _SORT ,
2021-06-08 01:23:25 +05:30
} ;
export const MAX _LIST _SIZE = 10 ;
export const API _PARAM = 'apiParam' ;
export const URL _PARAM = 'urlParam' ;
export const NORMAL _FILTER = 'normalFilter' ;
export const SPECIAL _FILTER = 'specialFilter' ;
export const ALTERNATIVE _FILTER = 'alternativeFilter' ;
2021-10-27 15:23:28 +05:30
export const SPECIAL _FILTER _VALUES = [
FILTER _NONE ,
FILTER _ANY ,
FILTER _CURRENT ,
FILTER _UPCOMING ,
FILTER _STARTED ,
] ;
2021-06-08 01:23:25 +05:30
2021-09-04 01:27:46 +05:30
export const TOKEN _TYPE _AUTHOR = 'author_username' ;
export const TOKEN _TYPE _ASSIGNEE = 'assignee_username' ;
export const TOKEN _TYPE _MILESTONE = 'milestone' ;
export const TOKEN _TYPE _LABEL = 'labels' ;
2021-10-27 15:23:28 +05:30
export const TOKEN _TYPE _TYPE = 'type' ;
2021-12-11 22:18:48 +05:30
export const TOKEN _TYPE _RELEASE = 'release' ;
2021-09-04 01:27:46 +05:30
export const TOKEN _TYPE _MY _REACTION = 'my_reaction_emoji' ;
export const TOKEN _TYPE _CONFIDENTIAL = 'confidential' ;
export const TOKEN _TYPE _ITERATION = 'iteration' ;
export const TOKEN _TYPE _EPIC = 'epic_id' ;
export const TOKEN _TYPE _WEIGHT = 'weight' ;
2021-06-08 01:23:25 +05:30
export const filters = {
2021-09-04 01:27:46 +05:30
[ TOKEN _TYPE _AUTHOR ] : {
2021-06-08 01:23:25 +05:30
[ API _PARAM ] : {
2021-09-30 23:02:18 +05:30
[ NORMAL _FILTER ] : 'authorUsername' ,
2021-06-08 01:23:25 +05:30
} ,
[ URL _PARAM ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'author_username' ,
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[author_username]' ,
} ,
2021-04-29 21:17:54 +05:30
} ,
} ,
2021-09-04 01:27:46 +05:30
[ TOKEN _TYPE _ASSIGNEE ] : {
2021-06-08 01:23:25 +05:30
[ API _PARAM ] : {
2021-09-30 23:02:18 +05:30
[ NORMAL _FILTER ] : 'assigneeUsernames' ,
[ SPECIAL _FILTER ] : 'assigneeId' ,
2021-06-08 01:23:25 +05:30
} ,
[ URL _PARAM ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'assignee_username[]' ,
[ SPECIAL _FILTER ] : 'assignee_id' ,
[ ALTERNATIVE _FILTER ] : 'assignee_username' ,
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[assignee_username][]' ,
} ,
2021-04-29 21:17:54 +05:30
} ,
} ,
2021-09-04 01:27:46 +05:30
[ TOKEN _TYPE _MILESTONE ] : {
2021-06-08 01:23:25 +05:30
[ API _PARAM ] : {
2021-09-30 23:02:18 +05:30
[ NORMAL _FILTER ] : 'milestoneTitle' ,
2021-10-27 15:23:28 +05:30
[ SPECIAL _FILTER ] : 'milestoneWildcardId' ,
2021-06-08 01:23:25 +05:30
} ,
[ URL _PARAM ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'milestone_title' ,
2021-10-27 15:23:28 +05:30
[ SPECIAL _FILTER ] : 'milestone_title' ,
2021-06-08 01:23:25 +05:30
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[milestone_title]' ,
} ,
2021-04-29 21:17:54 +05:30
} ,
} ,
2021-09-04 01:27:46 +05:30
[ TOKEN _TYPE _LABEL ] : {
2021-06-08 01:23:25 +05:30
[ API _PARAM ] : {
2021-09-30 23:02:18 +05:30
[ NORMAL _FILTER ] : 'labelName' ,
[ SPECIAL _FILTER ] : 'labelName' ,
2021-06-08 01:23:25 +05:30
} ,
[ URL _PARAM ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'label_name[]' ,
2021-09-30 23:02:18 +05:30
[ SPECIAL _FILTER ] : 'label_name[]' ,
2021-12-11 22:18:48 +05:30
[ ALTERNATIVE _FILTER ] : 'label_name' ,
2021-06-08 01:23:25 +05:30
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[label_name][]' ,
} ,
2021-04-29 21:17:54 +05:30
} ,
} ,
2021-10-27 15:23:28 +05:30
[ TOKEN _TYPE _TYPE ] : {
[ API _PARAM ] : {
[ NORMAL _FILTER ] : 'types' ,
} ,
[ URL _PARAM ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'type[]' ,
2021-12-11 22:18:48 +05:30
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[type][]' ,
} ,
} ,
} ,
[ TOKEN _TYPE _RELEASE ] : {
[ API _PARAM ] : {
[ NORMAL _FILTER ] : 'releaseTag' ,
[ SPECIAL _FILTER ] : 'releaseTagWildcardId' ,
} ,
[ URL _PARAM ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'release_tag' ,
[ SPECIAL _FILTER ] : 'release_tag' ,
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[release_tag]' ,
2021-10-27 15:23:28 +05:30
} ,
} ,
} ,
2021-09-04 01:27:46 +05:30
[ TOKEN _TYPE _MY _REACTION ] : {
2021-06-08 01:23:25 +05:30
[ API _PARAM ] : {
2021-09-30 23:02:18 +05:30
[ NORMAL _FILTER ] : 'myReactionEmoji' ,
[ SPECIAL _FILTER ] : 'myReactionEmoji' ,
2021-06-08 01:23:25 +05:30
} ,
[ URL _PARAM ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'my_reaction_emoji' ,
[ SPECIAL _FILTER ] : 'my_reaction_emoji' ,
} ,
2021-12-11 22:18:48 +05:30
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[my_reaction_emoji]' ,
} ,
2021-04-29 21:17:54 +05:30
} ,
} ,
2021-09-04 01:27:46 +05:30
[ TOKEN _TYPE _CONFIDENTIAL ] : {
2021-06-08 01:23:25 +05:30
[ API _PARAM ] : {
2021-09-30 23:02:18 +05:30
[ NORMAL _FILTER ] : 'confidential' ,
2021-06-08 01:23:25 +05:30
} ,
[ URL _PARAM ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'confidential' ,
} ,
2021-04-29 21:17:54 +05:30
} ,
} ,
2021-09-04 01:27:46 +05:30
[ TOKEN _TYPE _ITERATION ] : {
2021-06-08 01:23:25 +05:30
[ API _PARAM ] : {
2021-09-30 23:02:18 +05:30
[ NORMAL _FILTER ] : 'iterationId' ,
[ SPECIAL _FILTER ] : 'iterationWildcardId' ,
2021-06-08 01:23:25 +05:30
} ,
[ URL _PARAM ] : {
[ OPERATOR _IS ] : {
2021-09-30 23:02:18 +05:30
[ NORMAL _FILTER ] : 'iteration_id' ,
2021-06-08 01:23:25 +05:30
[ SPECIAL _FILTER ] : 'iteration_id' ,
} ,
[ OPERATOR _IS _NOT ] : {
2021-09-30 23:02:18 +05:30
[ NORMAL _FILTER ] : 'not[iteration_id]' ,
2021-06-08 01:23:25 +05:30
} ,
2021-04-29 21:17:54 +05:30
} ,
} ,
2021-09-04 01:27:46 +05:30
[ TOKEN _TYPE _EPIC ] : {
2021-06-08 01:23:25 +05:30
[ API _PARAM ] : {
2021-09-30 23:02:18 +05:30
[ NORMAL _FILTER ] : 'epicId' ,
[ SPECIAL _FILTER ] : 'epicId' ,
2021-06-08 01:23:25 +05:30
} ,
[ URL _PARAM ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'epic_id' ,
[ SPECIAL _FILTER ] : 'epic_id' ,
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[epic_id]' ,
} ,
2021-04-29 21:17:54 +05:30
} ,
} ,
2021-09-04 01:27:46 +05:30
[ TOKEN _TYPE _WEIGHT ] : {
2021-06-08 01:23:25 +05:30
[ API _PARAM ] : {
2021-09-30 23:02:18 +05:30
[ NORMAL _FILTER ] : 'weight' ,
[ SPECIAL _FILTER ] : 'weight' ,
2021-06-08 01:23:25 +05:30
} ,
[ URL _PARAM ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'weight' ,
[ SPECIAL _FILTER ] : 'weight' ,
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[weight]' ,
} ,
2021-04-29 21:17:54 +05:30
} ,
} ,
2021-06-08 01:23:25 +05:30
} ;