@eeacms/volto-arcgis-block 0.1.112 → 0.1.113

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,13 @@ 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.113](https://github.com/eea/volto-arcgis-block/compare/0.1.112...0.1.113) - 3 March 2023
8
+
7
9
  ### [0.1.112](https://github.com/eea/volto-arcgis-block/compare/0.1.111...0.1.112) - 1 March 2023
8
10
 
11
+ #### :hammer_and_wrench: Others
12
+
13
+ - Merge pull request #314 from eea/develop [Unai Bolivar - [`a7475d7`](https://github.com/eea/volto-arcgis-block/commit/a7475d7ea54d943c7f332836da8e33b3302a0c23)]
9
14
  ### [0.1.111](https://github.com/eea/volto-arcgis-block/compare/0.1.110...0.1.111) - 28 February 2023
10
15
 
11
16
  #### :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.112",
3
+ "version": "0.1.113",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -113,64 +113,70 @@ class HotspotWidget extends React.Component {
113
113
  this.props.selectedLayers[currentLckey].visible = false;
114
114
  }
115
115
  }
116
- if (typeFilter === 'lcc') {
117
- var selectBoxHighlightsLcc = document
118
- .getElementById('select-klc-lccTime')
119
- .value.match(/\d+/g)
120
- .map(Number)[0];
121
- let typeLegend =
122
- document.getElementById('select-klc-highlights-lcc').value ===
123
- 'Dichotomous'
124
- ? 'all_lcc_a_pol'
125
- : 'all_lcc_b_pol';
126
- if (this.esriLayer_lcc !== null) {
127
- this.esriLayer_lcc.sublayers.items[0].name = this.addLegendName(
128
- typeLegend,
129
- );
130
- this.esriLayer_lcc.sublayers.items[0].legendUrl = this.addLegendNameToUrl(
131
- typeLegend,
132
- );
133
- this.esriLayer_lcc.customLayerParameters['CQL_FILTER'] =
134
- 'klc_code LIKE ' +
135
- "'" +
136
- this.dataKlc_code +
137
- "'" +
138
- " AND in_pa = 'not_defined' AND date = " +
139
- selectBoxHighlightsLcc;
140
- this.props.map.add(this.esriLayer_lcc);
141
- this.props.selectedLayers['lcc_filter'] = this.esriLayer_lcc;
142
- this.props.selectedLayers['lcc_filter'].visible = true;
116
+ typeFilter.forEach((type) => {
117
+ if (type === 'lcc') {
118
+ var selectBoxHighlightsLcc = document
119
+ .getElementById('select-klc-lccTime')
120
+ .value.match(/\d+/g)
121
+ .map(Number)[0];
122
+ let typeLegend =
123
+ document.getElementById('select-klc-highlights-lcc').value ===
124
+ 'Dichotomous'
125
+ ? 'all_lcc_a_pol'
126
+ : 'all_lcc_b_pol';
127
+ if (this.esriLayer_lcc !== null) {
128
+ this.esriLayer_lcc.sublayers.items[0].name = this.addLegendName(
129
+ typeLegend,
130
+ );
131
+ this.esriLayer_lcc.sublayers.items[0].legendUrl = this.addLegendNameToUrl(
132
+ typeLegend,
133
+ );
134
+ this.esriLayer_lcc.customLayerParameters['CQL_FILTER'] =
135
+ 'klc_code LIKE ' +
136
+ "'" +
137
+ this.dataKlc_code +
138
+ "'" +
139
+ " AND in_pa = 'not_defined' AND date = " +
140
+ selectBoxHighlightsLcc;
141
+ this.props.map.add(this.esriLayer_lcc);
142
+ this.props.selectedLayers['lcc_filter'] = this.esriLayer_lcc;
143
+ this.props.selectedLayers['lcc_filter'].visible = true;
144
+ this.layerModelInit();
145
+ }
143
146
  }
144
- } else {
145
- let typeLegend =
146
- document.getElementById('select-klc-highlights-lc').value === 'Modular'
147
- ? 'all_present_lc_a_pol'
148
- : 'all_present_lc_b_pol';
149
- var selectBoxHighlightsLc = document
150
- .getElementById('select-klc-lcTime')
151
- .value.match(/\d+/g)
152
- .map(Number)[0];
153
- if (this.esriLayer_lc !== null) {
154
- this.esriLayer_lc.sublayers.items[0].name = this.addLegendName(
155
- typeLegend,
156
- );
157
- this.esriLayer_lc.sublayers.items[0].legendUrl = this.addLegendNameToUrl(
158
- typeLegend,
159
- );
160
- this.esriLayer_lc.customLayerParameters['CQL_FILTER'] =
161
- 'klc_code LIKE ' +
162
- "'" +
163
- this.dataKlc_code +
164
- "'" +
165
- " AND in_pa = 'not_defined' AND date = " +
166
- selectBoxHighlightsLc;
167
- this.props.map.add(this.esriLayer_lc);
168
- this.props.selectedLayers['lc_filter'] = this.esriLayer_lc;
169
- this.props.selectedLayers['lc_filter'].visible = true;
170
- //set sessionStorage value to keep the widget open
171
- sessionStorage.setItem('hotspotFilterApplied', 'true');
147
+ if (type === 'lc') {
148
+ let typeLegend =
149
+ document.getElementById('select-klc-highlights-lc').value ===
150
+ 'Modular'
151
+ ? 'all_present_lc_b_pol'
152
+ : 'all_present_lc_a_pol';
153
+ var selectBoxHighlightsLc = document
154
+ .getElementById('select-klc-lcTime')
155
+ .value.match(/\d+/g)
156
+ .map(Number)[0];
157
+ if (this.esriLayer_lc !== null) {
158
+ this.esriLayer_lc.sublayers.items[0].name = this.addLegendName(
159
+ typeLegend,
160
+ );
161
+ this.esriLayer_lc.sublayers.items[0].legendUrl = this.addLegendNameToUrl(
162
+ typeLegend,
163
+ );
164
+ this.esriLayer_lc.customLayerParameters['CQL_FILTER'] =
165
+ 'klc_code LIKE ' +
166
+ "'" +
167
+ this.dataKlc_code +
168
+ "'" +
169
+ " AND in_pa = 'not_defined' AND date = " +
170
+ selectBoxHighlightsLc;
171
+ this.props.map.add(this.esriLayer_lc);
172
+ this.props.selectedLayers['lc_filter'] = this.esriLayer_lc;
173
+ this.props.selectedLayers['lc_filter'].visible = true;
174
+ this.layerModelInit();
175
+ }
172
176
  }
173
- }
177
+ });
178
+ //set sessionStorage value to keep the widget open
179
+ sessionStorage.setItem('hotspotFilterApplied', 'true');
174
180
  }
175
181
 
176
182
  dropdownAnimation() {
@@ -243,6 +249,26 @@ class HotspotWidget extends React.Component {
243
249
  });
244
250
  }
245
251
 
252
+ renderApplyFilterButton() {
253
+ let typeFilter = [];
254
+
255
+ if (
256
+ this.container.current.querySelector('.presentLandCoverContainer').style
257
+ .display === 'block'
258
+ ) {
259
+ typeFilter.push('lc');
260
+ }
261
+
262
+ if (
263
+ this.container.current.querySelector('.landCoverChangeContainer').style
264
+ .display === 'block'
265
+ ) {
266
+ typeFilter.push('lcc');
267
+ }
268
+
269
+ return this.handleApplyFilter(typeFilter);
270
+ }
271
+
246
272
  renderPresentLandCover() {
247
273
  return (
248
274
  <div className="measurement-dropdown" id="PresentLandCoverDropdown">
@@ -278,12 +304,6 @@ class HotspotWidget extends React.Component {
278
304
  ></select>
279
305
  </label>
280
306
  </div>
281
- <button
282
- className="esri-button"
283
- onClick={() => this.handleApplyFilter('lc')}
284
- >
285
- Apply filter
286
- </button>
287
307
  </div>
288
308
  </div>
289
309
  );
@@ -419,12 +439,6 @@ class HotspotWidget extends React.Component {
419
439
  ></select>
420
440
  </label>
421
441
  </div>
422
- <button
423
- className="esri-button"
424
- onClick={() => this.handleApplyFilter('lcc')}
425
- >
426
- Apply filter
427
- </button>
428
442
  </div>
429
443
  </div>
430
444
  );
@@ -478,6 +492,12 @@ class HotspotWidget extends React.Component {
478
492
  <div className="landCoverChangeContainer">
479
493
  {this.renderLandCoverChange()}
480
494
  </div>
495
+ <button
496
+ className="esri-button"
497
+ onClick={() => this.renderApplyFilterButton()}
498
+ >
499
+ Apply filter
500
+ </button>
481
501
  </div>
482
502
  </div>
483
503
  </div>