@eeacms/volto-arcgis-block 0.1.192 → 0.1.194

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [0.1.194](https://github.com/eea/volto-arcgis-block/compare/0.1.193...0.1.194) - 13 September 2023
8
+
9
+ ### [0.1.193](https://github.com/eea/volto-arcgis-block/compare/0.1.192...0.1.193) - 13 September 2023
10
+
11
+ #### :hammer_and_wrench: Others
12
+
13
+ - CLMS-1795 (FEAT): LOADING SPINNER FOR LAYER VIEW LOAD works logged in [ujbolivar - [`f3426f2`](https://github.com/eea/volto-arcgis-block/commit/f3426f27cd19b9c2bf8d1a1e7e264dc5ffe9313f)]
14
+ - CLMS-1795 (FEAT): LOADING SPINNER FOR LAYER VIEW LOAD [ujbolivar - [`ffdba08`](https://github.com/eea/volto-arcgis-block/commit/ffdba087f3dc47efd3d946c51f003358a36eec0f)]
15
+ - CLMS-1795: loading spinner [ujbolivar - [`b413d91`](https://github.com/eea/volto-arcgis-block/commit/b413d918c18f67223fa1366edae7e4ee2f9f7952)]
16
+ - changed file name [ujbolivar - [`f7c2499`](https://github.com/eea/volto-arcgis-block/commit/f7c24992fe9aa78a9451a49957e115ddd358c2a7)]
7
17
  ### [0.1.192](https://github.com/eea/volto-arcgis-block/compare/0.1.191...0.1.192) - 11 September 2023
8
18
 
9
19
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.192",
3
+ "version": "0.1.194",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -183,6 +183,9 @@ class HotspotWidget extends React.Component {
183
183
 
184
184
  handleApplyFilter(typeFilter) {
185
185
  let typeLegend;
186
+ let filterId;
187
+
188
+ this.props.loadingHandler(true);
186
189
 
187
190
  if (this.props.selectedLayers) {
188
191
  //Clear previous selections when applying a new filter
@@ -236,6 +239,7 @@ class HotspotWidget extends React.Component {
236
239
  }
237
240
  }
238
241
  typeFilter.forEach((type) => {
242
+ filterId = type + '_filter';
239
243
  if (type === 'lcc') {
240
244
  let selectLccBoxTime = document.getElementById('select-klc-lccTime')
241
245
  .value;
@@ -271,7 +275,7 @@ class HotspotWidget extends React.Component {
271
275
  this.props.selectedLayers['lcc_filter'] = this.esriLayer_lcc;
272
276
  this.props.selectedLayers['lcc_filter'].visible = true;
273
277
  this.esriLayer_lcc2 = this.esriLayer_lcc;
274
- this.layerModelInit();
278
+ //this.layerModelInit();
275
279
  }
276
280
  }
277
281
  if (type === 'lc') {
@@ -308,7 +312,7 @@ class HotspotWidget extends React.Component {
308
312
  this.props.selectedLayers['lc_filter'] = this.esriLayer_lc;
309
313
  this.props.selectedLayers['lc_filter'].visible = true;
310
314
  this.esriLayer_lc2 = this.esriLayer_lc;
311
- this.layerModelInit();
315
+ //this.layerModelInit();
312
316
  }
313
317
  }
314
318
  this.esriLayer_klc.customLayerParameters['CQL_FILTER'] =
@@ -322,7 +326,7 @@ class HotspotWidget extends React.Component {
322
326
  this.props.map.add(this.esriLayer_klc);
323
327
  this.props.selectedLayers['klc_filter'].visible = true;
324
328
  this.esriLayer_klc2 = this.esriLayer_klc;
325
- this.layerModelInit();
329
+ //this.layerModelInit();
326
330
  }
327
331
  }
328
332
  this.esriLayer_pa.customLayerParameters['CQL_FILTER'] =
@@ -336,14 +340,25 @@ class HotspotWidget extends React.Component {
336
340
  this.props.map.add(this.esriLayer_pa);
337
341
  this.props.selectedLayers['pa_filter'].visible = true;
338
342
  this.esriLayer_pa2 = this.esriLayer_pa;
339
- this.layerModelInit();
340
343
  }
341
344
  }
345
+ this.layerModelInit();
342
346
  this.setBBoxCoordinates(this.dataBBox);
343
347
  });
344
348
  //set sessionStorage value to keep the widget open
345
349
  sessionStorage.setItem('hotspotFilterApplied', 'true');
346
350
  this.disableButton();
351
+ this.props.view
352
+ .whenLayerView(this.props.selectedLayers[filterId])
353
+ .then((layerView) => {
354
+ layerView.watch('updating', (isUpdating) => {
355
+ if (!isUpdating) {
356
+ setTimeout(() => {
357
+ this.props.loadingHandler(false);
358
+ }, 500);
359
+ }
360
+ });
361
+ });
347
362
  }
348
363
 
349
364
  dropdownAnimation() {
@@ -0,0 +1,85 @@
1
+ import React, { createRef } from 'react';
2
+ import './css/ArcgisMap.css';
3
+ import { loadModules } from 'esri-loader';
4
+ class LoadingSpinner extends React.Component {
5
+ constructor(props) {
6
+ super(props);
7
+ //We create a reference to a DOM element to be mounted
8
+ this.container = createRef();
9
+ //Initially, we set the state of the component to
10
+ //not be showing the basemap panel
11
+ this.state = {};
12
+ }
13
+
14
+ loader() {
15
+ return loadModules().then(() => {});
16
+ }
17
+
18
+ showLoading() {
19
+ if (this.props.layerLoading === false) {
20
+ this.container.current.style.display = 'none';
21
+ } else {
22
+ this.container.current.style.display = 'block';
23
+ }
24
+ this.setState({});
25
+ }
26
+
27
+ async componentDidMount() {
28
+ await this.loader();
29
+ this.props.view.when(() => {
30
+ this.props.view.ui.add(this.container.current, 'manual');
31
+ });
32
+ this.showLoading();
33
+ }
34
+
35
+ componentDidUpdate(prevProps) {
36
+ if (this.props.layerLoading !== prevProps.layerLoading) {
37
+ this.showLoading();
38
+ }
39
+ }
40
+
41
+ render() {
42
+ return (
43
+ <div
44
+ ref={this.container}
45
+ id="loader"
46
+ className="loading"
47
+ role="alert"
48
+ aria-busy="true"
49
+ aria-live="polite"
50
+ >
51
+ <div>
52
+ <svg
53
+ width="50"
54
+ height="50"
55
+ viewBox="0 0 24 24"
56
+ xmlns="http://www.w3.org/2000/svg"
57
+ >
58
+ <style>
59
+ {`.spinner_ajPY {
60
+ transform-origin: center;
61
+ animation: spinner_AtaB .75s infinite linear;
62
+ fill: #a0b128;
63
+ }
64
+ @keyframes spinner_AtaB {
65
+ 100% {
66
+ transform: rotate(360deg);
67
+ }
68
+ }`}
69
+ </style>
70
+ <path
71
+ d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"
72
+ opacity=".25"
73
+ />
74
+ <path
75
+ d="M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z"
76
+ class="spinner_ajPY"
77
+ />
78
+ </svg>
79
+ </div>
80
+ </div>
81
+ );
82
+ }
83
+ }
84
+
85
+ export default LoadingSpinner;
@@ -19,6 +19,8 @@ import MenuWidget from './MenuWidget';
19
19
  import HotspotWidget from './HotspotWidget';
20
20
  import PanWidget from './PanWidget';
21
21
  import BookmarkWidget from './BookmarkWidget';
22
+ import LoadingSpinner from './LoadingSpinner';
23
+
22
24
  //import "isomorphic-fetch"; <-- Necessary to use fetch?
23
25
  var Map, MapView, Zoom, intl, Basemap, WebTileLayer, Extent;
24
26
  let mapStatus = {};
@@ -50,13 +52,20 @@ class MapViewer extends React.Component {
50
52
  this.mapClass = classNames('map-container', {
51
53
  [`${props.customClass}`]: props.customClass || null,
52
54
  });
53
- this.state = {};
55
+ this.state = {
56
+ layerLoading: false,
57
+ };
54
58
  this.layers = {};
55
59
  this.activeLayersHandler = this.activeLayersHandler.bind(this);
56
60
  this.activeLayersArray = {};
57
61
  this.props.mapviewer_config.loading = true;
58
62
  this.cfgUrls = this.props.cfg.Urls;
59
63
  this.userID = null;
64
+ this.loadingHandler = this.loadingHandler.bind(this);
65
+ }
66
+
67
+ loadingHandler(bool) {
68
+ this.setState({ layerLoading: bool });
60
69
  }
61
70
 
62
71
  activeLayersHandler(newActiveLayers) {
@@ -330,6 +339,7 @@ class MapViewer extends React.Component {
330
339
  layers={sessionStorage}
331
340
  mapCfg={this.mapCfg}
332
341
  urls={this.cfgUrls}
342
+ loadingHandler={this.loadingHandler}
333
343
  />
334
344
  );
335
345
  }
@@ -349,6 +359,7 @@ class MapViewer extends React.Component {
349
359
  layers={this.layers}
350
360
  activeLayersHandler={this.activeLayersHandler}
351
361
  urls={this.cfgUrls}
362
+ loadingHandler={this.loadingHandler}
352
363
  />
353
364
  ); //call conf
354
365
  }
@@ -361,6 +372,12 @@ class MapViewer extends React.Component {
361
372
  return intl && <CheckLanguage />;
362
373
  }
363
374
 
375
+ renderLoadingSpinner() {
376
+ return (
377
+ <LoadingSpinner view={this.view} layerLoading={this.state.layerLoading} />
378
+ );
379
+ }
380
+
364
381
  /**
365
382
  * This method renders the map viewer, invoking if necessary the methods
366
383
  * to render the other widgets to display
@@ -391,6 +408,7 @@ class MapViewer extends React.Component {
391
408
  {this.renderHotspot()}
392
409
  {this.renderMenu()}
393
410
  {this.renderBookmark()}
411
+ {this.renderLoadingSpinner()}
394
412
  </div>
395
413
  </div>
396
414
  );
@@ -1650,6 +1650,7 @@ class MenuWidget extends React.Component {
1650
1650
 
1651
1651
  let group = this.getGroup(elem);
1652
1652
  if (elem.checked) {
1653
+ this.props.loadingHandler(true);
1653
1654
  if (this.props.download || this.location.search !== '') {
1654
1655
  if (
1655
1656
  this.extentInitiated === false &&
@@ -1705,6 +1706,13 @@ class MenuWidget extends React.Component {
1705
1706
  if (nuts) {
1706
1707
  this.map.reorder(nuts, this.map.layers.items.length + 1);
1707
1708
  }
1709
+ this.props.view.whenLayerView(this.layers[elem.id]).then((layerView) => {
1710
+ layerView.watch('updating', (isUpdating) => {
1711
+ if (!isUpdating) {
1712
+ this.props.loadingHandler(false);
1713
+ }
1714
+ });
1715
+ });
1708
1716
  this.checkForHotspots(elem, productContainerId);
1709
1717
  } else {
1710
1718
  sessionStorage.removeItem('downloadButtonClicked');
@@ -13,13 +13,20 @@
13
13
  pointer-events: auto;
14
14
  }
15
15
 
16
+ /* Loading Spinner */
16
17
  .loading {
17
18
  position: absolute;
18
19
  top: 50%;
19
20
  left: 50%;
21
+ display: none;
22
+ width: fit-content;
23
+ flex-direction: column;
24
+ align-items: center;
25
+ justify-content: center;
20
26
  color: #212529;
21
27
  font-size: 2rem;
22
28
  touch-action: auto;
29
+ transform: translate(-50%, -50%);
23
30
  }
24
31
 
25
32
  .map {
@@ -278,9 +285,12 @@ body.section-map-viewer
278
285
  width: auto !important;
279
286
  }
280
287
 
281
- .esri-button-menu__item-wrapper
288
+ div.esri-popover
289
+ div
290
+ div.esri-button-menu__content
291
+ ul.esri-button-menu__item-wrapper
282
292
  li.esri-button-menu__item
283
- [for*='-widget-1-menu-item-1'] {
293
+ [for*='-menu-item-1'] {
284
294
  display: none;
285
295
  }
286
296
  /* Area */
@@ -304,3 +304,11 @@
304
304
  color: #a0b128;
305
305
  font-size: 0.875rem;
306
306
  }
307
+
308
+ .use-cases-products-map
309
+ .map-container
310
+ .map
311
+ .esri-view-root
312
+ .esri-view-surface--touch-none {
313
+ background-color: #97dbf2;
314
+ }
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import './css/ArcgisMap.css';
3
-
4
- class Loader extends React.Component {
5
- render() {
6
- return (
7
- <div
8
- active=""
9
- //type="indeterminate"
10
- //scale="m"
11
- id="loader"
12
- className="loading"
13
- role="alert"
14
- aria-busy="true"
15
- aria-live="polite"
16
- >
17
- <div></div>
18
- <div></div>
19
- <br></br>
20
- <span>Loading...</span>
21
- </div>
22
- );
23
- }
24
- }
25
-
26
- export default Loader;