[pve-devel] [PATCH widget-toolkit] ui: SMART: show SMART data in correct columns

Matthias Heiserer m.heiserer at proxmox.com
Wed Feb 1 12:52:23 CET 2023


Signed-off-by: Matthias Heiserer <m.heiserer at 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






More information about the pve-devel mailing list