Skip to content

Commit ed94991

Browse files
committed
lookup all the known URLs of a machine
1 parent 80c1e4d commit ed94991

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

web/index.html

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,6 @@
721721
if(gotoServerValidateRemaining <= 0) {
722722
gotoServerMiddleClick = false;
723723
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-
//});
727724
}
728725
}
729726
});
@@ -734,17 +731,40 @@
734731
// console.log('goto server: ' + guid);
735732

736733
gotoServerStop = false;
734+
var checked = {};
737735
var len = NETDATA.registry.machines[guid].alternate_urls.length;
736+
var count = 0;
738737

739738
document.getElementById('gotoServerResponse').innerHTML = '';
740739
document.getElementById('gotoServerList').innerHTML = '';
741740
document.getElementById('gotoServerName').innerHTML = NETDATA.registry.machines[guid].name;
742741
$('#gotoServerModal').modal('show');
743742

744743
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+
}
747749

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);
748768
return false;
749769
}
750770

0 commit comments

Comments
 (0)