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