summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/monitoring/utils.js
blob: 581040e614198a68a47cd1673835c42f401e7f41 (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
import { timeWindows } from './constants'

export const getTimeDifferenceMinutes = (timeWindow) => {
  let timeDifferenceMinutes;
  switch(timeWindow) {
    case timeWindows.thirtyMinutes:
      timeDifferenceMinutes = 30;
      break;
    case timeWindows.threeHours:
      timeDifferenceMinutes = 60 * 3;
      break;
    case timeWindows.eightHours:
      timeDifferenceMinutes = 60 * 8;
      break;
    case timeWindows.oneDay:
      timeDifferenceMinutes = 60 * 24 * 1;
      break;
    case timeWindows.threeDays:
      timeDifferenceMinutes = 60 * 24 * 3;
      break;
    case timeWindows.oneWeek:
      timeDifferenceMinutes = 60 * 24 * 7 * 1;
      break;
    default:
      timeDifferenceMinutes = 60 * 8;
      break;
  }

  return timeDifferenceMinutes;
};

export default {};