m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMagdalena Grodzińska <mag.grodzinska@gmail.com>2020-01-11 12:42:49 +0100
committerMagdalena Grodzińska <mag.grodzinska@gmail.com>2020-01-11 12:42:49 +0100
commitde08aa61aa15a6a3925a1e110c40eb36fc70e8b7 (patch)
treea26becd5973eea65209a13f05b20d2b089ff4aad /src/main
parent5aa6345de1464a372bc69219ef9b777991bde1dd (diff)
Add some prefetching and curses to load js quicker
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java1
-rw-r--r--src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/attribChart.html10
-rw-r--r--src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html2
3 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java
index 120d80d..0715af5 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java
@@ -53,6 +53,7 @@ public class ClientController {
}
};
this.currentZoneName = "/uw/violet07";
+ fetchAttributeData(); // fetch attribute data as early as possible
}
@GetMapping("/")
diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/attribChart.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/attribChart.html
index ab83053..841d995 100644
--- a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/attribChart.html
+++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/attribChart.html
@@ -4,8 +4,11 @@
<head>
<meta charset="UTF-8">
<title>Attributes chart</title>
+ <link rel="preload" href="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" as="script">
+ <link rel="preload" href="https://www.gstatic.com/charts/loader.js" as="script">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
- <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
+ <script async type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
+ <script async type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart', 'table', 'controls', 'charteditor']});
google.charts.setOnLoadCallback(refreshChart());
@@ -13,6 +16,8 @@
var chartState = [];
function refreshChart() {
+ setTimeout(getData(), 500);
+ setTimeout(getData(), 1500);
setInterval(getData, 5000);
}
@@ -101,7 +106,7 @@
data.addColumn('string', col);
}
jsonData.shift();
- data.addRow(jsonData[0]);
+ data.addRow(jsonData[jsonData.length - 1]);
var table = new google.visualization.Table(document.getElementById('table_div'));
@@ -135,7 +140,6 @@
<div id="table_div" class="d-flex justify-content-center mt-5"></div>
</div>
-<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html
index 47b19af..043ac76 100644
--- a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html
+++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html
@@ -6,6 +6,8 @@
<meta charset="UTF-8">
<title>CloudAtlas Client - home</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+ <link rel="preload" href="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" as="script">
+ <link rel="preload" href="https://www.gstatic.com/charts/loader.js" as="script">
</head>
<body>