@eeacms/volto-arcgis-block 0.1.180 → 0.1.182

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,17 @@ 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.182](https://github.com/eea/volto-arcgis-block/compare/0.1.181...0.1.182) - 3 August 2023
8
+
9
+ #### :house: Documentation changes
10
+
11
+ - docs: Cleanup Makefile, update DEVELOP documentation, i18n - refs #254894 [valentinab25 - [`94a602e`](https://github.com/eea/volto-arcgis-block/commit/94a602ec618d2a802e55da892cdb76de7986cd62)]
12
+
13
+ ### [0.1.181](https://github.com/eea/volto-arcgis-block/compare/0.1.180...0.1.181) - 28 July 2023
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - CLMS-2422 (bug): year filter selectins persists past layer changes if as long as selected region exists in new layer options. Code refactored and cleaned. [ujbolivar - [`3aca73f`](https://github.com/eea/volto-arcgis-block/commit/3aca73f1485d54248523a6f5525dcfbe18473620)]
7
18
  ### [0.1.180](https://github.com/eea/volto-arcgis-block/compare/0.1.179...0.1.180) - 26 July 2023
8
19
 
9
20
  #### :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.180",
3
+ "version": "0.1.182",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -599,21 +599,19 @@ class HotspotWidget extends React.Component {
599
599
  selectBox.options.add(new Option(option, option, option));
600
600
  }
601
601
  for (let u = 0; u < selectBox.options.length; u++) {
602
- if (selectBox.options[u].label.includes(this.selectedArea)) {
602
+ if (!selectBox.options[u].label.includes(this.selectedArea)) {
603
+ selectBox.value = 'default';
604
+ continue;
605
+ } else {
603
606
  selectBox.value = this.selectedArea;
604
- if (this.lcYear === null) selectBoxLcTime.value = 'default';
605
- else if (this.lccYear === null)
606
- selectBoxLccTime.value = 'default';
607
- else {
607
+ if (this.lcYear !== null) {
608
608
  selectBoxLcTime.value = this.lcYear;
609
+ }
610
+ if (this.lccYear !== null) {
609
611
  selectBoxLccTime.value = this.lccYear;
610
612
  }
611
- break;
612
- } else {
613
- selectBox.value = 'default';
614
- selectBoxLcTime.value = 'default';
615
- selectBoxLccTime.value = 'default';
616
613
  }
614
+ break;
617
615
  }
618
616
  break;
619
617
  } else if (
@@ -625,24 +623,23 @@ class HotspotWidget extends React.Component {
625
623
  selectBox.options.add(new Option(option, option, option));
626
624
  }
627
625
  for (let u = 0; u < selectBox.options.length; u++) {
628
- if (selectBox.options[u].label.includes(this.selectedArea)) {
626
+ if (!selectBox.options[u].label.includes(this.selectedArea)) {
627
+ selectBox.value = 'default';
628
+ continue;
629
+ } else {
629
630
  selectBox.value = this.selectedArea;
630
- if (this.lcYear === null) selectBoxLcTime.value = 'default';
631
- else if (this.lccYear === null)
632
- selectBoxLccTime.value = 'default';
633
- else {
631
+ if (this.lcYear !== null) {
634
632
  selectBoxLcTime.value = this.lcYear;
633
+ }
634
+ if (this.lccYear !== null) {
635
635
  selectBoxLccTime.value = this.lccYear;
636
636
  }
637
- break;
638
- } else {
639
- selectBox.value = 'default';
640
- selectBoxLcTime.value = 'default';
641
- selectBoxLccTime.value = 'default';
642
637
  }
638
+ break;
643
639
  }
644
640
  break;
645
641
  }
642
+ break;
646
643
  }
647
644
  }
648
645
  if (selectBox.value === 'default') {
@@ -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])) {