@provoly/dashboard 1.4.30 → 1.4.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,7 @@ import { toLonLat, get, transform, fromLonLat } from 'ol/proj';
18
18
  import { register } from 'ol/proj/proj4';
19
19
  import { Vector, TileWMS, ImageWMS, WMTS, XYZ, Cluster, DataTile } from 'ol/source';
20
20
  import proj4 from 'proj4';
21
- import { BehaviorSubject, combineLatest, debounceTime, withLatestFrom, map, filter, distinctUntilChanged, startWith, delay, mergeMap, of, from, switchMap, catchError } from 'rxjs';
21
+ import { BehaviorSubject, combineLatest, debounceTime, withLatestFrom, map, filter, distinctUntilChanged, startWith, delay, mergeMap, of, from, switchMap, catchError, fromEvent } from 'rxjs';
22
22
  import { ScaleLine, Attribution, defaults } from 'ol/control';
23
23
  import { Polygon, Circle as Circle$1, LineString } from 'ol/geom';
24
24
  import PointerInteraction from 'ol/interaction/Pointer';
@@ -1949,11 +1949,20 @@ class WidgetMapComponent extends DataWidgetComponent {
1949
1949
  this.layers$,
1950
1950
  this.selectedIds$.pipe(distinctUntilChanged((p, c) => equal(p, c))),
1951
1951
  this.fitExtents$,
1952
- this.datasourceFilters$
1953
- ]).subscribe(([mapStyleLayer, layers, selectedIds, extents, filters]) => {
1952
+ this.datasourceFilters$,
1953
+ fromEvent(window, 'wms-layer-refresh').pipe(startWith(new CustomEvent(`wms-layer-refresh`, { detail: true })))
1954
+ ]).subscribe(([mapStyleLayer, layers, selectedIds, extents, filters, refreshEvent]) => {
1954
1955
  const neededCalculatedExtents = layers.filter((layer) => ['geoserver', 'wms'].includes(layer.get('type')) && layer.get('fit')).length;
1955
1956
  const nbCalculatedExtents = extents.filter((extent) => !extent.error).length;
1956
1957
  if (nbCalculatedExtents >= neededCalculatedExtents) {
1958
+ if (!refreshEvent.detail) {
1959
+ this.map
1960
+ .getAllLayers()
1961
+ .filter((l) => l instanceof TileLayer || l instanceof ImageLayer)
1962
+ .forEach((l) => {
1963
+ l.getSource().refresh();
1964
+ });
1965
+ }
1957
1966
  setTimeout(() => {
1958
1967
  const toApplyLayers = [...layers, ...mapStyleLayer];
1959
1968
  this.map.setLayers(toApplyLayers);