Welcome to mirror list, hosted at ThFree Co, Russian Federation.

constants.js « vue_shared « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3ebeec4a50ba18f75adcef189ce7fa322a6a711a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { __, sprintf } from '~/locale';
import { IssuableType, WorkspaceType } from '~/issues/constants';

const INTERVALS = {
  minute: 'minute',
  hour: 'hour',
  day: 'day',
};

export const FILE_SYMLINK_MODE = '120000';

export const SHORT_DATE_FORMAT = 'd mmm, yyyy';

export const ISO_SHORT_FORMAT = 'yyyy-mm-dd';

export const DATE_FORMATS = [SHORT_DATE_FORMAT, ISO_SHORT_FORMAT];

export const timeRanges = [
  {
    label: __('30 minutes'),
    duration: { seconds: 60 * 30 },
    name: 'thirtyMinutes',
    interval: INTERVALS.minute,
  },
  {
    label: __('3 hours'),
    duration: { seconds: 60 * 60 * 3 },
    name: 'threeHours',
    interval: INTERVALS.hour,
  },
  {
    label: __('8 hours'),
    duration: { seconds: 60 * 60 * 8 },
    name: 'eightHours',
    default: true,
    interval: INTERVALS.hour,
  },
  {
    label: __('1 day'),
    duration: { seconds: 60 * 60 * 24 * 1 },
    name: 'oneDay',
    interval: INTERVALS.hour,
  },
  {
    label: __('3 days'),
    duration: { seconds: 60 * 60 * 24 * 3 },
    name: 'threeDays',
    interval: INTERVALS.hour,
  },
  {
    label: __('7 days'),
    duration: { seconds: 60 * 60 * 24 * 7 * 1 },
    name: 'oneWeek',
    interval: INTERVALS.day,
  },
  {
    label: __('30 days'),
    duration: { seconds: 60 * 60 * 24 * 30 },
    name: 'oneMonth',
    interval: INTERVALS.day,
  },
];

export const defaultTimeRange = timeRanges.find((tr) => tr.default);
export const getTimeWindow = (timeWindowName) =>
  timeRanges.find((tr) => tr.name === timeWindowName);

export const AVATAR_SHAPE_OPTION_CIRCLE = 'circle';
export const AVATAR_SHAPE_OPTION_RECT = 'rect';

export const confidentialityInfoText = (workspaceType, issuableType) =>
  sprintf(
    __(
      'Only %{workspaceType} members with at least Reporter role can view or be notified about this %{issuableType}.',
    ),
    {
      workspaceType: workspaceType === WorkspaceType.project ? __('project') : __('group'),
      issuableType: issuableType === IssuableType.Issue ? __('issue') : __('epic'),
    },
  );