[pve-devel] [PATCH manager 1/3] fix #2435: GUI: LXC summary: Add privileged status and os type

Matthias Heiserer m.heiserer at proxmox.com
Fri Dec 2 14:50:16 CET 2022


The OS type is shown as icon, provided that we have an icon.
Otherwise, no icon is shown.

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

The image package is on our internal repo. It uses the images
from https://github.com/Lukas-W/font-logos

 www/index.html.tpl                    |  1 +
 www/manager6/panel/GuestStatusView.js | 27 +++++++++++++++++++++++++++
 www/manager6/panel/GuestSummary.js    | 22 ++++++++++++++++++++++
 3 files changed, 50 insertions(+)

diff --git a/www/index.html.tpl b/www/index.html.tpl
index 0c819977..29d7b4d2 100644
--- a/www/index.html.tpl
+++ b/www/index.html.tpl
@@ -11,6 +11,7 @@
     <link rel="stylesheet" type="text/css" href="/pve2/ext6/crisp/resources/charts-all.css?ver=7.0.0" />
     <link rel="stylesheet" type="text/css" href="/pve2/fa/css/font-awesome.css" />
     <link rel="stylesheet" type="text/css" href="/pve2/css/ext6-pve.css?ver=[% version %]" />
+    <link rel="stylesheet" type="text/css" href="/pve2/css/font-icon.css?ver=[% version %]" />
     <link rel="stylesheet" type="text/css" href="/pwt/css/ext6-pmx.css?ver=[% wtversion %]" />
     [% IF langfile %]
     <script type='text/javascript' src='/pve2/locale/pve-lang-[% lang %].js?ver=[% version %]'></script>
diff --git a/www/manager6/panel/GuestStatusView.js b/www/manager6/panel/GuestStatusView.js
index 8db1f492..d38b9631 100644
--- a/www/manager6/panel/GuestStatusView.js
+++ b/www/manager6/panel/GuestStatusView.js
@@ -11,6 +11,14 @@ Ext.define('PVE.panel.GuestStatusView', {
 	};
     },
 
+    controller: {
+	xclass: 'Ext.app.ViewController',
+
+	init: function(view) {
+	    view.applyLogos(this);
+	},
+    },
+
     layout: {
 	type: 'vbox',
 	align: 'stretch',
@@ -58,6 +66,25 @@ Ext.define('PVE.panel.GuestStatusView', {
 	    },
 	    printBar: false,
 	},
+	{
+	    title: gettext('OS type'),
+	    printBar: false,
+	    reference: 'ostype',
+	    cbind: {
+		hidden: '{isQemu}',
+		disabled: '{isQemu}',
+	    },
+	},
+	{
+	    title: gettext('Privileged'),
+	    printBar: false,
+	    reference: 'privileged',
+	    cbind: {
+		hidden: '{isQemu}',
+		disabled: '{isQemu}',
+	    },
+	    iconCls: 'fa fa-user-circle-o fa-fw',
+	},
 	{
 	    xtype: 'box',
 	    height: 15,
diff --git a/www/manager6/panel/GuestSummary.js b/www/manager6/panel/GuestSummary.js
index 1565db3f..d6655393 100644
--- a/www/manager6/panel/GuestSummary.js
+++ b/www/manager6/panel/GuestSummary.js
@@ -30,6 +30,27 @@ Ext.define('PVE.guest.Summary', {
 	var template = !!me.pveSelNode.data.template;
 	var rstore = me.statusStore;
 
+	const applyLogos = function(controller) {
+	    const updateView = (response) => {
+		const config = response.result.data;
+		const ostype = config.ostype;
+		const widget = controller.lookup("ostype");
+		widget.setIconCls(`pve-itype-os-${ostype} pmx-icon`);
+		const label = widget.getComponent('label');
+		label.update(Ext.apply(label.data, {
+		    usage: ostype,
+		}));
+		const unprivileged = config.unprivileged;
+		controller.lookup('privileged').updateValue(!unprivileged);
+	    };
+	    const url = `/api2/extjs/nodes/${nodename}/${type}/${vmid}/config`;
+	    Proxmox.Utils.API2Request({
+		url: url,
+		method: 'GET',
+		success: updateView,
+	    });
+	};
+
 	var items = [
 	    {
 		xtype: template ? 'pveTemplateStatusView' : 'pveGuestStatusView',
@@ -38,6 +59,7 @@ Ext.define('PVE.guest.Summary', {
 		itemId: 'gueststatus',
 		pveSelNode: me.pveSelNode,
 		rstore: rstore,
+		applyLogos: applyLogos,
 	    },
 	    {
 		xtype: 'pmxNotesView',
-- 
2.30.2






More information about the pve-devel mailing list