[pve-devel] [PATCH manager v2 2/5] gui: add tags to guest status line
Dominik Csapak
d.csapak at proxmox.com
Thu Oct 3 13:50:11 CEST 2019
this way they are always visible when a user has selected a vm
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/manager6/lxc/Config.js | 12 +++++++++---
www/manager6/qemu/Config.js | 11 +++++++++--
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/www/manager6/lxc/Config.js b/www/manager6/lxc/Config.js
index 0f81c1da..d9ea7fc6 100644
--- a/www/manager6/lxc/Config.js
+++ b/www/manager6/lxc/Config.js
@@ -163,16 +163,19 @@ Ext.define('PVE.lxc.Config', {
var statusTxt = Ext.create('Ext.toolbar.TextItem', {
data: {
- lock: undefined
+ lock: undefined,
+ tags: [],
},
tpl: [
'<tpl if="lock">',
'<i class="fa fa-lg fa-lock"></i> ({lock})',
+ '</tpl>',
+ '<tpl for="tags" between=" ">',
+ '{.}',
'</tpl>'
]
});
-
Ext.apply(me, {
title: Ext.String.format(gettext("Container {0} on node '{1}'"), vm.text, nodename),
hstateid: 'lxctab',
@@ -329,6 +332,7 @@ Ext.define('PVE.lxc.Config', {
me.mon(me.statusStore, 'load', function(s, records, success) {
var status;
var lock;
+ var tags;
if (!success) {
status = 'unknown';
} else {
@@ -338,9 +342,11 @@ Ext.define('PVE.lxc.Config', {
template = rec.data.value || false;
rec = s.data.get('lock');
lock = rec ? rec.data.value : undefined;
+ rec = s.data.get('tags');
+ tags = rec ? rec.data.value.split(/[,; ]/).map(val => PVE.Utils.getTagElement(val) ) : [];
}
- statusTxt.update({ lock: lock });
+ statusTxt.update({ lock: lock, tags: tags });
startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running' || template);
shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
diff --git a/www/manager6/qemu/Config.js b/www/manager6/qemu/Config.js
index ccf30a9b..ce389136 100644
--- a/www/manager6/qemu/Config.js
+++ b/www/manager6/qemu/Config.js
@@ -205,11 +205,15 @@ Ext.define('PVE.qemu.Config', {
var statusTxt = Ext.create('Ext.toolbar.TextItem', {
data: {
- lock: undefined
+ lock: undefined,
+ tags: [],
},
tpl: [
'<tpl if="lock">',
'<i class="fa fa-lg fa-lock"></i> ({lock})',
+ '</tpl>',
+ '<tpl for="tags" between=" ">',
+ '{.}',
'</tpl>'
]
});
@@ -372,6 +376,7 @@ Ext.define('PVE.qemu.Config', {
var spice = false;
var xtermjs = false;
var lock;
+ var tags;
if (!success) {
status = qmpstatus = 'unknown';
@@ -384,6 +389,8 @@ Ext.define('PVE.qemu.Config', {
template = rec.data.value || false;
rec = s.data.get('lock');
lock = rec ? rec.data.value : undefined;
+ rec = s.data.get('tags');
+ tags = rec ? rec.data.value.split(',').map(val => PVE.Utils.getTagElement(val) ) : [];
spice = s.data.get('spice') ? true : false;
xtermjs = s.data.get('serial') ? true : false;
@@ -407,7 +414,7 @@ Ext.define('PVE.qemu.Config', {
consoleBtn.setEnableSpice(spice);
consoleBtn.setEnableXtermJS(xtermjs);
- statusTxt.update({ lock: lock });
+ statusTxt.update({ lock: lock, tags: tags });
startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running' || template);
shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
--
2.20.1
More information about the pve-devel
mailing list