@eeacms/volto-eea-map 1.0.2 → 2.0.1

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,32 @@ 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.2](https://github.com/eea/volto-eea-map/compare/1.0.1...1.0.2) - 20 July 2023
7
+ ### [2.0.1](https://github.com/eea/volto-eea-map/compare/2.0.0...2.0.1) - 8 August 2023
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: data querys ok on remove too && memos [andreiggr - [`4a27e10`](https://github.com/eea/volto-eea-map/commit/4a27e10b3407734add7db0b09326aa16968b0c2a)]
12
+ - fix: another better way to autoupdate mutliple blocks [andreiggr - [`1b592c5`](https://github.com/eea/volto-eea-map/commit/1b592c58abf34b8c5a0d7c5044c50726f90b4496)]
13
+
14
+ #### :house: Internal changes
15
+
16
+ - chore: Move deepUpdateDataQueryParams to Schema -refs #254131 [dana-cfc4 - [`5f683de`](https://github.com/eea/volto-eea-map/commit/5f683deb2e91a721834616592f8bb3b9ee3379e0)]
17
+
18
+ #### :house: Documentation changes
19
+
20
+ - docs: Cleanup Makefile, update DEVELOP documentation, i18n - refs #254894 [valentinab25 - [`e3d1060`](https://github.com/eea/volto-eea-map/commit/e3d10606574c006e4ed3e5f2b2134e8f80913ff3)]
21
+
22
+ ## [2.0.0](https://github.com/eea/volto-eea-map/compare/1.0.2...2.0.0) - 25 July 2023
23
+
24
+ #### :nail_care: Enhancements
25
+
26
+ - refactor: remove countup - refs #254634 [dobri1408 - [`7763f61`](https://github.com/eea/volto-eea-map/commit/7763f612221210283c9c5dc3e15ede991c78f393)]
27
+
28
+ #### :hammer_and_wrench: Others
29
+
30
+ - Release 2.0.0 [Alin Voinea - [`7be280d`](https://github.com/eea/volto-eea-map/commit/7be280d4809186e663f422687aca3c33dd732904)]
31
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`ba6ed22`](https://github.com/eea/volto-eea-map/commit/ba6ed22118406db979457384d4739cced2096137)]
32
+ ### [1.0.2](https://github.com/eea/volto-eea-map/compare/1.0.1...1.0.2) - 21 July 2023
8
33
 
9
34
  #### :hammer_and_wrench: Others
10
35
 
package/DEVELOP.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  ## Develop
4
4
 
5
+ 1. Make sure you have `docker` and `docker compose` installed and running on your machine:
6
+
7
+ ```Bash
8
+ git clone https://github.com/eea/volto-eea-map.git
9
+ cd volto-eea-map
10
+ git checkout -b bugfix-123456 develop
11
+ make
12
+ make start
13
+ ```
14
+
15
+ 1. Wait for `Volto started at 0.0.0.0:3000` meesage
16
+
17
+ 1. Go to http://localhost:3000
18
+
19
+ 1. Happy hacking!
20
+
21
+ ```Bash
22
+ cd src/addons/volto-eea-map/
23
+ ```
24
+
25
+ ### Or add @eeacms/volto-eea-map to your Volto project
26
+
5
27
  Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
6
28
 
7
29
  1. Make sure you have installed `yo`, `@plone/generator-volto` and `mrs-developer`
@@ -49,3 +71,37 @@ Before starting make sure your development environment is properly set. See [Vol
49
71
  1. Happy hacking!
50
72
 
51
73
  cd src/addons/volto-addon-template/
74
+
75
+ ## Cypress
76
+
77
+ To run cypress locally, first make sure you don't have any Volto/Plone running on ports `8080` and `3000`.
78
+
79
+ You don't have to be in a `clean-volto-project`, you can be in any Volto Frontend
80
+ project where you added `volto-eea-map` to `mrs.developer.json`
81
+
82
+ Go to:
83
+
84
+ ```BASH
85
+ cd src/addons/volto-eea-map/
86
+ ```
87
+
88
+ Start:
89
+
90
+ ```Bash
91
+ make
92
+ make start
93
+ ```
94
+
95
+ This will build and start with Docker a clean `Plone backend` and `Volto Frontend` with `volto-eea-map` block installed.
96
+
97
+ Open Cypress Interface:
98
+
99
+ ```Bash
100
+ make cypress-open
101
+ ```
102
+
103
+ Or run it:
104
+
105
+ ```Bash
106
+ make cypress-run
107
+ ```
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # volto-addon-template
1
+ # volto-eea-map
2
2
 
3
3
  [![Releases](https://img.shields.io/github/v/release/eea/volto-eea-map)](https://github.com/eea/volto-eea-map/releases)
4
4
 
@@ -17,71 +17,77 @@
17
17
 
18
18
  [Volto](https://github.com/plone/volto) add-on
19
19
 
20
- # volto-eea-map
21
-
22
- Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
20
+ ## Features
23
21
 
24
- 1. Make sure you have installed `yo`, `@plone/generator-volto` and `mrs-developer`
22
+ Demo GIF
25
23
 
26
- npm install -g yo @plone/generator-volto mrs-developer
24
+ ## Getting started
27
25
 
28
- 1. Create new volto app
26
+ ### Try volto-eea-map with Docker
29
27
 
30
- yo @plone/volto my-volto-project --addon @eeacms/volto-eea-map --skip-install
31
- cd my-volto-project
28
+ git clone https://github.com/eea/volto-eea-map.git
29
+ cd volto-eea-map
30
+ make
31
+ make start
32
32
 
33
- 1. Add the following to `mrs.developer.json`:
33
+ Go to http://localhost:3000
34
34
 
35
- {
36
- "volto-eea-map": {
37
- "url": "https://github.com/eea/volto-eea-map.git",
38
- "package": "@eeacms/volto-eea-map",
39
- "branch": "develop",
40
- "path": "src"
41
- }
42
- }
35
+ ### Add volto-eea-map to your Volto project
43
36
 
44
- 1. Install
37
+ 1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone
45
38
 
46
- yarn develop
47
- yarn
39
+ ```Bash
40
+ docker compose up backend
41
+ ```
48
42
 
49
- 1. Start backend
43
+ 1. Start Volto frontend
50
44
 
51
- docker pull plone
52
- docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone
45
+ * If you already have a volto project, just update `package.json`:
53
46
 
54
- ...wait for backend to setup and start - `Ready to handle requests`:
47
+ ```JSON
48
+ "addons": [
49
+ "@eeacms/volto-eea-map"
50
+ ],
55
51
 
56
- docker logs -f plone
52
+ "dependencies": {
53
+ "@eeacms/volto-eea-map": "*"
54
+ }
55
+ ```
57
56
 
58
- ...you can also check http://localhost:8080/Plone
57
+ * If not, create one:
59
58
 
60
- 1. Start frontend
59
+ ```
60
+ npm install -g yo @plone/generator-volto
61
+ yo @plone/volto my-volto-project --canary --addon @eeacms/volto-eea-map
62
+ cd my-volto-project
63
+ ```
61
64
 
62
- yarn start
65
+ 1. Install new add-ons and restart Volto:
63
66
 
64
- 1. Go to http://localhost:3000
67
+ ```
68
+ yarn
69
+ yarn start
70
+ ```
65
71
 
66
- 1. Happy hacking!
72
+ 1. Go to http://localhost:3000
67
73
 
68
- cd src/addons/volto-eea-map/
74
+ 1. Happy editing!
69
75
 
70
- # Configuration
76
+ ## Release
71
77
 
72
- This addon contains the EEA Embed Map Block & EEA Map Block. It's configured to work with the map visualization content type and give more access to ArcGIS maps. See available maps here https://discomap.eea.europa.eu/
78
+ See [RELEASE.md](https://github.com/eea/volto-eea-map/blob/master/RELEASE.md).
73
79
 
74
- # Enable data queries auto-import
80
+ ## How to contribute
75
81
 
76
- To enable automatic import of queries from the content-type, "Parameters for data connections" should be checked as behavior on the content-type that uses the map.
82
+ See [DEVELOP.md](https://github.com/eea/volto-eea-map/blob/master/DEVELOP.md).
77
83
 
78
- controlpanel/dexterity-types/{content-type-id}
79
- # Enable Sources
84
+ ## Copyright and license
80
85
 
81
- Sources (Data provenance) should be set on the visualization. To enable this, "EEA Core Metadata" should be checked as behavior on the visualization content-type.
86
+ The Initial Owner of the Original Code is European Environment Agency (EEA).
87
+ All Rights Reserved.
82
88
 
83
- controlpanel/dexterity-types/map_visualization
84
-
85
- After this, sources can be added from the visualization edit interface. "Data Provenance" tab => "Add source"
89
+ See [LICENSE.md](https://github.com/eea/volto-eea-map/blob/master/LICENSE.md) for details.
86
90
 
91
+ ## Funding
87
92
 
93
+ [European Environment Agency (EU)](http://eea.europa.eu)
@@ -0,0 +1,28 @@
1
+ version: "3"
2
+ services:
3
+ backend:
4
+ image: plone/plone-backend:${PLONE_VERSION:-6}
5
+ ports:
6
+ - "8080:8080"
7
+ environment:
8
+ SITE: "Plone"
9
+
10
+ frontend:
11
+ build:
12
+ context: ./
13
+ dockerfile: ./Dockerfile
14
+ args:
15
+ ADDON_NAME: "${ADDON_NAME}"
16
+ ADDON_PATH: "${ADDON_PATH}"
17
+ VOLTO_VERSION: ${VOLTO_VERSION:-16}
18
+ ports:
19
+ - "3000:3000"
20
+ - "3001:3001"
21
+ depends_on:
22
+ - backend
23
+ volumes:
24
+ - ./:/app/src/addons/${ADDON_PATH}
25
+ environment:
26
+ RAZZLE_INTERNAL_API_PATH: "http://backend:8080/Plone"
27
+ RAZZLE_DEV_PROXY_API_PATH: "http://backend:8080/Plone"
28
+ HOST: "0.0.0.0"
@@ -0,0 +1,14 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: \n"
8
+ "Language: \n"
9
+ "Language-Team: \n"
10
+ "Content-Type: \n"
11
+ "Content-Transfer-Encoding: \n"
12
+ "Plural-Forms: \n"
13
+
14
+
@@ -0,0 +1,14 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: \n"
8
+ "Language: \n"
9
+ "Language-Team: \n"
10
+ "Content-Type: \n"
11
+ "Content-Transfer-Encoding: \n"
12
+ "Plural-Forms: \n"
13
+
14
+
@@ -0,0 +1,14 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: \n"
8
+ "Language: \n"
9
+ "Language-Team: \n"
10
+ "Content-Type: \n"
11
+ "Content-Transfer-Encoding: \n"
12
+ "Plural-Forms: \n"
13
+
14
+
package/locales/volto.pot CHANGED
@@ -0,0 +1,16 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Plone\n"
4
+ "POT-Creation-Date: 2023-06-28T10:48:22.678Z\n"
5
+ "Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
6
+ "Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
7
+ "MIME-Version: 1.0\n"
8
+ "Content-Type: text/plain; charset=utf-8\n"
9
+ "Content-Transfer-Encoding: 8bit\n"
10
+ "Plural-Forms: nplurals=1; plural=0;\n"
11
+ "Language-Code: en\n"
12
+ "Language-Name: English\n"
13
+ "Preferred-Encodings: utf-8\n"
14
+ "Domain: volto\n"
15
+
16
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-map",
3
- "version": "1.0.2",
3
+ "version": "2.0.1",
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",
@@ -38,9 +38,6 @@
38
38
  "cypress-fail-fast": "^5.0.1",
39
39
  "md5": "^2.3.0"
40
40
  },
41
- "resolutions": {
42
- "react-countup/countup.js": "2.5.0"
43
- },
44
41
  "scripts": {
45
42
  "release": "release-it",
46
43
  "bootstrap": "npm install -g ejs; npm link ejs; node bootstrap",
@@ -9,72 +9,22 @@ import Webmap from '@eeacms/volto-eea-map/components/Webmap';
9
9
  import ExtraViews from '@eeacms/volto-eea-map/components/ExtraViews';
10
10
 
11
11
  import { Schema } from './Schema';
12
- import {
13
- applyQueriesToMapLayers,
14
- updateBlockQueryFromPageQuery,
15
- } from '@eeacms/volto-eea-map/utils';
12
+ import { applyQueriesToMapLayers } from '@eeacms/volto-eea-map/utils';
16
13
 
17
14
  import { getVisualization } from '@eeacms/volto-eea-map/actions';
18
15
 
19
16
  const Edit = (props) => {
20
- const { block, data, onChangeBlock, selected, data_provenance = {} } = props;
21
- const { height = '' } = data;
17
+ const { block, onChangeBlock, selected, data_provenance = {} } = props;
22
18
  const schema = Schema(props);
23
19
  const [mapData, setMapData] = React.useState('');
24
-
25
- React.useEffect(() => {
26
- if (!Object.hasOwn(data, 'show_legend')) {
27
- onChangeBlock(block, {
28
- ...data,
29
- show_legend: true,
30
- });
31
- }
32
- if (!Object.hasOwn(data, 'show_sources')) {
33
- onChangeBlock(block, {
34
- ...data,
35
- show_sources: true,
36
- });
37
- }
38
- if (!Object.hasOwn(data, 'dataprotection')) {
39
- onChangeBlock(block, {
40
- ...data,
41
- dataprotection: { enabled: true },
42
- });
43
- }
44
- // eslint-disable-next-line react-hooks/exhaustive-deps
45
- }, [data.show_legend, data.show_sources, data.dataprotection]);
20
+ const data = React.useMemo(() => props.data, [props.data]);
21
+ const { height = '' } = data;
46
22
 
47
23
  React.useEffect(() => {
48
24
  props.getVisualization(props.data.vis_url);
49
25
  // eslint-disable-next-line react-hooks/exhaustive-deps
50
26
  }, [props.data.vis_url]);
51
27
 
52
- React.useEffect(() => {
53
- if (props.data_query) {
54
- //if block data_query_params do not exist, init them
55
- if (!props?.data?.data_query_params) {
56
- onChangeBlock(block, {
57
- ...props.data,
58
- data_query_params: [...props.data_query],
59
- });
60
- }
61
-
62
- //if block data_query_params exist, deep check them then change them in block data
63
- if (props?.data_query && data?.data_query_params) {
64
- const newDataQuery = updateBlockQueryFromPageQuery(
65
- props?.data_query,
66
- data?.data_query_params,
67
- );
68
-
69
- onChangeBlock(block, {
70
- ...data,
71
- data_query_params: [...newDataQuery],
72
- });
73
- }
74
- }
75
- // eslint-disable-next-line react-hooks/exhaustive-deps
76
- }, [props.data_query]);
77
-
78
28
  React.useEffect(() => {
79
29
  const updatedMapData = applyQueriesToMapLayers(
80
30
  props.map_visualization,
@@ -84,11 +34,7 @@ const Edit = (props) => {
84
34
  setMapData(updatedMapData);
85
35
 
86
36
  // eslint-disable-next-line react-hooks/exhaustive-deps
87
- }, [
88
- props.map_visualization,
89
- props.data.data_query_params,
90
- props.data.enable_queries,
91
- ]);
37
+ }, [props.map_visualization, props.data]);
92
38
 
93
39
  return (
94
40
  <>
@@ -1,3 +1,6 @@
1
+ import React from 'react';
2
+ import { deepUpdateDataQueryParams } from './helpers';
3
+
1
4
  const ProtectionSchema = () => ({
2
5
  title: 'Data Protection',
3
6
 
@@ -64,6 +67,12 @@ const ProtectionSchema = () => ({
64
67
  });
65
68
 
66
69
  export const Schema = (props) => {
70
+ const { block, onChangeBlock } = props;
71
+
72
+ const dataQuery = React.useMemo(() => props.data_query, [props.data_query]);
73
+ const data = React.useMemo(() => props.data, [props.data]);
74
+
75
+ deepUpdateDataQueryParams(block, data, dataQuery, onChangeBlock);
67
76
  return {
68
77
  title: 'Embed EEA Map Block',
69
78
  fieldsets: [
@@ -102,10 +111,12 @@ export const Schema = (props) => {
102
111
  title: 'Show sources',
103
112
  description: 'Will show sources set in this page Data provenance',
104
113
  type: 'boolean',
114
+ defaultValue: true,
105
115
  },
106
116
  show_legend: {
107
117
  title: 'Show legend',
108
118
  type: 'boolean',
119
+ defaultValue: true,
109
120
  },
110
121
  show_viewer: {
111
122
  title: 'Show API link',
@@ -127,6 +138,7 @@ export const Schema = (props) => {
127
138
  dataprotection: {
128
139
  widget: 'object',
129
140
  schema: ProtectionSchema(),
141
+ default: { enabled: true },
130
142
  },
131
143
  },
132
144
  required: [],
@@ -0,0 +1,30 @@
1
+ import { updateBlockQueryFromPageQuery } from '@eeacms/volto-eea-map/utils';
2
+
3
+ const deepUpdateDataQueryParams = (block, data, data_query, onChangeBlock) => {
4
+ // If block data_query_params do not exist, init them
5
+ if (!data?.data_query_params) {
6
+ onChangeBlock(block, {
7
+ ...data,
8
+ data_query_params: [...data_query],
9
+ });
10
+ }
11
+
12
+ // If block data_query_params exist, deep check them then change them in block data
13
+ if (data_query && data?.data_query_params) {
14
+ const newDataQuery = updateBlockQueryFromPageQuery(
15
+ data_query,
16
+ data?.data_query_params,
17
+ );
18
+
19
+ if (
20
+ JSON.stringify(newDataQuery) !== JSON.stringify(data.data_query_params)
21
+ ) {
22
+ onChangeBlock(block, {
23
+ ...data,
24
+ data_query_params: [...newDataQuery],
25
+ });
26
+ }
27
+ }
28
+ };
29
+
30
+ export { deepUpdateDataQueryParams };
@@ -1 +0,0 @@
1
- module.exports = require('@plone/volto/babel');