# HG changeset patch # User Markus Kottlaender # Date 1557224287 -7200 # Node ID fc008b32c593461cf0f90a077ce783297746a3d7 # Parent 1cb6676d15103b4b3cd6c4696cc598b30088b477 client: layers: loading animation for refreshing layer sources diff -r 1cb6676d1510 -r fc008b32c593 client/src/components/layers/Layers.vue --- a/client/src/components/layers/Layers.vue Mon May 06 18:18:17 2019 +0200 +++ b/client/src/components/layers/Layers.vue Tue May 07 12:18:07 2019 +0200 @@ -10,7 +10,9 @@ icon="layer-group" :title="label" :closeCallback="close" - :actions="[{ callback: refreshLayers, icon: 'sync' }]" + :actions="[ + { callback: refreshLayers, icon: mapsLoading ? 'spinner' : 'sync' } + ]" />
@@ -59,7 +61,7 @@ }, computed: { ...mapState("application", ["showLayers"]), - ...mapState("map", ["openLayersMaps"]), + ...mapState("map", ["openLayersMaps", "mapsLoading"]), label() { return this.$gettext("Layers"); } @@ -70,6 +72,7 @@ }, refreshLayers() { this.openLayersMaps.forEach(map => { + this.$store.commit("map/increaseMapsLoading"); let layers = map.getLayers().getArray(); for (let i = 0; i < layers.length; i++) { let layer = layers[i]; diff -r 1cb6676d1510 -r fc008b32c593 client/src/components/map/Map.vue --- a/client/src/components/map/Map.vue Mon May 06 18:18:17 2019 +0200 +++ b/client/src/components/map/Map.vue Tue May 07 12:18:07 2019 +0200 @@ -15,6 +15,7 @@ background-image: linear-gradient(45deg, #e8e8e8 25%, transparent 25%, transparent 75%, #e8e8e8 75%, #e8e8e8), linear-gradient(45deg, #e8e8e8 25%, transparent 25%, transparent 75%, #e8e8e8 75%, #e8e8e8) background-size: 20px 20px background-position: 0 0, 10px 10px + &.nocursor cursor: none @@ -175,6 +176,10 @@ }); this.map.getLayer = id => this.layers.get(id); + this.map.on("rendercomplete", () => { + this.$store.commit("map/decreaseMapsLoading"); + }); + // store map position on every move // will be obsolete once we abandoned the separated admin context this.map.on("moveend", event => { diff -r 1cb6676d1510 -r fc008b32c593 client/src/components/ui/UIBoxHeader.vue --- a/client/src/components/ui/UIBoxHeader.vue Mon May 06 18:18:17 2019 +0200 +++ b/client/src/components/ui/UIBoxHeader.vue Tue May 07 12:18:07 2019 +0200 @@ -16,7 +16,10 @@ :key="index" @click="action.callback" > - + { + state.mapsLoading++; + }, + decreaseMapsLoading: state => { + state.mapsLoading--; + if (state.mapsLoading < 0) state.mapsLoading = 0; + }, initialLoad: (state, initialLoad) => { state.initialLoad = initialLoad; },