@eeacms/volto-arcgis-block 0.1.181 → 0.1.183

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,6 +4,19 @@ 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.183](https://github.com/eea/volto-arcgis-block/compare/0.1.182...0.1.183) - 7 August 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - CLMS-2446 (jenkins) [Urkorue - [`efc5da9`](https://github.com/eea/volto-arcgis-block/commit/efc5da9ae68f664b295ffee899afb1cd51701507)]
12
+ - CLMS-2446 (bug): EEA38+UK remarked in the use cases map [Urkorue - [`c70ac80`](https://github.com/eea/volto-arcgis-block/commit/c70ac805f53d70efb07e68bd86afabe006bc7b0b)]
13
+ - CLMS-2402 (feat): Changed Use cases basemap to other with more information [Urkorue - [`5f7b42f`](https://github.com/eea/volto-arcgis-block/commit/5f7b42fbfb3e8138a139bdf780a5f09e07fc7f4f)]
14
+ ### [0.1.182](https://github.com/eea/volto-arcgis-block/compare/0.1.181...0.1.182) - 3 August 2023
15
+
16
+ #### :house: Documentation changes
17
+
18
+ - docs: Cleanup Makefile, update DEVELOP documentation, i18n - refs #254894 [valentinab25 - [`94a602e`](https://github.com/eea/volto-arcgis-block/commit/94a602ec618d2a802e55da892cdb76de7986cd62)]
19
+
7
20
  ### [0.1.181](https://github.com/eea/volto-arcgis-block/compare/0.1.180...0.1.181) - 28 July 2023
8
21
 
9
22
  #### :hammer_and_wrench: Others
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-arcgis-block.git
9
+ cd volto-arcgis-block
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-arcgis-block/
23
+ ```
24
+
25
+ ### Or add @eeacms/volto-arcgis-block 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-arcgis-block/
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-arcgis-block` to `mrs.developer.json`
81
+
82
+ Go to:
83
+
84
+ ```BASH
85
+ cd src/addons/volto-arcgis-block/
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-arcgis-block` 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/Dockerfile ADDED
@@ -0,0 +1,14 @@
1
+ # syntax=docker/dockerfile:1
2
+ ARG VOLTO_VERSION
3
+ FROM plone/frontend-builder:${VOLTO_VERSION}
4
+
5
+ ARG ADDON_NAME
6
+ ARG ADDON_PATH
7
+
8
+ COPY --chown=node:node ./ /app/src/addons/${ADDON_PATH}/
9
+
10
+ RUN /setupAddon
11
+ RUN yarn install
12
+
13
+ ENTRYPOINT ["yarn"]
14
+ CMD ["start"]
package/Jenkinsfile CHANGED
@@ -199,6 +199,31 @@ pipeline {
199
199
  }
200
200
  }
201
201
 
202
+ stage('SonarQube compare to master') {
203
+ when {
204
+ allOf {
205
+ environment name: 'CHANGE_ID', value: ''
206
+ branch 'develop'
207
+ not { changelog '.*^Automated release [0-9\\.]+$' }
208
+ }
209
+ }
210
+ steps {
211
+ node(label: 'docker') {
212
+ script {
213
+ sh '''docker pull eeacms/gitflow'''
214
+ sh '''echo "Error" > checkresult.txt'''
215
+ catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
216
+ sh '''set -o pipefail; docker run -i --rm --name="$BUILD_TAG-gitflow-sn" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" eeacms/gitflow /checkSonarqubemaster.sh | grep -v "Found script" | tee checkresult.txt'''
217
+ }
218
+
219
+ publishChecks name: 'SonarQube', title: 'Sonarqube Code Quality Check', summary: "Quality check on the SonarQube metrics from branch develop, comparing it with the ones from master branch. No bugs are allowed",
220
+ text: readFile(file: 'checkresult.txt'), conclusion: "${currentBuild.currentResult}",
221
+ detailsURL: "${env.BUILD_URL}display/redirect"
222
+ }
223
+ }
224
+ }
225
+ }
226
+
202
227
  stage('Pull Request') {
203
228
  when {
204
229
  not {
package/Makefile CHANGED
@@ -1,40 +1,126 @@
1
- SHELL=/bin/bash
1
+ ##############################################################################
2
+ # Run:
3
+ # make
4
+ # make start
5
+ #
6
+ # Go to:
7
+ #
8
+ # http://localhost:3000
9
+ #
10
+ # Cypress:
11
+ #
12
+ # make cypress-open
13
+ #
14
+ ##############################################################################
15
+ # SETUP MAKE
16
+ #
17
+ ## Defensive settings for make: https://tech.davis-hansson.com/p/make/
18
+ SHELL:=bash
19
+ .ONESHELL:
20
+ # for Makefile debugging purposes add -x to the .SHELLFLAGS
21
+ .SHELLFLAGS:=-eu -o pipefail -O inherit_errexit -c
22
+ .SILENT:
23
+ .DELETE_ON_ERROR:
24
+ MAKEFLAGS+=--warn-undefined-variables
25
+ MAKEFLAGS+=--no-builtin-rules
2
26
 
27
+ # Colors
28
+ # OK=Green, warn=yellow, error=red
29
+ ifeq ($(TERM),)
30
+ # no colors if not in terminal
31
+ MARK_COLOR=
32
+ OK_COLOR=
33
+ WARN_COLOR=
34
+ ERROR_COLOR=
35
+ NO_COLOR=
36
+ else
37
+ MARK_COLOR=`tput setaf 6`
38
+ OK_COLOR=`tput setaf 2`
39
+ WARN_COLOR=`tput setaf 3`
40
+ ERROR_COLOR=`tput setaf 1`
41
+ NO_COLOR=`tput sgr0`
42
+ endif
43
+
44
+ ##############################################################################
45
+ # SETTINGS AND VARIABLE
3
46
  DIR=$(shell basename $$(pwd))
4
- ADDON ?= "@eeacms/volto-arcgis-block"
5
-
6
- # We like colors
7
- # From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects
8
- RED=`tput setaf 1`
9
- GREEN=`tput setaf 2`
10
- RESET=`tput sgr0`
11
- YELLOW=`tput setaf 3`
12
-
13
- project:
14
- npm install -g yo
15
- npm install -g @plone/generator-volto
16
- npm install -g mrs-developer
17
- yo @plone/volto project --addon ${ADDON} --workspace "src/addons/${DIR}" --no-interactive
18
- ln -sf $$(pwd) project/src/addons/
19
- cp .project.eslintrc.js .eslintrc.js
20
- cd project && yarn
21
- @echo "-------------------"
22
- @echo "$(GREEN)Volto project is ready!$(RESET)"
23
- @echo "$(RED)Now run: cd project && yarn start$(RESET)"
24
-
25
- all: project
26
-
27
- .PHONY: start-test-backend
28
- start-test-backend: ## Start Test Plone Backend
29
- @echo "$(GREEN)==> Start Test Plone Backend$(RESET)"
30
- docker run -i --rm -e ZSERVER_HOST=0.0.0.0 -e ZSERVER_PORT=55001 -p 55001:55001 -e SITE=plone -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,kitconcept.volto:default-homepage -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,kitconcept.volto,kitconcept.volto.cors -e ADDONS='plone.app.robotframework plone.app.contenttypes plone.restapi kitconcept.volto' plone ./bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING
31
-
32
- .PHONY: start-backend-docker
33
- start-backend-docker: ## Starts a Docker-based backend
34
- @echo "$(GREEN)==> Start Docker-based Plone Backend$(RESET)"
35
- docker run -it --rm --name=plone -p 8080:8080 -e SITE=Plone -e ADDONS="kitconcept.volto" -e ZCML="kitconcept.volto.cors" plone
47
+ NODE_MODULES?="../../../node_modules"
48
+ PLONE_VERSION?=6
49
+ VOLTO_VERSION?=16
50
+ ADDON_PATH="${DIR}"
51
+ ADDON_NAME="@eeacms/${ADDON_PATH}"
52
+ DOCKER_COMPOSE=PLONE_VERSION=${PLONE_VERSION} VOLTO_VERSION=${VOLTO_VERSION} ADDON_NAME=${ADDON_NAME} ADDON_PATH=${ADDON_PATH} docker compose
53
+
54
+ # Top-level targets
55
+ .PHONY: all
56
+ all: clean install
57
+
58
+ .PHONY: clean
59
+ clean: ## Cleanup development environment
60
+ ${DOCKER_COMPOSE} down --volumes --remove-orphans
61
+
62
+ .PHONY: install
63
+ install: ## Build and install development environment
64
+ echo "Running: ${DOCKER_COMPOSE} build"
65
+ ${DOCKER_COMPOSE} pull
66
+ ${DOCKER_COMPOSE} build
67
+
68
+ .PHONY: start
69
+ start: ## Start development environment
70
+ echo "Running: ${DOCKER_COMPOSE} up"
71
+ ${DOCKER_COMPOSE} up
72
+
73
+ .PHONY: cypress-open
74
+ cypress-open: ## Open cypress integration tests
75
+ NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open
76
+
77
+ .PHONY: cypress-run
78
+ cypress-run: ## Run cypress integration tests
79
+ NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run
80
+
81
+ .PHONY: test
82
+ test: ## Run jest tests
83
+ ${DOCKER_COMPOSE} run -e CI=1 frontend test
84
+
85
+ .PHONY: test-update
86
+ test-update: ## Update jest tests snapshots
87
+ ${DOCKER_COMPOSE} run -e CI=1 frontend test -u
88
+
89
+ .PHONY: stylelint
90
+ stylelint: ## Stylelint
91
+ $(NODE_MODULES)/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'
92
+
93
+ .PHONY: stylelint-overrides
94
+ stylelint-overrides:
95
+ $(NODE_MODULES)/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'
96
+
97
+ .PHONY: stylelint-fix
98
+ stylelint-fix: ## Fix stylelint
99
+ $(NODE_MODULES)/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}' --fix
100
+ $(NODE_MODULES)/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides' --fix
101
+
102
+ .PHONY: prettier
103
+ prettier: ## Prettier
104
+ $(NODE_MODULES)/.bin/prettier --single-quote --check 'src/**/*.{js,jsx,json,css,less,md}'
105
+
106
+ .PHONY: prettier-fix
107
+ prettier-fix: ## Fix prettier
108
+ $(NODE_MODULES)/.bin/prettier --single-quote --write 'src/**/*.{js,jsx,json,css,less,md}'
109
+
110
+ .PHONY: lint
111
+ lint: ## ES Lint
112
+ $(NODE_MODULES)/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}'
113
+
114
+ .PHONY: lint-fix
115
+ lint-fix: ## Fix ES Lint
116
+ $(NODE_MODULES)/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}'
117
+
118
+ .PHONY: i18n
119
+ i18n: ## i18n
120
+ rm -rf build/messages
121
+ NODE_ENV=development $(NODE_MODULES)/.bin/i18n --addon
36
122
 
37
123
  .PHONY: help
38
- help: ## Show this help.
124
+ help: ## Show this help.
39
125
  @echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
40
- "
126
+ head -n 14 Makefile
@@ -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"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.181",
3
+ "version": "0.1.183",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -288,7 +288,7 @@ class InfoWidget extends React.Component {
288
288
  }
289
289
 
290
290
  for (let feature in this.features) {
291
- let topics = this.features[feature].attributes.Use_case_topics.split(',');
291
+ let topics = this.features[feature].attributes.Use_case_topics.split(';');
292
292
 
293
293
  for (let topic in topics) {
294
294
  processedData[topics[topic]].push(this.features[feature].attributes);
@@ -391,7 +391,7 @@ class InfoWidget extends React.Component {
391
391
  let topicProducts = [];
392
392
 
393
393
  for (let feature in features) {
394
- let topics = features[feature].attributes.Use_case_topics.split(',');
394
+ let topics = features[feature].attributes.Use_case_topics.split(';');
395
395
 
396
396
  for (let topic in topics) {
397
397
  if (!topicProducts.includes(topics[topic])) {
@@ -29,7 +29,12 @@ class LayerControl {
29
29
 
30
30
  getGeometry(country, layer) {
31
31
  layer.definitionExpression = `(`;
32
- if (country === 'EU' || country === 'EU 27+UK' || country === 'EEA+38UK') {
32
+ if (
33
+ country === 'EU' ||
34
+ country === 'EU 27+UK' ||
35
+ country === 'EEA38' ||
36
+ country === 'EEA38+UK'
37
+ ) {
33
38
  let states = mapViewer.props.cfg.Codes[country];
34
39
  for (let i = 0; i < states.length; i++) {
35
40
  layer.definitionExpression += `CNTR_ID = '${states[i]}'`;
@@ -124,6 +129,7 @@ class LayerControl {
124
129
  return Math.min(latZoom, lngZoom, this.zoomMax);
125
130
  //TODO calculate the corresponding level of zoom automatically
126
131
  }
132
+
127
133
  latRad(lat) {
128
134
  let sin = Math.sin((lat * Math.PI) / 180);
129
135
  let radX2 = Math.log((1 + sin) / (1 - sin)) / 2;
@@ -21,7 +21,7 @@ class NavigationControl extends React.Component {
21
21
  this.layerControl.hideLayer(layerSpatial.id);
22
22
  this.layerControl.showLayer(layerRegion.id);
23
23
  this.view.center = this.center;
24
- this.view.zoom = 0;
24
+ this.view.zoom = 1;
25
25
  layerSpatial.definitionExpression = null;
26
26
  mapViewer.setState(() => ({
27
27
  useCaseLevel: 1,
@@ -13,11 +13,11 @@ let Map,
13
13
  FeatureLayer,
14
14
  Extent,
15
15
  Basemap,
16
- VectorTileLayer,
17
16
  layerControl,
18
17
  navigationControl,
19
18
  layerSpatial,
20
- layerHighlight;
19
+ layerHighlight,
20
+ WebTileLayer;
21
21
 
22
22
  class UseCasesMapViewer extends React.Component {
23
23
  constructor(props) {
@@ -74,23 +74,16 @@ class UseCasesMapViewer extends React.Component {
74
74
  'esri/layers/FeatureLayer',
75
75
  'esri/geometry/Extent',
76
76
  'esri/Basemap',
77
- 'esri/layers/VectorTileLayer',
77
+ 'esri/layers/WebTileLayer',
78
78
  ]).then(
79
- ([
80
- _Map,
81
- _MapView,
82
- _FeatureLayer,
83
- _Extent,
84
- _Basemap,
85
- _VectorTileLayer,
86
- ]) => {
87
- [Map, MapView, FeatureLayer, Extent, Basemap, VectorTileLayer] = [
79
+ ([_Map, _MapView, _FeatureLayer, _Extent, _Basemap, _WebTileLayer]) => {
80
+ [Map, MapView, FeatureLayer, Extent, Basemap, WebTileLayer] = [
88
81
  _Map,
89
82
  _MapView,
90
83
  _FeatureLayer,
91
84
  _Extent,
92
85
  _Basemap,
93
- _VectorTileLayer,
86
+ _WebTileLayer,
94
87
  ];
95
88
  },
96
89
  );
@@ -105,27 +98,29 @@ class UseCasesMapViewer extends React.Component {
105
98
  loadCss();
106
99
  await this.loader();
107
100
 
108
- const gray_basemap = new VectorTileLayer({
109
- portalItem: {
110
- id: '291da5eab3a0412593b66d384379f89f',
111
- },
112
- });
113
-
114
- let basemap = new Basemap({
115
- baseLayers: [gray_basemap],
101
+ this.basemap = new Basemap({
102
+ title: 'Countries World',
103
+ thumbnailUrl:
104
+ 'https://gisco-services.ec.europa.eu/maps/wmts/CountriesWorld/EPSG3857/0/0/0.png',
105
+ baseLayers: [
106
+ new WebTileLayer({
107
+ urlTemplate:
108
+ 'https://gisco-services.ec.europa.eu/maps/tiles/CountriesWorld/EPSG3857/{z}/{x}/{y}.png',
109
+ }),
110
+ ],
116
111
  });
117
112
 
118
113
  // this.mapdiv.current is the reference to the current DOM element of
119
114
  // this.mapdiv after it was mounted by the render() method
120
115
  this.map = new Map({
121
- basemap: basemap,
116
+ basemap: this.basemap,
122
117
  });
123
118
 
124
119
  this.view = new MapView({
125
120
  container: this.mapdiv.current,
126
121
  map: this.map,
127
122
  center: this.mapCfg.center,
128
- zoom: this.mapCfg.zoom,
123
+ zoom: 1,
129
124
  ui: {
130
125
  components: ['attribution'],
131
126
  },