@eeacms/volto-arcgis-block 0.1.255 → 0.1.257

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,20 @@ 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.257](https://github.com/eea/volto-arcgis-block/compare/0.1.256...0.1.257) - 7 February 2024
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Prettier [manuelmartinezbilbomatica - [`00aa2e9`](https://github.com/eea/volto-arcgis-block/commit/00aa2e921b17404b22c848a7bd3d057328555c5e)]
12
+ - [FEAT] Info widget queries hotspot services [manuelmartinezbilbomatica - [`b9354f5`](https://github.com/eea/volto-arcgis-block/commit/b9354f5ba3e2a6ab7ea88e909cc693c0d3a53aee)]
13
+ - Version format issue solved [manuelmartinezbilbomatica - [`7d967cc`](https://github.com/eea/volto-arcgis-block/commit/7d967cc3b8e0f07d6638d0825869db84fc205db0)]
14
+ - Format issue solved by addin if statement with 'application/json'. Why HotStpot capabilities are not read will be solved later [manuelmartinezbilbomatica - [`3471847`](https://github.com/eea/volto-arcgis-block/commit/34718476b5414389d1c85e41cf68566e9765202e)]
15
+ ### [0.1.256](https://github.com/eea/volto-arcgis-block/compare/0.1.255...0.1.256) - 31 January 2024
16
+
17
+ #### :hammer_and_wrench: Others
18
+
19
+ - CLMS-2887 (Change): package.json [Urkorue - [`dad702d`](https://github.com/eea/volto-arcgis-block/commit/dad702da1447015b0d73a46463909d92a34b6297)]
20
+ - CLMS-2887 (Change): Improvements for NUTS and Country selection [Urkorue - [`9dcbccd`](https://github.com/eea/volto-arcgis-block/commit/9dcbccd498d9ce3715cd8d882692a0f7ebab5f23)]
7
21
  ### [0.1.255](https://github.com/eea/volto-arcgis-block/compare/0.1.254...0.1.255) - 31 January 2024
8
22
 
9
23
  #### :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.255",
3
+ "version": "0.1.257",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -124,21 +124,49 @@ class AreaWidget extends React.Component {
124
124
  this.container.current.querySelector('input:checked').click();
125
125
  }
126
126
  }
127
+ nutsRadioButton(e) {
128
+ if (e.target.value === 'nuts') {
129
+ if (
130
+ !document.getElementById('download_area_select_nuts2').checked &&
131
+ !document.getElementById('download_area_select_nuts3').checked
132
+ ) {
133
+ document.getElementById('download_area_select_nuts1').checked = true;
134
+ this.loadNutsService('nuts1', [1, 2]);
135
+ }
136
+ }
137
+ if (
138
+ e.target.value === 'nuts1' ||
139
+ e.target.value === 'nuts2' ||
140
+ e.target.value === 'nuts3'
141
+ ) {
142
+ document.getElementById('download_area_select_nuts').checked = true;
143
+ }
144
+ if (e.target.value === 'nuts0' || e.target.value === 'area') {
145
+ document.getElementById('download_area_select_nuts1').checked = false;
146
+ document.getElementById('download_area_select_nuts2').checked = false;
147
+ document.getElementById('download_area_select_nuts3').checked = false;
148
+ }
149
+ }
127
150
  nuts0handler(e) {
128
151
  this.loadNutsService(e.target.value, [0]);
152
+ this.loadCountriesService(e.target.value);
153
+ this.nutsRadioButton(e);
129
154
  }
130
155
  nuts1handler(e) {
131
156
  this.loadNutsService(e.target.value, [1, 2]);
157
+ this.nutsRadioButton(e);
132
158
  }
133
159
  nuts2handler(e) {
134
160
  this.loadNutsService(e.target.value, [3, 4, 5]);
161
+ this.nutsRadioButton(e);
135
162
  }
136
163
  nuts3handler(e) {
137
164
  this.loadNutsService(e.target.value, [6, 7, 8]);
165
+ this.nutsRadioButton(e);
138
166
  }
139
- countriesHandler(e) {
140
- this.loadCountriesService(e.target.value);
141
- }
167
+ // countriesHandler(e) {
168
+ // this.loadCountriesService(e.target.value);
169
+ // }
142
170
 
143
171
  loadNutsService(id, levels) {
144
172
  this.clearWidget();
@@ -164,7 +192,6 @@ class AreaWidget extends React.Component {
164
192
  }
165
193
 
166
194
  loadCountriesService(id) {
167
- this.clearWidget();
168
195
  document.querySelector('.esri-attribution__powered-by').style.display =
169
196
  'flex';
170
197
  var layer = new FeatureLayer({
@@ -205,7 +232,7 @@ class AreaWidget extends React.Component {
205
232
  }
206
233
  }
207
234
 
208
- rectanglehandler() {
235
+ rectanglehandler(event) {
209
236
  this.clearWidget();
210
237
  window.document.querySelector('.pan-container').style.display = 'flex';
211
238
  var fillSymbol = {
@@ -310,6 +337,7 @@ class AreaWidget extends React.Component {
310
337
  this.setState({
311
338
  ShowGraphics: drawGraphics,
312
339
  });
340
+ this.nutsRadioButton(event);
313
341
  }
314
342
  clearWidget() {
315
343
  window.document.querySelector('.pan-container').style.display = 'none';
@@ -420,14 +448,9 @@ class AreaWidget extends React.Component {
420
448
  }
421
449
 
422
450
  async initFMI() {
423
- let currentUrl = window.location.href.split('.eu');
424
- let fetchUrl = '';
425
- if (currentUrl[0] === 'https://clmsdemo.devel6cph.eea') {
426
- fetchUrl =
427
- 'https://clmsdemo.devel6cph.eea.europa.eu/++api++/@anon-registry';
428
- } else {
429
- fetchUrl = 'https://land.copernicus.eu/++api++/@anon-registry';
430
- }
451
+ let fetchUrl =
452
+ window.location.href.replace(window.location.pathname.substring(0), '') +
453
+ '/++api++/@anon-registry';
431
454
  try {
432
455
  let nutsResponse = await fetch(
433
456
  fetchUrl + '/clms.downloadtool.fme_config_controlpanel.nuts_service',
@@ -499,11 +522,7 @@ class AreaWidget extends React.Component {
499
522
  )}
500
523
  <div className="right-panel-content">
501
524
  <div className="area-panel">
502
- <div className="area-header">
503
- For areas of interest in the EU, EFTA, candidate countries or
504
- the United Kingdom: choose NUTS classification or draw a
505
- rectangle on the map.
506
- </div>
525
+ <div className="area-header">Select by country or region</div>
507
526
  <div className="ccl-form">
508
527
  <fieldset className="ccl-fieldset">
509
528
  <div className="ccl-form-group">
@@ -520,80 +539,92 @@ class AreaWidget extends React.Component {
520
539
  className="ccl-form-radio-label"
521
540
  htmlFor="download_area_select_nuts0"
522
541
  >
523
- <span>NUTS 0</span>
542
+ <span>By country</span>
524
543
  </label>
525
544
  </div>
526
545
  <div className="ccl-form-group">
527
546
  <input
528
547
  type="radio"
529
- id="download_area_select_nuts1"
548
+ id="download_area_select_nuts"
530
549
  name="downloadAreaSelect"
531
- value="nuts1"
532
- className="ccl-checkbox ccl-required ccl-form-check-input"
533
- onClick={this.nuts1handler.bind(this)}
534
- ></input>
535
- <label
536
- className="ccl-form-radio-label"
537
- htmlFor="download_area_select_nuts1"
538
- >
539
- <span>NUTS 1</span>
540
- </label>
541
- </div>
542
- <div className="ccl-form-group">
543
- <input
544
- type="radio"
545
- id="download_area_select_nuts2"
546
- name="downloadAreaSelect"
547
- value="nuts2"
548
- className="ccl-checkbox ccl-required ccl-form-check-input"
549
- onClick={this.nuts2handler.bind(this)}
550
- ></input>
551
- <label
552
- className="ccl-form-radio-label"
553
- htmlFor="download_area_select_nuts2"
554
- >
555
- <span>NUTS 2</span>
556
- </label>
557
- </div>
558
- <div className="ccl-form-group">
559
- <input
560
- type="radio"
561
- id="download_area_select_nuts3"
562
- name="downloadAreaSelect"
563
- value="nuts3"
564
- className="ccl-radio ccl-required ccl-form-check-input"
565
- onClick={this.nuts3handler.bind(this)}
550
+ value="nuts"
551
+ className="ccl-checkbox cl-required ccl-form-check-input"
552
+ onClick={this.nutsRadioButton.bind(this)}
566
553
  ></input>
567
554
  <label
568
555
  className="ccl-form-radio-label"
569
- htmlFor="download_area_select_nuts3"
556
+ htmlFor="download_area_select_nuts"
570
557
  >
571
- <span>NUTS 3</span>
558
+ <span>By NUTS</span>
559
+ <a
560
+ href={
561
+ 'https://land.copernicus.eu/en/faq/map-viewer/what-are-nuts'
562
+ }
563
+ target="_blank"
564
+ rel="noopener noreferrer"
565
+ onClick={(e) => e.stopPropagation()}
566
+ onKeyDown={(e) => e.stopPropagation()}
567
+ >
568
+ <span className="map-menu-icon nuts-menu-icon">
569
+ <FontAwesomeIcon icon={['fa', 'info-circle']} />
570
+ </span>
571
+ </a>
572
572
  </label>
573
573
  </div>
574
- <div className="ccl-form-group">
575
- <div>
576
- For areas of interest outside{' '}
577
- <b>the above ones, choose a country or</b> draw a
578
- rectangle on the map.
574
+ <div className="nuts-form">
575
+ <div className="ccl-form-group">
576
+ <input
577
+ type="radio"
578
+ id="download_area_select_nuts1"
579
+ name="downloadAreaSelectNuts"
580
+ value="nuts1"
581
+ className="ccl-checkbox ccl-required ccl-form-check-input"
582
+ onClick={this.nuts1handler.bind(this)}
583
+ ></input>
584
+ <label
585
+ className="ccl-form-radio-label"
586
+ htmlFor="download_area_select_nuts1"
587
+ >
588
+ <span>NUTS 1 (major socio-economic regions)</span>
589
+ </label>
590
+ </div>
591
+ <div className="ccl-form-group">
592
+ <input
593
+ type="radio"
594
+ id="download_area_select_nuts2"
595
+ name="downloadAreaSelectNuts"
596
+ value="nuts2"
597
+ className="ccl-checkbox ccl-required ccl-form-check-input"
598
+ onClick={this.nuts2handler.bind(this)}
599
+ ></input>
600
+ <label
601
+ className="ccl-form-radio-label"
602
+ htmlFor="download_area_select_nuts2"
603
+ >
604
+ <span>NUTS 2 (basic regions)</span>
605
+ </label>
606
+ </div>
607
+ <div className="ccl-form-group">
608
+ <input
609
+ type="radio"
610
+ id="download_area_select_nuts3"
611
+ name="downloadAreaSelectNuts"
612
+ value="nuts3"
613
+ className="ccl-radio ccl-required ccl-form-check-input"
614
+ onClick={this.nuts3handler.bind(this)}
615
+ ></input>
616
+ <label
617
+ className="ccl-form-radio-label"
618
+ htmlFor="download_area_select_nuts3"
619
+ >
620
+ <span>NUTS 3 (small regions)</span>
621
+ </label>
579
622
  </div>
580
- <br></br>
581
- <input
582
- type="radio"
583
- id="download_area_select_countries"
584
- name="downloadAreaSelect"
585
- value="countries"
586
- className="ccl-radio ccl-required ccl-form-check-input"
587
- onClick={this.countriesHandler.bind(this)}
588
- ></input>
589
- <label
590
- className="ccl-form-radio-label"
591
- htmlFor="download_area_select_countries"
592
- >
593
- <span>Country</span>
594
- </label>
595
623
  </div>
596
624
  <br></br>
625
+ <div className="rectangle-header">
626
+ Draw a rectangle on the map
627
+ </div>
597
628
  <div className="ccl-form-group">
598
629
  <input
599
630
  type="radio"
@@ -607,13 +638,10 @@ class AreaWidget extends React.Component {
607
638
  className="ccl-form-radio-label"
608
639
  htmlFor="download_area_select_rectangle"
609
640
  >
610
- <span>Draw by rectangle</span>
611
- <div>
612
- (Click and drag your mouse on the map. As you move
613
- your mouse, you’ll see the area of the rectangle next
614
- to your cursor. Finish the rectangle by releasing your
615
- mouse.)
616
- </div>
641
+ <span>
642
+ Click and drag your mouse on the map to select your
643
+ area of interest
644
+ </span>
617
645
  </label>
618
646
  </div>
619
647
  </fieldset>
@@ -390,8 +390,9 @@ class InfoWidget extends React.Component {
390
390
  let layerId = this.getLayerName(layer);
391
391
  let url = layer.featureInfoUrl ? layer.featureInfoUrl : layer.url;
392
392
  return this.wmsCapabilities(url).then((xml) => {
393
+ // let version = this.parseCapabilities(xml, 'wms_capabilities')[0].attributes['version'];
393
394
  let version = this.parseCapabilities(xml, 'wms_capabilities')[0]
394
- .attributes['version'];
395
+ .attributes['version'].nodeValue;
395
396
  let format = this.parseFormat(xml, layerId);
396
397
  let times = '';
397
398
  let nTimes = 1;
@@ -419,9 +420,10 @@ class InfoWidget extends React.Component {
419
420
  this.props.view.extent.ymax,
420
421
  HEIGHT: this.props.view.height,
421
422
  WIDTH: this.props.view.width,
422
- X: event.screenPoint.x,
423
- Y: event.screenPoint.y,
423
+ X: Math.round(event.screenPoint.x),
424
+ Y: Math.round(event.screenPoint.y),
424
425
  QUERY_LAYERS: layerId,
426
+ LAYERS: layerId,
425
427
  INFO_FORMAT: format,
426
428
  TIME: times ? times[0] + '/' + times[nTimes - 1] : '',
427
429
  FEATURE_COUNT: '' + nTimes,
@@ -463,19 +465,26 @@ class InfoWidget extends React.Component {
463
465
 
464
466
  parseCapabilities(xml, tag) {
465
467
  let result = xml.getElementsByTagName(tag);
468
+
466
469
  return result;
467
470
  }
468
471
 
469
472
  parseFormat(xml) {
470
- let formats = Array.from(
471
- Array.from(this.parseCapabilities(xml, 'getFeatureInfo')).map(
472
- (f) => f.children,
473
- )[0],
474
- ).map((v) => v.textContent);
475
- let format = formats.filter((v) => v.includes('json'))[0];
476
- if (!format) format = formats.filter((v) => v.includes('html'))[0];
477
- if (!format) format = formats.filter((v) => v.includes('text/xml'))[0];
478
- if (!format) format = formats[0];
473
+ // console.log(parseCapabilities(xml, 'getFeatureInfo'));
474
+ let getFeatureInfo_node = this.parseCapabilities(xml, 'getFeatureInfo');
475
+ let format = false;
476
+ if (getFeatureInfo_node.length > 0) {
477
+ let formats = Array.from(
478
+ Array.from(getFeatureInfo_node).map((f) => f.children)[0],
479
+ ).map((v) => v.textContent);
480
+
481
+ format = formats.filter((v) => v.includes('json'))[0];
482
+ if (!format) format = formats.filter((v) => v.includes('html'))[0];
483
+ if (!format) format = formats.filter((v) => v.includes('text/xml'))[0];
484
+ if (!format) format = formats[0];
485
+ } else {
486
+ format = 'application/json';
487
+ }
479
488
  return format;
480
489
  }
481
490
 
@@ -701,6 +701,16 @@ class MenuWidget extends React.Component {
701
701
  }
702
702
  }
703
703
  }
704
+ layers.forEach((layer, index) => {
705
+ let activeLayers = document.querySelectorAll('.active-layer');
706
+ activeLayers.forEach((item) => {
707
+ if (layer === item.getAttribute('layer-id')) {
708
+ item.parentElement.insertBefore(item, activeLayers[index]);
709
+ }
710
+ });
711
+ });
712
+ this.layersReorder();
713
+ this.saveLayerOrder();
704
714
  }
705
715
  });
706
716
  });
@@ -321,6 +321,37 @@ div.esri-popover
321
321
  margin-bottom: 1rem;
322
322
  }
323
323
 
324
+ .area-header {
325
+ padding: 1rem;
326
+ background-color: rgba(160, 177, 40, 0.5);
327
+ font-weight: bold;
328
+ }
329
+
330
+ .rectangle-header {
331
+ padding-top: 0.5rem;
332
+ border-width: 2px;
333
+ border-style: solid none none none;
334
+ border-color: #a0b128;
335
+ margin-bottom: 1rem;
336
+ font-weight: bold;
337
+ }
338
+
339
+ .area-panel .ccl-form {
340
+ padding-bottom: 0.5rem !important;
341
+ border-width: 2px;
342
+ border-style: none none solid none;
343
+ border-color: #a0b128;
344
+ margin-left: 1rem !important;
345
+ }
346
+
347
+ .nuts-form {
348
+ margin-top: 0.5rem;
349
+ margin-left: 2rem;
350
+ }
351
+
352
+ label.ccl-form-radio-label span.nuts-menu-icon {
353
+ margin-left: 9rem;
354
+ }
324
355
  /* Left menu */
325
356
  .map-menu {
326
357
  position: relative;
@@ -198,14 +198,9 @@ class UseCasesMapViewer extends React.Component {
198
198
  this.setState(() => ({ useCaseLevel: 1 }));
199
199
  }
200
200
  async initFMI() {
201
- let currentUrl = window.location.href.split('.eu');
202
- let fetchUrl = '';
203
- if (currentUrl[0] === 'https://clmsdemo.devel6cph.eea') {
204
- fetchUrl =
205
- 'https://clmsdemo.devel6cph.eea.europa.eu/++api++/@anon-registry';
206
- } else {
207
- fetchUrl = 'https://land.copernicus.eu/++api++/@anon-registry';
208
- }
201
+ let fetchUrl =
202
+ window.location.href.replace(window.location.pathname.substring(0), '') +
203
+ '/++api++/@anon-registry';
209
204
  try {
210
205
  let highlightResponse = await fetch(
211
206
  fetchUrl + this.serviceCfg.Highlight_service,