[pve-devel] [PATCH manager] prevent visual flashing of button when changing element in the tree

Emmanuel Kasper e.kasper at proxmox.com
Tue Oct 31 10:16:39 CET 2017


Acked-by: Emmanuel Kasper <e.kasper at proxmox.com>


On 10/30/2017 03:03 PM, Dominik Csapak wrote:
> when changing between elements in the tree, either the
> start or shutdown buttons were visually flashing (meaning they are
> enabled/disabled for a short time and change state shortly after)
> 
> this patch fixes that
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  www/manager6/lxc/Config.js  | 6 ++++--
>  www/manager6/qemu/Config.js | 6 ++++--
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/www/manager6/lxc/Config.js b/www/manager6/lxc/Config.js
> index 7a735cd6..0ffc4841 100644
> --- a/www/manager6/lxc/Config.js
> +++ b/www/manager6/lxc/Config.js
> @@ -19,6 +19,8 @@ Ext.define('PVE.lxc.Config', {
>  
>  	var template = me.pveSelNode.data.template;
>  
> +	var running = !!me.pveSelNode.data.uptime;
> +
>  	var caps = Ext.state.Manager.get('GuiCap');
>  
>  	var base_url = '/nodes/' + nodename + '/lxc/' + vmid;
> @@ -42,7 +44,7 @@ Ext.define('PVE.lxc.Config', {
>  
>  	var startBtn = Ext.create('Ext.Button', {
>  	    text: gettext('Start'),
> -	    disabled: !caps.vms['VM.PowerMgmt'],
> +	    disabled: !caps.vms['VM.PowerMgmt'] || running,
>  	    handler: function() {
>  		vm_command('start');
>  	    },
> @@ -62,7 +64,7 @@ Ext.define('PVE.lxc.Config', {
>  
>  	var shutdownBtn = Ext.create('PVE.button.Split', {
>  	    text: gettext('Shutdown'),
> -	    disabled: !caps.vms['VM.PowerMgmt'],
> +	    disabled: !caps.vms['VM.PowerMgmt'] || !running,
>  	    confirmMsg: PVE.Utils.format_task_description('vzshutdown', vmid),
>  	    handler: function() {
>  		vm_command('shutdown');
> diff --git a/www/manager6/qemu/Config.js b/www/manager6/qemu/Config.js
> index f36ba690..db0f3152 100644
> --- a/www/manager6/qemu/Config.js
> +++ b/www/manager6/qemu/Config.js
> @@ -19,6 +19,8 @@ Ext.define('PVE.qemu.Config', {
>  
>  	var template = !!me.pveSelNode.data.template;
>  
> +	var running = !!me.pveSelNode.data.uptime;
> +
>  	var caps = Ext.state.Manager.get('GuiCap');
>  
>  	var base_url = '/nodes/' + nodename + "/qemu/" + vmid;
> @@ -52,7 +54,7 @@ Ext.define('PVE.qemu.Config', {
>  
>  	var startBtn = Ext.create('Ext.Button', {
>  	    text: gettext('Start'),
> -	    disabled: !caps.vms['VM.PowerMgmt'],
> +	    disabled: !caps.vms['VM.PowerMgmt'] || running,
>  	    hidden: template,
>  	    handler: function() {
>  		vm_command('start');
> @@ -133,7 +135,7 @@ Ext.define('PVE.qemu.Config', {
>  
>  	var shutdownBtn = Ext.create('PVE.button.Split', {
>  	    text: gettext('Shutdown'),
> -	    disabled: !caps.vms['VM.PowerMgmt'],
> +	    disabled: !caps.vms['VM.PowerMgmt'] || !running,
>  	    hidden: template,
>  	    confirmMsg: PVE.Utils.format_task_description('qmshutdown', vmid),
>  	    handler: function() {
> 




More information about the pve-devel mailing list