2021-04-22 23:09:40 -04:00
import { _ _ , s _ _ } from '~/locale' ;
2020-07-10 05:09:01 -04:00
2019-11-06 16:06:44 -05:00
// 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-10 05:09:01 -04:00
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' ,
} ,
} ,
] ;
2020-07-13 14:09:16 -04:00
2021-04-22 23:09:40 -04:00
export const i18n = {
calendarLabel : _ _ ( 'Subscribe to calendar' ) ,
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' ) ,
reorderError : _ _ ( 'An error occurred while reordering issues.' ) ,
rssLabel : _ _ ( 'Subscribe to RSS feed' ) ,
} ;
2020-07-13 14:09:16 -04:00
export const JIRA _IMPORT _SUCCESS _ALERT _HIDE _MAP _KEY = 'jira-import-success-alert-hide-map' ;
2021-03-17 17:11:29 -04:00
export const BLOCKING _ISSUES _ASC = 'BLOCKING_ISSUES_ASC' ;
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 _ASC = 'LABEL_PRIORITY_ASC' ;
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 _ASC = 'PRIORITY_ASC' ;
export const PRIORITY _DESC = 'PRIORITY_DESC' ;
export const RELATIVE _POSITION _ASC = 'RELATIVE_POSITION_ASC' ;
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' ;
const BLOCKING _ISSUES = 'blocking_issues' ;
export const sortParams = {
[ PRIORITY _ASC ] : {
order _by : PRIORITY ,
sort : SORT _ASC ,
} ,
[ 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 _ASC ] : {
order _by : LABEL _PRIORITY ,
sort : SORT _ASC ,
} ,
[ LABEL _PRIORITY _DESC ] : {
order _by : LABEL _PRIORITY ,
sort : SORT _DESC ,
} ,
[ RELATIVE _POSITION _ASC ] : {
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 _ASC ] : {
order _by : BLOCKING _ISSUES ,
sort : SORT _ASC ,
} ,
[ BLOCKING _ISSUES _DESC ] : {
order _by : BLOCKING _ISSUES ,
sort : SORT _DESC ,
} ,
} ;
export const sortOptions = [
{
id : 1 ,
title : _ _ ( 'Priority' ) ,
sortDirection : {
ascending : PRIORITY _ASC ,
descending : PRIORITY _DESC ,
} ,
} ,
{
id : 2 ,
title : _ _ ( 'Created date' ) ,
sortDirection : {
ascending : CREATED _ASC ,
descending : CREATED _DESC ,
} ,
} ,
{
id : 3 ,
title : _ _ ( 'Last updated' ) ,
sortDirection : {
ascending : UPDATED _ASC ,
descending : UPDATED _DESC ,
} ,
} ,
{
id : 4 ,
title : _ _ ( 'Milestone due date' ) ,
sortDirection : {
ascending : MILESTONE _DUE _ASC ,
descending : MILESTONE _DUE _DESC ,
} ,
} ,
{
id : 5 ,
title : _ _ ( 'Due date' ) ,
sortDirection : {
ascending : DUE _DATE _ASC ,
descending : DUE _DATE _DESC ,
} ,
} ,
{
id : 6 ,
title : _ _ ( 'Popularity' ) ,
sortDirection : {
ascending : POPULARITY _ASC ,
descending : POPULARITY _DESC ,
} ,
} ,
{
id : 7 ,
title : _ _ ( 'Label priority' ) ,
sortDirection : {
ascending : LABEL _PRIORITY _ASC ,
descending : LABEL _PRIORITY _DESC ,
} ,
} ,
{
id : 8 ,
title : _ _ ( 'Manual' ) ,
sortDirection : {
ascending : RELATIVE _POSITION _ASC ,
descending : RELATIVE _POSITION _ASC ,
} ,
} ,
{
id : 9 ,
title : _ _ ( 'Weight' ) ,
sortDirection : {
ascending : WEIGHT _ASC ,
descending : WEIGHT _DESC ,
} ,
} ,
{
id : 10 ,
title : _ _ ( 'Blocking' ) ,
sortDirection : {
ascending : BLOCKING _ISSUES _ASC ,
descending : BLOCKING _ISSUES _DESC ,
} ,
} ,
] ;
2021-04-22 23:09:40 -04:00
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 filters = {
author _username : {
apiParam : {
[ OPERATOR _IS ] : 'author_username' ,
[ OPERATOR _IS _NOT ] : 'not[author_username]' ,
} ,
urlParam : {
[ OPERATOR _IS ] : 'author_username' ,
[ OPERATOR _IS _NOT ] : 'not[author_username]' ,
} ,
} ,
assignee _username : {
apiParam : {
[ OPERATOR _IS ] : 'assignee_username' ,
[ OPERATOR _IS _NOT ] : 'not[assignee_username]' ,
} ,
urlParam : {
[ OPERATOR _IS ] : 'assignee_username[]' ,
[ OPERATOR _IS _NOT ] : 'not[assignee_username][]' ,
} ,
} ,
labels : {
apiParam : {
[ OPERATOR _IS ] : 'labels' ,
[ OPERATOR _IS _NOT ] : 'not[labels]' ,
} ,
urlParam : {
[ OPERATOR _IS ] : 'label_name[]' ,
[ OPERATOR _IS _NOT ] : 'not[label_name][]' ,
} ,
} ,
} ;