ui: refactor calculate_dedup_factor

so that we can reuse this

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-11-10 10:18:07 +01:00 committed by Thomas Lamprecht
parent 8432e4a655
commit 48d6dede4a
2 changed files with 9 additions and 4 deletions

View File

@ -247,6 +247,14 @@ Ext.define('PBS.Utils', {
}; };
}, },
calculate_dedup_factor: function(gcstatus) {
let dedup = 1.0;
if (gcstatus['disk-bytes'] > 0) {
dedup = (gcstatus['index-data-bytes'] || 0)/gcstatus['disk-bytes'];
}
return dedup;
},
constructor: function() { constructor: function() {
var me = this; var me = this;

View File

@ -57,10 +57,7 @@ Ext.define('PBS.DataStoreInfo', {
let gcstatus = store.getById('gc-status').data.value; let gcstatus = store.getById('gc-status').data.value;
let dedup = 1.0; let dedup = PBS.Utils.calculate_dedup_factor(gcstatus);
if (gcstatus['disk-bytes'] > 0) {
dedup = (gcstatus['index-data-bytes'] || 0)/gcstatus['disk-bytes'];
}
let countstext = function(count) { let countstext = function(count) {
count = count || {}; count = count || {};