@eeacms/volto-arcgis-block 0.1.76 → 0.1.78

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,7 +4,18 @@ 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.76](https://github.com/eea/volto-arcgis-block/compare/0.1.75...0.1.76) - 25 November 2022
7
+ ### [0.1.78](https://github.com/eea/volto-arcgis-block/compare/0.1.77...0.1.78) - 30 November 2022
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - readme [Mikel Larreategi - [`cd1dd61`](https://github.com/eea/volto-arcgis-block/commit/cd1dd61efb9ccc4bb0969c11cd4b7f9113ec91b9)]
12
+ ### [0.1.77](https://github.com/eea/volto-arcgis-block/compare/0.1.76...0.1.77) - 30 November 2022
13
+
14
+ #### :rocket: New Features
15
+
16
+ - feat: Show modal to user when opening the download map viewer for datasets that cannot be visualised on the map - CLMS-1544 [joewdavies - [`4d22881`](https://github.com/eea/volto-arcgis-block/commit/4d2288109b9b858bc561baadd1dc0e581fceb461)]
17
+
18
+ ### [0.1.76](https://github.com/eea/volto-arcgis-block/compare/0.1.75...0.1.76) - 28 November 2022
8
19
 
9
20
  #### :rocket: New Features
10
21
 
package/README.md CHANGED
@@ -25,7 +25,6 @@ This endpoint is called `@mapviewer` and an example implementation is in the [cl
25
25
 
26
26
  This means that the product is not generic enough to show any ArcGIS map.
27
27
 
28
- ![Demo example volto-arcgis-block](docs/demo.gif)
29
28
 
30
29
  ## Styling
31
30
  To create custom styles, we need to add it in the block configuration and import the Less file into our project.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.76",
3
+ "version": "0.1.78",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -92,12 +92,13 @@ export const AddCartItem = ({
92
92
  unique_id: `${id}-${new Date().getTime()}`,
93
93
  area: area,
94
94
  };
95
- if (
96
- dataset.IsTimeSeries &&
97
- datasetElem
98
- .querySelector('.map-dataset-checkbox input')
99
- .hasAttribute('time-start')
100
- ) {
95
+ let hasTimeStart = datasetElem
96
+ ? datasetElem
97
+ .querySelector('.map-dataset-checkbox input')
98
+ .hasAttribute('time-start')
99
+ : false;
100
+
101
+ if (dataset.IsTimeSeries && hasTimeStart) {
101
102
  let datasetInput = datasetElem.querySelector(
102
103
  '.map-dataset-checkbox input',
103
104
  );
@@ -412,7 +413,11 @@ class MenuWidget extends React.Component {
412
413
  this.container = createRef();
413
414
  //Initially, we set the state of the component to
414
415
  //not be showing the basemap panel
415
- this.state = { showMapMenu: false, tms_jsx: null };
416
+ this.state = {
417
+ showMapMenu: false,
418
+ noServiceModal: true,
419
+ setNoServiceModal: true,
420
+ };
416
421
  // call the props of the layers list (mapviewer.jsx)
417
422
  this.compCfg = this.props.conf;
418
423
  this.map = this.props.map;
@@ -490,6 +495,16 @@ class MenuWidget extends React.Component {
490
495
  return Promise.all(promises);
491
496
  }
492
497
 
498
+ closeNoServiceModal = (e) => {
499
+ if (e) e.stopPropagation();
500
+ this.setState({ noServiceModal: false });
501
+ };
502
+
503
+ showNoServiceModal = (e) => {
504
+ if (e) e.stopPropagation();
505
+ this.setState({ noServiceModal: true });
506
+ };
507
+
493
508
  /**
494
509
  * Method that will be invoked when the
495
510
  * button is clicked. It controls the open
@@ -541,7 +556,7 @@ class MenuWidget extends React.Component {
541
556
  if (this.props.download && this.layers) {
542
557
  let layerid = Object.keys(this.layers)[0];
543
558
 
544
- if (this.layers[layerid].isTimeSeries) {
559
+ if (layerid && this.layers[layerid].isTimeSeries) {
545
560
  // select active on map tab
546
561
  let event = new MouseEvent('click', {
547
562
  view: window,
@@ -1641,8 +1656,10 @@ class MenuWidget extends React.Component {
1641
1656
  }
1642
1657
 
1643
1658
  datasetChecks.forEach((element) => {
1644
- element.checked = value;
1645
- this.toggleDataset(value, element.id, element);
1659
+ if (element) {
1660
+ element.checked = value;
1661
+ this.toggleDataset(value, element.id, element);
1662
+ }
1646
1663
  });
1647
1664
  }
1648
1665
 
@@ -2534,6 +2551,52 @@ class MenuWidget extends React.Component {
2534
2551
  />
2535
2552
  </div>
2536
2553
  )}
2554
+
2555
+ {this.props.download &&
2556
+ this.layers &&
2557
+ !Object.keys(this.layers)[0] && (
2558
+ // CLMS-1588 show modal if download and dataset has no dataset to show
2559
+
2560
+ <>
2561
+ <Modal
2562
+ size="tiny"
2563
+ open={this.state.noServiceModal}
2564
+ onClose={() => this.closeNoServiceModal()}
2565
+ onOpen={() => this.showNoServiceModal()}
2566
+ className="map-download-modal"
2567
+ >
2568
+ <div className="modal-close modal-clms-close">
2569
+ <span
2570
+ className="ccl-icon-close"
2571
+ onClick={(e) => this.closeNoServiceModal(e)}
2572
+ onKeyDown={(e) => this.closeNoServiceModal(e)}
2573
+ aria-label="Close"
2574
+ tabIndex="0"
2575
+ role="button"
2576
+ ></span>
2577
+ </div>
2578
+ <Modal.Content>
2579
+ <p>
2580
+ This dataset cannot be visualised on the map, only
2581
+ downloaded.
2582
+ </p>
2583
+ </Modal.Content>
2584
+ <Modal.Actions>
2585
+ <div
2586
+ className="map-download-buttons"
2587
+ style={{ textAlign: 'center', display: 'block' }}
2588
+ >
2589
+ <button
2590
+ className="ccl-button ccl-button-green"
2591
+ onClick={(e) => this.closeNoServiceModal(e)}
2592
+ >
2593
+ Continue
2594
+ </button>
2595
+ </div>
2596
+ </Modal.Actions>
2597
+ </Modal>
2598
+ </>
2599
+ )}
2537
2600
  </div>
2538
2601
  </div>
2539
2602
  <div tooltip="Menu of products" direction="right" type="widget">