[pve-devel] [PATCH manager 1/1] gui: show lock in status bar of vms/cts

Dominik Csapak d.csapak at proxmox.com
Wed Mar 20 11:29:03 CET 2019


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/lxc/Config.js  | 20 +++++++++++++++++++-
 www/manager6/qemu/Config.js | 18 +++++++++++++++++-
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/www/manager6/lxc/Config.js b/www/manager6/lxc/Config.js
index 51864f1a..de125404 100644
--- a/www/manager6/lxc/Config.js
+++ b/www/manager6/lxc/Config.js
@@ -160,10 +160,22 @@ Ext.define('PVE.lxc.Config', {
 	    vmid: vmid
 	});
 
+	var statusTxt = Ext.create('Ext.toolbar.TextItem', {
+	    data: {
+		lock: undefined
+	    },
+	    tpl: [
+		'<tpl if="lock">',
+		'<i class="fa fa-lg fa-lock"></i>: ' + '{lock}',
+		'</tpl>'
+	    ]
+	});
+
+
 	Ext.apply(me, {
 	    title: Ext.String.format(gettext("Container {0} on node '{1}'"), vm.text, nodename),
 	    hstateid: 'lxctab',
-	    tbar: [ startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn ],
+	    tbar: [ statusTxt, startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn ],
 	    defaults: { statusStore: me.statusStore },
 	    items: [
 		{
@@ -314,6 +326,7 @@ Ext.define('PVE.lxc.Config', {
 
 	me.mon(me.statusStore, 'load', function(s, records, success) {
 	    var status;
+	    var lock;
 	    if (!success) {
 		status = 'unknown';
 	    } else {
@@ -321,7 +334,12 @@ Ext.define('PVE.lxc.Config', {
 		status = rec ? rec.data.value : 'unknown';
 		rec = s.data.get('template');
 		template = rec.data.value || false;
+		rec = s.data.get('lock');
+		lock = rec ? rec.data.value : undefined;
 	    }
+
+	    statusTxt.update({ lock: lock });
+
 	    startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running' || template);
 	    shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
 	    stopBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'stopped');
diff --git a/www/manager6/qemu/Config.js b/www/manager6/qemu/Config.js
index 38496f4f..a61e58c4 100644
--- a/www/manager6/qemu/Config.js
+++ b/www/manager6/qemu/Config.js
@@ -175,10 +175,21 @@ Ext.define('PVE.qemu.Config', {
 	    vmid: vmid
 	});
 
+	var statusTxt = Ext.create('Ext.toolbar.TextItem', {
+	    data: {
+		lock: undefined
+	    },
+	    tpl: [
+		'<tpl if="lock">',
+		'<i class="fa fa-lg fa-lock"></i>: ' + '{lock}',
+		'</tpl>'
+	    ]
+	});
+
 	Ext.apply(me, {
 	    title: Ext.String.format(gettext("Virtual Machine {0} on node '{1}'"), vm.text, nodename),
 	    hstateid: 'kvmtab',
-	    tbar: [ resumeBtn, startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn ],
+	    tbar: [ statusTxt, resumeBtn, startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn ],
 	    defaults: { statusStore: me.statusStore },
 	    items: [
 		{
@@ -331,6 +342,7 @@ Ext.define('PVE.qemu.Config', {
 	    var qmpstatus;
 	    var spice = false;
 	    var xtermjs = false;
+	    var lock;
 
 	    if (!success) {
 		status = qmpstatus = 'unknown';
@@ -341,6 +353,8 @@ Ext.define('PVE.qemu.Config', {
 		qmpstatus = rec ? rec.data.value : 'unknown';
 		rec = s.data.get('template');
 		template = rec.data.value || false;
+		rec = s.data.get('lock');
+		lock = rec ? rec.data.value : undefined;
 
 		spice = s.data.get('spice') ? true : false;
 		xtermjs = s.data.get('serial') ? true : false;
@@ -362,6 +376,8 @@ Ext.define('PVE.qemu.Config', {
 	    consoleBtn.setEnableSpice(spice);
 	    consoleBtn.setEnableXtermJS(xtermjs);
 
+	    statusTxt.update({ lock: lock });
+
 	    startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running' || template);
 	    shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
 	    me.down('#removeBtn').setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
-- 
2.11.0




More information about the pve-devel mailing list