added dashboard option to show seconds as time
Costa Tsaousis (ktsaou) committed
Oct 8, 2017 at 13:38 UTC
8a5d720d6f543ca2a7ff90412eff61c452a7ded4
2 files changed
+23
-7
web/dashboard.js
+2
-1
@@ -296,6 +296,7 @@ var NETDATA = window.NETDATA || {};
296
current: {
297
units: 'auto', // can be 'auto' or 'original'
298
temperature: 'celsius', // can be 'celsius' or 'fahrenheit'
299
+ seconds_as_time: true, // show seconds as DDd:HH:MM:SS ?
300
301
pixels_per_point: isSlowDevice()?5:1, // the minimum pixels per point for all charts
302
// increase this to speed javascript up
@@ -1536,7 +1537,7 @@ var NETDATA = window.NETDATA || {};
1537
},
1538
'seconds': {
1539
'time': {
1539
- check: function () { return NETDATA.options.current.units === 'auto'; },
1540
+ check: function () { return NETDATA.options.current.seconds_as_time; },
1541
convert: function (seconds) {
1542
seconds = Math.abs(seconds);
1543
web/index.html
+21
-6
@@ -2750,6 +2750,7 @@
2750
sync_option('smooth_plot');
2751
sync_option('pan_and_zoom_data_padding');
2752
sync_option('show_help');
2753
+ sync_option('seconds_as_time');
2754
theme_sync_option('netdata_theme_control');
2755
units_sync_option('units_conversion');
2756
temp_sync_option('units_temp');
@@ -2779,6 +2780,7 @@
2780
});
2781
$('#smooth_plot').change(function() { NETDATA.setOption('smooth_plot', $(this).prop('checked')); });
2782
$('#pan_and_zoom_data_padding').change(function() { NETDATA.setOption('pan_and_zoom_data_padding', $(this).prop('checked')); });
2783
+ $('#seconds_as_time').change(function() { NETDATA.setOption('seconds_as_time', $(this).prop('checked')); });
2784
2785
$('#units_conversion').change(function() {
2786
NETDATA.setOption('units', $(this).prop('checked')?'auto':'original');
@@ -3435,12 +3437,19 @@
3437
<div class="form-group">
3438
<table>
3439
<tr class="option-row">
3438
- <td class="option-control"><input id="units_conversion" type="checkbox" checked data-toggle="toggle" data-on="Scale Units" data-off="Fixed Units" data-width="110px"></td>
3440
+ <td colspan="2" align="center">
3441
+ <small>
3442
+ <b>These settings are applied gradually, as charts are updated. To force them, refresh the dashboard now</b>.
3443
+ </small>
3444
+ </td>
3445
+ </tr>
3446
+ <tr class="option-row">
3447
+ <td class="option-control"><input id="units_conversion" type="checkbox" checked data-toggle="toggle" data-on="Scale Units" data-off="Fixed Units" data-onstyle="success" data-width="110px"></td>
3448
<td class="option-info"><strong>Enable auto-scaling of select units?</strong><br/>
3449
<small>When set to <b>Scale Units</b> the values shown will dynamically be scaled (e.g. 1000 kilobits will be shown as 1 megabit).
3450
+ Netdata can auto-scale these original units: <code>kilobits/s</code>, <code>kilobytes/s</code>, <code>KB/s</code>,
3451
+ <code>KB</code>, <code>MB</code>, and <code>GB</code>.
3452
When set to <b>Fixed Units</b> all the values will be rendered using the original units maintained by the netdata server.
3442
- <br/>
3443
- <b>This setting will be applied gradually as charts are updated. To force it, refresh the dashboard</b>.
3453
</small>
3454
</td>
3455
</tr>
@@ -3448,8 +3457,14 @@
3457
<td class="option-control"><input id="units_temp" type="checkbox" checked data-toggle="toggle" data-on="Celsius" data-off="Fahrenheit" data-width="110px"></td>
3458
<td class="option-info"><strong>Which units to use for temperatures?</strong><br/>
3459
<small>Set the temperature units of the dashboard.
3451
- <br/>
3452
- <b>This setting will be applied gradually as charts are updated. To force it, refresh the dashboard</b>.
3460
+ </small>
3461
+ </td>
3462
+ </tr>
3463
+ <tr class="option-row">
3464
+ <td class="option-control"><input id="seconds_as_time" type="checkbox" checked data-toggle="toggle" data-on="Time" data-off="Seconds" data-onstyle="success" data-width="110px"></td>
3465
+ <td class="option-info"><strong>Convert seconds to time?</strong><br/>
3466
+ <small>When set to <b>Time</b>, charts that present <code>seconds</code> will show <code>DDd:HH:MM:SS</code>.
3467
+ When set to <b>Seconds</b>, the raw number of seconds will be presented.
3468
</small>
3469
</td>
3470
</tr>
@@ -3591,4 +3606,4 @@
3606
</div>
3607
</body>
3608
</html>
3594
-<script type="text/javascript" src="dashboard.js?v20171006-1"></script>
3609
+<script type="text/javascript" src="dashboard.js?v20171008-1"></script>