public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Matthias Heiserer <m.heiserer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 1/3] fix #2435: GUI: LXC summary: Add privileged status and os type
Date: Fri,  2 Dec 2022 14:50:16 +0100	[thread overview]
Message-ID: <20221202135018.250016-1-m.heiserer@proxmox.com> (raw)

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@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





             reply	other threads:[~2022-12-02 13:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02 13:50 Matthias Heiserer [this message]
2022-12-02 13:50 ` [pve-devel] [PATCH manager 2/3] GUI: LXC Template Summary: display " Matthias Heiserer
2022-12-02 13:50 ` [pve-devel] [PATCH manager 3/3] code cleanup: convert var to let/const Matthias Heiserer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221202135018.250016-1-m.heiserer@proxmox.com \
    --to=m.heiserer@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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