From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 3/4] ui: refactor calculate_dedup_factor
Date: Tue, 10 Nov 2020 10:18:07 +0100 [thread overview]
Message-ID: <20201110091808.4476-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20201110091808.4476-1-d.csapak@proxmox.com>
so that we can reuse this
Signed-off-by: Dominik Csapak <d.csapak@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
next prev parent reply other threads:[~2020-11-10 9:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-10 9:18 [pbs-devel] [PATCH proxmox-backup 1/4] api2/status/datastore-usage: add gc-status and history start and delta Dominik Csapak
2020-11-10 9:18 ` [pbs-devel] [PATCH proxmox-backup 2/4] ui: add panel/UsageChart Dominik Csapak
2020-11-10 9:18 ` Dominik Csapak [this message]
2020-11-10 9:18 ` [pbs-devel] [PATCH proxmox-backup 4/4] ui: Datastores Summary: change layout and chart Dominik Csapak
2020-11-10 10:47 ` [pbs-devel] applied-series: [PATCH proxmox-backup 1/4] api2/status/datastore-usage: add gc-status and history start and delta Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201110091808.4476-3-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox