@eeacms/volto-arcgis-block 0.1.255 → 0.1.256

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,12 @@ 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.256](https://github.com/eea/volto-arcgis-block/compare/0.1.255...0.1.256) - 31 January 2024
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - CLMS-2887 (Change): package.json [Urkorue - [`dad702d`](https://github.com/eea/volto-arcgis-block/commit/dad702da1447015b0d73a46463909d92a34b6297)]
12
+ - CLMS-2887 (Change): Improvements for NUTS and Country selection [Urkorue - [`9dcbccd`](https://github.com/eea/volto-arcgis-block/commit/9dcbccd498d9ce3715cd8d882692a0f7ebab5f23)]
7
13
  ### [0.1.255](https://github.com/eea/volto-arcgis-block/compare/0.1.254...0.1.255) - 31 January 2024
8
14
 
9
15
  #### :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.256",
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,79 @@ 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>
524
- </label>
525
- </div>
526
- <div className="ccl-form-group">
527
- <input
528
- type="radio"
529
- id="download_area_select_nuts1"
530
- 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>
542
+ <span>By country</span>
556
543
  </label>
557
544
  </div>
558
545
  <div className="ccl-form-group">
559
546
  <input
560
547
  type="radio"
561
- id="download_area_select_nuts3"
548
+ id="download_area_select_nuts"
562
549
  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>
572
559
  </label>
573
560
  </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.
561
+ <div className="nuts-form">
562
+ <div className="ccl-form-group">
563
+ <input
564
+ type="radio"
565
+ id="download_area_select_nuts1"
566
+ name="downloadAreaSelectNuts"
567
+ value="nuts1"
568
+ className="ccl-checkbox ccl-required ccl-form-check-input"
569
+ onClick={this.nuts1handler.bind(this)}
570
+ ></input>
571
+ <label
572
+ className="ccl-form-radio-label"
573
+ htmlFor="download_area_select_nuts1"
574
+ >
575
+ <span>NUTS 1 (major socio-economic regions)</span>
576
+ </label>
577
+ </div>
578
+ <div className="ccl-form-group">
579
+ <input
580
+ type="radio"
581
+ id="download_area_select_nuts2"
582
+ name="downloadAreaSelectNuts"
583
+ value="nuts2"
584
+ className="ccl-checkbox ccl-required ccl-form-check-input"
585
+ onClick={this.nuts2handler.bind(this)}
586
+ ></input>
587
+ <label
588
+ className="ccl-form-radio-label"
589
+ htmlFor="download_area_select_nuts2"
590
+ >
591
+ <span>NUTS 2 (basic regions)</span>
592
+ </label>
593
+ </div>
594
+ <div className="ccl-form-group">
595
+ <input
596
+ type="radio"
597
+ id="download_area_select_nuts3"
598
+ name="downloadAreaSelectNuts"
599
+ value="nuts3"
600
+ className="ccl-radio ccl-required ccl-form-check-input"
601
+ onClick={this.nuts3handler.bind(this)}
602
+ ></input>
603
+ <label
604
+ className="ccl-form-radio-label"
605
+ htmlFor="download_area_select_nuts3"
606
+ >
607
+ <span>NUTS 3 (small regions)</span>
608
+ </label>
579
609
  </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
610
  </div>
596
611
  <br></br>
612
+ <div className="rectangle-header">
613
+ Draw a rectangle on the map
614
+ </div>
597
615
  <div className="ccl-form-group">
598
616
  <input
599
617
  type="radio"
@@ -607,13 +625,10 @@ class AreaWidget extends React.Component {
607
625
  className="ccl-form-radio-label"
608
626
  htmlFor="download_area_select_rectangle"
609
627
  >
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>
628
+ <span>
629
+ Click and drag your mouse on the map to select your
630
+ area of interest
631
+ </span>
617
632
  </label>
618
633
  </div>
619
634
  </fieldset>
@@ -321,6 +321,33 @@ 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-top: #a0b128;
335
+ margin-bottom: 1rem;
336
+ font-weight: bold;
337
+ }
338
+
339
+ .ccl-form {
340
+ padding-bottom: 0.5rem !important;
341
+ border-width: 2px;
342
+ border-style: none none solid none;
343
+ border-bottom: #a0b128;
344
+ margin-left: 1rem !important;
345
+ }
346
+
347
+ .nuts-form {
348
+ margin-top: 0.5rem;
349
+ margin-left: 2rem;
350
+ }
324
351
  /* Left menu */
325
352
  .map-menu {
326
353
  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,