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

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

100 lines
2.7 KiB
JavaScript
Raw Normal View History

2022-08-27 11:52:29 +05:30
import { __, n__, sprintf } from '~/locale';
2023-05-27 22:25:52 +05:30
import { TYPE_ISSUE, WORKSPACE_PROJECT } from '~/issues/constants';
2020-04-08 14:13:33 +05:30
const INTERVALS = {
minute: 'minute',
hour: 'hour',
day: 'day',
};
2020-07-28 23:09:34 +05:30
export const FILE_SYMLINK_MODE = '120000';
2023-03-17 16:20:25 +05:30
export const SHORT_DATE_FORMAT = 'mmm dd, yyyy';
2021-04-29 21:17:54 +05:30
2021-10-27 15:23:28 +05:30
export const ISO_SHORT_FORMAT = 'yyyy-mm-dd';
2023-03-04 22:38:38 +05:30
export const LONG_DATE_FORMAT_WITH_TZ = 'yyyy-mm-dd HH:MM:ss Z';
export const DATE_FORMATS = [SHORT_DATE_FORMAT, ISO_SHORT_FORMAT, LONG_DATE_FORMAT_WITH_TZ];
2021-10-27 15:23:28 +05:30
2022-08-27 11:52:29 +05:30
const getTimeLabel = (days) => n__('1 day', '%d days', days);
/* eslint-disable @gitlab/require-i18n-strings */
2020-04-08 14:13:33 +05:30
export const timeRanges = [
{
2022-08-27 11:52:29 +05:30
label: n__('1 minute', '%d minutes', 30),
shortcut: '30_minutes',
2020-04-08 14:13:33 +05:30
duration: { seconds: 60 * 30 },
name: 'thirtyMinutes',
interval: INTERVALS.minute,
},
{
2022-08-27 11:52:29 +05:30
label: n__('1 hour', '%d hours', 3),
shortcut: '3_hours',
2020-04-08 14:13:33 +05:30
duration: { seconds: 60 * 60 * 3 },
name: 'threeHours',
interval: INTERVALS.hour,
},
{
2022-08-27 11:52:29 +05:30
label: n__('1 hour', '%d hours', 8),
shortcut: '8_hours',
2020-04-08 14:13:33 +05:30
duration: { seconds: 60 * 60 * 8 },
name: 'eightHours',
default: true,
interval: INTERVALS.hour,
},
{
2022-08-27 11:52:29 +05:30
label: getTimeLabel(1),
shortcut: '1_day',
2020-04-08 14:13:33 +05:30
duration: { seconds: 60 * 60 * 24 * 1 },
name: 'oneDay',
interval: INTERVALS.hour,
},
{
2022-08-27 11:52:29 +05:30
label: getTimeLabel(3),
shortcut: '3_days',
2020-04-08 14:13:33 +05:30
duration: { seconds: 60 * 60 * 24 * 3 },
name: 'threeDays',
interval: INTERVALS.hour,
},
{
2022-08-27 11:52:29 +05:30
label: getTimeLabel(7),
shortcut: '7_days',
2020-04-08 14:13:33 +05:30
duration: { seconds: 60 * 60 * 24 * 7 * 1 },
name: 'oneWeek',
interval: INTERVALS.day,
},
{
2022-08-27 11:52:29 +05:30
label: getTimeLabel(30),
shortcut: '30_days',
2020-04-08 14:13:33 +05:30
duration: { seconds: 60 * 60 * 24 * 30 },
name: 'oneMonth',
interval: INTERVALS.day,
},
];
2022-08-27 11:52:29 +05:30
/* eslint-enable @gitlab/require-i18n-strings */
2020-04-08 14:13:33 +05:30
2021-03-08 18:12:59 +05:30
export const defaultTimeRange = timeRanges.find((tr) => tr.default);
2021-12-11 22:18:48 +05:30
export const AVATAR_SHAPE_OPTION_CIRCLE = 'circle';
export const AVATAR_SHAPE_OPTION_RECT = 'rect';
2022-07-16 23:28:13 +05:30
export const confidentialityInfoText = (workspaceType, issuableType) =>
sprintf(
__(
2022-07-23 23:45:48 +05:30
'Only %{workspaceType} members with %{permissions} can view or be notified about this %{issuableType}.',
2022-07-16 23:28:13 +05:30
),
{
2023-05-27 22:25:52 +05:30
workspaceType: workspaceType === WORKSPACE_PROJECT ? __('project') : __('group'),
2023-04-23 21:23:45 +05:30
issuableType: issuableType === TYPE_ISSUE ? __('issue') : __('epic'),
2022-07-23 23:45:48 +05:30
permissions:
2023-04-23 21:23:45 +05:30
issuableType === TYPE_ISSUE
2022-07-23 23:45:48 +05:30
? __('at least the Reporter role, the author, and assignees')
: __('at least the Reporter role'),
2022-07-16 23:28:13 +05:30
},
);
2022-11-25 23:54:43 +05:30
export const EDITING_MODE_MARKDOWN_FIELD = 'markdownField';
export const EDITING_MODE_CONTENT_EDITOR = 'contentEditor';
2023-06-20 00:43:36 +05:30
export const CLEAR_AUTOSAVE_ENTRY_EVENT = 'markdown_clear_autosave_entry';