[pve-devel] [PATCH v3 manager 5/5] add reboot button for containers
Oguz Bektas
o.bektas at proxmox.com
Wed Nov 20 15:03:49 CET 2019
On Wed, Nov 20, 2019 at 02:33:29PM +0100, Thomas Lamprecht wrote:
> On 11/19/19 6:37 PM, Oguz Bektas wrote:
> > also use the opportunity to refactor the shutdown button code into the
> > menu.
> >
> > Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
> > ---
> >
> > v2->v3:
> > no changes.
> >
> > www/manager6/lxc/Config.js | 35 +++++++++++++++++++++--------------
> > 1 file changed, 21 insertions(+), 14 deletions(-)
> >
> > diff --git a/www/manager6/lxc/Config.js b/www/manager6/lxc/Config.js
> > index 0f81c1da..5c760f13 100644
> > --- a/www/manager6/lxc/Config.js
> > +++ b/www/manager6/lxc/Config.js
> > @@ -52,18 +52,6 @@ Ext.define('PVE.lxc.Config', {
> > 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', {
> > text: gettext('Shutdown'),
> > disabled: !caps.vms['VM.PowerMgmt'] || !running,
> > @@ -73,7 +61,27 @@ Ext.define('PVE.lxc.Config', {
> > vm_command('shutdown');
> > },
> > 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'
> > +
> > + },{
> > + text: gettext('Reboot'),
> > + disabled: !caps.vms['VM.PowerMgmt'],
> > + confirmMsg: Proxmox.Utils.format_task_description('vzreboot', vmid),
> > + tooltip: Ext.String.format(gettext('Reboot {0}'), 'CT'),
> > + handler: function() {
> > + vm_command("reboot");
> > + },
> > + iconCls: 'fa fa-refresh'
> > + }]
> > },
> > iconCls: 'fa fa-power-off'
> > });
> > @@ -344,7 +352,6 @@ Ext.define('PVE.lxc.Config', {
> >
> > 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');
>
> ...what about the status changes when one has the correct caps??
since stopBtn (and reboot button) is now a item of shutdownBtn menu (because of
refactoring), the check on shutdownBtn disables all of them (shutdown,
stop, reboot) when status !== 'running'
> Also, why is this mixed with the reboot button addition?
i'll split it in new version
>
> > me.down('#removeBtn').setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
> > consoleBtn.setDisabled(template);
> > });
> >
>
More information about the pve-devel
mailing list