[PATCH pve-manager 1/1] ui: add a device label to disk and network interfaces

Yoann Laissus yoann.laissus at gmail.com
Wed Aug 3 21:08:25 CEST 2022


close #2672

Signed-off-by: Yoann Laissus <yoann.laissus at gmail.com>
---
 www/manager6/Parser.js           | 5 +++++
 www/manager6/qemu/HDEdit.js      | 9 +++++++++
 www/manager6/qemu/NetworkEdit.js | 9 ++++++++-
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/www/manager6/Parser.js b/www/manager6/Parser.js
index 9f7b2c84..c0d1ecc9 100644
--- a/www/manager6/Parser.js
+++ b/www/manager6/Parser.js
@@ -121,6 +121,8 @@ Ext.define('PVE.Parser', {
 		}
 	    } else if ((match_res = p.match(/^bridge=(\S+)$/)) !== null) {
 		res.bridge = match_res[1];
+	    } else if ((match_res = p.match(/^device_label=(\S+)$/)) !== null) {
+		res.device_label = match_res[1];
 	    } else if ((match_res = p.match(/^rate=(\d+(\.\d+)?)$/)) !== null) {
 		res.rate = match_res[1];
 	    } else if ((match_res = p.match(/^tag=(\d+(\.\d+)?)$/)) !== null) {
@@ -178,6 +180,9 @@ Ext.define('PVE.Parser', {
 	if (net.mtu) {
 	    netstr += ",mtu=" + net.mtu;
 	}
+	if (net.device_label) {
+	    netstr += ",device_label=" + net.device_label;
+	}
 	return netstr;
     },
 
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 4e4d6aac..54fd5c4d 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -85,6 +85,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	    me.drive.format = values.diskformat;
 	}
 
+	PVE.Utils.propertyStringSet(me.drive, values.device_label, 'device_label');
 	PVE.Utils.propertyStringSet(me.drive, !values.backup, 'backup', '0');
 	PVE.Utils.propertyStringSet(me.drive, values.noreplicate, 'replicate', 'no');
 	PVE.Utils.propertyStringSet(me.drive, values.discard, 'discard', 'on');
@@ -144,6 +145,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	}
 
 	values.hdimage = drive.file;
+	values.device_label = drive.device_label;
 	values.backup = PVE.Parser.parseBoolean(drive.backup, 1);
 	values.noreplicate = !PVE.Parser.parseBoolean(drive.replicate, 1);
 	values.diskformat = drive.format || 'raw';
@@ -238,6 +240,13 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	    });
 	}
 
+	column1.push({
+		xtype: 'textfield',
+		fieldLabel: gettext('Label'),
+		name: 'device_label',
+		vtype: 'DnsName',
+	});
+
 	column2.push(
 	    {
 		xtype: 'CacheTypeSelector',
diff --git a/www/manager6/qemu/NetworkEdit.js b/www/manager6/qemu/NetworkEdit.js
index b39cffdc..d080b8ed 100644
--- a/www/manager6/qemu/NetworkEdit.js
+++ b/www/manager6/qemu/NetworkEdit.js
@@ -8,6 +8,7 @@ Ext.define('PVE.qemu.NetworkInputPanel', {
     onGetValues: function(values) {
 	var me = this;
 
+	me.network.device_label = values.device_label;
 	me.network.model = values.model;
 	if (values.nonetwork) {
 	    return {};
@@ -140,7 +141,13 @@ Ext.define('PVE.qemu.NetworkInputPanel', {
 		vtype: 'MacAddress',
 		allowBlank: true,
 		emptyText: 'auto',
-	    });
+	    },
+            {
+                xtype: 'textfield',
+                name: 'device_label',
+                fieldLabel: gettext('Label'),
+                vtype: 'DnsName',
+            });
 	me.advancedColumn2 = [
 	    {
 		xtype: 'numberfield',
-- 
2.37.1




More information about the pve-devel mailing list