-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
55 lines (46 loc) · 1.42 KB
/
index.js
File metadata and controls
55 lines (46 loc) · 1.42 KB
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
45
46
47
48
49
50
51
52
53
54
55
let html_ids,
backendUp;
let wWidth = 1280,
wHeight = 720;
// Initialize important values
init();
window.onresize = onWindowResize;
// Initialize backend connection
// openBackendConnection();
function init(){
html_ids = {}
html_ids['activityLog'] = 'activity-log';
backendUp = false;
onWindowResize();
}
function updateBackendState(heartBeat = false){
if (heartBeat){
$('#' + html_ids['backendState'])
.css('background-color', '#EECF1E');
}
else if (backendUp){
$('#' + html_ids['backendStateText'])
.text("Backend Connected");
$('#' + html_ids['backendState'])
.css('background-color', '#1EA01E');
}else{
$('#' + html_ids['backendStateText'])
.text("Backend Disconnected");
$('#' + html_ids['backendState'])
.css('background-color', '#911100');
}
}
function onWindowResize(){
wWidth = $('#viz-wrapper').width();
wHeight = $('#viz-wrapper').height();
$('#viz-container').css({'height': wHeight + 'px', 'width': wWidth + 'px'});
$('.side-bar-container').css('height', wHeight + 'px');
$('#footer-bar').css('width', wWidth + 'px');
}
function addNewEventLog(title, text = ''){
var log = document.getElementById(html_ids['activityLog']);
log.insertAdjacentHTML('afterbegin',
'<div class="event-log"> \
<h4>'+ title +'</h4> \
<p>'+ text +'</p></div>');
}