From bb7ab2baa63285497635c6869a63a4d1799f9b9e Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 21 Feb 2018 15:15:40 +0100 Subject: [PATCH] collect and show errors on dashboard if a cluster member is not reachable, collect the errors and show them once to the user Signed-off-by: Dominik Csapak --- 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 + ':
' + error.msg + '
'; + }); + 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.39.2