aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bh20simplewebuploader/main.py2
-rw-r--r--bh20simplewebuploader/static/map.js14
-rw-r--r--bh20simplewebuploader/templates/demo-run.html0
-rw-r--r--bh20simplewebuploader/templates/demo.html21
-rw-r--r--bh20simplewebuploader/templates/home.html15
-rw-r--r--bh20simplewebuploader/templates/map.html0
-rw-r--r--bh20simplewebuploader/templates/mapheader.html16
7 files changed, 40 insertions, 28 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py
index e8bb507..206f884 100644
--- a/bh20simplewebuploader/main.py
+++ b/bh20simplewebuploader/main.py
@@ -253,7 +253,7 @@ def send_home():
Send the front page.
"""
- return render_template('home.html', menu='HOME')
+ return render_template('home.html', menu='HOME', load_map=True)
@app.route('/upload')
diff --git a/bh20simplewebuploader/static/map.js b/bh20simplewebuploader/static/map.js
index e1a4289..8b8ecba 100644
--- a/bh20simplewebuploader/static/map.js
+++ b/bh20simplewebuploader/static/map.js
@@ -31,6 +31,7 @@ function drawMap(){
radius: parseInt(data[i]["count"]) //not working for whatever reason
}).addTo(mymap);
}
+ // updateMapMarkers(data);
});
document.getElementById("map_view").classList.remove("invisible");
@@ -42,11 +43,11 @@ function drawMap(){
/* This function updates the map with markers
*
*/
-function updateMapMarkers() {
+function updateMapMarkers(data) {
// markers.clearLayers(); // remove all markers
// document.getElementById("results").classList.remove("invisible");
- document.getElementById("loader").classList.add("invisible");
- /*
+ // document.getElementById("loader").classList.add("invisible");
+
for (let i = 0; i < data.length; i++) {
let {"count": fastaCount, GPS, LocationLabel: label } = data[i];
let coordinates = GPS.split(" ");
@@ -57,10 +58,11 @@ function updateMapMarkers() {
let marker = L.marker([lat, lon]);
marker.bindPopup("<b>" + label + "</b><br/>" + "FastaCount: " +fastaCount);
// markers.addLayer(marker)
- }}
- */
+ }
+ }
+
// Reload the map
- map.invalidateSize();
+ // map.invalidateSize();
// document.getElementById("map_view").classList.add("invisible");
// document.getElementById("loader").classList.add("invisible");
}
diff --git a/bh20simplewebuploader/templates/demo-run.html b/bh20simplewebuploader/templates/demo-run.html
deleted file mode 100644
index e69de29..0000000
--- a/bh20simplewebuploader/templates/demo-run.html
+++ /dev/null
diff --git a/bh20simplewebuploader/templates/demo.html b/bh20simplewebuploader/templates/demo.html
index 3a80abf..65ba462 100644
--- a/bh20simplewebuploader/templates/demo.html
+++ b/bh20simplewebuploader/templates/demo.html
@@ -1,25 +1,7 @@
<!DOCTYPE html>
<html>
{% include 'header.html' %}
-
- <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
- integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
- crossorigin=""/>
- <link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css"
- integrity="sha512-RLEjtaFGdC4iQMJDbMzim/dOvAu+8Qp9sw7QE4wIMYcg2goVoivzwgSZq9CsIxp4xKAZPKh5J2f2lOko2Ze6FQ=="
- crossorigin=""/>
- <link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.Default.css"
- integrity="sha512-BBToHPBStgMiw0lD4AtkRIZmdndhB6aQbXpX7omcrXeG2PauGBl2lzq2xUZTxaLxYz5IDHlmneCZ1IJ+P3kYtQ=="
- crossorigin=""/>
-
- <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"
- integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="
- crossorigin=""></script>
- <script src="https://unpkg.com/leaflet.markercluster@1.4.1/dist/leaflet.markercluster.js"
- integrity="sha512-MQlyPV+ol2lp4KodaU/Xmrn+txc1TP15pOBF/2Sfre7MRsA/pB4Vy58bEqe9u7a7DczMLtU5wT8n7OblJepKbg=="
- crossorigin=""></script>
-
-
+ {% include 'mapheader.html' %}
<body>
{% include 'banner.html' %}
{% include 'menu.html' %}
@@ -36,7 +18,6 @@
<button class="button" onclick="fetchSEQCountByTech()">Count by Sequencer</button>
<!-- <button class="button" onclick="fetchAllaccessions()">Show All accessions</button> -->
<button class="button" onclick="fetchSEQCountbyContinent()">Count by Continent</button>
- <button class="button" onclick="fetchMap()">Map</button>
</div>
</div>
diff --git a/bh20simplewebuploader/templates/home.html b/bh20simplewebuploader/templates/home.html
index b90a18d..42b08c0 100644
--- a/bh20simplewebuploader/templates/home.html
+++ b/bh20simplewebuploader/templates/home.html
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
{% include 'header.html' %}
+ {% include 'mapheader.html' %}
<body>
{% include 'banner.html' %}
{% include 'menu.html' %}
@@ -44,7 +45,19 @@
</div>
</section>
-{% include 'footer.html' %}
+ <section id="map_view" class="invisible">
+ <div id="mapid"></div>
+ </section>
+
+ {% include 'footer.html' %}
+
+
+ <script type="text/javascript">
+ let scriptRoot = {{ request.script_root|tojson|safe }}; // examples
+
+ drawMap()
+
+ </script>
</body>
</html>
diff --git a/bh20simplewebuploader/templates/map.html b/bh20simplewebuploader/templates/map.html
deleted file mode 100644
index e69de29..0000000
--- a/bh20simplewebuploader/templates/map.html
+++ /dev/null
diff --git a/bh20simplewebuploader/templates/mapheader.html b/bh20simplewebuploader/templates/mapheader.html
new file mode 100644
index 0000000..ca62051
--- /dev/null
+++ b/bh20simplewebuploader/templates/mapheader.html
@@ -0,0 +1,16 @@
+ <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
+ integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
+ crossorigin=""/>
+ <link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css"
+ integrity="sha512-RLEjtaFGdC4iQMJDbMzim/dOvAu+8Qp9sw7QE4wIMYcg2goVoivzwgSZq9CsIxp4xKAZPKh5J2f2lOko2Ze6FQ=="
+ crossorigin=""/>
+ <link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.Default.css"
+ integrity="sha512-BBToHPBStgMiw0lD4AtkRIZmdndhB6aQbXpX7omcrXeG2PauGBl2lzq2xUZTxaLxYz5IDHlmneCZ1IJ+P3kYtQ=="
+ crossorigin=""/>
+
+ <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"
+ integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="
+ crossorigin=""></script>
+ <script src="https://unpkg.com/leaflet.markercluster@1.4.1/dist/leaflet.markercluster.js"
+ integrity="sha512-MQlyPV+ol2lp4KodaU/Xmrn+txc1TP15pOBF/2Sfre7MRsA/pB4Vy58bEqe9u7a7DczMLtU5wT8n7OblJepKbg=="
+ crossorigin=""></script>