all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v2 widget-toolkit] ui: SMART: fix eslint error and show correct value
@ 2023-02-24 12:10 Matthias Heiserer
  2023-02-24 13:25 ` Dominik Csapak
  0 siblings, 1 reply; 2+ messages in thread
From: Matthias Heiserer @ 2023-02-24 12:10 UTC (permalink / raw)
  To: pve-devel

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

Sorry for the long delay and the overall confusion!
This is the v2 of https://lists.proxmox.com/pipermail/pve-devel/2023-February/055798.html
The second arrow function spans multiple lines, that's because it really does not fit on a single one
and previous attempts to reduce the size didn't work out.

 src/window/DiskSmart.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/window/DiskSmart.js b/src/window/DiskSmart.js
index b538ea1..af2a023 100644
--- a/src/window/DiskSmart.js
+++ b/src/window/DiskSmart.js
@@ -159,12 +159,17 @@ Ext.define('Proxmox.window.DiskSmart', {
 	    {
 		name: 'real-value',
 		// FIXME remove with next major release (PBS 3.0)
-		calculate: data => (data.normalized ?? false) ? data.raw : data.value,
+		calculate: data => data.raw,
 	    },
 	    {
 		name: 'real-normalized',
 		// FIXME remove with next major release (PBS 3.0)
-		calculate: data => data.normalized ?? data.raw,
+		calculate: data => {
+		    if (data.normalized === undefined || data.raw === undefined) {
+			return data.value;
+		    }
+		    return data.normalized;
+		},
 	    },
 	],
 	idProperty: 'name',
-- 
2.30.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pve-devel] [PATCH v2 widget-toolkit] ui: SMART: fix eslint error and show correct value
  2023-02-24 12:10 [pve-devel] [PATCH v2 widget-toolkit] ui: SMART: fix eslint error and show correct value Matthias Heiserer
@ 2023-02-24 13:25 ` Dominik Csapak
  0 siblings, 0 replies; 2+ messages in thread
From: Dominik Csapak @ 2023-02-24 13:25 UTC (permalink / raw)
  To: Proxmox VE development discussion, Matthias Heiserer

On 2/24/23 13:10, Matthias Heiserer wrote:
> Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
> ---
> 
> Sorry for the long delay and the overall confusion!
> This is the v2 of https://lists.proxmox.com/pipermail/pve-devel/2023-February/055798.html
> The second arrow function spans multiple lines, that's because it really does not fit on a single one
> and previous attempts to reduce the size didn't work out.
> 
>   src/window/DiskSmart.js | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/window/DiskSmart.js b/src/window/DiskSmart.js
> index b538ea1..af2a023 100644
> --- a/src/window/DiskSmart.js
> +++ b/src/window/DiskSmart.js
> @@ -159,12 +159,17 @@ Ext.define('Proxmox.window.DiskSmart', {
>   	    {
>   		name: 'real-value',
>   		// FIXME remove with next major release (PBS 3.0)
> -		calculate: data => (data.normalized ?? false) ? data.raw : data.value,
> +		calculate: data => data.raw,
>   	    },
>   	    {
>   		name: 'real-normalized',
>   		// FIXME remove with next major release (PBS 3.0)
> -		calculate: data => data.normalized ?? data.raw,
> +		calculate: data => {
> +		    if (data.normalized === undefined || data.raw === undefined) {
> +			return data.value;
> +		    }
> +		    return data.normalized;
> +		},
>   	    },
>   	],
>   	idProperty: 'name',


just fyi, i talked with matthias off-list, imho the correct solution is to use

real-value: data.raw ?? data.value
real-normalized: data.normalized ?? data.value

since we had raw+value in pve and normalized+value in pbs

so reading 'raw' with 'value' fallback for 'real-value' is correct for both
and reading 'normalized' with 'value' fallback for 'real-normalized' is also correct for both

for new versions it's also correct since we then always have raw+normalized anyway




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-24 13:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24 12:10 [pve-devel] [PATCH v2 widget-toolkit] ui: SMART: fix eslint error and show correct value Matthias Heiserer
2023-02-24 13:25 ` Dominik Csapak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal