mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-14 21:28:40 +00:00
gui: show lock in status bar of vms/cts
also add 'tbarSpacing' parameter to ConfigPanel, that controls the spacing after the title Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
0b985d6f23
commit
375d291810
@ -160,10 +160,23 @@ Ext.define('PVE.lxc.Config', {
|
|||||||
vmid: vmid
|
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, {
|
Ext.apply(me, {
|
||||||
title: Ext.String.format(gettext("Container {0} on node '{1}'"), vm.text, nodename),
|
title: Ext.String.format(gettext("Container {0} on node '{1}'"), vm.text, nodename),
|
||||||
hstateid: 'lxctab',
|
hstateid: 'lxctab',
|
||||||
tbar: [ startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn ],
|
tbarSpacing: false,
|
||||||
|
tbar: [ statusTxt, '->', startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn ],
|
||||||
defaults: { statusStore: me.statusStore },
|
defaults: { statusStore: me.statusStore },
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
@ -314,6 +327,7 @@ Ext.define('PVE.lxc.Config', {
|
|||||||
|
|
||||||
me.mon(me.statusStore, 'load', function(s, records, success) {
|
me.mon(me.statusStore, 'load', function(s, records, success) {
|
||||||
var status;
|
var status;
|
||||||
|
var lock;
|
||||||
if (!success) {
|
if (!success) {
|
||||||
status = 'unknown';
|
status = 'unknown';
|
||||||
} else {
|
} else {
|
||||||
@ -321,7 +335,12 @@ Ext.define('PVE.lxc.Config', {
|
|||||||
status = rec ? rec.data.value : 'unknown';
|
status = rec ? rec.data.value : 'unknown';
|
||||||
rec = s.data.get('template');
|
rec = s.data.get('template');
|
||||||
template = rec.data.value || false;
|
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);
|
startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running' || template);
|
||||||
shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
|
shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
|
||||||
stopBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'stopped');
|
stopBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'stopped');
|
||||||
|
@ -46,6 +46,8 @@ Ext.define('PVE.panel.Config', {
|
|||||||
showSearch: true, // add a ressource grid with a search button as first tab
|
showSearch: true, // add a ressource grid with a search button as first tab
|
||||||
viewFilter: undefined, // a filter to pass to that ressource grid
|
viewFilter: undefined, // a filter to pass to that ressource grid
|
||||||
|
|
||||||
|
tbarSpacing: true, // if true, adds a spacer after the title in tbar
|
||||||
|
|
||||||
dockedItems: [{
|
dockedItems: [{
|
||||||
// this is needed for the overflow handler
|
// this is needed for the overflow handler
|
||||||
xtype: 'toolbar',
|
xtype: 'toolbar',
|
||||||
@ -183,7 +185,9 @@ Ext.define('PVE.panel.Config', {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tbar.unshift('->');
|
if (me.tbarSpacing) {
|
||||||
|
tbar.unshift('->');
|
||||||
|
}
|
||||||
tbar.unshift({
|
tbar.unshift({
|
||||||
xtype: 'tbtext',
|
xtype: 'tbtext',
|
||||||
text: title,
|
text: title,
|
||||||
|
@ -175,10 +175,22 @@ Ext.define('PVE.qemu.Config', {
|
|||||||
vmid: vmid
|
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, {
|
Ext.apply(me, {
|
||||||
title: Ext.String.format(gettext("Virtual Machine {0} on node '{1}'"), vm.text, nodename),
|
title: Ext.String.format(gettext("Virtual Machine {0} on node '{1}'"), vm.text, nodename),
|
||||||
hstateid: 'kvmtab',
|
hstateid: 'kvmtab',
|
||||||
tbar: [ resumeBtn, startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn ],
|
tbarSpacing: false,
|
||||||
|
tbar: [ statusTxt, '->', resumeBtn, startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn ],
|
||||||
defaults: { statusStore: me.statusStore },
|
defaults: { statusStore: me.statusStore },
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
@ -331,6 +343,7 @@ Ext.define('PVE.qemu.Config', {
|
|||||||
var qmpstatus;
|
var qmpstatus;
|
||||||
var spice = false;
|
var spice = false;
|
||||||
var xtermjs = false;
|
var xtermjs = false;
|
||||||
|
var lock;
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
status = qmpstatus = 'unknown';
|
status = qmpstatus = 'unknown';
|
||||||
@ -341,6 +354,8 @@ Ext.define('PVE.qemu.Config', {
|
|||||||
qmpstatus = rec ? rec.data.value : 'unknown';
|
qmpstatus = rec ? rec.data.value : 'unknown';
|
||||||
rec = s.data.get('template');
|
rec = s.data.get('template');
|
||||||
template = rec.data.value || false;
|
template = rec.data.value || false;
|
||||||
|
rec = s.data.get('lock');
|
||||||
|
lock = rec ? rec.data.value : undefined;
|
||||||
|
|
||||||
spice = s.data.get('spice') ? true : false;
|
spice = s.data.get('spice') ? true : false;
|
||||||
xtermjs = s.data.get('serial') ? true : false;
|
xtermjs = s.data.get('serial') ? true : false;
|
||||||
@ -362,6 +377,8 @@ Ext.define('PVE.qemu.Config', {
|
|||||||
consoleBtn.setEnableSpice(spice);
|
consoleBtn.setEnableSpice(spice);
|
||||||
consoleBtn.setEnableXtermJS(xtermjs);
|
consoleBtn.setEnableXtermJS(xtermjs);
|
||||||
|
|
||||||
|
statusTxt.update({ lock: lock });
|
||||||
|
|
||||||
startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running' || template);
|
startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running' || template);
|
||||||
shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
|
shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
|
||||||
me.down('#removeBtn').setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
|
me.down('#removeBtn').setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
|
||||||
|
Loading…
Reference in New Issue
Block a user