Skip to content
Snippets Groups Projects
Commit 00d1ed47 authored by matograine's avatar matograine
Browse files

show right endpoint for Cesium.

parent 18b395a7
Branches
Tags
No related merge requests found
......@@ -99,10 +99,10 @@ class BMAEndpoint{
this.url_root = '';
switch (this.type) {
case 'BMA':
this.url_root += "http://"
this.url_protocol = "http://"
break
case 'BMAS':
this.url_root += "https://"
this.url_protocol = "https://"
break
default:
return false
......@@ -126,11 +126,13 @@ class BMAEndpoint{
this.url_root += this.path
}
this.url_base = this.url_protocol + this.url_root
return true;
}
get_head = async function() {
let url_block = this.url_root + '/blockchain/current'
let url_block = this.url_protocol + this.url_root + '/blockchain/current'
console.log(this.url_block)
let start = Date.now();
let config = {
......
class DuniterNodes
{
constructor (peerings) {
this.fields = ['url_root', 'head_block', 'type']
this.fields = ['url_root', 'head_block', 'type', 'speed']
this.ep_body = document.createElement('tbody')
this.draw()
......@@ -47,7 +47,7 @@ class DuniterNodes
this.written_urls = []
let new_tbody = document.createElement('tbody')
if (endpoint.reachable && ! this.written_urls.includes(endpoint.url_root) ) {
if (endpoint.reachable && ! this.written_urls.includes(endpoint.url_base) ) {
// count blocks for majority
if (! this.count_blocks['b_' + endpoint.head_block]) {
......@@ -62,8 +62,8 @@ class DuniterNodes
while (this.endpoints[0] && this.endpoints[0].head_block >= endpoint.head_block) {
let current_ep = this.endpoints.shift()
if (! this.written_urls.includes(current_ep.url_root)) {
this.written_urls.push(current_ep.url_root)
if (! this.written_urls.includes(current_ep.url_base)) {
this.written_urls.push(current_ep.url_base)
}
new_tbody.appendChild(current_ep.row)
......@@ -74,8 +74,8 @@ class DuniterNodes
// draw empty elements
this.endpoints.forEach(ep => {
ep.draw_row(this.fields)
if (! this.written_urls.includes(ep.url_root)) {
this.written_urls.push(ep.url_root)
if (! this.written_urls.includes(ep.url_base)) {
this.written_urls.push(ep.url_base)
new_tbody.appendChild(ep.row)
}
})
......@@ -88,7 +88,6 @@ class DuniterNodes
}
draw() {
this.ep_table = document.getElementById('endpoints_table')
this.ep_table.innerHTML = ''
this.ep_table.appendChild(this.ep_body)
......@@ -125,7 +124,6 @@ class DuniterNodes
}
})
console.log(consensus_block)
return consensus_block
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment