@cryptotaxi247 / netdata-1 / commits / 62141f595

do not break if alarms are fetched for non-existing charts

Costa Tsaousis (ktsaou) committed Jan 26, 2017 at 13:45 UTC 62141f59539b1bbd55c68bf8a9f39194d8cab3ff
1 file changed +7
web/index.html
+7
@@ -1562,6 +1562,13 @@
1562
1563 function alarm_to_html(alarm, full) {
1564 var chart = options.data.charts[alarm.chart];
1565 + if(typeof(chart) === 'undefined') {
1566 + // this means the charts loaded are incomplete
1567 + // probably netdata was restarted and more charts
1568 + // are now available.
1569 + return '';
1570 + }
1571 +
1572 var has_alarm = ((typeof alarm.warn !== 'undefined' || typeof alarm.crit !== 'undefined')?true:false);
1573
1574 var role_href = ((has_alarm === true)?('<br/>&nbsp;<br/>role: <b>' + alarm.recipient + '</b><br/>&nbsp;<br/><b><i class="fa fa-line-chart" aria-hidden="true"></i></b><small>&nbsp;&nbsp;<a href="#" onClick="NETDATA.alarms.scrollToChart(\'' + alarm.chart + '\'); $(\'#alarmsModal\').modal(\'hide\'); return false;">jump to chart</a></small>'):('&nbsp;'));