@eeacms/volto-arcgis-block 0.1.356 → 0.1.357

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,8 +4,19 @@ 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.357](https://github.com/eea/volto-arcgis-block/compare/0.1.356...0.1.357) - 12 May 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Merge pull request #945 from eea/CLMS-285178-ISOLATED-SWIPE-WIDGET-FIX [Unai Bolivar - [`617b4c4`](https://github.com/eea/volto-arcgis-block/commit/617b4c43ad4363267c4df34c72e64314ee42afb4)]
12
+ - CLMS-285178 (bug): Separated swipe from other tickets and can push now going [Unai Bolivar - [`84efe24`](https://github.com/eea/volto-arcgis-block/commit/84efe24d964b79f54ddf17f69e389a3f57e3f867)]
13
+ - CLMS-285178 (bug): Separated swipe from other tickets and can push [Unai Bolivar - [`3e94fd6`](https://github.com/eea/volto-arcgis-block/commit/3e94fd6d2f92817d6b0220155a7e8a0ed5d8dfdb)]
14
+ - Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`fdd39ce`](https://github.com/eea/volto-arcgis-block/commit/fdd39ce6c0d848b33f3b6d033e4b35e9bd4f2002)]
7
15
  ### [0.1.356](https://github.com/eea/volto-arcgis-block/compare/0.1.355...0.1.356) - 6 May 2025
8
16
 
17
+ #### :hammer_and_wrench: Others
18
+
19
+ - Merge pull request #944 from eea/develop [Unai Bolivar - [`a034911`](https://github.com/eea/volto-arcgis-block/commit/a0349111d5f09be64b57acccc6a14cc5617f279a)]
9
20
  ### [0.1.355](https://github.com/eea/volto-arcgis-block/compare/0.1.354...0.1.355) - 5 May 2025
10
21
 
11
22
  ### [0.1.354](https://github.com/eea/volto-arcgis-block/compare/0.1.353...0.1.354) - 24 April 2025
package/Jenkinsfile CHANGED
@@ -4,7 +4,7 @@ pipeline {
4
4
  environment {
5
5
  GIT_NAME = "volto-arcgis-block"
6
6
  NAMESPACE = "@eeacms"
7
- SONARQUBE_TAGS = "volto.eea.europa.eu,clms.land.copernicus.eu,water.europa.eu-freshwater,clmsdemo.devel6cph.eea.europa.eu,land.copernicus.eu"
7
+ SONARQUBE_TAGS = "volto.eea.europa.eu,clms.land.copernicus.eu,water.europa.eu-freshwater,clmsdemo.devel6cph.eea.europa.eu,land.copernicus.eu,ask.copernicus.eu"
8
8
  DEPENDENCIES = ""
9
9
  BACKEND_PROFILES = "eea.kitkat:testing"
10
10
  BACKEND_ADDONS = "clms.addon,clms.types,clms.downloadtool,clms.statstool"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.356",
3
+ "version": "0.1.357",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -25,8 +25,11 @@ class SwipeWidget extends React.Component {
25
25
  this.dpiMax = 1200;
26
26
  this.scaleMax = 600000000;
27
27
  this.map = this.props.map;
28
- this.layers = this.props.layers;
28
+ // layers = this.props.layers;
29
29
  this.hasSwipe = false;
30
+ this.prevActiveLayers = this.props.mapViewer.activeLayers
31
+ ? this.props.mapViewer.activeLayers
32
+ : [];
30
33
  }
31
34
 
32
35
  loader() {
@@ -103,6 +106,27 @@ class SwipeWidget extends React.Component {
103
106
  });
104
107
  }
105
108
 
109
+ componentDidUpdate(prevProps, prevState) {
110
+ const curr = this.props.mapViewer.activeLayers || [];
111
+ const prev = this.prevActiveLayers || [];
112
+ const changed =
113
+ curr.length !== prev.length || curr.some((layer, i) => layer !== prev[i]);
114
+ if (this.state.showMapMenu && changed) {
115
+ if (curr.length === 0) {
116
+ sessionStorage.setItem('checkedLayers', JSON.stringify([]));
117
+ this.map.layers.removeAll();
118
+ this.props.view.ui.remove(this.swipe);
119
+ this.hasSwipe = false;
120
+ this.resetSwipeWidgetToDefault();
121
+ // this.openMenu(this);
122
+ } else if (this.hasSwipe) {
123
+ this.loadOptions();
124
+ this.renderApplySwipeButton();
125
+ }
126
+ }
127
+ this.prevActiveLayers = curr;
128
+ }
129
+
106
130
  getLayerTitle(layer) {
107
131
  let title;
108
132
  if (layer.url && layer.url.toLowerCase().includes('wmts')) {
@@ -119,6 +143,7 @@ class SwipeWidget extends React.Component {
119
143
  return title;
120
144
  }
121
145
  loadOptions() {
146
+ const layers = this.props.layers;
122
147
  var selectLeadingLayer = document.getElementById('select-leading-layer');
123
148
  if (selectLeadingLayer) {
124
149
  this.removeOptions(selectLeadingLayer);
@@ -143,9 +168,9 @@ class SwipeWidget extends React.Component {
143
168
  this.map.layers.items.length > 0
144
169
  ) {
145
170
  cl = [];
146
- // Find the layer ID in this.layers that corresponds to each map.layers item
171
+ // Find the layer ID in layers that corresponds to each map.layers item
147
172
  for (const mapLayer of this.map.layers.items) {
148
- for (const [layerKey, layerObj] of Object.entries(this.layers)) {
173
+ for (const [layerKey, layerObj] of Object.entries(layers)) {
149
174
  if (layerObj.id === mapLayer.id) {
150
175
  cl.push(layerKey);
151
176
  break;
@@ -162,32 +187,32 @@ class SwipeWidget extends React.Component {
162
187
  // Process the layers
163
188
  if (cl && cl.length > 0) {
164
189
  cl.forEach((layer) => {
165
- if (this.layers[layer]) {
166
- let layerId = this.layers[layer].id;
167
- if (this.layers['lcc_filter']) {
190
+ if (layers[layer]) {
191
+ let layerId = layers[layer].id;
192
+ if (layers['lcc_filter']) {
168
193
  if (
169
194
  layer === 'all_lcc_a_pol_1_4_1_0' ||
170
195
  layer === 'all_lcc_b_pol_1_4_1_1'
171
196
  ) {
172
- layerId = this.layers['lcc_filter'].id;
197
+ layerId = layers['lcc_filter'].id;
173
198
  }
174
199
  }
175
- if (this.layers['lc_filter']) {
200
+ if (layers['lc_filter']) {
176
201
  if (
177
202
  layer === 'all_present_lc_a_pol_1_4_0_0' ||
178
203
  layer === 'all_present_lc_b_pol_1_4_0_1'
179
204
  ) {
180
- layerId = this.layers['lc_filter'].id;
205
+ layerId = layers['lc_filter'].id;
181
206
  }
182
207
  }
183
- if (this.layers['klc_filter']) {
208
+ if (layers['klc_filter']) {
184
209
  if (layer === 'cop_klc_1_4_2_0') {
185
- layerId = this.layers['klc_filter'].id;
210
+ layerId = layers['klc_filter'].id;
186
211
  }
187
212
  }
188
- if (this.layers['pa_filter']) {
213
+ if (layers['pa_filter']) {
189
214
  if (layer === 'protected_areas_1_4_3_0') {
190
- layerId = this.layers['pa_filter'].id;
215
+ layerId = layers['pa_filter'].id;
191
216
  }
192
217
  }
193
218
  if (selectLeadingLayer) {
@@ -198,7 +223,7 @@ class SwipeWidget extends React.Component {
198
223
  ) {
199
224
  selectLeadingLayer.options.add(
200
225
  new Option(
201
- this.getLayerTitle(this.layers[layer]),
226
+ this.getLayerTitle(layers[layer]),
202
227
  layerId,
203
228
  true,
204
229
  true,
@@ -206,11 +231,7 @@ class SwipeWidget extends React.Component {
206
231
  );
207
232
  } else {
208
233
  selectLeadingLayer.options.add(
209
- new Option(
210
- this.getLayerTitle(this.layers[layer]),
211
- layerId,
212
- false,
213
- ),
234
+ new Option(this.getLayerTitle(layers[layer]), layerId, false),
214
235
  );
215
236
  }
216
237
  }
@@ -222,7 +243,7 @@ class SwipeWidget extends React.Component {
222
243
  ) {
223
244
  selectTrailingLayer.options.add(
224
245
  new Option(
225
- this.getLayerTitle(this.layers[layer]),
246
+ this.getLayerTitle(layers[layer]),
226
247
  layerId,
227
248
  true,
228
249
  true,
@@ -230,11 +251,7 @@ class SwipeWidget extends React.Component {
230
251
  );
231
252
  } else {
232
253
  selectTrailingLayer.options.add(
233
- new Option(
234
- this.getLayerTitle(this.layers[layer]),
235
- layerId,
236
- false,
237
- ),
254
+ new Option(this.getLayerTitle(layers[layer]), layerId, false),
238
255
  );
239
256
  }
240
257
  }
@@ -242,6 +259,33 @@ class SwipeWidget extends React.Component {
242
259
  });
243
260
  }
244
261
  }
262
+ resetSwipeWidgetToDefault() {
263
+ // Remove all swipe layers
264
+ if (this.swipe) {
265
+ this.swipe.leadingLayers.removeAll();
266
+ this.swipe.trailingLayers.removeAll();
267
+ this.hasSwipe = false;
268
+ }
269
+ // Reset dropdowns to default
270
+ const selectLeadingLayer = document.getElementById('select-leading-layer');
271
+ if (selectLeadingLayer) {
272
+ this.removeOptions(selectLeadingLayer);
273
+ selectLeadingLayer.options.add(
274
+ new Option('Select a leading layer', 'default', false, false),
275
+ );
276
+ selectLeadingLayer.options[0].disabled = true;
277
+ }
278
+ const selectTrailingLayer = document.getElementById(
279
+ 'select-trailing-layer',
280
+ );
281
+ if (selectTrailingLayer) {
282
+ this.removeOptions(selectTrailingLayer);
283
+ selectTrailingLayer.options.add(
284
+ new Option('Select a trailing layer', 'default', false, false),
285
+ );
286
+ selectTrailingLayer.options[0].disabled = true;
287
+ }
288
+ }
245
289
  removeOptions(selectElement) {
246
290
  if (selectElement.options.length > 0) {
247
291
  var i,
@@ -252,6 +296,7 @@ class SwipeWidget extends React.Component {
252
296
  }
253
297
  }
254
298
  renderApplySwipeButton() {
299
+ const layers = this.props.layers;
255
300
  this.props.view.ui.remove(this.swipe);
256
301
  this.props.view.ui.add(this.swipe);
257
302
  this.hasSwipe = true;
@@ -268,44 +313,44 @@ class SwipeWidget extends React.Component {
268
313
  let cl = JSON.parse(sessionStorage.getItem('checkedLayers'));
269
314
  if (cl) {
270
315
  cl.forEach((layer) => {
271
- if (this.layers[layer].id === selectedLeadingLayer) {
272
- this.swipe.leadingLayers.add(this.layers[layer]);
316
+ if (layers[layer].id === selectedLeadingLayer) {
317
+ this.swipe.leadingLayers.add(layers[layer]);
273
318
  }
274
- if (this.layers[layer].id === selectedTrailingLayer) {
275
- this.swipe.trailingLayers.add(this.layers[layer]);
319
+ if (layers[layer].id === selectedTrailingLayer) {
320
+ this.swipe.trailingLayers.add(layers[layer]);
276
321
  }
277
322
  });
278
323
  }
279
- if (this.layers['lcc_filter']) {
280
- if (this.layers['lcc_filter'].id === selectedLeadingLayer) {
281
- this.swipe.leadingLayers.add(this.layers['lcc_filter']);
324
+ if (layers['lcc_filter']) {
325
+ if (layers['lcc_filter'].id === selectedLeadingLayer) {
326
+ this.swipe.leadingLayers.add(layers['lcc_filter']);
282
327
  }
283
- if (this.layers['lcc_filter'].id === selectedTrailingLayer) {
284
- this.swipe.trailingLayers.add(this.layers['lcc_filter']);
328
+ if (layers['lcc_filter'].id === selectedTrailingLayer) {
329
+ this.swipe.trailingLayers.add(layers['lcc_filter']);
285
330
  }
286
331
  }
287
- if (this.layers['lc_filter']) {
288
- if (this.layers['lc_filter'].id === selectedLeadingLayer) {
289
- this.swipe.leadingLayers.add(this.layers['lc_filter']);
332
+ if (layers['lc_filter']) {
333
+ if (layers['lc_filter'].id === selectedLeadingLayer) {
334
+ this.swipe.leadingLayers.add(layers['lc_filter']);
290
335
  }
291
- if (this.layers['lc_filter'].id === selectedTrailingLayer) {
292
- this.swipe.trailingLayers.add(this.layers['lc_filter']);
336
+ if (layers['lc_filter'].id === selectedTrailingLayer) {
337
+ this.swipe.trailingLayers.add(layers['lc_filter']);
293
338
  }
294
339
  }
295
- if (this.layers['klc_filter']) {
296
- if (this.layers['klc_filter'].id === selectedLeadingLayer) {
297
- this.swipe.leadingLayers.add(this.layers['klc_filter']);
340
+ if (layers['klc_filter']) {
341
+ if (layers['klc_filter'].id === selectedLeadingLayer) {
342
+ this.swipe.leadingLayers.add(layers['klc_filter']);
298
343
  }
299
- if (this.layers['klc_filter'].id === selectedTrailingLayer) {
300
- this.swipe.trailingLayers.add(this.layers['klc_filter']);
344
+ if (layers['klc_filter'].id === selectedTrailingLayer) {
345
+ this.swipe.trailingLayers.add(layers['klc_filter']);
301
346
  }
302
347
  }
303
- if (this.layers['pa_filter']) {
304
- if (this.layers['pa_filter'].id === selectedLeadingLayer) {
305
- this.swipe.leadingLayers.add(this.layers['pa_filter']);
348
+ if (layers['pa_filter']) {
349
+ if (layers['pa_filter'].id === selectedLeadingLayer) {
350
+ this.swipe.leadingLayers.add(layers['pa_filter']);
306
351
  }
307
- if (this.layers['pa_filter'].id === selectedTrailingLayer) {
308
- this.swipe.trailingLayers.add(this.layers['pa_filter']);
352
+ if (layers['pa_filter'].id === selectedTrailingLayer) {
353
+ this.swipe.trailingLayers.add(layers['pa_filter']);
309
354
  }
310
355
  }
311
356
  this.map.layers.removeAll();
@@ -318,23 +363,24 @@ class SwipeWidget extends React.Component {
318
363
  }
319
364
 
320
365
  loadVisibleLayers() {
366
+ const layers = this.props.layers;
321
367
  let cl = JSON.parse(sessionStorage.getItem('checkedLayers'));
322
368
  if (cl) {
323
369
  cl.forEach((layer) => {
324
- this.map.layers.add(this.layers[layer]);
370
+ this.map.layers.add(layers[layer]);
325
371
  });
326
372
  }
327
- if (this.layers['lcc_filter']) {
328
- this.map.layers.add(this.layers['lcc_filter']);
373
+ if (layers['lcc_filter']) {
374
+ this.map.layers.add(layers['lcc_filter']);
329
375
  }
330
- if (this.layers['lc_filter']) {
331
- this.map.layers.add(this.layers['lc_filter']);
376
+ if (layers['lc_filter']) {
377
+ this.map.layers.add(layers['lc_filter']);
332
378
  }
333
- if (this.layers['klc_filter']) {
334
- this.map.layers.add(this.layers['klc_filter']);
379
+ if (layers['klc_filter']) {
380
+ this.map.layers.add(layers['klc_filter']);
335
381
  }
336
- if (this.layers['pa_filter']) {
337
- this.map.layers.add(this.layers['pa_filter']);
382
+ if (layers['pa_filter']) {
383
+ this.map.layers.add(layers['pa_filter']);
338
384
  }
339
385
  }
340
386
  /**