]> git.proxmox.com Git - pve-manager.git/commitdiff
gui: show lock in status bar of vms/cts
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 21 Mar 2019 09:55:20 +0000 (10:55 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 21 Mar 2019 17:39:27 +0000 (18:39 +0100)
also add 'tbarSpacing' parameter to ConfigPanel, that controls
the spacing after the title

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
www/manager6/lxc/Config.js
www/manager6/panel/ConfigPanel.js
www/manager6/qemu/Config.js

index 51864f1aea1ea1c6e56c152665d8d96cd28ad67c..9f219ed49f2c81bf9c6bbc4c26a05593d09aaabc 100644 (file)
@@ -160,10 +160,23 @@ 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 ],
+           tbarSpacing: false,
+           tbar: [ statusTxt, '->', startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn ],
            defaults: { statusStore: me.statusStore },
            items: [
                {
@@ -314,6 +327,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 +335,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');
index e3c71eef2568925e050db7455e10f6a5f774af70..dbdf50506731dcb54742430ec38f3cc2ba0f8861 100644 (file)
@@ -46,6 +46,8 @@ Ext.define('PVE.panel.Config', {
     showSearch: true, // add a ressource grid with a search button as first tab
     viewFilter: undefined, // a filter to pass to that ressource grid
 
+    tbarSpacing: true, // if true, adds a spacer after the title in tbar
+
     dockedItems: [{
        // this is needed for the overflow handler
        xtype: 'toolbar',
@@ -183,7 +185,9 @@ Ext.define('PVE.panel.Config', {
            }
        }
 
-       tbar.unshift('->');
+       if (me.tbarSpacing) {
+           tbar.unshift('->');
+       }
        tbar.unshift({
            xtype: 'tbtext',
            text: title,
index 38496f4fc56825e080d05d8b7f8d59cfb06cd843..0474fdb4eca2f6625585709ca40364c245763e8d 100644 (file)
@@ -175,10 +175,22 @@ 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 ],
+           tbarSpacing: false,
+           tbar: [ statusTxt, '->', resumeBtn, startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn ],
            defaults: { statusStore: me.statusStore },
            items: [
                {
@@ -331,6 +343,7 @@ Ext.define('PVE.qemu.Config', {
            var qmpstatus;
            var spice = false;
            var xtermjs = false;
+           var lock;
 
            if (!success) {
                status = qmpstatus = 'unknown';
@@ -341,6 +354,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 +377,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');