@eeacms/volto-eea-map 1.0.0 → 1.0.2

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,24 @@ 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
- ### [1.0.0](https://github.com/eea/volto-eea-map/compare/0.1.35...1.0.0) - 15 June 2023
7
+ ### [1.0.2](https://github.com/eea/volto-eea-map/compare/1.0.1...1.0.2) - 20 July 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Allow blocks in content type [Tiberiu Ichim - [`2ac09a6`](https://github.com/eea/volto-eea-map/commit/2ac09a613aba07f6cbaf42c386660f2d7d09bd13)]
12
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`403b4c0`](https://github.com/eea/volto-eea-map/commit/403b4c009e5aaded58203bc292ba3baa4631488b)]
13
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`aedb654`](https://github.com/eea/volto-eea-map/commit/aedb6544fd45b147a3385425aba46ffba108f5ca)]
14
+ ### [1.0.1](https://github.com/eea/volto-eea-map/compare/1.0.0...1.0.1) - 22 June 2023
15
+
16
+ #### :rocket: New Features
17
+
18
+ - feat: use map_viz endpoint in eea.api.dataconnector [andreiggr - [`e6ce6dd`](https://github.com/eea/volto-eea-map/commit/e6ce6dd0a87343be8dae945780ef4b9ace6d830a)]
19
+
20
+ #### :house: Internal changes
21
+
22
+ - chore: useeffect updates improvements & cleanup unused layer wwidget [andreiggr - [`1b30d99`](https://github.com/eea/volto-eea-map/commit/1b30d99b481262d0184c8e5ad10331f0315d4f2a)]
23
+
24
+ ## [1.0.0](https://github.com/eea/volto-eea-map/compare/0.1.35...1.0.0) - 15 June 2023
8
25
 
9
26
  #### :bug: Bug Fixes
10
27
 
@@ -54,6 +71,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
54
71
 
55
72
  - chore: clear unused #254131 [andreiggr - [`ccec2ea`](https://github.com/eea/volto-eea-map/commit/ccec2eaab173c905cd4ea0190a9c6cfd630250f9)]
56
73
  - chore: clear block style #254131 [andreiggr - [`af500bc`](https://github.com/eea/volto-eea-map/commit/af500bc10a5f280eff0335f45bae1596d66a7e6b)]
74
+ - chore: [JENKINS] Remove alpha testing version [valentinab25 - [`76b29e5`](https://github.com/eea/volto-eea-map/commit/76b29e510f5156590723831a524bc39dfba6deba)]
57
75
 
58
76
  #### :hammer_and_wrench: Others
59
77
 
@@ -63,6 +81,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
63
81
  - * versions [andreiggr - [`6d9ff2b`](https://github.com/eea/volto-eea-map/commit/6d9ff2b26a236b6445678e3d84698d1c3c0826f4)]
64
82
  - add razzle-plugin-scss dep [andreiggr - [`d74cee5`](https://github.com/eea/volto-eea-map/commit/d74cee51d30c866afe55730e5b25e0bf11d2caea)]
65
83
  - volto-object-widget [andreiggr - [`18d0ed7`](https://github.com/eea/volto-eea-map/commit/18d0ed72c1ba7b0f7159a0eefc09ccea9acee5cb)]
84
+ - Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`5911d01`](https://github.com/eea/volto-eea-map/commit/5911d01f7f3bc79a2c834fab75a9a4ac05d2d042)]
66
85
  ### [0.1.32](https://github.com/eea/volto-eea-map/compare/0.1.31...0.1.32) - 20 February 2023
67
86
 
68
87
  #### :hammer_and_wrench: Others
@@ -70,6 +89,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
70
89
  - remove console.log [tedw87 - [`3aeb3e8`](https://github.com/eea/volto-eea-map/commit/3aeb3e8ec5474387f3cd22eb9b387c6681e17120)]
71
90
  - refactor code [tedw87 - [`6d7830e`](https://github.com/eea/volto-eea-map/commit/6d7830eb934f56c255eea5642bdefba30d892946)]
72
91
  - add Blossom basemap layer [tedw87 - [`5226ee2`](https://github.com/eea/volto-eea-map/commit/5226ee218df3401cf467afbc7a4d720dc30719e1)]
92
+ - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`1dad5c6`](https://github.com/eea/volto-eea-map/commit/1dad5c6617096ff85223165a6dd2b1d5d7deea6a)]
73
93
  ### [0.1.31](https://github.com/eea/volto-eea-map/compare/0.1.30...0.1.31) - 11 November 2022
74
94
 
75
95
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-map",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "@eeacms/volto-eea-map: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -4,8 +4,6 @@ import { SidebarPortal } from '@plone/volto/components';
4
4
  import { connect } from 'react-redux';
5
5
  import { compose } from 'redux';
6
6
 
7
- import { getContent } from '@plone/volto/actions';
8
-
9
7
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
10
8
  import Webmap from '@eeacms/volto-eea-map/components/Webmap';
11
9
  import ExtraViews from '@eeacms/volto-eea-map/components/ExtraViews';
@@ -16,15 +14,10 @@ import {
16
14
  updateBlockQueryFromPageQuery,
17
15
  } from '@eeacms/volto-eea-map/utils';
18
16
 
17
+ import { getVisualization } from '@eeacms/volto-eea-map/actions';
18
+
19
19
  const Edit = (props) => {
20
- const {
21
- block,
22
- data,
23
- onChangeBlock,
24
- selected,
25
- id,
26
- data_provenance = {},
27
- } = props;
20
+ const { block, data, onChangeBlock, selected, data_provenance = {} } = props;
28
21
  const { height = '' } = data;
29
22
  const schema = Schema(props);
30
23
  const [mapData, setMapData] = React.useState('');
@@ -52,7 +45,7 @@ const Edit = (props) => {
52
45
  }, [data.show_legend, data.show_sources, data.dataprotection]);
53
46
 
54
47
  React.useEffect(() => {
55
- props.getContent(props.data.vis_url, null, id);
48
+ props.getVisualization(props.data.vis_url);
56
49
  // eslint-disable-next-line react-hooks/exhaustive-deps
57
50
  }, [props.data.vis_url]);
58
51
 
@@ -91,7 +84,11 @@ const Edit = (props) => {
91
84
  setMapData(updatedMapData);
92
85
 
93
86
  // eslint-disable-next-line react-hooks/exhaustive-deps
94
- }, [props.map_visualization, props.data]);
87
+ }, [
88
+ props.map_visualization,
89
+ props.data.data_query_params,
90
+ props.data.enable_queries,
91
+ ]);
95
92
 
96
93
  return (
97
94
  <>
@@ -132,13 +129,15 @@ export default compose(
132
129
  connect(
133
130
  (state, props) => ({
134
131
  data_query: state.content.data.data_query,
135
- data_provenance:
136
- state.content.subrequests?.[props.id]?.data?.data_provenance,
137
- map_visualization:
138
- state.content.subrequests?.[props.id]?.data?.map_visualization_data,
132
+ map_visualization: props.data.vis_url
133
+ ? state.map_visualizations?.data[props.data.vis_url]?.data
134
+ : '',
135
+ data_provenance: props.data.vis_url
136
+ ? state.map_visualizations?.data[props.data.vis_url]?.data_provenance
137
+ : '',
139
138
  }),
140
139
  {
141
- getContent,
140
+ getVisualization,
142
141
  },
143
142
  ),
144
143
  )(Edit);
@@ -5,19 +5,19 @@ import { compose } from 'redux';
5
5
 
6
6
  import { PrivacyProtection } from '@eeacms/volto-embed';
7
7
 
8
- import { getContent } from '@plone/volto/actions';
9
8
  import Webmap from '@eeacms/volto-eea-map/components/Webmap';
10
9
  import ExtraViews from '@eeacms/volto-eea-map/components/ExtraViews';
11
10
  import { applyQueriesToMapLayers } from '@eeacms/volto-eea-map/utils';
11
+ import { getVisualization } from '@eeacms/volto-eea-map/actions';
12
12
 
13
13
  const View = (props) => {
14
- const { data, id, data_provenance = {} } = props || {};
14
+ const { data, data_provenance = {} } = props || {};
15
15
  const { height = '' } = data;
16
16
 
17
17
  const [mapData, setMapData] = React.useState('');
18
18
 
19
19
  React.useEffect(() => {
20
- props.getContent(props.data.vis_url, null, id);
20
+ props.getVisualization(props.data.vis_url);
21
21
  // eslint-disable-next-line react-hooks/exhaustive-deps
22
22
  }, [props.data.vis_url]);
23
23
 
@@ -30,7 +30,11 @@ const View = (props) => {
30
30
 
31
31
  setMapData(updatedMapData);
32
32
  // eslint-disable-next-line react-hooks/exhaustive-deps
33
- }, [props.map_visualization, props.data]);
33
+ }, [
34
+ props.map_visualization,
35
+ props.data.data_query_params,
36
+ props.data.enable_queries,
37
+ ]);
34
38
 
35
39
  return (
36
40
  <PrivacyProtection data={data} height={height} {...props}>
@@ -56,13 +60,15 @@ const View = (props) => {
56
60
  export default compose(
57
61
  connect(
58
62
  (state, props) => ({
59
- data_provenance:
60
- state.content.subrequests?.[props.id]?.data?.data_provenance,
61
- map_visualization:
62
- state.content.subrequests?.[props.id]?.data?.map_visualization_data,
63
+ map_visualization: props.data.vis_url
64
+ ? state.map_visualizations?.data[props.data.vis_url]?.data
65
+ : '',
66
+ data_provenance: props.data.vis_url
67
+ ? state.map_visualizations?.data[props.data.vis_url]?.data_provenance
68
+ : '',
63
69
  }),
64
70
  {
65
- getContent,
71
+ getVisualization,
66
72
  },
67
73
  ),
68
74
  )(View);
@@ -30,9 +30,7 @@ const Webmap = (props) => {
30
30
  props.data.layers,
31
31
  ]);
32
32
  const base = React.useMemo(() => props?.data?.base || {}, [props.data.base]);
33
- const legend = React.useMemo(() => props?.data?.legend || {}, [
34
- props.data.legend,
35
- ]);
33
+
36
34
  const general = React.useMemo(() => props?.data?.general || {}, [
37
35
  props.data.general,
38
36
  ]);
@@ -49,10 +47,6 @@ const Webmap = (props) => {
49
47
  .filter(({ map_layer }) => map_layer)
50
48
  .map((l, i) => l.map_layer);
51
49
 
52
- const options = {
53
- css: true,
54
- };
55
-
56
50
  const mapRef = React.useRef();
57
51
  const [modules, setModules] = React.useState({});
58
52
 
@@ -61,7 +55,9 @@ const Webmap = (props) => {
61
55
  React.useEffect(() => {
62
56
  if (!modules_loaded.current) {
63
57
  modules_loaded.current = true;
64
- loadModules(MODULES, options).then((modules) => {
58
+ loadModules(MODULES, {
59
+ css: true,
60
+ }).then((modules) => {
65
61
  const [
66
62
  Map,
67
63
  MapView,
@@ -92,7 +88,7 @@ const Webmap = (props) => {
92
88
  });
93
89
  });
94
90
  }
95
- }, [setModules, options]);
91
+ }, [setModules]);
96
92
 
97
93
  var customFeatureLayerRenderer = {
98
94
  type: 'simple', // autocasts as new SimpleRenderer()
@@ -312,27 +308,6 @@ const Webmap = (props) => {
312
308
  });
313
309
  view.ui.add(zoomWidget, zoomPosition);
314
310
  }
315
-
316
- if (legend?.legend?.show_legend) {
317
- const legendPosition =
318
- legend && legend.legend && legend.legend.position
319
- ? legend.legend.position
320
- : 'top-right';
321
-
322
- const legendWidget = new Expand({
323
- content: new Legend({
324
- view: view,
325
- style: 'classic',
326
- }),
327
- view: view,
328
- expanded: false,
329
- expandIconClass: 'esri-icon-legend',
330
- expandTooltip: 'Legend',
331
- classNames: 'some-cool-expand',
332
- });
333
- view.ui.add(legendWidget, legendPosition);
334
- }
335
-
336
311
  const printPosition =
337
312
  general && general.print_position ? general.print_position : '';
338
313
 
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import Webmap from '../Webmap';
3
+ import { hasBlocksData } from '@plone/volto/helpers';
4
+ import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
3
5
 
4
6
  const VisualizationView = (props) => {
5
7
  const { content = {} } = props;
@@ -7,8 +9,12 @@ const VisualizationView = (props) => {
7
9
  const { map_visualization_data = {} } = content;
8
10
 
9
11
  return (
10
- <div>
11
- <Webmap data={map_visualization_data} />
12
+ <div id="page-document" className="view-viewarcgismap">
13
+ {hasBlocksData(content) ? (
14
+ <RenderBlocks {...props} />
15
+ ) : (
16
+ <Webmap data={map_visualization_data} />
17
+ )}
12
18
  </div>
13
19
  );
14
20
  };
@@ -0,0 +1,6 @@
1
+ import Webmap from '../Webmap';
2
+
3
+ export default function VisualizationViewWidget(props) {
4
+ const { value: map_visualization_data = {} } = props;
5
+ return <Webmap data={map_visualization_data} />;
6
+ }
package/src/index.js CHANGED
@@ -7,6 +7,7 @@ import DataQueryWidget from './components/widgets/DataQueryWidget';
7
7
  import LayerSelectWidget from './components/widgets/LayerSelectWidget';
8
8
 
9
9
  import VisualizationEditorWidget from './components/visualization/VisualizationEditorWidget';
10
+ import VisualizationViewWidget from './components/visualization/VisualizationViewWidget';
10
11
  import VisualizationView from './components/visualization/VisualizationView';
11
12
 
12
13
  import SimpleColorPickerWidget from './components/widgets/SimpleColorPickerWidget';
@@ -61,6 +62,7 @@ export default (config) => {
61
62
 
62
63
  //map editor for the visualization(content-type)
63
64
  config.widgets.id.map_visualization_data = VisualizationEditorWidget;
65
+ config.widgets.views.id.map_visualization_data = VisualizationViewWidget;
64
66
  //map viewer for the visualization(content-type)
65
67
  config.views.contentTypesViews.map_visualization = VisualizationView;
66
68