mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 12:07:08 +00:00
Toggle loading property while (re)loading layers
This commit is contained in:
@@ -191,10 +191,12 @@ export default {
|
||||
|
||||
const query = new URLSearchParams({bbox, limit});
|
||||
|
||||
let requestsCount = 0;
|
||||
for (const l of this.layerRefreshConfig.filter(i => !layerset || layerset.includes(i.layer))) {
|
||||
if (map.hasLayer(l.layer)) {
|
||||
// Firing all refresh events asynchronously, which is OK provided
|
||||
// we don't have hundreds of layers to be refreshed.
|
||||
requestsCount++;
|
||||
await this.api([l.url(query)]).then( (layer) => {
|
||||
l.layer.clearLayers();
|
||||
if ((layer.features && layer.features.length < limit) || ("length" in layer && layer.length < limit)) {
|
||||
@@ -202,9 +204,13 @@ export default {
|
||||
} else {
|
||||
console.log("Too much data from", l.url(query));
|
||||
}
|
||||
if (--requestsCount == 0) {
|
||||
this.loading = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
this.loading = requestsCount > 0;
|
||||
},
|
||||
|
||||
...mapActions(["api"])
|
||||
|
||||
Reference in New Issue
Block a user