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

Thomas Lamprecht t.lamprecht at proxmox.com
Tue May 7 19:53:44 CEST 2019


On 5/3/19 2:06 PM, Dominik Csapak wrote:
> we skip offline nodes, check for nodes without subscription,
> and finally check for 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>
> ---
> changes from v1:
> * explicitely check for offline nodes with their status

applied, but with a followup as you still had a chance for blinking stuff..
I.e., with one without ('') and two with different they could blink, depending
of record sorting. So I do not break on mixed anymore, but record that only.

> 
>  www/manager6/dc/Summary.js | 38 +++++++++++++++++++++++++++++---------
>  1 file changed, 29 insertions(+), 9 deletions(-)
> 
> diff --git a/www/manager6/dc/Summary.js b/www/manager6/dc/Summary.js
> index 091ece76..c7bfe07a 100644
> --- a/www/manager6/dc/Summary.js
> +++ b/www/manager6/dc/Summary.js
> @@ -236,40 +236,60 @@ Ext.define('PVE.dc.Summary', {
>  		if (records[i].get('type') !== 'node') {
>  		    continue;
>  		}
> +		var node = records[i];
> +		if (node.get('status') === 'offline') {
> +		    continue;
> +		}
> +
> +		curlevel = node.get('level');
> +
> +		// no subscription, set and break
> +		if (curlevel === '') {
> +		    level = '';
> +		    break;
> +		}
>  
> -		curlevel = records[i].get('level');
> -		if (level === undefined || !curlevel) {
> +		// save level
> +		if (level === undefined) {
>  		    level = curlevel;
>  		    continue;
>  		}
>  
> +		// detect different levels
>  		if (level !== curlevel) {
>  		    break;
>  		}
>  	    }
>  
> +	    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