diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-18 03:09:43 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-18 03:09:43 +0000 |
commit | b4b9b3854eddd2a4829113ebfc1812c3a332a7d9 (patch) | |
tree | 6a21e491917e1606d81329af710459b0217eb1a4 /app/assets/javascripts/vue_shared/constants.js | |
parent | 2e31c85a97183814ffa7ba5cc58f7bbad668fb2b (diff) | |
download | gitlab-ce-b4b9b3854eddd2a4829113ebfc1812c3a332a7d9.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/vue_shared/constants.js')
-rw-r--r-- | app/assets/javascripts/vue_shared/constants.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/app/assets/javascripts/vue_shared/constants.js b/app/assets/javascripts/vue_shared/constants.js new file mode 100644 index 00000000000..63ce4212717 --- /dev/null +++ b/app/assets/javascripts/vue_shared/constants.js @@ -0,0 +1,56 @@ +import { __ } from '~/locale'; + +const INTERVALS = { + minute: 'minute', + hour: 'hour', + day: 'day', +}; + +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: __('1 week'), + duration: { seconds: 60 * 60 * 24 * 7 * 1 }, + name: 'oneWeek', + interval: INTERVALS.day, + }, + { + label: __('1 month'), + 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); |