* [pve-devel] [PATCH manager 1/3] fix #2435: GUI: LXC summary: Add privileged status and os type
@ 2022-12-02 13:50 Matthias Heiserer
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
0 siblings, 2 replies; 3+ messages in thread
From: Matthias Heiserer @ 2022-12-02 13:50 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] [PATCH manager 2/3] GUI: LXC Template Summary: display privileged status and os type
2022-12-02 13:50 [pve-devel] [PATCH manager 1/3] fix #2435: GUI: LXC summary: Add privileged status and os type Matthias Heiserer
@ 2022-12-02 13:50 ` Matthias Heiserer
2022-12-02 13:50 ` [pve-devel] [PATCH manager 3/3] code cleanup: convert var to let/const Matthias Heiserer
1 sibling, 0 replies; 3+ messages in thread
From: Matthias Heiserer @ 2022-12-02 13:50 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
---
www/manager6/panel/TemplateStatusView.js | 35 ++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/www/manager6/panel/TemplateStatusView.js b/www/manager6/panel/TemplateStatusView.js
index 4e17a41c..5543f4fe 100644
--- a/www/manager6/panel/TemplateStatusView.js
+++ b/www/manager6/panel/TemplateStatusView.js
@@ -1,12 +1,28 @@
Ext.define('PVE.panel.TemplateStatusView', {
extend: 'Proxmox.panel.StatusView',
alias: 'widget.pveTemplateStatusView',
+ mixins: ['Proxmox.Mixin.CBind'],
+
+ cbindData: function(initialConfig) {
+ var me = this;
+ return {
+ isQemu: me.pveSelNode.data.type === 'qemu',
+ };
+ },
layout: {
type: 'vbox',
align: 'stretch',
},
+ controller: {
+ xclass: 'Ext.app.ViewController',
+
+ init: function(view) {
+ view.applyLogos(this);
+ },
+ },
+
defaults: {
xtype: 'pmxInfoWidget',
printBar: false,
@@ -30,6 +46,25 @@ Ext.define('PVE.panel.TemplateStatusView', {
iconCls: 'fa fa-fw fa-building',
title: gettext('Node'),
},
+ {
+ 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: 20,
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] [PATCH manager 3/3] code cleanup: convert var to let/const
2022-12-02 13:50 [pve-devel] [PATCH manager 1/3] fix #2435: GUI: LXC summary: Add privileged status and os type Matthias Heiserer
2022-12-02 13:50 ` [pve-devel] [PATCH manager 2/3] GUI: LXC Template Summary: display " Matthias Heiserer
@ 2022-12-02 13:50 ` Matthias Heiserer
1 sibling, 0 replies; 3+ messages in thread
From: Matthias Heiserer @ 2022-12-02 13:50 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
---
www/manager6/panel/GuestStatusView.js | 16 ++++++++--------
www/manager6/panel/GuestSummary.js | 16 ++++++++--------
www/manager6/panel/TemplateStatusView.js | 6 +++---
3 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/www/manager6/panel/GuestStatusView.js b/www/manager6/panel/GuestStatusView.js
index d38b9631..f1002740 100644
--- a/www/manager6/panel/GuestStatusView.js
+++ b/www/manager6/panel/GuestStatusView.js
@@ -4,7 +4,7 @@ Ext.define('PVE.panel.GuestStatusView', {
mixins: ['Proxmox.Mixin.CBind'],
cbindData: function(initialConfig) {
- var me = this;
+ const me = this;
return {
isQemu: me.pveSelNode.data.type === 'qemu',
isLxc: me.pveSelNode.data.type === 'lxc',
@@ -40,9 +40,9 @@ Ext.define('PVE.panel.GuestStatusView', {
printBar: false,
multiField: true,
renderer: function(record) {
- var me = this;
- var text = record.data.status;
- var qmpstatus = record.data.qmpstatus;
+ const me = this;
+ let text = record.data.status;
+ const qmpstatus = record.data.qmpstatus;
if (qmpstatus && qmpstatus !== record.data.status) {
text += ' (' + qmpstatus + ')';
}
@@ -126,7 +126,7 @@ Ext.define('PVE.panel.GuestStatusView', {
maxField: 'maxdisk',
printBar: false,
renderer: function(used, max) {
- var me = this;
+ const me = this;
me.setPrintBar(used > 0);
if (used === 0) {
return Proxmox.Utils.render_size(max);
@@ -152,10 +152,10 @@ Ext.define('PVE.panel.GuestStatusView', {
],
updateTitle: function() {
- var me = this;
- var uptime = me.getRecordValue('uptime');
+ const me = this;
+ const uptime = me.getRecordValue('uptime');
- var text = "";
+ let text = "";
if (Number(uptime) > 0) {
text = " (" + gettext('Uptime') + ': ' + Proxmox.Utils.format_duration_long(uptime)
+ ')';
diff --git a/www/manager6/panel/GuestSummary.js b/www/manager6/panel/GuestSummary.js
index d6655393..694cf324 100644
--- a/www/manager6/panel/GuestSummary.js
+++ b/www/manager6/panel/GuestSummary.js
@@ -6,14 +6,14 @@ Ext.define('PVE.guest.Summary', {
bodyPadding: 5,
initComponent: function() {
- var me = this;
+ const me = this;
- var nodename = me.pveSelNode.data.node;
+ const nodename = me.pveSelNode.data.node;
if (!nodename) {
throw "no node name specified";
}
- var vmid = me.pveSelNode.data.vmid;
+ const vmid = me.pveSelNode.data.vmid;
if (!vmid) {
throw "no VM ID specified";
}
@@ -26,9 +26,9 @@ Ext.define('PVE.guest.Summary', {
throw "no status storage specified";
}
- var type = me.pveSelNode.data.type;
- var template = !!me.pveSelNode.data.template;
- var rstore = me.statusStore;
+ const type = me.pveSelNode.data.type;
+ const template = !!me.pveSelNode.data.template;
+ const rstore = me.statusStore;
const applyLogos = function(controller) {
const updateView = (response) => {
@@ -51,7 +51,7 @@ Ext.define('PVE.guest.Summary', {
});
};
- var items = [
+ let items = [
{
xtype: template ? 'pveTemplateStatusView' : 'pveGuestStatusView',
flex: 1,
@@ -70,7 +70,7 @@ Ext.define('PVE.guest.Summary', {
},
];
- var rrdstore;
+ let rrdstore;
if (!template) {
// in non-template mode put the two panels always together
items = [
diff --git a/www/manager6/panel/TemplateStatusView.js b/www/manager6/panel/TemplateStatusView.js
index 5543f4fe..bacc5410 100644
--- a/www/manager6/panel/TemplateStatusView.js
+++ b/www/manager6/panel/TemplateStatusView.js
@@ -4,7 +4,7 @@ Ext.define('PVE.panel.TemplateStatusView', {
mixins: ['Proxmox.Mixin.CBind'],
cbindData: function(initialConfig) {
- var me = this;
+ const me = this;
return {
isQemu: me.pveSelNode.data.type === 'qemu',
};
@@ -103,9 +103,9 @@ Ext.define('PVE.panel.TemplateStatusView', {
],
initComponent: function() {
- var me = this;
+ const me = this;
- var name = me.pveSelNode.data.name;
+ const name = me.pveSelNode.data.name;
if (!name) {
throw "no name specified";
}
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-02 13:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-02 13:50 [pve-devel] [PATCH manager 1/3] fix #2435: GUI: LXC summary: Add privileged status and os type Matthias Heiserer
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox