fix to show a menu when the registry is not reachable
Costa Tsaousis committed
May 13, 2016 at 03:14 UTC
15e7f603f3063a57e61274512dd64b12774ce508
1 file changed
+31
-27
web/index.html
+31
-27
@@ -361,11 +361,11 @@
361
}
362
363
var netdataRegistryCallback = function(urls) {
364
+ var el = '';
365
+ var a1 = '';
366
+ var found = 0;
367
+
368
if(urls) {
365
- var found = 0;
366
- var el = '';
367
- var a1 = '';
368
-
369
$.each(urls, function(i, u) {
370
if(u.guid !== NETDATA.registry.machine_guid) {
371
found++;
@@ -373,32 +373,36 @@
373
a1 += '<li id="registry_action_' + u.guid + '"><a href="#" onclick="deleteRegistryModalHandler(\'' + u.guid + '\',\'' + u.name + '\',\'' + u.url + '\'); return false;"><i class="fa fa-trash-o" aria-hidden="true" style="color: #999;"></i></a></li>';
374
}
375
});
376
+ }
377
377
- if(!found) {
378
+ if(!found) {
379
+ if(urls)
380
el += '<li><a href="https://github.com/firehol/netdata/wiki/mynetdata-menu-item" style="color: #666;" target="_blank">your netdata server list is empty...</a></li>';
379
- a1 += '<li><a href="#"> </a></li>';
380
-
381
- el += '<li role="separator" class="divider"></li>' +
382
- '<li><a href="//london.netdata.rocks/default.html">EU - London (DigitalOcean.com)</a></li>' +
383
- '<li><a href="//atlanta.netdata.rocks/default.html">US - Atlanta (CDN77.com)</a></li>' +
384
- '<li><a href="//athens.netdata.rocks/default.html">EU - Athens</a></li>';
385
- a1 += '<li role="separator" class="divider"></li>' +
386
- '<li><a href="#"> </a></li>' +
387
- '<li><a href="#"> </a></li>'+
388
- '<li><a href="#"> </a></li>';
389
- }
390
-
391
- el += '<li role="separator" class="divider"></li>';
392
- a1 += '<li role="separator" class="divider"></li>';
393
-
394
- el += '<li><a href="https://github.com/firehol/netdata/wiki/mynetdata-menu-item" style="color: #999;" target="_blank">What is this?</a></li>';
395
- a1 += '<li><a href="#" style="color: #999;" onclick="switchRegistryModalHandler(); return false;"><i class="fa fa-cog" aria-hidden="true" style="color: #999;"></i></a></li>'
396
-
397
- document.getElementById('mynetdata_servers').innerHTML = el;
398
- document.getElementById('mynetdata_actions1').innerHTML = a1;
399
-
400
- document.getElementById('mynetdata_servers2').innerHTML = el;
381
+ else
382
+ el += '<li><a href="https://github.com/firehol/netdata/wiki/mynetdata-menu-item" style="color: #666;" target="_blank">failed to contact the registry...</a></li>';
383
+
384
+ a1 += '<li><a href="#"> </a></li>';
385
+
386
+ el += '<li role="separator" class="divider"></li>' +
387
+ '<li><a href="//london.netdata.rocks/default.html">EU - London (DigitalOcean.com)</a></li>' +
388
+ '<li><a href="//atlanta.netdata.rocks/default.html">US - Atlanta (CDN77.com)</a></li>' +
389
+ '<li><a href="//athens.netdata.rocks/default.html">EU - Athens</a></li>';
390
+ a1 += '<li role="separator" class="divider"></li>' +
391
+ '<li><a href="#"> </a></li>' +
392
+ '<li><a href="#"> </a></li>'+
393
+ '<li><a href="#"> </a></li>';
394
}
395
+
396
+ el += '<li role="separator" class="divider"></li>';
397
+ a1 += '<li role="separator" class="divider"></li>';
398
+
399
+ el += '<li><a href="https://github.com/firehol/netdata/wiki/mynetdata-menu-item" style="color: #999;" target="_blank">What is this?</a></li>';
400
+ a1 += '<li><a href="#" style="color: #999;" onclick="switchRegistryModalHandler(); return false;"><i class="fa fa-cog" aria-hidden="true" style="color: #999;"></i></a></li>'
401
+
402
+ document.getElementById('mynetdata_servers').innerHTML = el;
403
+ document.getElementById('mynetdata_actions1').innerHTML = a1;
404
+
405
+ document.getElementById('mynetdata_servers2').innerHTML = el;
406
};
407
408
</script>