mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-14 14:32:37 +00:00
lxc: refactor stop button
move stopBtn into shutdownBtn as a menu item. we can remove the setDisabled() call for stopBtn near the end, since when shutdownBtn is disabled, so is stopBtn. Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
This commit is contained in:
parent
1ff3fef0b0
commit
2f13fde351
@ -52,18 +52,6 @@ Ext.define('PVE.lxc.Config', {
|
|||||||
iconCls: 'fa fa-play'
|
iconCls: 'fa fa-play'
|
||||||
});
|
});
|
||||||
|
|
||||||
var stopBtn = Ext.create('Ext.menu.Item',{
|
|
||||||
text: gettext('Stop'),
|
|
||||||
disabled: !caps.vms['VM.PowerMgmt'],
|
|
||||||
confirmMsg: Proxmox.Utils.format_task_description('vzstop', vmid),
|
|
||||||
tooltip: Ext.String.format(gettext('Stop {0} immediately'), 'CT'),
|
|
||||||
dangerous: true,
|
|
||||||
handler: function() {
|
|
||||||
vm_command("stop");
|
|
||||||
},
|
|
||||||
iconCls: 'fa fa-stop'
|
|
||||||
});
|
|
||||||
|
|
||||||
var shutdownBtn = Ext.create('PVE.button.Split', {
|
var shutdownBtn = Ext.create('PVE.button.Split', {
|
||||||
text: gettext('Shutdown'),
|
text: gettext('Shutdown'),
|
||||||
disabled: !caps.vms['VM.PowerMgmt'] || !running,
|
disabled: !caps.vms['VM.PowerMgmt'] || !running,
|
||||||
@ -73,7 +61,17 @@ Ext.define('PVE.lxc.Config', {
|
|||||||
vm_command('shutdown');
|
vm_command('shutdown');
|
||||||
},
|
},
|
||||||
menu: {
|
menu: {
|
||||||
items:[stopBtn]
|
items:[{
|
||||||
|
text: gettext('Stop'),
|
||||||
|
disabled: !caps.vms['VM.PowerMgmt'],
|
||||||
|
confirmMsg: Proxmox.Utils.format_task_description('vzstop', vmid),
|
||||||
|
tooltip: Ext.String.format(gettext('Stop {0} immediately'), 'CT'),
|
||||||
|
dangerous: true,
|
||||||
|
handler: function() {
|
||||||
|
vm_command("stop");
|
||||||
|
},
|
||||||
|
iconCls: 'fa fa-stop'
|
||||||
|
}]
|
||||||
},
|
},
|
||||||
iconCls: 'fa fa-power-off'
|
iconCls: 'fa fa-power-off'
|
||||||
});
|
});
|
||||||
@ -344,7 +342,6 @@ Ext.define('PVE.lxc.Config', {
|
|||||||
|
|
||||||
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');
|
|
||||||
me.down('#removeBtn').setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
|
me.down('#removeBtn').setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
|
||||||
consoleBtn.setDisabled(template);
|
consoleBtn.setDisabled(template);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user