-
Notifications
You must be signed in to change notification settings - Fork 0
/
getGraph.js
44 lines (33 loc) · 1.11 KB
/
getGraph.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
async function checkAvailability() {
let response = await fetch('http://127.0.0.1:8050/check_dendrogram');
let data = await response.json();
// console.log(data);
// console.log(data.available);
return data.available
}
async function getGraph() {
let available = false;
let timeoutReached = false;
setTimeout(() => {
timeoutReached = true;
}, 3000);
while (!available && !timeoutReached) {
available = await checkAvailability();
console.log(available);
}
if (timeoutReached) {
console.log("Request timed out after 3 seconds.");
} else {
console.log("Availability Confirmed.");
var graphFrame = document.getElementById('graphFrame');
graphFrame.style.display = 'block';
var graphHeader = document.getElementById('graphHeader');
graphHeader.innerHTML = "";
graphHeader.style.position = 'relative';
var iframe = document.getElementById('graph');
iframe.style.visibility = 'visible';
iframe.src = "http://127.0.0.1:8050/";
}
hideSpinner();
return available
}