add subscription panel on dc summary

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@proxmox.com>
This commit is contained in:
Dominik Csapak 2019-03-01 14:27:49 +01:00 committed by Thomas Lamprecht
parent c3b04731bb
commit f734486b70

View File

@ -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();
});