[pve-devel] [PATCH manager] add subscription panel on dc summary

Dominik Csapak d.csapak at proxmox.com
Fri Mar 1 14:27:49 CET 2019


So that the users have a good and fast feedback about ther
support and subscripttion status, especially if they have
mistakenly different levels of susbscriptions in their cluster.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
this is modeled after the subscription panel in the pmg dashboard,
but differently enough, so that a refactor would be more work than
what we would gain
 www/manager6/dc/Summary.js | 52 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/www/manager6/dc/Summary.js b/www/manager6/dc/Summary.js
index d2a52ff3..55a76bf0 100644
--- a/www/manager6/dc/Summary.js
+++ b/www/manager6/dc/Summary.js
@@ -59,6 +59,16 @@ Ext.define('PVE.dc.Summary', {
 	    itemId: 'nodeview',
 	    xtype: 'pveDcNodeView',
 	    height: 250
+	},
+	{
+	    title: gettext('Subscriptions'),
+	    height: 220,
+	    items: [
+		{
+		    itemId: 'subscriptions',
+		    xtype: 'pveHealthWidget'
+		}
+	    ]
 	}
     ],
 
@@ -208,6 +218,48 @@ Ext.define('PVE.dc.Summary', {
 	var dcHealth = me.getComponent('dcHealth');
 	me.mon(rstore, 'load', dcHealth.updateStatus, dcHealth);
 
+	var subs = me.down('#subscriptions');
+	me.mon(rstore, 'load', function(store, records, success) {
+	    var i;
+	    var level;
+	    var curlevel;
+	    for (i = 0; i < records.length; i++) {
+		if (records[i].get('type') !== 'node') {
+		    continue;
+		}
+
+		curlevel = records[i].get('level');
+		if (level === undefined) {
+		    level = curlevel;
+		    continue;
+		}
+
+		if (level !== curlevel) {
+		    break;
+		}
+	    }
+
+	    if (level === '') {
+		subs.setData({
+		    title: gettext('No Subscription'),
+		    iconCls: PVE.Utils.get_health_icon('critical', true),
+		    text: gettext('You have at least one node without subscription.')
+		});
+	    } else if (level !== curlevel) {
+		subs.setData({
+		    title: gettext('Mixed Subscriptions'),
+		    iconCls: PVE.Utils.get_health_icon('warning', true),
+		    text: gettext('Warning: Your subscription levels are not the same.')
+		});
+	    } else {
+		subs.setData({
+		    title: PVE.Utils.render_support_level(level),
+		    iconCls: PVE.Utils.get_health_icon('good', true),
+		    text: gettext('Your subscription status is valid.')
+		});
+	    }
+	});
+
 	me.on('destroy', function(){
 	    rstore.stopUpdate();
 	});
-- 
2.11.0





More information about the pve-devel mailing list