lookup all the known URLs of a machine
Costa Tsaousis (ktsaou) committed
Sep 30, 2016 at 09:28 UTC
ed949919d09784b89d2e036c356895ac806e5919
1 file changed
+25
-5
web/index.html
+25
-5
@@ -721,9 +721,6 @@
721
if(gotoServerValidateRemaining <= 0) {
722
gotoServerMiddleClick = false;
723
document.getElementById('gotoServerResponse').innerHTML = '<b>Sorry! I cannot find any operational URL for this server</b>';
724
- //NETDATA.registry.search(guid, function(d) {
725
- // console.log(d);
726
- //});
724
}
725
}
726
});
@@ -734,7 +731,9 @@
731
// console.log('goto server: ' + guid);
732
733
gotoServerStop = false;
734
+ var checked = {};
735
var len = NETDATA.registry.machines[guid].alternate_urls.length;
736
+ var count = 0;
737
738
document.getElementById('gotoServerResponse').innerHTML = '';
739
document.getElementById('gotoServerList').innerHTML = '';
@@ -742,9 +741,30 @@
741
$('#gotoServerModal').modal('show');
742
743
gotoServerValidateRemaining = len;
745
- while(len--)
746
- gotoServerValidateUrl(len, guid, NETDATA.registry.machines[guid].alternate_urls[len]);
744
+ while(len--) {
745
+ var url = NETDATA.registry.machines[guid].alternate_urls[len];
746
+ checked[url] = true;
747
+ gotoServerValidateUrl(count++, guid, url);
748
+ }
749
750
+ setTimeout(function() {
751
+ if(gotoServerStop === false) {
752
+ document.getElementById('gotoServerResponse').innerHTML = '<b>Added all the known URLs for this machine.</b>';
753
+ NETDATA.registry.search(guid, function(data) {
754
+ console.log(data);
755
+ len = data.urls.length;
756
+ while(len--) {
757
+ var url = data.urls[len][1];
758
+ console.log(url);
759
+ if(typeof checked[url] === 'undefined') {
760
+ gotoServerValidateRemaining++;
761
+ checked[url] = true;
762
+ gotoServerValidateUrl(count++, guid, url);
763
+ }
764
+ }
765
+ });
766
+ }
767
+ }, 2000);
768
return false;
769
}
770