diff --git a/client_src/js/MapManager.mjs b/client_src/js/MapManager.mjs
index 89d2a6f..1a778d1 100644
--- a/client_src/js/MapManager.mjs
+++ b/client_src/js/MapManager.mjs
@@ -41,6 +41,9 @@ class MapManager {
this.map.attributionControl.addAttribution("Data: Connected Humber");
this.map.attributionControl.addAttribution("Air Quality Web by Starbeamrainbowlabs");
+ // Setup the UI
+ this.ui = new UI(Config, this);
+ this.ui.setup().then(() => console.log("[map] UI setup complete."));
// Load the device information
this.device_data = new DeviceData();
@@ -49,11 +52,13 @@ class MapManager {
// Add the device markers
console.info("[map] Loading device markers....");
- this.setup_device_markers()
- .then(() => console.info("[map] Device markers loaded successfully."))
- .then(this.setup_overlay.bind(this))
- .then(this.setup_layer_control.bind(this))
- .then(() => document.querySelector("main").classList.remove("working-visual"));
+ Promise.all([
+ this.setup_device_markers.bind(this)()
+ .then(() => console.info("[map] Device markers loaded successfully.")),
+
+ this.setup_overlay.bind(this)()
+ .then(this.setup_layer_control.bind(this))
+ ]).then(() => document.querySelector("main").classList.remove("working-visual"));
// Add the heatmap
// console.info("[map] Loading heatmap....");
@@ -62,9 +67,6 @@ class MapManager {
// // ...and the time dimension
// .then(this.setup_time_dimension.bind(this))
// .then(() => console.info("[map] Time dimension initialised."));
-
- this.ui = new UI(Config, this);
- this.ui.setup().then(() => console.log("[map] UI setup complete."));
}
async setup_overlay() {
diff --git a/client_src/js/UI.mjs b/client_src/js/UI.mjs
index 799ded2..5267470 100644
--- a/client_src/js/UI.mjs
+++ b/client_src/js/UI.mjs
@@ -43,6 +43,8 @@ class UI {
}
async setup() {
+ await show_changelog(true);
+
this.reading_types = JSON.parse(
await GetFromUrl(`${this.config.api_root}?action=list-reading-types`)
);
@@ -75,8 +77,6 @@ class UI {
]);
this.ui_panel.setIndex("Reading Type", this.reading_types.findIndex((type) => type.short_descr == "PM25"));
-
- await show_changelog(true);
await this.tour.run_once();
}
}