public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-manager 0/2] fix #1981: get next free disk id on change of bus/device
@ 2022-09-28  9:37 Stefan Hrdlicka
  2022-09-28  9:37 ` [pve-devel] [PATCH pve-manager 1/2] " Stefan Hrdlicka
  2022-09-28  9:37 ` [pve-devel] [PATCH pve-manager 2/2] cleanup: style fix Stefan Hrdlicka
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Hrdlicka @ 2022-09-28  9:37 UTC (permalink / raw)
  To: pve-devel

When adding a disk to an existing VM and switching between SCSI and IDE 
(or any other bus) the gui will now select the next free device id
automatically.

Stefan Hrdlicka (2):
  fix #1981: get next free disk id on change of bus/device
  cleanup: style fix

 www/manager6/form/ControllerSelector.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

-- 
2.30.2





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

* [pve-devel] [PATCH pve-manager 1/2] fix #1981: get next free disk id on change of bus/device
  2022-09-28  9:37 [pve-devel] [PATCH pve-manager 0/2] fix #1981: get next free disk id on change of bus/device Stefan Hrdlicka
@ 2022-09-28  9:37 ` Stefan Hrdlicka
  2022-09-28 10:28   ` Matthias Heiserer
  2022-09-28  9:37 ` [pve-devel] [PATCH pve-manager 2/2] cleanup: style fix Stefan Hrdlicka
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Hrdlicka @ 2022-09-28  9:37 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
---
 FYI: When IDE already has 4 devices and the user tries to add another one,
 the number device number isn't changed since there isn't any space
 left.

 www/manager6/form/ControllerSelector.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/www/manager6/form/ControllerSelector.js b/www/manager6/form/ControllerSelector.js
index d84c49d6..6daede95 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -12,7 +12,9 @@ Ext.define('PVE.form.ControllerSelector', {
 	let freeId = PVE.Utils.nextFreeDisk(controllers, me.vmconfig);
 
 	if (freeId !== undefined) {
-	    busField.setValue(freeId.controller);
+	    if (busField !== undefined) {
+		busField.setValue(freeId.controller);
+	    }
 	    deviceIDField.setValue(freeId.id);
 	}
     },
@@ -83,6 +85,7 @@ Ext.define('PVE.form.ControllerSelector', {
 				return;
 			    }
 			    let field = me.down('field[name=deviceid]');
+			    me.setToFree([value], undefined, field);
 			    field.setMaxValue(PVE.Utils.diskControllerMaxIDs[value] - 1);
 			    field.validate();
 			},
-- 
2.30.2





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

* [pve-devel] [PATCH pve-manager 2/2] cleanup: style fix
  2022-09-28  9:37 [pve-devel] [PATCH pve-manager 0/2] fix #1981: get next free disk id on change of bus/device Stefan Hrdlicka
  2022-09-28  9:37 ` [pve-devel] [PATCH pve-manager 1/2] " Stefan Hrdlicka
@ 2022-09-28  9:37 ` Stefan Hrdlicka
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Hrdlicka @ 2022-09-28  9:37 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
---
 www/manager6/form/ControllerSelector.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/www/manager6/form/ControllerSelector.js b/www/manager6/form/ControllerSelector.js
index 6daede95..e6baa893 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -61,7 +61,7 @@ Ext.define('PVE.form.ControllerSelector', {
     },
 
     initComponent: function() {
-	var me = this;
+	let me = this;
 
 	Ext.apply(me, {
 	    fieldLabel: gettext('Bus/Device'),
-- 
2.30.2





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

* Re: [pve-devel] [PATCH pve-manager 1/2] fix #1981: get next free disk id on change of bus/device
  2022-09-28  9:37 ` [pve-devel] [PATCH pve-manager 1/2] " Stefan Hrdlicka
@ 2022-09-28 10:28   ` Matthias Heiserer
  0 siblings, 0 replies; 4+ messages in thread
From: Matthias Heiserer @ 2022-09-28 10:28 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Hrdlicka

On 28.09.2022 11:37, Stefan Hrdlicka wrote:
>   	if (freeId !== undefined) {
> -	    busField.setValue(freeId.controller);
> +	    if (busField !== undefined) {
> +		busField.setValue(freeId.controller);
> +	    }
nit: IMO, optional chaining (?.) would make this more readable:
     busField?.setValue(freeId.controller);

Semantically, it should be more or less the same.
>   	    deviceIDField.setValue(freeId.id);
>   	}
>       },





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

end of thread, other threads:[~2022-09-28 10:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28  9:37 [pve-devel] [PATCH pve-manager 0/2] fix #1981: get next free disk id on change of bus/device Stefan Hrdlicka
2022-09-28  9:37 ` [pve-devel] [PATCH pve-manager 1/2] " Stefan Hrdlicka
2022-09-28 10:28   ` Matthias Heiserer
2022-09-28  9:37 ` [pve-devel] [PATCH pve-manager 2/2] cleanup: style fix Stefan Hrdlicka

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