From 7ab4b86ad8c61b3e7119e2d54bd5cfa14dcc92f7 Mon Sep 17 00:00:00 2001
From: Loic Baron <loic.baron@lip6.fr>
Date: Wed, 8 Apr 2015 16:46:47 +0200
Subject: [PATCH] Monitoring Widget: no monitoring available if error in
 request

---
 portal/templates/_widget-monitor.html | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/portal/templates/_widget-monitor.html b/portal/templates/_widget-monitor.html
index cb7af4fc..6a7ab7a7 100644
--- a/portal/templates/_widget-monitor.html
+++ b/portal/templates/_widget-monitor.html
@@ -14,14 +14,18 @@
 	$(document).ready(function() {
 		$.get('/monitor/services', function(result) {
 			for (var r in result) {
-				html = '<div class="col-xs-6 col-sm-4 col-md-3 s-monitor"><div class="row">';
-				html += '<div class="col-md-2"><img src="{{ STATIC_URL }}icons/'+result[r].status+'.png"></div>';
-				html += '<div class="col-md-8">';
-				html += '<h4>'+result[r].name+'<h4>';
-				html += '<span class="subtitle">'+result[r].type+'</span>';
-				if (typeof(result[r].version) != 'undefined')
-					html += ' <span class="version">version '+result[r].version+'</span>';
-				html += '</div></div></div>';
+                if(r == 'error'){
+                    html = '<div style="padding-left:20px;">no monitoring available</div>'
+                }else{
+				    html = '<div class="col-xs-6 col-sm-4 col-md-3 s-monitor"><div class="row">';
+				    html += '<div class="col-md-2"><img src="{{ STATIC_URL }}icons/'+result[r].status+'.png"></div>';
+				    html += '<div class="col-md-8">';
+				    html += '<h4>'+result[r].name+'<h4>';
+				    html += '<span class="subtitle">'+result[r].type+'</span>';
+				    if (typeof(result[r].version) != 'undefined')
+				    	html += ' <span class="version">version '+result[r].version+'</span>';
+				    html += '</div></div></div>';
+                }
 				$('div#monitor-services').append(html);
 			}
 		});
-- 
2.47.0