@eeacms/volto-arcgis-block 0.1.295 → 0.1.297

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,12 +4,26 @@ 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.297](https://github.com/eea/volto-arcgis-block/compare/0.1.296...0.1.297) - 16 July 2024
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - CLMS-272374 (Feat):Area search by code zoom [Urkorue - [`513bbf0`](https://github.com/eea/volto-arcgis-block/commit/513bbf0290aebabafd9a06e16cfd096fbe9fa6fa)]
12
+ - CLMS-272327 (Feat): Upload file improvements [Urkorue - [`7abfe58`](https://github.com/eea/volto-arcgis-block/commit/7abfe58503fd83b532e5a74c15f3a61370fa1177)]
13
+ ### [0.1.296](https://github.com/eea/volto-arcgis-block/compare/0.1.295...0.1.296) - 15 July 2024
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - Merge pull request #805 from eea/develop [Unai Bolivar - [`33ca8ca`](https://github.com/eea/volto-arcgis-block/commit/33ca8ca8f2751181398d91e0bb19826dce8a8dc6)]
18
+ - Update package.json [Urkorue - [`f2367f1`](https://github.com/eea/volto-arcgis-block/commit/f2367f1080939a66d18f2ecce5f28fec0250b961)]
19
+ - Update CHANGELOG.md [Urkorue - [`8bb1b46`](https://github.com/eea/volto-arcgis-block/commit/8bb1b465bf67e2d8aa243f99ab3fadd8975c0b4d)]
20
+ - CLMS-272327 (Feat):Upload file improves [Urkorue - [`fc9104d`](https://github.com/eea/volto-arcgis-block/commit/fc9104d8984d1b8bd86672299a07389ba44294da)]
21
+ - no lazy load rollback 2 [Unai Bolivar - [`5458a0e`](https://github.com/eea/volto-arcgis-block/commit/5458a0ec00966717f5aa5a56d2f215562489a649)]
7
22
  ### [0.1.295](https://github.com/eea/volto-arcgis-block/compare/0.1.294...0.1.295) - 12 July 2024
8
23
 
9
24
  #### :hammer_and_wrench: Others
10
25
 
11
26
  - Fix prettier [Tiberiu Ichim - [`cf8c30b`](https://github.com/eea/volto-arcgis-block/commit/cf8c30b494fc7c40578dbb6bf2ccc7518b31949f)]
12
- - Use icon component from fortawesome [Tiberiu Ichim - [`369a64d`](https://github.com/eea/volto-arcgis-block/commit/369a64d0cc977be402885dd9d24400dd11580aa4)]
13
27
  ### [0.1.294](https://github.com/eea/volto-arcgis-block/compare/0.1.293...0.1.294) - 11 July 2024
14
28
 
15
29
  #### :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.295",
3
+ "version": "0.1.297",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -153,6 +153,7 @@ class AreaWidget extends React.Component {
153
153
  showInfoPopup: false,
154
154
  infoPopupType: 'area',
155
155
  });
156
+ this.props.uploadFileHandler(true);
156
157
  this.clearWidget();
157
158
  this.removeFileUploadedLayer();
158
159
  this.container.current.querySelector(
@@ -188,6 +189,7 @@ class AreaWidget extends React.Component {
188
189
  showInfoPopup: true,
189
190
  infoPopupType: 'area',
190
191
  });
192
+ this.props.uploadFileHandler(true);
191
193
  this.container.current.querySelector('input:checked').click();
192
194
  }
193
195
  }
@@ -220,11 +222,13 @@ class AreaWidget extends React.Component {
220
222
  showInfoPopup: true,
221
223
  infoPopupType: 'prepackage',
222
224
  });
225
+ this.props.uploadFileHandler(true);
223
226
  } else {
224
227
  this.setState({
225
228
  showInfoPopup: true,
226
229
  infoPopupType: 'area',
227
230
  });
231
+ this.props.uploadFileHandler(true);
228
232
  }
229
233
  }
230
234
  nuts0handler(e) {
@@ -305,6 +309,7 @@ class AreaWidget extends React.Component {
305
309
  };
306
310
 
307
311
  handleFileUpload = (e) => {
312
+ this.removeNutsLayers();
308
313
  //Get the file name
309
314
 
310
315
  const fileName = e.target.value.toLowerCase();
@@ -340,6 +345,7 @@ class AreaWidget extends React.Component {
340
345
  showInfoPopup: true,
341
346
  infoPopupType: 'fileFormat',
342
347
  });
348
+ this.props.uploadFileHandler(false);
343
349
  return;
344
350
  }
345
351
 
@@ -354,6 +360,7 @@ class AreaWidget extends React.Component {
354
360
  showInfoPopup: true,
355
361
  infoPopupType: 'fileLimit',
356
362
  });
363
+ this.props.uploadFileHandler(false);
357
364
  return;
358
365
  }
359
366
 
@@ -362,6 +369,7 @@ class AreaWidget extends React.Component {
362
369
  showInfoPopup: true,
363
370
  infoPopupType: 'shapefileLimit',
364
371
  });
372
+ this.props.uploadFileHandler(false);
365
373
  return;
366
374
  }
367
375
 
@@ -389,6 +397,7 @@ class AreaWidget extends React.Component {
389
397
  setTimeout(() => {
390
398
  e.target.value = null;
391
399
  }, 2000);
400
+ this.props.uploadFileHandler(this.state.infoPopupType);
392
401
  };
393
402
 
394
403
  generateFeatureCollection(fileName, file, inputFormat) {
@@ -444,6 +453,7 @@ class AreaWidget extends React.Component {
444
453
  showInfoPopup: true,
445
454
  infoPopupType: 'invalidShapefile',
446
455
  });
456
+ this.props.uploadFileHandler(false);
447
457
  return;
448
458
  }
449
459
 
@@ -464,6 +474,7 @@ class AreaWidget extends React.Component {
464
474
  showInfoPopup: true,
465
475
  infoPopupType: 'invalidShapefile',
466
476
  });
477
+ this.props.uploadFileHandler(false);
467
478
  } else if (
468
479
  error &&
469
480
  error.details &&
@@ -474,7 +485,9 @@ class AreaWidget extends React.Component {
474
485
  showInfoPopup: true,
475
486
  infoPopupType: 'incorrectWkid',
476
487
  });
488
+ this.props.uploadFileHandler(false);
477
489
  } else {
490
+ this.props.uploadFileHandler(false);
478
491
  // Handle other errors
479
492
  }
480
493
  });
@@ -534,16 +547,13 @@ class AreaWidget extends React.Component {
534
547
  showInfoPopup: true,
535
548
  infoPopupType: 'fullDataset',
536
549
  });
550
+ this.props.uploadFileHandler(true);
537
551
  } else {
538
552
  //Remove old uploaded file and save new one to component props for reference
539
553
 
540
554
  this.removeFileUploadedLayer();
541
555
  this.fileUploadLayer = { layers: layers, sourceGraphics: sourceGraphics };
542
556
 
543
- //remove NUTS and COUNTRIES layers from map
544
-
545
- this.removeNutsLayers();
546
-
547
557
  //Add uploaded layer to the map and zoom to the extent
548
558
 
549
559
  this.props.view.graphics.addMany(sourceGraphics);
@@ -579,7 +589,7 @@ class AreaWidget extends React.Component {
579
589
  showInfoPopup: true,
580
590
  infoPopupType: 'download',
581
591
  });
582
-
592
+ this.props.uploadFileHandler(true);
583
593
  //Save file upload layer to session storage as a tag for adding item to cart action
584
594
 
585
595
  sessionStorage.setItem(
@@ -597,6 +607,7 @@ class AreaWidget extends React.Component {
597
607
  showInfoPopup: true,
598
608
  infoPopupType: 'singleFeature',
599
609
  });
610
+ this.props.uploadFileHandler(false);
600
611
  return false;
601
612
  } else {
602
613
  return true;
@@ -657,12 +668,23 @@ class AreaWidget extends React.Component {
657
668
 
658
669
  //Check if the file extent is larger than the limit
659
670
  //If checkExtent() is false, add the layer to the map
660
-
661
- if (this.checkExtent(csvExtent.extent)) {
671
+ if (
672
+ csvExtent.extent.width === null ||
673
+ csvExtent.extent.width === undefined ||
674
+ csvExtent.extent.height === null ||
675
+ csvExtent.extent.height === undefined
676
+ ) {
677
+ this.setState({
678
+ showInfoPopup: true,
679
+ infoPopupType: 'fileFormat',
680
+ });
681
+ this.props.uploadFileHandler(false);
682
+ } else if (this.checkExtent(csvExtent.extent)) {
662
683
  this.setState({
663
684
  showInfoPopup: true,
664
685
  infoPopupType: 'fullDataset',
665
686
  });
687
+ this.props.uploadFileHandler(true);
666
688
  } else {
667
689
  //Draw a polygon around of the CSVlayer Features data
668
690
 
@@ -726,10 +748,6 @@ class AreaWidget extends React.Component {
726
748
  sourceGraphics: polygonGraphic,
727
749
  };
728
750
 
729
- //Clean the map before adding the graphic
730
-
731
- this.removeNutsLayers();
732
-
733
751
  //Add the polygon graphic to the map
734
752
 
735
753
  this.props.view.graphics.add(polygonGraphic);
@@ -759,6 +777,7 @@ class AreaWidget extends React.Component {
759
777
  showInfoPopup: true,
760
778
  infoPopupType: 'download',
761
779
  });
780
+ this.props.uploadFileHandler(true);
762
781
 
763
782
  //Save file upload layer to session storage as a tag for adding item to cart action
764
783
 
@@ -768,6 +787,11 @@ class AreaWidget extends React.Component {
768
787
  );
769
788
  }
770
789
  } catch (error) {
790
+ this.setState({
791
+ showInfoPopup: true,
792
+ infoPopupType: 'fileFormat',
793
+ });
794
+ this.props.uploadFileHandler(false);
771
795
  //console.error('Error: ', error);
772
796
  }
773
797
  }
@@ -784,6 +808,7 @@ class AreaWidget extends React.Component {
784
808
  showInfoPopup: true,
785
809
  infoPopupType: 'incorrectWkid',
786
810
  });
811
+ this.props.uploadFileHandler(false);
787
812
  }
788
813
  }
789
814
 
@@ -871,11 +896,13 @@ class AreaWidget extends React.Component {
871
896
  showInfoPopup: true,
872
897
  infoPopupType: 'fullDataset',
873
898
  });
899
+ this.props.uploadFileHandler(true);
874
900
  } else {
875
901
  this.setState({
876
902
  showInfoPopup: true,
877
903
  infoPopupType: 'download',
878
904
  });
905
+ this.props.uploadFileHandler(true);
879
906
  }
880
907
  if (this.props.download) {
881
908
  if (extentGraphic && this.checkExtent(extentGraphic.geometry)) {
@@ -915,11 +942,13 @@ class AreaWidget extends React.Component {
915
942
  showInfoPopup: true,
916
943
  infoPopupType: 'fullDataset',
917
944
  });
945
+ this.props.uploadFileHandler(true);
918
946
  } else {
919
947
  this.setState({
920
948
  showInfoPopup: true,
921
949
  infoPopupType: 'download',
922
950
  });
951
+ this.props.uploadFileHandler(true);
923
952
  }
924
953
  if (this.props.download) {
925
954
  if (extentGraphic && this.checkExtent(extentGraphic.geometry)) {
@@ -967,6 +996,7 @@ class AreaWidget extends React.Component {
967
996
  this.setState({
968
997
  infoPopupType: 'area',
969
998
  });
999
+ this.props.uploadFileHandler(true);
970
1000
  if (sessionStorage.getItem('fileUploadLayer')) {
971
1001
  sessionStorage.removeItem('fileUploadLayer');
972
1002
  }
@@ -1039,6 +1069,8 @@ class AreaWidget extends React.Component {
1039
1069
  showInfoPopup: true,
1040
1070
  infoPopupType: 'download',
1041
1071
  });
1072
+ this.props.uploadFileHandler(true);
1073
+ this.props.view.goTo(feature.geometry);
1042
1074
  }
1043
1075
  });
1044
1076
  if (!found && count === 0) {
@@ -1106,6 +1138,7 @@ class AreaWidget extends React.Component {
1106
1138
  showInfoPopup: true,
1107
1139
  infoPopupType: 'download',
1108
1140
  });
1141
+ this.props.uploadFileHandler(true);
1109
1142
  if (this.props.download) {
1110
1143
  document.querySelector(
1111
1144
  '.drawRectanglePopup-block',
@@ -1575,6 +1608,16 @@ class AreaWidget extends React.Component {
1575
1608
  </div>
1576
1609
  </>
1577
1610
  )}
1611
+ {this.state.infoPopupType === 'invalidFileFormat' && (
1612
+ <>
1613
+ <span className="drawRectanglePopup-icon">
1614
+ <FontAwesomeIcon icon={['fas', 'info-circle']} />
1615
+ </span>
1616
+ <div className="drawRectanglePopup-text">
1617
+ The file content is not correctly formatted.
1618
+ </div>
1619
+ </>
1620
+ )}
1578
1621
  </div>
1579
1622
  </div>
1580
1623
  </div>
@@ -56,6 +56,7 @@ class MapViewer extends React.Component {
56
56
  this.state = {
57
57
  layerLoading: false,
58
58
  layers: {},
59
+ uploadedFile: true,
59
60
  };
60
61
  this.activeLayersHandler = this.activeLayersHandler.bind(this);
61
62
  this.activeLayersArray = {};
@@ -67,6 +68,7 @@ class MapViewer extends React.Component {
67
68
  this.mapLayersHandler = this.mapLayersHandler.bind(this);
68
69
  this.bookmarkHandler = this.bookmarkHandler.bind(this);
69
70
  this.prepackageHandler = this.prepackageHandler.bind(this);
71
+ this.uploadFileHandler = this.uploadFileHandler.bind(this);
70
72
  }
71
73
 
72
74
  mapLayersHandler(newLayers) {
@@ -119,6 +121,10 @@ class MapViewer extends React.Component {
119
121
  this.setState({ prepackageChecked: prepackage });
120
122
  }
121
123
 
124
+ uploadFileHandler(message) {
125
+ this.setState({ uploadedFile: message });
126
+ }
127
+
122
128
  loader() {
123
129
  return loadModules([
124
130
  'esri/WebMap',
@@ -427,6 +433,8 @@ class MapViewer extends React.Component {
427
433
  bookmarkHandler={this.bookmarkHandler}
428
434
  prepackageChecked={this.state.prepackageChecked}
429
435
  prepackageHandler={this.prepackageHandler}
436
+ uploadedFile={this.state.uploadedFile}
437
+ uploadFileHandler={this.uploadFileHandler}
430
438
  />
431
439
  ); //call conf
432
440
  }
@@ -499,6 +507,8 @@ export const CheckLogin = ({ reference }) => {
499
507
  mapviewer_config={reference.props.mapviewer_config}
500
508
  prepackageChecked={reference.state.prepackageChecked}
501
509
  prepackageHandler={reference.prepackageHandler}
510
+ uploadedFile={reference.state.uploadedFile}
511
+ uploadFileHandler={reference.uploadFileHandler}
502
512
  />
503
513
  )}
504
514
  </>
@@ -29,6 +29,7 @@ export const AddCartItem = ({
29
29
  dataset,
30
30
  handleOpenPopup,
31
31
  prepackage,
32
+ uploadedFile,
32
33
  }) => {
33
34
  const { addCartItem, isLoggedIn } = useCartState();
34
35
 
@@ -187,7 +188,7 @@ export const AddCartItem = ({
187
188
  Add to cart
188
189
  </button>
189
190
  </div>
190
- ) : isLoggedIn && !prepackage ? ( // If isLoggedIn == true and user clicks download
191
+ ) : isLoggedIn && !prepackage && uploadedFile ? ( // If isLoggedIn == true and user clicks download
191
192
  <Popup
192
193
  trigger={
193
194
  <span
@@ -285,6 +286,25 @@ export const AddCartItem = ({
285
286
  }
286
287
  {...popupSettings}
287
288
  />
289
+ ) : isLoggedIn && !uploadedFile ? (
290
+ <Popup
291
+ trigger={
292
+ <span
293
+ className={'map-menu-icon map-menu-icon-login'}
294
+ onKeyDown={(e) => {}}
295
+ tabIndex="0"
296
+ role="button"
297
+ >
298
+ <FontAwesomeIcon
299
+ className={' locked'}
300
+ icon={['fas', 'download']}
301
+ />
302
+ <FontAwesomeIcon icon={['fas', 'lock']} />
303
+ </span>
304
+ }
305
+ content={'Uploaded file has an error'}
306
+ {...popupSettings}
307
+ />
288
308
  ) : (
289
309
  // If isLoggedIn == false and user clicks download
290
310
  <Popup
@@ -1500,6 +1520,7 @@ class MenuWidget extends React.Component {
1500
1520
  dataset={dataset}
1501
1521
  handleOpenPopup={this.handleOpenPopup}
1502
1522
  prepackage={this.props.prepackageChecked}
1523
+ uploadedFile={this.props.uploadedFile}
1503
1524
  />
1504
1525
  ) : (
1505
1526
  <span
@@ -4002,6 +4023,7 @@ class MenuWidget extends React.Component {
4002
4023
  areaData={this.props.area}
4003
4024
  handleOpenPopup={this.handleOpenPopup}
4004
4025
  prepackage={this.props.prepackageChecked}
4026
+ uploadedFile={this.props.uploadedFile}
4005
4027
  />
4006
4028
  </div>
4007
4029
  )}