]> arthur.barton.de Git - netdata.git/commitdiff
fix to show a menu when the registry is not reachable
authorCosta Tsaousis <costa@tsaousis.gr>
Fri, 13 May 2016 00:14:04 +0000 (03:14 +0300)
committerCosta Tsaousis <costa@tsaousis.gr>
Fri, 13 May 2016 00:14:04 +0000 (03:14 +0300)
web/index.html

index 225e201e23e374be175c82dd16bdfe42759c6976..df48f2fa6682fb30db5010a5760a05e89352e865 100644 (file)
                }
 
                var netdataRegistryCallback = function(urls) {
+                       var el = '';
+                       var a1 = '';
+                       var found = 0;
+
                        if(urls) {
-                               var found = 0;
-                               var el = '';
-                               var a1 = '';
-       
                                $.each(urls, function(i, u) {
                                        if(u.guid !== NETDATA.registry.machine_guid) {
                                                found++;
                                                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>';
                                        }
                                });
+                       }
 
-                               if(!found) {
+                       if(!found) {
+                               if(urls)
                                        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>';
-                                       a1 += '<li><a href="#">&nbsp;</a></li>';
-
-                                       el += '<li role="separator" class="divider"></li>' +
-                                                       '<li><a href="//london.netdata.rocks/default.html">EU - London (DigitalOcean.com)</a></li>' +
-                                                       '<li><a href="//atlanta.netdata.rocks/default.html">US - Atlanta (CDN77.com)</a></li>' +
-                                                       '<li><a href="//athens.netdata.rocks/default.html">EU - Athens</a></li>';
-                                       a1 += '<li role="separator" class="divider"></li>' +
-                                                       '<li><a href="#">&nbsp;</a></li>' +
-                                                       '<li><a href="#">&nbsp;</a></li>'+
-                                                       '<li><a href="#">&nbsp;</a></li>';
-                               }
-               
-                               el += '<li role="separator" class="divider"></li>';
-                               a1 += '<li role="separator" class="divider"></li>';
-       
-                               el += '<li><a href="https://github.com/firehol/netdata/wiki/mynetdata-menu-item" style="color: #999;" target="_blank">What is this?</a></li>';
-                               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>'
-       
-                               document.getElementById('mynetdata_servers').innerHTML = el;
-                               document.getElementById('mynetdata_actions1').innerHTML = a1;
-       
-                               document.getElementById('mynetdata_servers2').innerHTML = el;
+                               else
+                                       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>';
+
+                               a1 += '<li><a href="#">&nbsp;</a></li>';
+
+                               el += '<li role="separator" class="divider"></li>' +
+                                               '<li><a href="//london.netdata.rocks/default.html">EU - London (DigitalOcean.com)</a></li>' +
+                                               '<li><a href="//atlanta.netdata.rocks/default.html">US - Atlanta (CDN77.com)</a></li>' +
+                                               '<li><a href="//athens.netdata.rocks/default.html">EU - Athens</a></li>';
+                               a1 += '<li role="separator" class="divider"></li>' +
+                                               '<li><a href="#">&nbsp;</a></li>' +
+                                               '<li><a href="#">&nbsp;</a></li>'+
+                                               '<li><a href="#">&nbsp;</a></li>';
                        }
+
+                       el += '<li role="separator" class="divider"></li>';
+                       a1 += '<li role="separator" class="divider"></li>';
+
+                       el += '<li><a href="https://github.com/firehol/netdata/wiki/mynetdata-menu-item" style="color: #999;" target="_blank">What is this?</a></li>';
+                       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>'
+
+                       document.getElementById('mynetdata_servers').innerHTML = el;
+                       document.getElementById('mynetdata_actions1').innerHTML = a1;
+
+                       document.getElementById('mynetdata_servers2').innerHTML = el;
                };
 
        </script>