Skip to content
Snippets Groups Projects
Commit 387384e1 authored by Georgi's avatar Georgi
Browse files

Moved the reload script to reload only the visualization container instead of...

Moved the reload script to reload only the visualization container instead of the whole page, that way only the visualizations are redrawn.
parent e659a948
No related branches found
No related tags found
No related merge requests found
Pipeline #7708 passed
......@@ -5,7 +5,7 @@
<div style="width: 100%; height: 800px"
id="container">
<div class="row h-100">
<div class="col-md-auto left">
<div class="col-sm-auto col-md-auto col-lg-auto col-xl-auto">
<h2>Available Agents</h2>
<table class="table">
@foreach ($graph_elements as $graph_element)
......@@ -23,31 +23,16 @@
@endforeach
</table>
</div>
<div class="col-10 right" id="visualization">
<h2>Test2</h2>
<div class="col" id="visualization">
</div>
</div>
</div>
</div>
<div class="text-muted bottom-right">
Reload in <span id="reload-countdown">300</span> seconds
Reload visualization in <span id="reload-countdown">300</span> seconds
</div>
<script type="text/javascript">
var reload_countdown = 300;
setInterval(function() {
reload_countdown -= 1;
$('#reload-countdown').text(reload_countdown);
if (reload_countdown === 0) {
console.log('reload...');
location.reload();
}
}, 1000);
</script>
<script>
var json_elements = @json($graph_elements);
console.log(json_elements);
......@@ -56,8 +41,19 @@
json_elements.forEach(function (arrayItem){
var name = arrayItem.name;
var data = arrayItem.data;
var reload_countdown = 300;
document.getElementById(name).addEventListener("click", function () {
drawBubbleGraph(name, container);
setInterval(function() {
reload_countdown -= 1;
$('#reload-countdown').text(reload_countdown);
if (reload_countdown === 0) {
console.log('reload...');
reload_countdown = 300;
drawBubbleGraph(name, container);
}
}, 1000);
});
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment