@eeacms/volto-eea-map 3.2.0 → 3.3.0

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,11 +4,25 @@ 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
- ### [3.2.0](https://github.com/eea/volto-eea-map/compare/3.1.0...3.2.0) - 13 December 2023
7
+ ### [3.3.0](https://github.com/eea/volto-eea-map/compare/3.2.1...3.3.0) - 17 January 2024
8
8
 
9
9
  #### :rocket: New Features
10
10
 
11
- - feat: use data_query from connected_data_parameters defined in volto-datablocks [Miu Razvan - [`e755c7d`](https://github.com/eea/volto-eea-map/commit/e755c7d3f3076d751cbace7ac69c19d7fcf37ba9)]
11
+ - feat: show embed error + always show sources [Razvan - [`35f5465`](https://github.com/eea/volto-eea-map/commit/35f546574d347716ce043a482e7eda55a0180d44)]
12
+
13
+ #### :house: Internal changes
14
+
15
+
16
+ #### :hammer_and_wrench: Others
17
+
18
+ - Release 3.3.0 [Alin Voinea - [`8b21828`](https://github.com/eea/volto-eea-map/commit/8b2182871b3d13d0e9164d99d2964e3999e8cc48)]
19
+ - use arcgis map for screenshot [andreiggr - [`94cc865`](https://github.com/eea/volto-eea-map/commit/94cc8651667ab351fc761b810634f3b124d6e6bb)]
20
+ - update checks to support older javascript engines(screenshoter) [andreiggr - [`7b58516`](https://github.com/eea/volto-eea-map/commit/7b5851628160a8ff474c6405a0285014eb7da05f)]
21
+ - better check map layers [andreiggr - [`d3e7d6b`](https://github.com/eea/volto-eea-map/commit/d3e7d6bfaa2e06b5de40c1e13bf9d39241d2c0c0)]
22
+ - PP screenshot to mapserver jsapi app [andreiggr - [`a0b4dd4`](https://github.com/eea/volto-eea-map/commit/a0b4dd4033e43bc34b11ede95435a7c76a0cb6b8)]
23
+ ### [3.2.1](https://github.com/eea/volto-eea-map/compare/3.2.0...3.2.1) - 13 December 2023
24
+
25
+ ### [3.2.0](https://github.com/eea/volto-eea-map/compare/3.1.0...3.2.0) - 13 December 2023
12
26
 
13
27
  #### :bug: Bug Fixes
14
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-map",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
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",
@@ -33,7 +33,6 @@ const Edit = (props) => {
33
33
  enable_queries,
34
34
  show_legend = true,
35
35
  show_note = true,
36
- show_sources = true,
37
36
  show_more_info = true,
38
37
  show_share = true,
39
38
  dataprotection = { enabled: true },
@@ -66,7 +65,7 @@ const Edit = (props) => {
66
65
 
67
66
  useEffect(() => {
68
67
  const mapVisId = flattenToAppURL(map_visualization_data['@id'] || '');
69
- if (vis_url && vis_url !== mapVisId) {
68
+ if (!map_visualization_data?.error && vis_url && vis_url !== mapVisId) {
70
69
  getContent(vis_url, null, id);
71
70
  }
72
71
  if (!vis_url) {
@@ -118,7 +117,7 @@ const Edit = (props) => {
118
117
  ...data,
119
118
  show_legend,
120
119
  show_note,
121
- show_sources,
120
+ show_sources: true,
122
121
  show_more_info,
123
122
  show_share,
124
123
  dataprotection,
@@ -86,7 +86,6 @@ export const Schema = (props) => {
86
86
  'show_legend',
87
87
  'show_viewer',
88
88
  'show_note',
89
- 'show_sources',
90
89
  'show_more_info',
91
90
  'show_share',
92
91
  ],
@@ -13,7 +13,6 @@ const View = (props) => {
13
13
  enable_queries,
14
14
  show_legend = true,
15
15
  show_note = true,
16
- show_sources = true,
17
16
  show_more_info = true,
18
17
  show_share = true,
19
18
  dataprotection = { enabled: true },
@@ -35,11 +34,22 @@ const View = (props) => {
35
34
  setMapData(updatedMapData);
36
35
  }, [map_visualization_data, data_query_params, enable_queries]);
37
36
 
37
+ const mapUrl = map_visualization_data?.layers?.map_layers[0]?.map_layer
38
+ ?.map_service_url
39
+ ? `${map_visualization_data.layers.map_layers[0].map_layer.map_service_url}?f=jsapi`
40
+ : '';
41
+
42
+ if (map_visualization_data?.error) {
43
+ return (
44
+ <p dangerouslySetInnerHTML={{ __html: map_visualization_data.error }} />
45
+ );
46
+ }
47
+
38
48
  return (
39
49
  <PrivacyProtection
40
- data={data}
41
50
  className="embed-map-visualization"
42
51
  {...props}
52
+ data={mapUrl ? { ...data, url: mapUrl } : data}
43
53
  >
44
54
  {!!mapData && (
45
55
  <>
@@ -49,7 +59,7 @@ const View = (props) => {
49
59
  ...data,
50
60
  show_legend,
51
61
  show_note,
52
- show_sources,
62
+ show_sources: true,
53
63
  show_more_info,
54
64
  show_share,
55
65
  dataprotection,
@@ -11,7 +11,10 @@ import codeSVG from '@eeacms/volto-eea-map/static/code-line.svg';
11
11
  const LayerLegend = ({ data, show_viewer }) => {
12
12
  const [legendRows, setLegendRows] = React.useState([]);
13
13
 
14
- const { map_service_url = '', layer = {} } = data;
14
+ const map_service_url =
15
+ data && data.map_service_url ? data.map_service_url : '';
16
+
17
+ const layer = data && data.layer ? data.layer : {};
15
18
  const { id, name } = layer || {};
16
19
 
17
20
  const fetchLegend = async (url, activeLayerID) => {
@@ -23,11 +26,11 @@ const LayerLegend = ({ data, show_viewer }) => {
23
26
  };
24
27
 
25
28
  React.useEffect(() => {
26
- if (data.map_service_url && id !== undefined) {
29
+ if (data?.map_service_url && id !== undefined) {
27
30
  fetchLegend(`${data.map_service_url}/legend`, id);
28
31
  }
29
32
  // eslint-disable-next-line react-hooks/exhaustive-deps
30
- }, [id, data.map_service_url]);
33
+ }, [id, data]);
31
34
 
32
35
  return (
33
36
  <Grid.Column>
@@ -61,7 +64,7 @@ const LayerLegend = ({ data, show_viewer }) => {
61
64
  </a>
62
65
  )}
63
66
  </div>
64
- {data.description && serializeNodes(data.description)}
67
+ {data?.description && serializeNodes(data.description)}
65
68
  <div style={{ display: 'flex', flexDirection: 'column' }}>
66
69
  {legendRows.length > 0 &&
67
70
  legendRows.map((item, i) => {
@@ -21,25 +21,20 @@ const MODULES = [
21
21
  ];
22
22
 
23
23
  const Webmap = (props) => {
24
- const { editMode, height, id } = props;
25
-
26
- const device = React.useMemo(() => props.device || {}, [props.device]);
27
-
28
- const data = React.useMemo(() => props.data || {}, [props.data]);
29
-
30
- const layers = React.useMemo(() => props?.data?.layers || {}, [
31
- props.data.layers,
32
- ]);
33
- const base = React.useMemo(() => props?.data?.base || {}, [props.data.base]);
34
-
35
- const general = React.useMemo(() => props?.data?.general || {}, [
36
- props.data.general,
37
- ]);
38
- const styles = React.useMemo(() => props?.data?.styles || {}, [
39
- props.data.styles,
40
- ]);
41
-
42
- const { base_layer = '' } = base;
24
+ const editMode = props && props.editMode ? props.editMode : false;
25
+ const height = props && props.height ? props.height : '';
26
+ const id = props && props.id ? props.id : '';
27
+ const device = props && props.device ? props.device : {};
28
+ const data = props && props.data ? props.data : {};
29
+
30
+ const layers =
31
+ props && props.data && props.data.layers ? props.data.layers : {};
32
+ const base = props && props.data && props.data.base ? props.data.base : {};
33
+ const general =
34
+ props && props.data && props.data.general ? props.data.general : {};
35
+ const styles =
36
+ props && props.data && props.data.styles ? props.data.styles : {};
37
+ const base_layer = base && base.base_layer ? base.base_layer : '';
43
38
 
44
39
  const map_layers =
45
40
  layers &&
@@ -146,7 +141,7 @@ const Webmap = (props) => {
146
141
  .map(
147
142
  (
148
143
  {
149
- map_service_url,
144
+ map_service_url = '',
150
145
  layer,
151
146
  fullLayer,
152
147
  query = '',
@@ -6,9 +6,12 @@ import Webmap from '../Webmap';
6
6
  import ExtraViews from '../ExtraViews';
7
7
 
8
8
  const VisualizationView = (props) => {
9
- const { content = {} } = props;
9
+ const content = props && props.content ? props.content : {};
10
10
 
11
- const { map_visualization_data = {} } = content;
11
+ const map_visualization_data =
12
+ content && content.map_visualization_data
13
+ ? content.map_visualization_data
14
+ : {};
12
15
 
13
16
  return (
14
17
  <div id="page-document" className="view-viewarcgismap">