2021-06-08 01:23:25 +05:30
import { _ _ , s _ _ } from '~/locale' ;
import {
FILTER _ANY ,
FILTER _CURRENT ,
FILTER _NONE ,
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' ;
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 } ,
} ;
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' ) ,
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' ) ,
searchPlaceholder : _ _ ( 'Search or filter results…' ) ,
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-09-04 01:27:46 +05:30
export const initialPageParams = {
firstPageSize : PAGE _SIZE ,
} ;
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' ;
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' ;
export const PRIORITY _DESC = 'PRIORITY_DESC' ;
2021-06-08 01:23:25 +05:30
export const RELATIVE _POSITION _DESC = 'RELATIVE_POSITION_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' ;
const SORT _ASC = 'asc' ;
const SORT _DESC = 'desc' ;
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' ;
const POPULARITY _ASC _SORT = 'popularity_asc' ;
const WEIGHT _DESC _SORT = 'weight_desc' ;
const BLOCKING _ISSUES _DESC _SORT = 'blocking_issues_desc' ;
2021-04-29 21:17:54 +05:30
const BLOCKING _ISSUES = 'blocking_issues' ;
2021-06-08 01:23:25 +05:30
export const apiSortParams = {
2021-04-29 21:17:54 +05:30
[ PRIORITY _DESC ] : {
order _by : PRIORITY ,
sort : SORT _DESC ,
} ,
[ CREATED _ASC ] : {
order _by : CREATED _AT ,
sort : SORT _ASC ,
} ,
[ CREATED _DESC ] : {
order _by : CREATED _AT ,
sort : SORT _DESC ,
} ,
[ UPDATED _ASC ] : {
order _by : UPDATED _AT ,
sort : SORT _ASC ,
} ,
[ UPDATED _DESC ] : {
order _by : UPDATED _AT ,
sort : SORT _DESC ,
} ,
[ MILESTONE _DUE _ASC ] : {
order _by : MILESTONE _DUE ,
sort : SORT _ASC ,
} ,
[ MILESTONE _DUE _DESC ] : {
order _by : MILESTONE _DUE ,
sort : SORT _DESC ,
} ,
[ DUE _DATE _ASC ] : {
order _by : DUE _DATE ,
sort : SORT _ASC ,
} ,
[ DUE _DATE _DESC ] : {
order _by : DUE _DATE ,
sort : SORT _DESC ,
} ,
[ POPULARITY _ASC ] : {
order _by : POPULARITY ,
sort : SORT _ASC ,
} ,
[ POPULARITY _DESC ] : {
order _by : POPULARITY ,
sort : SORT _DESC ,
} ,
[ LABEL _PRIORITY _DESC ] : {
order _by : LABEL _PRIORITY ,
sort : SORT _DESC ,
} ,
2021-06-08 01:23:25 +05:30
[ RELATIVE _POSITION _DESC ] : {
2021-04-29 21:17:54 +05:30
order _by : RELATIVE _POSITION ,
per _page : 100 ,
sort : SORT _ASC ,
} ,
[ WEIGHT _ASC ] : {
order _by : WEIGHT ,
sort : SORT _ASC ,
} ,
[ WEIGHT _DESC ] : {
order _by : WEIGHT ,
sort : SORT _DESC ,
} ,
[ BLOCKING _ISSUES _DESC ] : {
order _by : BLOCKING _ISSUES ,
sort : SORT _DESC ,
} ,
} ;
2021-06-08 01:23:25 +05:30
export const urlSortParams = {
[ PRIORITY _DESC ] : {
sort : PRIORITY ,
2021-04-29 21:17:54 +05:30
} ,
2021-06-08 01:23:25 +05:30
[ CREATED _ASC ] : {
sort : CREATED _ASC _SORT ,
} ,
[ CREATED _DESC ] : {
sort : CREATED _DATE _SORT ,
} ,
[ UPDATED _ASC ] : {
sort : UPDATED _ASC _SORT ,
} ,
[ UPDATED _DESC ] : {
sort : UPDATED _DESC _SORT ,
} ,
[ MILESTONE _DUE _ASC ] : {
sort : MILESTONE _SORT ,
} ,
[ MILESTONE _DUE _DESC ] : {
sort : MILESTONE _DUE _DESC _SORT ,
} ,
[ DUE _DATE _ASC ] : {
sort : DUE _DATE ,
} ,
[ DUE _DATE _DESC ] : {
sort : DUE _DATE _DESC _SORT ,
} ,
[ POPULARITY _ASC ] : {
sort : POPULARITY _ASC _SORT ,
} ,
[ POPULARITY _DESC ] : {
sort : POPULARITY ,
} ,
[ LABEL _PRIORITY _DESC ] : {
sort : LABEL _PRIORITY ,
} ,
[ RELATIVE _POSITION _DESC ] : {
sort : RELATIVE _POSITION ,
per _page : 100 ,
} ,
[ WEIGHT _ASC ] : {
sort : WEIGHT ,
} ,
[ WEIGHT _DESC ] : {
sort : WEIGHT _DESC _SORT ,
} ,
[ BLOCKING _ISSUES _DESC ] : {
sort : BLOCKING _ISSUES _DESC _SORT ,
} ,
} ;
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' ;
export const SPECIAL _FILTER _VALUES = [ FILTER _NONE , FILTER _ANY , FILTER _CURRENT ] ;
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' ;
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 ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'author_username' ,
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[author_username]' ,
} ,
} ,
[ 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 ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'assignee_username' ,
[ SPECIAL _FILTER ] : 'assignee_id' ,
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[assignee_username]' ,
} ,
} ,
[ 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 ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'milestone' ,
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[milestone]' ,
} ,
} ,
[ URL _PARAM ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'milestone_title' ,
} ,
[ 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 ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'labels' ,
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[labels]' ,
} ,
} ,
[ URL _PARAM ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'label_name[]' ,
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[label_name][]' ,
} ,
2021-04-29 21:17:54 +05:30
} ,
} ,
2021-09-04 01:27:46 +05:30
[ TOKEN _TYPE _MY _REACTION ] : {
2021-06-08 01:23:25 +05:30
[ API _PARAM ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'my_reaction_emoji' ,
[ SPECIAL _FILTER ] : 'my_reaction_emoji' ,
} ,
} ,
[ URL _PARAM ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'my_reaction_emoji' ,
[ SPECIAL _FILTER ] : '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 ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'confidential' ,
} ,
} ,
[ 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 ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'iteration_title' ,
[ SPECIAL _FILTER ] : 'iteration_id' ,
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[iteration_title]' ,
} ,
} ,
[ URL _PARAM ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'iteration_title' ,
[ SPECIAL _FILTER ] : 'iteration_id' ,
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[iteration_title]' ,
} ,
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 ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'epic_id' ,
[ SPECIAL _FILTER ] : 'epic_id' ,
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[epic_id]' ,
} ,
} ,
[ 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 ] : {
[ OPERATOR _IS ] : {
[ NORMAL _FILTER ] : 'weight' ,
[ SPECIAL _FILTER ] : 'weight' ,
} ,
[ OPERATOR _IS _NOT ] : {
[ NORMAL _FILTER ] : 'not[weight]' ,
} ,
} ,
[ 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
} ;