public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Matthias Heiserer <m.heiserer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH widget-toolkit] ui: SMART: show SMART data in correct columns
Date: Wed,  1 Feb 2023 12:52:23 +0100	[thread overview]
Message-ID: <20230201115223.103313-1-m.heiserer@proxmox.com> (raw)

Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
---

Sorry for the long delay!
v1: https://lists.proxmox.com/pipermail/pve-devel/2022-July/053599.html
Changes from v1:
use Field.calculate as suggested by Dominik

 src/window/DiskSmart.js | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/window/DiskSmart.js b/src/window/DiskSmart.js
index 3c8040b..490020d 100644
--- a/src/window/DiskSmart.js
+++ b/src/window/DiskSmart.js
@@ -38,12 +38,12 @@ Ext.define('Proxmox.window.DiskSmart', {
 		},
 		{
 		    text: gettext('Value'),
-		    dataIndex: 'raw',
+		    dataIndex: 'real-value',
 		    renderer: Ext.String.htmlEncode,
 		},
 		{
 		    text: gettext('Normalized'),
-		    dataIndex: 'value',
+		    dataIndex: 'real-normalized',
 		    width: 60,
 		},
 		{
@@ -154,7 +154,26 @@ Ext.define('Proxmox.window.DiskSmart', {
     Ext.define('pmx-smart-attribute', {
 	extend: 'Ext.data.Model',
 	fields: [
-	    { name: 'id', type: 'number' }, 'name', 'value', 'worst', 'threshold', 'flags', 'fail', 'raw',
+	    { name: 'id', type: 'number' }, 'name', 'value', 'worst', 'threshold', 'flags', 'fail',
+	    'raw', 'normalized',
+	    {
+		name: 'real-value',
+		calculate: function(data) {
+		    if (data.normalized === undefined) {
+			return data.value; // FIXME remove with next major release (PBS 3.0)
+		    }
+		    return data.raw;
+		},
+	    },
+	    {
+		name: 'real-normalized',
+		calculate: function(data) {
+		    if (data.normalized === undefined) {
+			return data.raw; // FIXME remove with next major release (PBS 3.0)
+		    }
+		    return data.normalized;
+		},
+	    },
 	],
 	idProperty: 'name',
     });
-- 
2.30.2





             reply	other threads:[~2023-02-01 11:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01 11:52 Matthias Heiserer [this message]
2023-02-07 15:07 ` Thomas Lamprecht
2023-02-08 10:29   ` Matthias Heiserer

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=20230201115223.103313-1-m.heiserer@proxmox.com \
    --to=m.heiserer@proxmox.com \
    --cc=pve-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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal