@eeacms/volto-arcgis-block 0.1.421 → 0.1.423

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,7 +4,18 @@ 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.421](https://github.com/eea/volto-arcgis-block/compare/0.1.420...0.1.421) - 26 January 2026
7
+ ### [0.1.423](https://github.com/eea/volto-arcgis-block/compare/0.1.422...0.1.423) - 29 January 2026
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - (bug): Update url modifications to allow for correct proxy redirect in upload widget. Fix Styles to make WFS feature selection visibly checked. [Unai Bolivar - [`5a95ca9`](https://github.com/eea/volto-arcgis-block/commit/5a95ca919e825d95268bbd5746e3f7b9fc8a2c54)]
12
+ ### [0.1.422](https://github.com/eea/volto-arcgis-block/compare/0.1.421...0.1.422) - 28 January 2026
13
+
14
+ #### :hammer_and_wrench: Others
15
+
16
+ - (bug): Update upload widget to fetch from proxy endpoint [Unai Bolivar - [`bee63dc`](https://github.com/eea/volto-arcgis-block/commit/bee63dc12f97eb7e121962de6cc38293fe5fa594)]
17
+ - (bug): Fix error popup for input text that is not valid url in upload widget [Unai Bolivar - [`2e03394`](https://github.com/eea/volto-arcgis-block/commit/2e03394aaa054530e30e312108fcfb5ce8452a5f)]
18
+ ### [0.1.421](https://github.com/eea/volto-arcgis-block/compare/0.1.420...0.1.421) - 27 January 2026
8
19
 
9
20
  #### :hammer_and_wrench: Others
10
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.421",
3
+ "version": "0.1.423",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -2295,7 +2295,7 @@ class MenuWidget extends React.Component {
2295
2295
  /\/(ows|ogc)(\b|\/)/i.test(baseUrl);
2296
2296
 
2297
2297
  if (serviceType === 'WMTS') {
2298
- resourceLayers = [new WMTSLayer({ url: viewService })];
2298
+ resourceLayers = [new WMTSLayer({ url: baseUrl })];
2299
2299
  } else if (isWFS) {
2300
2300
  resourceLayers = Object.entries(serviceSelection || {})
2301
2301
  .map(([name, title]) => {
@@ -2324,7 +2324,10 @@ class MenuWidget extends React.Component {
2324
2324
  .filter(Boolean);
2325
2325
  } else {
2326
2326
  resourceLayers = [
2327
- new WMSLayer({ url: viewService, typename: serviceSelection || [] }),
2327
+ new WMSLayer({
2328
+ url: baseUrl,
2329
+ typename: serviceSelection || [],
2330
+ }),
2328
2331
  ];
2329
2332
  }
2330
2333
  } catch (error) {
@@ -23,6 +23,7 @@ class UploadWidget extends React.Component {
23
23
  serviceUrl: '',
24
24
  selectedServiceType: '',
25
25
  wfsFeatures: {},
26
+ selectedFeatures: {},
26
27
  };
27
28
  this.menuClass =
28
29
  'esri-icon-sketch-rectangle esri-widget--button esri-widget esri-interactive';
@@ -31,7 +32,6 @@ class UploadWidget extends React.Component {
31
32
  this.uploadUrlServiceHandler = this.props.uploadUrlServiceHandler;
32
33
  this.uploadFileErrorHandler = this.props.uploadFileErrorHandler;
33
34
  this.errorPopup = this.errorPopup.bind(this);
34
- this.selectedFeatures = {};
35
35
  }
36
36
 
37
37
  loader() {
@@ -175,9 +175,33 @@ class UploadWidget extends React.Component {
175
175
  return serviceUrl;
176
176
  };
177
177
 
178
+ isValidUrl = (url) => {
179
+ try {
180
+ new URL(url);
181
+ return true;
182
+ } catch (e) {
183
+ return false;
184
+ }
185
+ };
186
+
187
+ stripProtocol = (url) => {
188
+ return (url || '').replace(/^https?:\/\//i, '');
189
+ };
190
+
191
+ getProxyBase = () => {
192
+ const href = window.location.href || '';
193
+ return href.replace('/en/map-viewer', '/ogcproxy/');
194
+ // return 'https://clmsdemo.devel6cph.eea.europa.eu/ogcproxy/';
195
+ };
196
+
197
+ buildProxiedUrl = (url) => {
198
+ return this.getProxyBase() + this.stripProtocol(url);
199
+ };
200
+
178
201
  getCapabilities = (url, serviceType) => {
179
202
  // Get the coordinates of the click on the view
180
- return esriRequest(url, {
203
+ const proxiedUrl = this.buildProxiedUrl(url);
204
+ return esriRequest(proxiedUrl, {
181
205
  responseType: 'html',
182
206
  sync: 'true',
183
207
  query: {
@@ -227,19 +251,20 @@ class UploadWidget extends React.Component {
227
251
 
228
252
  handleFeatureCheckboxChange = (event) => {
229
253
  const key = event.target.value;
230
- const { wfsFeatures } = this.state;
254
+ const { wfsFeatures, selectedFeatures } = this.state;
255
+ const nextSelected = { ...selectedFeatures };
231
256
  if (event.target.checked) {
232
- this.selectedFeatures[key] =
233
- wfsFeatures && wfsFeatures[key] ? wfsFeatures[key] : key;
257
+ if (wfsFeatures && wfsFeatures[key]) {
258
+ nextSelected[key] = wfsFeatures[key];
259
+ } else {
260
+ nextSelected[key] = key;
261
+ }
234
262
  } else {
235
- if (
236
- this.selectedFeatures &&
237
- Object.prototype.hasOwnProperty.call(this.selectedFeatures, key)
238
- ) {
239
- delete this.selectedFeatures[key];
263
+ if (Object.prototype.hasOwnProperty.call(nextSelected, key)) {
264
+ delete nextSelected[key];
240
265
  }
241
266
  }
242
- this.setState({});
267
+ this.setState({ selectedFeatures: nextSelected });
243
268
  };
244
269
 
245
270
  handleSelectLayers = async () => {
@@ -247,7 +272,8 @@ class UploadWidget extends React.Component {
247
272
  if (
248
273
  selectedServiceType === 'WFS' &&
249
274
  serviceUrl &&
250
- serviceUrl.trim() !== ''
275
+ serviceUrl.trim() !== '' &&
276
+ this.isValidUrl(serviceUrl)
251
277
  ) {
252
278
  const normalizedUrl = this.getNormalizedUrlForType(
253
279
  serviceUrl,
@@ -264,20 +290,30 @@ class UploadWidget extends React.Component {
264
290
  };
265
291
 
266
292
  handleUploadService = async () => {
267
- const { serviceUrl, selectedServiceType } = this.state;
268
- if (selectedServiceType && serviceUrl && serviceUrl.trim() !== '') {
293
+ const serviceUrl = this.state.serviceUrl;
294
+ const selectedServiceType = this.state.selectedServiceType;
295
+ const selectedFeatures = this.state.selectedFeatures;
296
+ if (
297
+ selectedServiceType &&
298
+ serviceUrl &&
299
+ serviceUrl.trim() !== '' &&
300
+ this.isValidUrl(serviceUrl)
301
+ ) {
269
302
  const normalizedUrl = this.getNormalizedUrlForType(
270
303
  serviceUrl,
271
304
  selectedServiceType,
272
305
  );
306
+ const proxiedUrl = this.buildProxiedUrl(normalizedUrl);
273
307
  if (selectedServiceType === 'WMS') {
274
- this.uploadWMSService(normalizedUrl);
308
+ this.uploadUrlServiceHandler(proxiedUrl, 'WMS');
275
309
  this.setState({ serviceUrl: '' });
276
310
  } else if (selectedServiceType === 'WMTS') {
277
- this.uploadWMTSService(normalizedUrl);
311
+ this.uploadUrlServiceHandler(proxiedUrl, 'WMTS');
278
312
  this.setState({ serviceUrl: '' });
279
313
  } else if (selectedServiceType === 'WFS') {
280
- this.uploadWFSService(normalizedUrl);
314
+ this.uploadUrlServiceHandler(proxiedUrl, 'WFS', selectedFeatures);
315
+ this.setState({ wfsFeatures: {}, serviceUrl: '' });
316
+ this.setState({ selectedFeatures: {} });
281
317
  } else {
282
318
  this.errorPopup();
283
319
  this.setState({ serviceUrl: '' });
@@ -298,9 +334,8 @@ class UploadWidget extends React.Component {
298
334
  };
299
335
 
300
336
  uploadWFSService = (url) => {
301
- this.uploadUrlServiceHandler(url, 'WFS', this.selectedFeatures);
302
- this.selectedFeatures = {};
303
- this.setState({ wfsFeatures: {}, serviceUrl: '' });
337
+ this.uploadUrlServiceHandler(url, 'WFS', this.state.selectedFeatures);
338
+ this.setState({ wfsFeatures: {}, serviceUrl: '', selectedFeatures: {} });
304
339
  };
305
340
 
306
341
  errorPopup = () => {
@@ -356,13 +391,16 @@ class UploadWidget extends React.Component {
356
391
  * @returns jsx
357
392
  */
358
393
  render() {
359
- const { selectedServiceType, serviceUrl, wfsFeatures } = this.state;
394
+ const selectedServiceType = this.state.selectedServiceType;
395
+ const serviceUrl = this.state.serviceUrl;
396
+ const wfsFeatures = this.state.wfsFeatures;
397
+ const selectedFeatures = this.state.selectedFeatures;
360
398
  const isUploadDisabled =
361
399
  !selectedServiceType ||
362
400
  !(serviceUrl && serviceUrl.trim() !== '') ||
363
401
  (selectedServiceType === 'WFS' &&
364
402
  Object.keys(wfsFeatures || {}).length > 0 &&
365
- Object.keys(this.selectedFeatures || {}).length === 0);
403
+ Object.keys(selectedFeatures || {}).length === 0);
366
404
  return (
367
405
  <>
368
406
  <div ref={this.container} className="upload-container">
@@ -490,7 +528,12 @@ class UploadWidget extends React.Component {
490
528
  type="checkbox"
491
529
  value={key}
492
530
  onChange={this.handleFeatureCheckboxChange}
493
- checked={Boolean(this.selectedFeatures[key])}
531
+ checked={
532
+ this.state.selectedFeatures &&
533
+ this.state.selectedFeatures[key]
534
+ ? true
535
+ : false
536
+ }
494
537
  style={{ width: '18px', height: '18px' }}
495
538
  />
496
539
  <span>{title || key}</span>
@@ -622,9 +622,20 @@ div.upload-container.esri-component
622
622
  font-size: 0.875rem;
623
623
  }
624
624
 
625
- .upload-container .esri-button:hover {
625
+ .upload-container .esri-button {
626
626
  border: none;
627
+ }
628
+
629
+ .upload-container .esri-button:enabled {
627
630
  background-color: #a0b128;
631
+ color: white;
632
+ cursor: pointer;
633
+ }
634
+
635
+ .upload-container .esri-button:enabled:hover {
636
+ border: none;
637
+ background-color: #7c8921;
638
+ color: white;
628
639
  }
629
640
 
630
641
  div.upload-container div.wfs-features-list label.field input[type='checkbox'] {
@@ -646,12 +657,32 @@ div.upload-container div.wfs-features-list label.field input[type='checkbox'] {
646
657
  vertical-align: middle;
647
658
  }
648
659
 
660
+ div.upload-container
661
+ div.wfs-features-list
662
+ label.field
663
+ input[type='checkbox']:checked {
664
+ border-color: #a0b128;
665
+ background-color: #a0b128;
666
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' d='M6.173 12.927L1.24 8l1.414-1.414 3.52 3.52 7.07-7.07L14.658 4.45z'/%3E%3C/svg%3E");
667
+ background-position: center;
668
+ background-repeat: no-repeat;
669
+ background-size: 12px 12px;
670
+ }
671
+
649
672
  .upload-container .esri-button:disabled:hover,
650
673
  .upload-container .esri-button[disabled]:hover {
651
674
  border: 1px solid #999999;
652
675
  background-color: #cccccc;
653
676
  color: #666666;
654
- cursor: not-allowed;
677
+ cursor: default;
678
+ }
679
+
680
+ .upload-container .esri-button:disabled,
681
+ .upload-container .esri-button[disabled] {
682
+ border: 1px solid #999999;
683
+ background-color: #cccccc;
684
+ color: #666666;
685
+ cursor: default;
655
686
  }
656
687
 
657
688
  .upload-panel {