[pbs-devel] [PATCH proxmox-backup 3/4] ui: refactor calculate_dedup_factor
Dominik Csapak
d.csapak at proxmox.com
Tue Nov 10 10:18:07 CET 2020
so that we can reuse this
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/Utils.js | 8 ++++++++
www/datastore/Summary.js | 5 +----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/www/Utils.js b/www/Utils.js
index 2d0993a3..f678a916 100644
--- a/www/Utils.js
+++ b/www/Utils.js
@@ -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() {
var me = this;
diff --git a/www/datastore/Summary.js b/www/datastore/Summary.js
index ac3f19e2..5c757e8c 100644
--- a/www/datastore/Summary.js
+++ b/www/datastore/Summary.js
@@ -57,10 +57,7 @@ Ext.define('PBS.DataStoreInfo', {
let gcstatus = store.getById('gc-status').data.value;
- let dedup = 1.0;
- if (gcstatus['disk-bytes'] > 0) {
- dedup = (gcstatus['index-data-bytes'] || 0)/gcstatus['disk-bytes'];
- }
+ let dedup = PBS.Utils.calculate_dedup_factor(gcstatus);
let countstext = function(count) {
count = count || {};
--
2.20.1
More information about the pbs-devel
mailing list