debian-mirror-gitlab/app/assets/javascripts/work_items/constants.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

158 lines
5.4 KiB
JavaScript
Raw Normal View History

2022-10-11 01:57:18 +05:30
import { s__, sprintf } from '~/locale';
import { capitalizeFirstCharacter } from '~/lib/utils/text_utility';
2022-03-02 08:16:31 +05:30
2022-07-16 23:28:13 +05:30
export const STATE_OPEN = 'OPEN';
export const STATE_CLOSED = 'CLOSED';
export const STATE_EVENT_REOPEN = 'REOPEN';
export const STATE_EVENT_CLOSE = 'CLOSE';
2022-07-23 23:45:48 +05:30
export const TRACKING_CATEGORY_SHOW = 'workItems:show';
2022-08-13 15:12:31 +05:30
export const TASK_TYPE_NAME = 'Task';
2022-07-23 23:45:48 +05:30
2022-08-13 15:12:31 +05:30
export const WIDGET_TYPE_ASSIGNEES = 'ASSIGNEES';
2022-07-23 23:45:48 +05:30
export const WIDGET_TYPE_DESCRIPTION = 'DESCRIPTION';
2022-08-13 15:12:31 +05:30
export const WIDGET_TYPE_LABELS = 'LABELS';
2022-10-11 01:57:18 +05:30
export const WIDGET_TYPE_START_AND_DUE_DATE = 'START_AND_DUE_DATE';
2022-07-23 23:45:48 +05:30
export const WIDGET_TYPE_WEIGHT = 'WEIGHT';
2023-03-04 22:38:38 +05:30
export const WIDGET_TYPE_PROGRESS = 'PROGRESS';
2022-07-23 23:45:48 +05:30
export const WIDGET_TYPE_HIERARCHY = 'HIERARCHY';
2022-11-25 23:54:43 +05:30
export const WIDGET_TYPE_MILESTONE = 'MILESTONE';
export const WIDGET_TYPE_ITERATION = 'ITERATION';
2023-03-04 22:38:38 +05:30
export const WIDGET_TYPE_NOTES = 'NOTES';
export const WIDGET_TYPE_HEALTH_STATUS = 'HEALTH_STATUS';
2022-07-23 23:45:48 +05:30
2022-08-27 11:52:29 +05:30
export const WORK_ITEM_TYPE_ENUM_INCIDENT = 'INCIDENT';
export const WORK_ITEM_TYPE_ENUM_ISSUE = 'ISSUE';
export const WORK_ITEM_TYPE_ENUM_TASK = 'TASK';
export const WORK_ITEM_TYPE_ENUM_TEST_CASE = 'TEST_CASE';
export const WORK_ITEM_TYPE_ENUM_REQUIREMENTS = 'REQUIREMENTS';
2023-03-04 22:38:38 +05:30
export const WORK_ITEM_TYPE_ENUM_OBJECTIVE = 'OBJECTIVE';
export const WORK_ITEM_TYPE_ENUM_KEY_RESULT = 'KEY_RESULT';
export const WORK_ITEM_TYPE_VALUE_ISSUE = 'Issue';
export const WORK_ITEM_TYPE_VALUE_OBJECTIVE = 'Objective';
2022-08-27 11:52:29 +05:30
export const i18n = {
2022-11-25 23:54:43 +05:30
fetchErrorTitle: s__('WorkItem|Work item not found'),
fetchError: s__(
"WorkItem|This work item is not available. It either doesn't exist or you don't have permission to view it.",
),
2022-08-27 11:52:29 +05:30
updateError: s__('WorkItem|Something went wrong while updating the work item. Please try again.'),
confidentialTooltip: s__(
'WorkItem|Only project members with at least the Reporter role, the author, and assignees can view or be notified about this task.',
),
};
2022-07-23 23:45:48 +05:30
2022-11-25 23:54:43 +05:30
export const I18N_WORK_ITEM_ERROR_FETCHING_LABELS = s__(
'WorkItem|Something went wrong when fetching labels. Please try again.',
);
2022-10-11 01:57:18 +05:30
export const I18N_WORK_ITEM_ERROR_CREATING = s__(
'WorkItem|Something went wrong when creating %{workItemType}. Please try again.',
);
export const I18N_WORK_ITEM_ERROR_UPDATING = s__(
'WorkItem|Something went wrong while updating the %{workItemType}. Please try again.',
);
export const I18N_WORK_ITEM_ERROR_DELETING = s__(
'WorkItem|Something went wrong when deleting the %{workItemType}. Please try again.',
);
export const I18N_WORK_ITEM_DELETE = s__('WorkItem|Delete %{workItemType}');
export const I18N_WORK_ITEM_ARE_YOU_SURE_DELETE = s__(
'WorkItem|Are you sure you want to delete the %{workItemType}? This action cannot be reversed.',
);
export const I18N_WORK_ITEM_DELETED = s__('WorkItem|%{workItemType} deleted');
2022-11-25 23:54:43 +05:30
export const I18N_WORK_ITEM_FETCH_ITERATIONS_ERROR = s__(
'WorkItem|Something went wrong when fetching iterations. Please try again.',
);
2023-03-04 22:38:38 +05:30
export const I18N_WORK_ITEM_CREATE_BUTTON_LABEL = s__('WorkItem|Create %{workItemType}');
export const I18N_WORK_ITEM_ADD_BUTTON_LABEL = s__('WorkItem|Add %{workItemType}');
export const I18N_WORK_ITEM_ADD_MULTIPLE_BUTTON_LABEL = s__('WorkItem|Add %{workItemType}s');
export const I18N_WORK_ITEM_SEARCH_INPUT_PLACEHOLDER = s__(
'WorkItem|Search existing %{workItemType}s',
);
2022-10-11 01:57:18 +05:30
export const sprintfWorkItem = (msg, workItemTypeArg) => {
const workItemType = workItemTypeArg || s__('WorkItem|Work item');
return capitalizeFirstCharacter(
sprintf(msg, {
workItemType: workItemType.toLocaleLowerCase(),
}),
);
};
2022-07-23 23:45:48 +05:30
export const WIDGET_ICONS = {
2022-08-27 11:52:29 +05:30
TASK: 'issue-type-task',
2022-07-23 23:45:48 +05:30
};
export const WORK_ITEM_STATUS_TEXT = {
CLOSED: s__('WorkItem|Closed'),
OPEN: s__('WorkItem|Open'),
};
2022-08-27 11:52:29 +05:30
export const WORK_ITEMS_TYPE_MAP = {
[WORK_ITEM_TYPE_ENUM_INCIDENT]: {
icon: `issue-type-incident`,
name: s__('WorkItem|Incident'),
},
[WORK_ITEM_TYPE_ENUM_ISSUE]: {
icon: `issue-type-issue`,
name: s__('WorkItem|Issue'),
},
[WORK_ITEM_TYPE_ENUM_TASK]: {
icon: `issue-type-task`,
name: s__('WorkItem|Task'),
},
[WORK_ITEM_TYPE_ENUM_TEST_CASE]: {
icon: `issue-type-test-case`,
name: s__('WorkItem|Test case'),
},
[WORK_ITEM_TYPE_ENUM_REQUIREMENTS]: {
icon: `issue-type-requirements`,
name: s__('WorkItem|Requirements'),
},
2023-03-04 22:38:38 +05:30
[WORK_ITEM_TYPE_ENUM_OBJECTIVE]: {
icon: `issue-type-objective`,
name: s__('WorkItem|Objective'),
},
[WORK_ITEM_TYPE_ENUM_KEY_RESULT]: {
icon: `issue-type-issue`,
name: s__('WorkItem|Key Result'),
},
};
export const WORK_ITEMS_TREE_TEXT_MAP = {
[WORK_ITEM_TYPE_VALUE_OBJECTIVE]: {
title: s__('WorkItem|Child objectives and key results'),
empty: s__('WorkItem|No objectives or key results are currently assigned.'),
},
[WORK_ITEM_TYPE_VALUE_ISSUE]: {
title: s__('WorkItem|Tasks'),
empty: s__(
'WorkItem|No tasks are currently assigned. Use tasks to break down this issue into smaller parts.',
),
},
};
export const WORK_ITEM_NAME_TO_ICON_MAP = {
Issue: 'issue-type-issue',
Task: 'issue-type-task',
Objective: 'issue-type-objective',
// eslint-disable-next-line @gitlab/require-i18n-strings
'Key Result': 'issue-type-key-result',
2022-08-27 11:52:29 +05:30
};
2022-10-11 01:57:18 +05:30
2023-01-13 00:05:48 +05:30
export const FORM_TYPES = {
create: 'create',
add: 'add',
2023-03-04 22:38:38 +05:30
[WORK_ITEM_TYPE_ENUM_OBJECTIVE]: {
icon: `issue-type-issue`,
name: s__('WorkItem|Objective'),
},
2023-01-13 00:05:48 +05:30
};
2022-10-11 01:57:18 +05:30
export const DEFAULT_PAGE_SIZE_ASSIGNEES = 10;
2023-03-04 22:38:38 +05:30
export const DEFAULT_PAGE_SIZE_NOTES = 100;