diff options
author | Frank Bergkemper <frank.bergkemper@bareos.com> | 2017-09-28 18:52:27 +0300 |
---|---|---|
committer | Frank Bergkemper <frank.bergkemper@bareos.com> | 2017-09-28 18:52:27 +0300 |
commit | 5049831d3034d65e687e6f600a94f5e42be6c77d (patch) | |
tree | a5381b2388c269fa3ff0689eba9428f1be3189df | |
parent | 9071f50c4654eab333fe79e287d1294bb2e3e9d1 (diff) |
Fix to bugreport #827
The volume retention was not shown correctly for values higher than a year.
The formatRetention() function displays years, months, days and hours now.
Fixes #827: webui volume retention is not showed correctly
-rw-r--r-- | public/js/custom-functions.js | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/public/js/custom-functions.js b/public/js/custom-functions.js index 7064e82..8a90f98 100644 --- a/public/js/custom-functions.js +++ b/public/js/custom-functions.js @@ -165,14 +165,23 @@ function formatJobLevel(data) { } function formatRetention(data) { - var retention; - //retention = Math.round( (data / 60 / 60 / 24) ); - retention = Math.floor((data % 31536000) / 86400); - if(retention == 0) { - return '-'; + if( Math.floor(data / 31536000) >= 1 ) { + return Math.floor(data / 31536000) + ' ' + iJS._('year(s)'); + } + else if( Math.floor(data / 2678400) >= 1 ) { + return Math.floor(data / 2678400) + ' ' + iJS._('month(s)'); + } + else if( Math.floor(data / 86400) >= 1 ) { + return Math.floor(data / 86400) + ' ' + iJS._('day(s)'); + } + else if( Math.floor(data / 3600) >= 1 ) { + return Math.floor(data / 3600) + ' ' + iJS._('hour(s)'); + } + else if( Math.floor(data / 60) >= 1 ) { + return Math.floor(data / 60) + ' ' + iJS._('second(s)'); } else { - return retention + ' ' + iJS._('day(s)'); + return '-'; } } @@ -202,7 +211,7 @@ function formatExpiration(volstatus, lastwritten, volretention) { } } else { - return Math.ceil((volretention / 60 / 60 / 24)) + ' ' + iJS._("day(s)"); + return formatRetention(volretention); } } |