[pve-devel] [PATCH manager] fix #2183: fix blinking subscription and show unknown status

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Apr 19 06:26:26 CEST 2019


dejvú? ;) 

Am 4/18/19 um 2:59 PM schrieb Dominik Csapak:
> when a node is offline, its sub level is undefined/null
> 
> now we check first for '' (which is no subscription) and omit
> further checks
> 
> then we skip offline nodes, and then we continue to check if we
> detect different levels
> 
> if for some reason we do not get any subscription status (should not happen)
> we show 'unknown'
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  www/manager6/dc/Summary.js | 36 ++++++++++++++++++++++++++++--------
>  1 file changed, 28 insertions(+), 8 deletions(-)
> 
> diff --git a/www/manager6/dc/Summary.js b/www/manager6/dc/Summary.js
> index 091ece76..b26eeb92 100644
> --- a/www/manager6/dc/Summary.js
> +++ b/www/manager6/dc/Summary.js
> @@ -238,7 +238,20 @@ Ext.define('PVE.dc.Summary', {
>  		}
>  
>  		curlevel = records[i].get('level');
> -		if (level === undefined || !curlevel) {
> +
> +		// no subscription, set and break
> +		if (curlevel === '') {
> +		    level = '';
> +		    break;
> +		}
> +
> +		// skip offline nodes
> +		if (!curlevel) {
> +		    continue;
> +		}
> +
> +		// save level

at this point this feels really hacky and complicated for such a thing to check..
Can we not just filter out offline nodes over there status first (or some other
state property) and just check this like done?

> +		if (level === undefined) {
>  		    level = curlevel;
>  		    continue;
>  		}
> @@ -248,28 +261,35 @@ Ext.define('PVE.dc.Summary', {
>  		}
>  	    }
>  
> +	    var data = {
> +		title: Proxmox.Utils.unknownText,
> +		text: Proxmox.Utils.unknownText,
> +		iconCls: PVE.Utils.get_health_icon(undefined, true)
> +	    };
>  	    if (level === '') {
> -		subs.setData({
> +		data = {
>  		    title: gettext('No Subscription'),
>  		    iconCls: PVE.Utils.get_health_icon('critical', true),
>  		    text: gettext('You have at least one node without subscription.')
> -		});
> +		};
>  		subs.setUserCls('pointer');
>  	    } else if (level !== curlevel) {
> -		subs.setData({
> +		data = {
>  		    title: gettext('Mixed Subscriptions'),
>  		    iconCls: PVE.Utils.get_health_icon('warning', true),
>  		    text: gettext('Warning: Your subscription levels are not the same.')
> -		});
> +		};
>  		subs.setUserCls('pointer');
> -	    } else {
> -		subs.setData({
> +	    } else if (level) {
> +		data = {
>  		    title: PVE.Utils.render_support_level(level),
>  		    iconCls: PVE.Utils.get_health_icon('good', true),
>  		    text: gettext('Your subscription status is valid.')
> -		});
> +		};
>  		subs.setUserCls('');
>  	    }
> +
> +	    subs.setData(data);
>  	});
>  
>  	me.on('destroy', function(){
> 





More information about the pve-devel mailing list