[pve-devel] [PATCH v10 manager 16/19] ui: HD edit: support setting an import path in setDrive

Fabian Ebner f.ebner at proxmox.com
Wed Apr 6 10:04:13 CEST 2022


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 www/manager6/qemu/HDEdit.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 7acb922c..991cc16a 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -142,6 +142,9 @@ Ext.define('PVE.qemu.HDInputPanel', {
     setDrive: function(drive) {
 	var me = this;
 
+	let importPath = drive.importPath;
+	delete drive.importPath;
+
 	me.drive = drive;
 
 	let values = {};
@@ -173,6 +176,15 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	values.iops_rd_max = drive.iops_rd_max;
 	values.iops_wr_max = drive.iops_wr_max;
 
+	if (importPath) {
+	    values[`diskSource-${me.id}`] = 'path';
+	    values.sourcePath = importPath;
+
+	    // Doesn't happen automatically if not rendered yet.
+	    me.down('radiofield[inputValue=empty]').setValue(false);
+	    me.down('radiofield[inputValue=volume]').setValue(false);
+	}
+
 	me.setValues(values);
     },
 
-- 
2.30.2






More information about the pve-devel mailing list