From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] dashboard: fix datastore full estimate for not changing usage
Date: Tue, 2 Mar 2021 14:38:49 +0100 [thread overview]
Message-ID: <20210302133849.19892-1-d.csapak@proxmox.com> (raw)
If the usage of a datastore did not change, we did not
return an estimate. The ui interpreted this as 'not enough data', but
it should actually be 'never'.
Fixing this by always setting the estimate first to 0 and overwriting
if we successfully calculated one, and checking for 'undefined' in the ui.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/api2/status.rs | 3 +--
www/Utils.js | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/api2/status.rs b/src/api2/status.rs
index 5ea1525d..11b46154 100644
--- a/src/api2/status.rs
+++ b/src/api2/status.rs
@@ -160,12 +160,11 @@ pub fn datastore_status(
// we skip the calculation for datastores with not enough data
if usage_list.len() >= 7 {
+ entry["estimated-full-date"] = Value::from(0);
if let Some((a,b)) = linear_regression(&time_list, &usage_list) {
if b != 0.0 {
let estimate = (1.0 - a) / b;
entry["estimated-full-date"] = Value::from(estimate.floor() as u64);
- } else {
- entry["estimated-full-date"] = Value::from(0);
}
}
}
diff --git a/www/Utils.js b/www/Utils.js
index 778dad24..4667efb2 100644
--- a/www/Utils.js
+++ b/www/Utils.js
@@ -277,7 +277,7 @@ Ext.define('PBS.Utils', {
},
render_estimate: function(value) {
- if (!value) {
+ if (value === undefined) {
return gettext('Not enough data');
}
--
2.20.1
next reply other threads:[~2021-03-02 13:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 13:38 Dominik Csapak [this message]
2021-03-02 16:51 ` [pbs-devel] applied: " Dietmar Maurer
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=20210302133849.19892-1-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