Monitoring Widget: no monitoring available if error in request
authorLoic Baron <loic.baron@lip6.fr>
Wed, 8 Apr 2015 14:46:47 +0000 (16:46 +0200)
committerLoic Baron <loic.baron@lip6.fr>
Wed, 8 Apr 2015 14:46:47 +0000 (16:46 +0200)
portal/templates/_widget-monitor.html

index cb7af4f..6a7ab7a 100644 (file)
        $(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);
                        }
                });