mirror of
https://github.com/ConnectedHumber/Air-Quality-Web
synced 2024-11-22 06:23:01 +00:00
Reorder & optimise loading of UI elements
This commit is contained in:
parent
c91a895f9d
commit
98ebc02ec7
2 changed files with 12 additions and 10 deletions
|
@ -41,6 +41,9 @@ class MapManager {
|
||||||
this.map.attributionControl.addAttribution("Data: <a href='https://connectedhumber.org/'>Connected Humber</a>");
|
this.map.attributionControl.addAttribution("Data: <a href='https://connectedhumber.org/'>Connected Humber</a>");
|
||||||
this.map.attributionControl.addAttribution("<a href='https://github.com/ConnectedHumber/Air-Quality-Web/'>Air Quality Web</a> by <a href='https://starbeamrainbowlabs.com/'>Starbeamrainbowlabs</a>");
|
this.map.attributionControl.addAttribution("<a href='https://github.com/ConnectedHumber/Air-Quality-Web/'>Air Quality Web</a> by <a href='https://starbeamrainbowlabs.com/'>Starbeamrainbowlabs</a>");
|
||||||
|
|
||||||
|
// Setup the UI
|
||||||
|
this.ui = new UI(Config, this);
|
||||||
|
this.ui.setup().then(() => console.log("[map] UI setup complete."));
|
||||||
|
|
||||||
// Load the device information
|
// Load the device information
|
||||||
this.device_data = new DeviceData();
|
this.device_data = new DeviceData();
|
||||||
|
@ -49,11 +52,13 @@ class MapManager {
|
||||||
|
|
||||||
// Add the device markers
|
// Add the device markers
|
||||||
console.info("[map] Loading device markers....");
|
console.info("[map] Loading device markers....");
|
||||||
this.setup_device_markers()
|
Promise.all([
|
||||||
.then(() => console.info("[map] Device markers loaded successfully."))
|
this.setup_device_markers.bind(this)()
|
||||||
.then(this.setup_overlay.bind(this))
|
.then(() => console.info("[map] Device markers loaded successfully.")),
|
||||||
|
|
||||||
|
this.setup_overlay.bind(this)()
|
||||||
.then(this.setup_layer_control.bind(this))
|
.then(this.setup_layer_control.bind(this))
|
||||||
.then(() => document.querySelector("main").classList.remove("working-visual"));
|
]).then(() => document.querySelector("main").classList.remove("working-visual"));
|
||||||
|
|
||||||
// Add the heatmap
|
// Add the heatmap
|
||||||
// console.info("[map] Loading heatmap....");
|
// console.info("[map] Loading heatmap....");
|
||||||
|
@ -62,9 +67,6 @@ class MapManager {
|
||||||
// // ...and the time dimension
|
// // ...and the time dimension
|
||||||
// .then(this.setup_time_dimension.bind(this))
|
// .then(this.setup_time_dimension.bind(this))
|
||||||
// .then(() => console.info("[map] Time dimension initialised."));
|
// .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() {
|
async setup_overlay() {
|
||||||
|
|
|
@ -43,6 +43,8 @@ class UI {
|
||||||
}
|
}
|
||||||
|
|
||||||
async setup() {
|
async setup() {
|
||||||
|
await show_changelog(true);
|
||||||
|
|
||||||
this.reading_types = JSON.parse(
|
this.reading_types = JSON.parse(
|
||||||
await GetFromUrl(`${this.config.api_root}?action=list-reading-types`)
|
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"));
|
this.ui_panel.setIndex("Reading Type", this.reading_types.findIndex((type) => type.short_descr == "PM25"));
|
||||||
|
|
||||||
|
|
||||||
await show_changelog(true);
|
|
||||||
await this.tour.run_once();
|
await this.tour.run_once();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue