public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager v2] fix #5302: ui: vm cpu affinity displayed in hardware overview
@ 2024-10-15  9:17 Timothy Nicholson
  2024-10-16 16:41 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Timothy Nicholson @ 2024-10-15  9:17 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Timothy Nicholson <t.nicholson@proxmox.com>
---
changes since v1:
* fix javascript indentation

 www/manager6/qemu/HardwareView.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index 86d5f4cf..59e670db 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -103,7 +103,7 @@ Ext.define('PVE.qemu.HardwareView', {
 		tdCls: 'pve-itype-icon-cpu',
 		group: 3,
 		defaultValue: '1',
-		multiKey: ['sockets', 'cpu', 'cores', 'numa', 'vcpus', 'cpulimit', 'cpuunits'],
+		multiKey: ['sockets', 'cpu', 'cores', 'numa', 'vcpus', 'cpulimit', 'cpuunits', 'affinity'],
 		renderer: function(value, metaData, record, rowIndex, colIndex, store, pending) {
 		    var sockets = me.getObjectValue('sockets', 1, pending);
 		    var model = me.getObjectValue('cpu', undefined, pending);
@@ -112,6 +112,7 @@ Ext.define('PVE.qemu.HardwareView', {
 		    var vcpus = me.getObjectValue('vcpus', undefined, pending);
 		    var cpulimit = me.getObjectValue('cpulimit', undefined, pending);
 		    var cpuunits = me.getObjectValue('cpuunits', undefined, pending);
+		    var cpuaffinity = me.getObjectValue('affinity', undefined, pending);
 
 		    let res = Ext.String.format(
 		        '{0} ({1} sockets, {2} cores)', sockets * cores, sockets, cores);
@@ -131,6 +132,9 @@ Ext.define('PVE.qemu.HardwareView', {
 		    if (cpuunits) {
 			res += ' [cpuunits=' + cpuunits +']';
 		    }
+		    if (cpuaffinity) {
+			res += ' [cpuaffinity=' + cpuaffinity + ']';
+		    }
 
 		    return res;
 		},
@@ -214,6 +218,9 @@ Ext.define('PVE.qemu.HardwareView', {
 	    ostype: {
 		visible: false,
 	    },
+	    affinity: {
+		visible: false,
+	    },
 	};
 
 	PVE.Utils.forEachBus(undefined, function(type, id) {
-- 
2.39.5


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* [pve-devel] applied: [PATCH manager v2] fix #5302: ui: vm cpu affinity displayed in hardware overview
  2024-10-15  9:17 [pve-devel] [PATCH manager v2] fix #5302: ui: vm cpu affinity displayed in hardware overview Timothy Nicholson
@ 2024-10-16 16:41 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2024-10-16 16:41 UTC (permalink / raw)
  To: Proxmox VE development discussion, Timothy Nicholson

Am 15/10/2024 um 11:17 schrieb Timothy Nicholson:
> Signed-off-by: Timothy Nicholson <t.nicholson@proxmox.com>
> ---
> changes since v1:
> * fix javascript indentation
> 
>  www/manager6/qemu/HardwareView.js | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
>

applied, thanks!

FWIW, and definitively pre-exsiting, this rendered could be cleaned up and
condensed a bit, e.g. by doing something like:

----8<----
diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index 59e670db9..0b83a23f7 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -104,37 +104,27 @@ Ext.define('PVE.qemu.HardwareView', {
 		group: 3,
 		defaultValue: '1',
 		multiKey: ['sockets', 'cpu', 'cores', 'numa', 'vcpus', 'cpulimit', 'cpuunits', 'affinity'],
-		renderer: function(value, metaData, record, rowIndex, colIndex, store, pending) {
-		    var sockets = me.getObjectValue('sockets', 1, pending);
-		    var model = me.getObjectValue('cpu', undefined, pending);
-		    var cores = me.getObjectValue('cores', 1, pending);
-		    var numa = me.getObjectValue('numa', undefined, pending);
-		    var vcpus = me.getObjectValue('vcpus', undefined, pending);
-		    var cpulimit = me.getObjectValue('cpulimit', undefined, pending);
-		    var cpuunits = me.getObjectValue('cpuunits', undefined, pending);
-		    var cpuaffinity = me.getObjectValue('affinity', undefined, pending);
+		renderer: function(_value, metaData, record, rowIndex, colIndex, store, pending) {
+		    let sockets = me.getObjectValue('sockets', 1, pending);
+		    let cores = me.getObjectValue('cores', 1, pending);
 
 		    let res = Ext.String.format(
 		        '{0} ({1} sockets, {2} cores)', sockets * cores, sockets, cores);
 
-		    if (model) {
-			res += ' [' + model + ']';
-		    }
-		    if (numa) {
-			res += ' [numa=' + numa +']';
-		    }
-		    if (vcpus) {
-			res += ' [vcpus=' + vcpus +']';
-		    }
-		    if (cpulimit) {
-			res += ' [cpulimit=' + cpulimit +']';
-		    }
-		    if (cpuunits) {
-			res += ' [cpuunits=' + cpuunits +']';
-		    }
-		    if (cpuaffinity) {
-			res += ' [cpuaffinity=' + cpuaffinity + ']';
-		    }
+		    let renderKeyIfSet = (key, label, valueOnly) => {
+			let value = me.getObjectValue(key, undefined, pending);
+			if (value) {
+			    label ??= key;
+			    res += valueOnly ? ` [${value}]` : ` [${label}=${value}]`;
+			}
+		    };
+
+		    renderKeyIfSet('cpu', 'model', true);
+		    renderKeyIfSet('numa');
+		    renderKeyIfSet('vcpus');
+		    renderKeyIfSet('cpulimit');
+		    renderKeyIfSet('cpuunits');
+		    renderKeyIfSet('affinity');
 
 		    return res;
 		},


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

end of thread, other threads:[~2024-10-16 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-15  9:17 [pve-devel] [PATCH manager v2] fix #5302: ui: vm cpu affinity displayed in hardware overview Timothy Nicholson
2024-10-16 16:41 ` [pve-devel] applied: " Thomas Lamprecht

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