@eeacms/volto-arcgis-block 0.1.24 → 0.1.25

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,19 @@ 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.25](https://github.com/eea/volto-arcgis-block/compare/0.1.24...0.1.25)
8
+
9
+ - Bugs n improvements [`#82`](https://github.com/eea/volto-arcgis-block/pull/82)
10
+ - ESLint fix [`c129348`](https://github.com/eea/volto-arcgis-block/commit/c129348ee3886e0419029dd2bfe835c28878444c)
11
+ - Filter by product and dataset [`c89711a`](https://github.com/eea/volto-arcgis-block/commit/c89711acf4f46c8426c7e34add2baf4debe67697)
12
+ - ESLint fix [`406842a`](https://github.com/eea/volto-arcgis-block/commit/406842a54f1964bf2b4b0e709719028a5a47a903)
13
+ - Timeslider bug fixing [`c7a8345`](https://github.com/eea/volto-arcgis-block/commit/c7a834538a54a8c48e2e34259d3d733a1194007a)
14
+
7
15
  #### [0.1.24](https://github.com/eea/volto-arcgis-block/compare/0.1.23...0.1.24)
8
16
 
17
+ > 21 December 2021
18
+
19
+ - Develop [`#77`](https://github.com/eea/volto-arcgis-block/pull/77)
9
20
  - Bugs n improvements [`#80`](https://github.com/eea/volto-arcgis-block/pull/80)
10
21
  - The area array to a json object and added a unique_id to the cart [`#79`](https://github.com/eea/volto-arcgis-block/pull/79)
11
22
  - Remove Global from legend [`#76`](https://github.com/eea/volto-arcgis-block/pull/76)
package/Jenkinsfile CHANGED
@@ -124,7 +124,7 @@ pipeline {
124
124
  node(label: 'docker') {
125
125
  script {
126
126
  try {
127
- sh '''docker pull plone; docker run -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
127
+ sh '''docker pull plone; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
128
128
  sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=test plone/volto-addon-ci cypress'''
129
129
  } finally {
130
130
  try {
@@ -142,7 +142,8 @@ pipeline {
142
142
  reportName: 'CypressCoverage',
143
143
  reportTitles: 'Integration Tests Code Coverage'])
144
144
  }
145
- archiveArtifacts artifacts: 'cypress-reports/videos/*.mp4', fingerprint: true
145
+ sh '''touch empty_file; for ok_test in $(grep -E 'file=.*failures="0"' $(grep 'testsuites .*failures="0"' $(find cypress-results -name *.xml) empty_file | awk -F: '{print $1}') empty_file | sed 's/.* file="\\(.*\\)" time.*/\\1/' | sed 's#^cypress/integration/##g' | sed 's#^../../../node_modules/@eeacms/##g'); do rm -f cypress-reports/videos/$ok_test.mp4; rm -f cypress-reports/$ok_test.mp4; done'''
146
+ archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: true
146
147
  stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true
147
148
  }
148
149
  finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -71,7 +71,7 @@ class InfoWidget extends React.Component {
71
71
  this.props.view.on('click', (e) => {
72
72
  if (this.props.mapViewer.activeWidget === this) {
73
73
  let timeLayers = this.map.layers.items.filter(
74
- (a) => a.timeInfo && a.visible,
74
+ (a) => a.isTimeSeries && a.visible,
75
75
  );
76
76
  let layer = timeLayers[timeLayers.length - 1];
77
77
  let title;
@@ -316,6 +316,25 @@ class MenuWidget extends React.Component {
316
316
  }
317
317
  //to watch the component
318
318
  this.setState({});
319
+ this.checkUrl();
320
+ }
321
+
322
+ checkUrl() {
323
+ let url = new URL(window.location.href);
324
+ let product = url.searchParams.get('product');
325
+ let dataset = url.searchParams.get('dataset');
326
+ if (product || dataset) {
327
+ let event = new MouseEvent('click', {
328
+ view: window,
329
+ bubbles: true,
330
+ cancelable: false,
331
+ });
332
+ let elem = product
333
+ ? '[productid="' + product + '"]'
334
+ : '[datasetid="' + dataset + '"]';
335
+ let node = document.querySelector(elem + ' input');
336
+ node.dispatchEvent(event);
337
+ }
319
338
  }
320
339
 
321
340
  /**
@@ -416,6 +435,7 @@ class MenuWidget extends React.Component {
416
435
  <div
417
436
  className="map-menu-product-dropdown"
418
437
  id={'product_' + inheritedIndexProduct}
438
+ productid={product.ProductId}
419
439
  key={'a' + prodIndex}
420
440
  >
421
441
  <fieldset className="ccl-fieldset" key={'b' + prodIndex}>
@@ -523,8 +543,6 @@ class MenuWidget extends React.Component {
523
543
  dataset.Layer[0].LayerId + '_' + inheritedIndexDataset + '_0',
524
544
  );
525
545
  }
526
- // ./dataset-catalogue/dataset-info.html
527
- // ./dataset-catalogue/dataset-download.html
528
546
 
529
547
  return (
530
548
  <div
@@ -638,6 +656,7 @@ class MenuWidget extends React.Component {
638
656
  legendUrl: urlWMS + legendRequest + layer.LayerId,
639
657
  },
640
658
  ],
659
+ isTimeSeries: isTimeSeries,
641
660
  });
642
661
  } else if (urlWMS.toLowerCase().includes('wmts')) {
643
662
  this.layers[layer.LayerId + '_' + inheritedIndexLayer] = new WMTSLayer({
@@ -648,6 +667,7 @@ class MenuWidget extends React.Component {
648
667
  id: layer.LayerId,
649
668
  title: layer.Title,
650
669
  },
670
+ isTimeSeries: isTimeSeries,
651
671
  });
652
672
  } else {
653
673
  this.layers[
@@ -657,6 +677,7 @@ class MenuWidget extends React.Component {
657
677
  id: layer.LayerId,
658
678
  title: layer.Title,
659
679
  popupEnabled: true,
680
+ isTimeSeries: isTimeSeries,
660
681
  });
661
682
  }
662
683
  }
@@ -701,7 +722,6 @@ class MenuWidget extends React.Component {
701
722
  if (!this.visibleLayers) this.visibleLayers = {};
702
723
  if (!this.timeLayers) this.timeLayers = {};
703
724
  let parentId = elem.getAttribute('parentid');
704
- let layerId = elem.getAttribute('layerid');
705
725
  if (elem.checked) {
706
726
  this.map.add(this.layers[elem.id]);
707
727
  this.visibleLayers[elem.id] = ['fas', 'eye'];
@@ -714,7 +734,10 @@ class MenuWidget extends React.Component {
714
734
  if (nuts) {
715
735
  this.map.reorder(nuts, this.map.layers.items.length + 1);
716
736
  }
717
- if (Object.keys(this.timeLayers).length > 0) {
737
+ if (
738
+ this.map.layers.items.filter((a) => a.isTimeSeries && a.visible)
739
+ .length > 0
740
+ ) {
718
741
  if (!document.querySelector('.info-container')) {
719
742
  let div = document.createElement('div');
720
743
  document.querySelector('.esri-ui-top-right').appendChild(div);
@@ -732,23 +755,15 @@ class MenuWidget extends React.Component {
732
755
  }
733
756
  }
734
757
  } else {
735
- let checkboxes = document.getElementsByName('layerCheckbox');
736
- let repeatedLayers = [];
737
- for (let checkbox = 0; checkbox < checkboxes.length - 1; checkbox++) {
738
- if (checkboxes[checkbox].getAttribute('layerid') === layerId) {
739
- if (checkboxes[checkbox].checked) repeatedLayers.push(repeatedLayers);
740
- }
741
- }
742
- if (repeatedLayers.length === 0) {
743
- this.map.remove(this.layers[elem.id]);
744
- delete this.activeLayersJSON[elem.id];
745
- delete this.visibleLayers[elem.id];
746
- delete this.timeLayers[elem.id];
747
- }
758
+ this.map.remove(this.layers[elem.id]);
759
+ delete this.activeLayersJSON[elem.id];
760
+ delete this.visibleLayers[elem.id];
761
+ delete this.timeLayers[elem.id];
748
762
  }
749
763
  this.updateCheckDataset(parentId);
750
764
  if (
751
- Object.keys(this.timeLayers).length === 0 &&
765
+ this.map.layers.items.filter((a) => a.isTimeSeries && a.visible)
766
+ .length === 0 &&
752
767
  document.querySelector('.info-container')
753
768
  ) {
754
769
  this.props.mapViewer.closeActiveWidget();
@@ -920,10 +935,13 @@ class MenuWidget extends React.Component {
920
935
  let reorder_elem = document.querySelector('#active_layers').firstChild;
921
936
  if (!reorder_elem) return;
922
937
  reorder_elem.setAttribute('layer-order', counter++);
923
- this.layerReorder(reorder_elem.id, counter);
938
+ this.layerReorder(reorder_elem.getAttribute('layer-id'), counter);
924
939
  while ((reorder_elem = reorder_elem.nextSibling)) {
925
940
  reorder_elem.setAttribute('layer-order', counter++);
926
- this.layerReorder(this.layers[reorder_elem.id], counter);
941
+ this.layerReorder(
942
+ this.layers[reorder_elem.getAttribute('layer-id')],
943
+ counter,
944
+ );
927
945
  }
928
946
  }
929
947
 
@@ -986,15 +1004,15 @@ class MenuWidget extends React.Component {
986
1004
  document.querySelector('#download_label').classList.add('locked');
987
1005
  this.activeLayersJSON[elem.id] = this.addActiveLayer(elem, order);
988
1006
  } else {
989
- if (this.visibleLayers[elem.id][1] === 'eye') {
990
- this.layers[elem.id].visible = false;
991
- this.visibleLayers[elem.id] = ['fas', 'eye-slash'];
1007
+ if (this.visibleLayers[layerId][1] === 'eye') {
1008
+ this.layers[layerId].visible = false;
1009
+ this.visibleLayers[layerId] = ['fas', 'eye-slash'];
992
1010
  }
993
1011
  document
994
- .querySelector('.active-layer[layer-id="' + elem.id + '"]')
1012
+ .querySelector('.active-layer[layer-id="' + layerId + '"]')
995
1013
  .classList.add('locked');
996
- this.activeLayersJSON[elem.id] = this.addActiveLayer(
997
- document.getElementById(elem.id),
1014
+ this.activeLayersJSON[layerId] = this.addActiveLayer(
1015
+ document.getElementById(layerId),
998
1016
  order,
999
1017
  );
1000
1018
  }
@@ -1028,16 +1046,16 @@ class MenuWidget extends React.Component {
1028
1046
  document.querySelector('.esri-ui-bottom-right'),
1029
1047
  );
1030
1048
  } else {
1031
- if (this.visibleLayers[elem.id][1] === 'eye-slash') {
1032
- this.layers[elem.id].visible = true;
1033
- this.visibleLayers[elem.id] = ['fas', 'eye'];
1034
- this.activeLayersJSON[elem.id] = this.addActiveLayer(
1035
- document.getElementById(elem.id),
1049
+ if (this.visibleLayers[layerId][1] === 'eye-slash') {
1050
+ this.layers[layerId].visible = true;
1051
+ this.visibleLayers[layerId] = ['fas', 'eye'];
1052
+ this.activeLayersJSON[layerId] = this.addActiveLayer(
1053
+ document.getElementById(layerId),
1036
1054
  order,
1037
1055
  );
1038
1056
  }
1039
1057
  document
1040
- .querySelector('.active-layer[layer-id="' + elem.id + '"]')
1058
+ .querySelector('.active-layer[layer-id="' + layerId + '"]')
1041
1059
  .classList.remove('locked');
1042
1060
  }
1043
1061
  });
@@ -57,6 +57,9 @@ class TimesliderWidget extends React.Component {
57
57
  });
58
58
 
59
59
  this.TimesliderWidget.watch('timeExtent', (timeExtent) => {
60
+ if (!this.container.current ? true : false) {
61
+ this.TimesliderWidget.stop();
62
+ }
60
63
  let start = new Date(timeExtent.start).getTime();
61
64
  let end = new Date(timeExtent.end).getTime();
62
65
  this.props.time.elem.setAttribute('time-start', start);