diff --git a/webapp/src/index.js b/webapp/src/index.js index 9d2e21b..01bc491 100644 --- a/webapp/src/index.js +++ b/webapp/src/index.js @@ -55,7 +55,7 @@ $(function(){ // IPs var ips = _.join(item.details.ipv4_addresses, ', '); - row.append('' + (ips === '' ? no : ips) + ''); + row.append('' + (ips === '' ? no : ips) + ''); // SITE_REACHABLE var reachable = '' + yes + ''; @@ -65,10 +65,14 @@ $(function(){ row.append('' + reachable + ''); // HTTP_RESPONSE_DURATION - var durationClass = 'bad'; - if (item.result.HTTP_RESPONSE_DURATION.score > 0) { durationClass = 'medium'; } - if (item.result.HTTP_RESPONSE_DURATION.score > 0.5) { durationClass = 'good'; } - row.append('' + item.result.HTTP_RESPONSE_DURATION.value + ' ms'); + if (!item.result.SITE_REACHABLE.value || item.result.HTTP_RESPONSE_DURATION.value === null) { + row.append('' + no + ''); + } else { + var durationClass = 'bad'; + if (item.result.HTTP_RESPONSE_DURATION.score > 0) { durationClass = 'medium'; } + if (item.result.HTTP_RESPONSE_DURATION.score > 0.5) { durationClass = 'good'; } + row.append('' + item.result.HTTP_RESPONSE_DURATION.value + ' ms'); + } // FAVICON var icon = item.result.FAVICON.value && (item.details.icons[0] != null); @@ -103,7 +107,7 @@ $(function(){ // screenshots var screenshot = false; - if (item.details.canonical_urls.length > 0) { + if (item.details.canonical_urls && item.details.canonical_urls.length > 0) { if (typeof screenshots[item.details.canonical_urls[0]] !== 'undefined') { var surl = 'http://green-spider-screenshots.sendung.de/320x640/'+screenshots[item.details.canonical_urls[0]]; var lurl = 'http://green-spider-screenshots.sendung.de/1500x1500/'+screenshots[item.details.canonical_urls[0]];