diff --git a/index.html b/index.html index 8430547..d1dae6e 100644 --- a/index.html +++ b/index.html @@ -27,6 +27,6 @@
- + diff --git a/script.js b/script.js index 4384f3f..439b1ca 100644 --- a/script.js +++ b/script.js @@ -2,11 +2,6 @@ $(document).ready(function() { var config = { uptimerobot: { api_keys: [ - 'm776590650-e291a9a509ce82dc719350d6', - 'm776590666-a657ffa8828aea401e337879', - 'm776590648-36bde29bdc0b551f8ea18b88', - 'm778556460-a25f70740ba97f693ea2ac5d', - 'm776590646-e51287a02018f0947feda64a' ], logs: 1 }, @@ -72,64 +67,66 @@ $(document).ready(function() { function message(issues) { issues.forEach(function(issue) { - var status = issue.labels.reduce(function(status, label) { - if (/^status:/.test(label.name)) { - return label.name.replace('status:', ''); - } else { - return status; + if( issue.labels.length > 0 ){ // only display labelled issues + var status = issue.labels.reduce(function(status, label) { + if (/^status:/.test(label.name)) { + return label.name.replace('status:', ''); + } else { + return status; + } + }, 'operational'); + + var systems = issue.labels.filter(function(label) { + return /^system:/.test(label.name); + }).map(function(label) { + return label.name.replace('system:', '') + }); + + if (issue.state === 'open') { + $('#panel').data('incident', 'true'); + $('#panel').attr('class', (status === 'operational' ? 'panel-success' : 'panel-warn') ); + $('#paneltitle').html('' + issue.title + ''); } - }, 'operational'); - - var systems = issue.labels.filter(function(label) { - return /^system:/.test(label.name); - }).map(function(label) { - return label.name.replace('system:', '') - }); - - if (issue.state === 'open') { - $('#panel').data('incident', 'true'); - $('#panel').attr('class', (status === 'operational' ? 'panel-success' : 'panel-warn') ); - $('#paneltitle').html('' + issue.title + ''); - } - var html = '
\n'; - html += '
\n'; + var html = '
\n'; + html += '
\n'; - if (issue.state === 'closed') { - html += '
'; - } else { - html += '
'; - } + if (issue.state === 'closed') { + html += '
'; + } else { + html += '
'; + } - html += '
\n'; - html += '' + datetime(issue.created_at) + '\n'; + html += '
\n'; + html += '' + datetime(issue.created_at) + '\n'; - // status - if (issue.state === 'closed') { - html += 'closed'; - } else { - html += ''; - html += "open"; - html += '\n'; - } + // status + if (issue.state === 'closed') { + html += 'closed'; + } else { + html += ''; + html += "open"; + html += '\n'; + } - // systems - for (var i = 0; i < systems.length; i++) { - html += '' + systems[i] + ''; - } + // systems + for (var i = 0; i < systems.length; i++) { + html += '' + systems[i] + ''; + } - html += '

' + issue.title + '

\n'; - html += '
\n'; - html += '

' + issue.body + '

\n'; + html += '

' + issue.title + '

\n'; + html += '
\n'; + html += '

' + issue.body + '

\n'; - if (issue.state === 'closed') { - html += '

Updated ' + datetime(issue.closed_at) + '
'; - html += 'The system is back in normal operation.

'; + if (issue.state === 'closed') { + html += '

Updated ' + datetime(issue.closed_at) + '
'; + html += 'The system is back in normal operation.

'; + } + html += '
'; + html += '
'; + html += '
'; + $('#incidents').append(html); } - html += '
'; - html += ''; - html += '
'; - $('#incidents').append(html); }); function datetime(string) {