@eeacms/volto-arcgis-block 0.1.313 → 0.1.315

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,17 @@ 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.315](https://github.com/eea/volto-arcgis-block/compare/0.1.314...0.1.315) - 18 November 2024
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - CLMS-276819 (bug): improved specificity in container variables upon load/reload [Unai Bolivar - [`dac6af1`](https://github.com/eea/volto-arcgis-block/commit/dac6af15642e02cf436f7395f31b1916e7b04ef3)]
12
+ ### [0.1.314](https://github.com/eea/volto-arcgis-block/compare/0.1.313...0.1.314) - 13 November 2024
13
+
14
+ #### :hammer_and_wrench: Others
15
+
16
+ - CLMS-3362 (bug): Info widget properly lays out layer data from fields properties [Unai Bolivar - [`9fc0198`](https://github.com/eea/volto-arcgis-block/commit/9fc01986f796c1444acdb01faa301b690c5c3aad)]
17
+ - CLMS-3362 (bug): Info widget still needs work addressing map image layers [Unai Bolivar - [`e22f46b`](https://github.com/eea/volto-arcgis-block/commit/e22f46b6a00492de52df2d78e79f470da00d125e)]
7
18
  ### [0.1.313](https://github.com/eea/volto-arcgis-block/compare/0.1.312...0.1.313) - 11 November 2024
8
19
 
9
20
  ### [0.1.312](https://github.com/eea/volto-arcgis-block/compare/0.1.311...0.1.312) - 8 November 2024
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.313",
3
+ "version": "0.1.315",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -134,10 +134,11 @@ class InfoWidget extends React.Component {
134
134
  }
135
135
  }
136
136
  }
137
- } else {
137
+ }
138
+ if (!title) {
138
139
  title = this.getLayerTitle(layer);
139
140
  }
140
- if (layer.isTimeSeries) {
141
+ if (layer?.isTimeSeries) {
141
142
  if (layer.url.toLowerCase().includes('wms')) {
142
143
  layerTypes.push({
143
144
  isTimeSeries: true,
@@ -164,14 +165,33 @@ class InfoWidget extends React.Component {
164
165
  promises.push(this.identify(layer, e));
165
166
  }
166
167
  } else {
167
- if (layer.url.toLowerCase().includes('wms')) {
168
+ if (layer.url?.toLowerCase().endsWith('mapserver')) {
169
+ const capabilitiesIndex = {
170
+ 1: 13,
171
+ 2: 12,
172
+ 3: 11,
173
+ 4: 10,
174
+ 5: 9,
175
+ 7: 7,
176
+ 8: 6,
177
+ 9: 5,
178
+ 10: 4,
179
+ 11: 3,
180
+ 12: 0,
181
+ 13: 1,
182
+ };
183
+
168
184
  layerTypes.push({
169
185
  isTimeSeries: false,
170
- type: 'wms',
186
+ type: 'map-image',
171
187
  title: title,
172
188
  fields: layer.fields,
173
189
  });
174
- promises.push(this.identifyWMS(layer, e));
190
+ capabilitiesIndex[index] !== undefined
191
+ ? promises.push(
192
+ this.ogcCapabilities(layer, capabilitiesIndex[index]),
193
+ )
194
+ : promises.push(Promise.reject());
175
195
  } else if (layer.url.toLowerCase().includes('wmts')) {
176
196
  layerTypes.push({
177
197
  isTimeSeries: false,
@@ -205,7 +225,7 @@ class InfoWidget extends React.Component {
205
225
  fields: layer.fields,
206
226
  };
207
227
  } else {
208
- if (layer.isTimeSeries) {
228
+ if (layer?.isTimeSeries) {
209
229
  switch (layer.type) {
210
230
  case 'wms':
211
231
  if (data.type === 'FeatureCollection') {
@@ -355,6 +375,26 @@ class InfoWidget extends React.Component {
355
375
  fields: layer.fields,
356
376
  };
357
377
  break;
378
+ case 'map-image':
379
+ if (properties.length) properties = [];
380
+ if (data && data.fields) {
381
+ properties = data.fields
382
+ .map((field) => {
383
+ return Object.entries(field).map(
384
+ ([key, value]) => {
385
+ return [key, value];
386
+ },
387
+ );
388
+ })
389
+ .flat();
390
+ }
391
+ this.infoData[index] = {
392
+ title: layer.title,
393
+ data: properties,
394
+ message: message,
395
+ fields: layer.fields,
396
+ };
397
+ break;
358
398
  default:
359
399
  break;
360
400
  }
@@ -381,6 +421,8 @@ class InfoWidget extends React.Component {
381
421
  if (layer.url.toLowerCase().includes('wmts')) {
382
422
  // CLMS-1105
383
423
  title = layer._wmtsTitle;
424
+ } else if (layer.url.toLowerCase().toLowerCase().endsWith('mapserver')) {
425
+ title = layer.title;
384
426
  } else {
385
427
  if (layer.sublayers) {
386
428
  title = layer.sublayers.items[0].title;
@@ -482,6 +524,18 @@ class InfoWidget extends React.Component {
482
524
  });
483
525
  }
484
526
 
527
+ ogcCapabilities(layer, index) {
528
+ let url = `${layer.url}/${index}?f=pjson`;
529
+ return esriRequest(url, {
530
+ responseType: 'application/json',
531
+ sync: 'true',
532
+ }).then((response) => {
533
+ if (!response) return;
534
+ let data = JSON.parse(response.data);
535
+ return data;
536
+ });
537
+ }
538
+
485
539
  parseCapabilities(xml, tag) {
486
540
  let result = xml.getElementsByTagName(tag);
487
541
 
@@ -683,11 +683,16 @@ class MenuWidget extends React.Component {
683
683
  // and ensure that the component is rendered again
684
684
  this.setState({ showMapMenu: false });
685
685
  } else {
686
- const container = this.container.current;
687
- if (!this.container.current) return;
688
- const tabContainer = container.querySelector('#tabcontainer');
689
- const paneles = container.querySelector('#paneles');
690
- const esriWidgetButton = container.querySelector(
686
+ /*
687
+ The following variables have been changed from container
688
+ to this.container.current to avoid data viewer crash
689
+ when client comes from dataset / product pages or refreshing
690
+ */
691
+ const tabContainer = this.container.current.querySelector(
692
+ '#tabcontainer',
693
+ );
694
+ const paneles = this.container.current.querySelector('#paneles');
695
+ const esriWidgetButton = this.container.current.querySelector(
691
696
  '.esri-widget--button',
692
697
  );
693
698
  const timeSliderContainer = document.querySelector(
@@ -719,7 +724,7 @@ class MenuWidget extends React.Component {
719
724
  // and ensure that the component is rendered again
720
725
  this.setState({ showMapMenu: true });
721
726
  }
722
- if (this.loadFirst) {
727
+ if (this.loadFirst && this.container.current) {
723
728
  this.checkUrl();
724
729
  this.loadFirst = false;
725
730
  this.zoomTooltips();
@@ -822,13 +827,6 @@ class MenuWidget extends React.Component {
822
827
  }, 1000);
823
828
  }
824
829
 
825
- waitForContainer(mapdiv) {
826
- while (mapdiv === null) {
827
- new Promise((resolve) => setTimeout(resolve, 100)); // wait for 100ms
828
- }
829
- return mapdiv;
830
- }
831
-
832
830
  /**
833
831
  * This method is executed after the render method is executed
834
832
  */
@@ -875,11 +873,6 @@ class MenuWidget extends React.Component {
875
873
  this.props.bookmarkData === undefined
876
874
  ) {
877
875
  return;
878
- //} else if (
879
- // this.props.bookmarkData &&
880
- // this.props.bookmarkData.active === false
881
- //) {
882
- // return;
883
876
  } else if (
884
877
  this.props.bookmarkData &&
885
878
  this.props.bookmarkData.active === true
@@ -897,13 +890,11 @@ class MenuWidget extends React.Component {
897
890
  let visibleArray = this.props.bookmarkData.visible[pos];
898
891
  visible =
899
892
  String(visibleArray[index]) === 'true' ? true : false;
900
- //this.layers[layer].visible = visible;
901
893
  if (this.layers[layer]) {
902
894
  let opacityArray = this.props.bookmarkData.opacity[pos];
903
895
  this.layers[layer].opacity = opacityArray[index];
904
896
  }
905
897
  }
906
- //this.map.layers.add(this.layers[layer]);
907
898
  node.checked = true;
908
899
  this.toggleLayer(node);
909
900
  if (visible === false) {