17417: make sure that there is enough of a config.yml file for the wb1
[arvados.git] / apps / workbench / app / assets / javascripts / keep_disks.js.coffee
1 ### Copyright (C) The Arvados Authors. All rights reserved.
2
3 SPDX-License-Identifier: AGPL-3.0 ###
4
5 cache_age_in_days = (milliseconds_age) ->
6   ONE_DAY = 1000 * 60 * 60 * 24
7   milliseconds_age / ONE_DAY
8
9 cache_age_hover = (milliseconds_age) ->
10   'Cache age ' + cache_age_in_days(milliseconds_age).toFixed(1) + ' days.'
11
12 cache_age_axis_label = (milliseconds_age) ->
13   cache_age_in_days(milliseconds_age).toFixed(0) + ' days'
14
15 float_as_percentage = (proportion) ->
16   (proportion.toFixed(4) * 100) + '%'
17
18 $.renderHistogram = (histogram_data) ->
19   Morris.Area({
20     element: 'cache-age-vs-disk-histogram',
21     pointSize: 0,
22     lineWidth: 0,
23     data: histogram_data,
24     xkey: 'age',
25     ykeys: ['persisted', 'cache'],
26     labels: ['Persisted Storage Disk Utilization', 'Cached Storage Disk Utilization'],
27     ymax: 1,
28     ymin: 0,
29     xLabelFormat: cache_age_axis_label,
30     yLabelFormat: float_as_percentage,
31     dateFormat: cache_age_hover
32   })