defaults: {
padding: 5,
- plugins: 'responsive',
- responsiveConfig: {
- 'width < 1900': {
- columnWidth: 1
- },
- 'width >= 1900': {
- columnWidth: 0.5
- }
- }
+ columnWidth: 1,
},
items: [
{
itemId: 'dcHealth',
- xtype: 'pveDcHealth'
+ xtype: 'pveDcHealth',
},
{
itemId: 'dcGuests',
- xtype: 'pveDcGuests'
+ xtype: 'pveDcGuests',
},
{
title: gettext('Resources'),
layout: 'hbox',
defaults: {
xtype: 'proxmoxGauge',
- flex: 1
+ flex: 1,
},
- items:[
+ items: [
{
title: gettext('CPU'),
- itemId: 'cpu'
+ itemId: 'cpu',
},
{
title: gettext('Memory'),
- itemId: 'memory'
+ itemId: 'memory',
},
{
title: gettext('Storage'),
- itemId: 'storage'
- }
- ]
+ itemId: 'storage',
+ },
+ ],
},
{
itemId: 'nodeview',
xtype: 'pveDcNodeView',
- height: 250
+ height: 250,
},
{
title: gettext('Subscriptions'),
items: [
{
itemId: 'subscriptions',
- xtype: 'pveHealthWidget'
- }
- ]
- }
+ xtype: 'pveHealthWidget',
+ userCls: 'pointer',
+ listeners: {
+ element: 'el',
+ click: function() {
+ if (this.component.userCls === 'pointer') {
+ window.open('https://www.proxmox.com/en/proxmox-ve/pricing', '_blank');
+ }
+ },
+ },
+ },
+ ],
+ },
],
+ listeners: {
+ resize: function(panel) {
+ PVE.Utils.updateColumns(panel);
+ },
+ },
+
initComponent: function() {
var me = this;
model: 'pve-dc-nodes',
proxy: {
type: 'proxmox',
- url: "/api2/json/cluster/status"
- }
+ url: "/api2/json/cluster/status",
+ },
});
var gridstore = Ext.create('Proxmox.data.DiffStore', {
rstore: rstore,
filters: {
property: 'type',
- value: 'node'
+ value: 'node',
},
sorters: {
property: 'id',
- direction: 'ASC'
- }
+ direction: 'ASC',
+ },
});
me.callParent();
var total = 0;
var usableStorages = {};
var storages = sp.get('dash-storages') || '';
- storages.split(',').forEach(function(storage){
+ storages.split(',').forEach(function(storage) {
if (storage !== '') {
usableStorages[storage] = true;
}
running: 0,
paused: 0,
stopped: 0,
- template: 0
+ template: 0,
};
var lxc = {
running: 0,
paused: 0,
stopped: 0,
- template: 0
+ template: 0,
};
var error = 0;
for (i = 0; i < results.length; i++) {
var item = results[i];
- switch(item.data.type) {
+ switch (item.data.type) {
case 'node':
- cpu += (item.data.cpu * item.data.maxcpu);
+ cpu += item.data.cpu * item.data.maxcpu;
maxcpu += item.data.maxcpu || 0;
memory += item.data.mem || 0;
maxmem += item.data.maxmem || 0;
break;
}
if (!countedStorages[item.data.storage] ||
- (item.data.storage === 'local' &&
- !countedStorages[item.data.id])) {
+ !item.data.shared && !countedStorages[item.data.id]) {
used += item.data.disk;
total += item.data.maxdisk;
}
var text = Ext.String.format(gettext('of {0} CPU(s)'), maxcpu);
- cpustat.updateValue((cpu/maxcpu), text);
+ cpustat.updateValue(cpu/maxcpu, text);
- text = Ext.String.format(gettext('{0} of {1}'), PVE.Utils.render_size(memory), PVE.Utils.render_size(maxmem));
- memorystat.updateValue((memory/maxmem), text);
+ text = Ext.String.format(gettext('{0} of {1}'), Proxmox.Utils.render_size(memory), Proxmox.Utils.render_size(maxmem));
+ memorystat.updateValue(memory/maxmem, text);
- text = Ext.String.format(gettext('{0} of {1}'), PVE.Utils.render_size(used), PVE.Utils.render_size(total));
- storagestat.updateValue((used/total), text);
+ text = Ext.String.format(gettext('{0} of {1}'), Proxmox.Utils.render_size(used), Proxmox.Utils.render_size(total));
+ storagestat.updateValue(used/total, text);
- gueststatus.updateValues(qemu,lxc,error);
+ gueststatus.updateValues(qemu, lxc, error);
me.suspendLayout = false;
me.updateLayout(true);
me.mon(rstore, 'load', function(store, records, success) {
var i;
var level;
- var curlevel;
+ var mixed = false;
for (i = 0; i < records.length; i++) {
if (records[i].get('type') !== 'node') {
continue;
}
-
- curlevel = records[i].get('level');
- if (level === undefined || !curlevel) {
- level = curlevel;
+ var node = records[i];
+ if (node.get('status') === 'offline') {
continue;
}
- if (level !== curlevel) {
+ var curlevel = node.get('level');
+
+ if (curlevel === '') { // no subscription trumps all, set and break
+ level = '';
break;
}
+
+ if (level === undefined) { // save level
+ level = curlevel;
+ } else if (level !== curlevel) { // detect different levels
+ mixed = true;
+ }
}
+ 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.')
- });
- } else if (level !== curlevel) {
- subs.setData({
+ text: gettext('You have at least one node without subscription.'),
+ };
+ subs.setUserCls('pointer');
+ } else if (mixed) {
+ data = {
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({
+ text: gettext('Warning: Your subscription levels are not the same.'),
+ };
+ subs.setUserCls('pointer');
+ } 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.')
- });
+ text: gettext('Your subscription status is valid.'),
+ };
+ subs.setUserCls('');
}
+
+ subs.setData(data);
});
- me.on('destroy', function(){
+ me.on('destroy', function() {
rstore.stopUpdate();
});
+ me.mon(sp, 'statechange', function(provider, key, value) {
+ if (key !== 'summarycolumns') {
+ return;
+ }
+ PVE.Utils.updateColumns(me);
+ });
+
rstore.startUpdate();
- }
+ },
});