[pmg-devel] [PATCH pmg-gui 2/2] collect and show errors on dashboard
Dominik Csapak
d.csapak at proxmox.com
Wed Feb 21 15:15:40 CET 2018
if a cluster member is not reachable, collect the errors and show
them once to the user
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
js/Dashboard.js | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/js/Dashboard.js b/js/Dashboard.js
index 4684a58..ce94841 100644
--- a/js/Dashboard.js
+++ b/js/Dashboard.js
@@ -113,6 +113,7 @@ Ext.define('PMG.Dashboard', {
var mem = 0;
var hd = 0;
var count = records.length;
+ var errors = [];
records.forEach(function(item) {
// subscription level check
@@ -135,6 +136,13 @@ Ext.define('PMG.Dashboard', {
var rootfs = item.data.rootfs || { used: 0, total: 1 };
hd += (rootfs.used/rootfs.total);
+ if (item.data.conn_error && count > 1) {
+ count--;
+ errors.push({
+ name: item.data.name,
+ msg: item.data.conn_error
+ });
+ }
});
var subscriptionPanel = me.lookup('subscription');
@@ -152,6 +160,15 @@ Ext.define('PMG.Dashboard', {
var hdPanel = me.lookup('hd');
hdPanel.updateValue(hd);
+
+ if (errors.length && !viewmodel.get('error_shown')) {
+ var text = "";
+ errors.forEach(function(error) {
+ text += error.name + ':<br>' + error.msg + '<br>';
+ });
+ Ext.Msg.alert(gettext('Error'), text);
+ viewmodel.set('error_shown', true);
+ }
},
init: function(view) {
@@ -166,6 +183,7 @@ Ext.define('PMG.Dashboard', {
data: {
timespan: 300, // in seconds
hours: 12, // in hours
+ error_shown: false,
'bytes_in': 0,
'bytes_out': 0,
'avg_ptime': 0.0
--
2.11.0
More information about the pmg-devel
mailing list