@eeacms/volto-arcgis-block 0.1.366 → 0.1.368

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,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
+ ### [0.1.368](https://github.com/eea/volto-arcgis-block/compare/0.1.367...0.1.368) - 17 June 2025
8
+
9
+ ### [0.1.367](https://github.com/eea/volto-arcgis-block/compare/0.1.366...0.1.367) - 17 June 2025
10
+
11
+ #### :house: Internal changes
12
+
13
+ - chore: [JENKINS] fix variable, uncomment tests [valentinab25 - [`00d88b5`](https://github.com/eea/volto-arcgis-block/commit/00d88b52265cba983d1d5e21a49c051004b705b5)]
14
+ - chore: [JENKINS] use clms-theme pipeline [valentinab25 - [`52b392c`](https://github.com/eea/volto-arcgis-block/commit/52b392cc993f3767099525ed39249e574ce2b421)]
15
+ - chore: [JENKINS] use volto 16 pipeline [valentinab25 - [`a676671`](https://github.com/eea/volto-arcgis-block/commit/a676671186aa227f4c77a766b9ca852028168b5c)]
16
+ - chore: [JENKINS] fix Dockerfile to use eea frontend-builder [valentinab25 - [`980608c`](https://github.com/eea/volto-arcgis-block/commit/980608cc867ace42896831791a55c535838250ee)]
17
+ - chore: [JENKINS] update Makefile for Jenkins [valentinab25 - [`021267e`](https://github.com/eea/volto-arcgis-block/commit/021267e620d6529327a730f122a39f7fec53b293)]
18
+
19
+ #### :hammer_and_wrench: Others
20
+
21
+ - (ci): closed stages scope in Jenkinsfile [Unai Bolivar - [`c50394d`](https://github.com/eea/volto-arcgis-block/commit/c50394d5f59dc7f1d32bc3d138bdea4401515da4)]
22
+ - (ci): testing changes in Jenkins [Unai Bolivar - [`ca13cd9`](https://github.com/eea/volto-arcgis-block/commit/ca13cd903fbc424c2650b01473d1cd929df2bf75)]
23
+ - (bug): modernize Jenkins pipeline to use latest volto-addon-ci image [Unai Bolivar - [`5a91852`](https://github.com/eea/volto-arcgis-block/commit/5a918528f4dbe82460b17243d4241d5797a1a1f3)]
24
+ - (test): Adding a comment to test if develop branch is stable [Unai Bolivar - [`84975d7`](https://github.com/eea/volto-arcgis-block/commit/84975d702ff158926711d379372106c7278f8eb4)]
7
25
  ### [0.1.366](https://github.com/eea/volto-arcgis-block/compare/0.1.365...0.1.366) - 4 June 2025
8
26
 
9
27
  ### [0.1.365](https://github.com/eea/volto-arcgis-block/compare/0.1.364...0.1.365) - 28 May 2025
package/Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # syntax=docker/dockerfile:1
2
2
  ARG VOLTO_VERSION
3
- FROM plone/frontend-builder:${VOLTO_VERSION}
3
+ FROM eeacms/frontend-builder:${VOLTO_VERSION}
4
4
 
5
5
  ARG ADDON_NAME
6
6
  ARG ADDON_PATH
package/Jenkinsfile CHANGED
@@ -1,5 +1,10 @@
1
1
  pipeline {
2
- agent any
2
+ tools {
3
+ jdk 'Java17'
4
+ }
5
+ agent {
6
+ node { label 'docker-host' }
7
+ }
3
8
 
4
9
  environment {
5
10
  GIT_NAME = "volto-arcgis-block"
@@ -9,10 +14,12 @@ pipeline {
9
14
  BACKEND_PROFILES = "eea.kitkat:testing"
10
15
  BACKEND_ADDONS = "clms.addon,clms.types,clms.downloadtool,clms.statstool"
11
16
  VOLTO = "16.31.1"
17
+ IMAGE_NAME = BUILD_TAG.toLowerCase().replaceAll('[^a-z0-9]', '-')
18
+ NODEJS_VERSION = "22"
12
19
  }
13
20
 
14
- stages {
15
21
 
22
+ stages {
16
23
  stage('Release') {
17
24
  when {
18
25
  allOf {
@@ -22,55 +29,41 @@ pipeline {
22
29
  }
23
30
  steps {
24
31
  node(label: 'docker') {
25
- withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),string(credentialsId: 'eea-jenkins-npm-token', variable: 'NPM_TOKEN')]) {
26
- sh '''docker pull eeacms/gitflow'''
27
- sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-master" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" -e GIT_TOKEN="$GITHUB_TOKEN" -e NPM_TOKEN="$NPM_TOKEN" -e LANGUAGE=javascript eeacms/gitflow'''
32
+ withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'), string(credentialsId: 'eea-jenkins-npm-token', variable: 'NPM_TOKEN')]) {
33
+ sh '''docker run -i --rm --pull always --name="$IMAGE_NAME-gitflow-master" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" -e GIT_TOKEN="$GITHUB_TOKEN" -e NPM_TOKEN="$NPM_TOKEN" -e NODEJS_VERSION="$NODEJS_VERSION" -e LANGUAGE=javascript eeacms/gitflow'''
28
34
  }
29
35
  }
30
36
  }
31
37
  }
32
38
 
33
- stage('Code') {
39
+ stage('Check if testing needed') {
34
40
  when {
35
41
  allOf {
36
- environment name: 'CHANGE_ID', value: ''
37
- not { changelog '.*^Automated release [0-9\\.]+$' }
38
42
  not { branch 'master' }
43
+ not { branch 'develop' }
44
+ environment name: 'CHANGE_ID', value: ''
39
45
  }
40
46
  }
41
47
  steps {
42
- parallel(
48
+ script {
49
+ withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) {
50
+ check_result = sh script: '''docker run --pull always -i --rm --name="$IMAGE_NAME-gitflow-check" -e GIT_TOKEN="$GITHUB_TOKEN" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_ORG="$GIT_ORG" -e GIT_NAME="$GIT_NAME" eeacms/gitflow /check_if_testing_needed.sh''', returnStatus: true
43
51
 
44
- "ES lint": {
45
- node(label: 'docker') {
46
- sh '''docker pull plone/volto-addon-ci:15.x'''
47
- sh '''docker run -i --rm --name="$BUILD_TAG-eslint" -e VOLTO="$VOLTO" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:15.x eslint'''
48
- }
49
- },
50
-
51
- "Style lint": {
52
- node(label: 'docker') {
53
- sh '''docker pull plone/volto-addon-ci:15.x'''
54
- sh '''docker run -i --rm --name="$BUILD_TAG-stylelint" -e VOLTO="$VOLTO" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci stylelint'''
55
- }
56
- },
57
-
58
- "Prettier": {
59
- node(label: 'docker') {
60
- sh '''docker pull plone/volto-addon-ci:15.x'''
61
- sh '''docker run -i --rm --name="$BUILD_TAG-prettier" -e VOLTO="$VOLTO" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci prettier'''
52
+ if (check_result == 0) {
53
+ env.SKIP_TESTS = 'yes'
54
+ }
62
55
  }
63
- }
64
- )
56
+ }
65
57
  }
66
58
  }
67
59
 
68
- stage('Tests') {
60
+ stage('Testing') {
69
61
  when {
70
62
  anyOf {
71
63
  allOf {
72
64
  not { environment name: 'CHANGE_ID', value: '' }
73
65
  environment name: 'CHANGE_TARGET', value: 'develop'
66
+ environment name: 'SKIP_TESTS', value: ''
74
67
  }
75
68
  allOf {
76
69
  environment name: 'CHANGE_ID', value: ''
@@ -78,26 +71,76 @@ pipeline {
78
71
  not { changelog '.*^Automated release [0-9\\.]+$' }
79
72
  branch 'master'
80
73
  }
74
+ environment name: 'SKIP_TESTS', value: ''
81
75
  }
82
76
  }
83
77
  }
84
- steps {
85
- parallel(
78
+ stages {
79
+ stage('Build test image') {
80
+ steps {
81
+ checkout scm
82
+ sh '''docker build --pull --build-arg="VOLTO_VERSION=$VOLTO" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend'''
83
+ }
84
+ }
86
85
 
87
- "Volto": {
88
- node(label: 'docker') {
89
- script {
90
- try {
91
- sh '''docker pull plone/volto-addon-ci:15.x'''
92
- sh '''docker run -i --name="$BUILD_TAG-volto" -e NAMESPACE="$NAMESPACE" -e VOLTO=$VOLTO -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:15.x'''
93
- sh '''rm -rf xunit-reports'''
94
- sh '''mkdir -p xunit-reports'''
95
- sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/coverage xunit-reports/'''
96
- sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/junit.xml xunit-reports/'''
97
- sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/unit_tests_log.txt xunit-reports/'''
98
- stash name: "xunit-reports", includes: "xunit-reports/**"
99
- archiveArtifacts artifacts: "xunit-reports/unit_tests_log.txt", fingerprint: true
100
- publishHTML (target : [
86
+ stage('Fix code') {
87
+ when {
88
+ environment name: 'CHANGE_ID', value: ''
89
+ not { branch 'master' }
90
+ }
91
+ steps {
92
+ script {
93
+ fix_result = sh(script: '''docker run --name="$IMAGE_NAME-fix" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend ci-fix''', returnStatus: true)
94
+ sh '''docker cp $IMAGE_NAME-fix:/app/src/addons/$GIT_NAME/src .'''
95
+ sh '''docker rm -v $IMAGE_NAME-fix'''
96
+ FOUND_FIX = sh(script: '''git diff | wc -l''', returnStdout: true).trim()
97
+
98
+ if (FOUND_FIX != '0') {
99
+ withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) {
100
+ sh '''sed -i "s|url = .*|url = https://eea-jenkins:$GITHUB_TOKEN@github.com/eea/$GIT_NAME.git|" .git/config'''
101
+ }
102
+ sh '''git fetch origin $GIT_BRANCH:$GIT_BRANCH'''
103
+ sh '''git checkout $GIT_BRANCH'''
104
+ sh '''git add src/'''
105
+ sh '''git commit -m "style: Automated code fix" '''
106
+ sh '''git push --set-upstream origin $GIT_BRANCH'''
107
+ sh '''exit 1'''
108
+ }
109
+ }
110
+ }
111
+ }
112
+
113
+ stage('ES lint') {
114
+ steps {
115
+ sh '''docker run --rm --name="$IMAGE_NAME-eslint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend lint'''
116
+ }
117
+ }
118
+
119
+ stage('Style lint') {
120
+ steps {
121
+ sh '''docker run --rm --name="$IMAGE_NAME-stylelint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend stylelint'''
122
+ }
123
+ }
124
+
125
+ stage('Prettier') {
126
+ steps {
127
+ sh '''docker run --rm --name="$IMAGE_NAME-prettier" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend prettier'''
128
+ }
129
+ }
130
+
131
+ stage('Coverage Tests') {
132
+ parallel {
133
+
134
+ stage('Unit tests') {
135
+ steps {
136
+ script {
137
+ try {
138
+ sh '''docker run --name="$IMAGE_NAME-volto" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend test-ci'''
139
+ sh '''rm -rf xunit-reports'''
140
+ sh '''mkdir -p xunit-reports'''
141
+ sh '''docker cp $IMAGE_NAME-volto:/app/coverage xunit-reports/'''
142
+ sh '''docker cp $IMAGE_NAME-volto:/app/junit.xml xunit-reports/'''
143
+ publishHTML(target : [
101
144
  allowMissing: false,
102
145
  alwaysLinkToLastBuild: true,
103
146
  keepAll: true,
@@ -110,16 +153,71 @@ pipeline {
110
153
  catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
111
154
  junit testResults: 'xunit-reports/junit.xml', allowEmptyResults: true
112
155
  }
113
- sh script: '''docker rm -v $BUILD_TAG-volto''', returnStatus: true
156
+ sh script: '''docker rm -v $IMAGE_NAME-volto''', returnStatus: true
157
+ }
114
158
  }
115
159
  }
116
160
  }
161
+
162
+ // stage('Integration tests') {
163
+ // steps {
164
+ // script {
165
+ // try {
166
+ // sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
167
+ // sh '''docker run -d --shm-size=3g --link $IMAGE_NAME-plone:plone --name="$IMAGE_NAME-cypress" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend start-ci'''
168
+ // sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make cypress-ci'''
169
+ // } finally {
170
+ // try {
171
+ // sh '''rm -rf cypress-videos cypress-results cypress-coverage cypress-screenshots'''
172
+ // sh '''mkdir -p cypress-videos cypress-results cypress-coverage cypress-screenshots'''
173
+ // videos = sh script: '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos/''', returnStatus: true
174
+ // sh '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/reports cypress-results/'''
175
+ // screenshots = sh script: '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/screenshots cypress-screenshots''', returnStatus: true
176
+
177
+ // archiveArtifacts artifacts: 'cypress-screenshots/**', fingerprint: true, allowEmptyArchive: true
178
+
179
+ // coverage = sh script: '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/coverage cypress-coverage''', returnStatus: true
180
+
181
+ // if ( coverage == 0 ) {
182
+ // publishHTML(target : [allowMissing: false,
183
+ // alwaysLinkToLastBuild: true,
184
+ // keepAll: true,
185
+ // reportDir: 'cypress-coverage/coverage/lcov-report',
186
+ // reportFiles: 'index.html',
187
+ // reportName: 'CypressCoverage',
188
+ // reportTitles: 'Integration Tests Code Coverage'])
189
+ // }
190
+ // if ( videos == 0 ) {
191
+ // sh '''for file in $(find cypress-results -name *.xml); do if [ $(grep -E 'failures="[1-9].*"' $file | wc -l) -eq 0 ]; then testname=$(grep -E 'file=.*failures="0"' $file | sed 's#.* file=".*\\/\\(.*\\.[jsxt]\\+\\)" time.*#\\1#' ); rm -f cypress-videos/videos/$testname.mp4; fi; done'''
192
+ // archiveArtifacts artifacts: 'cypress-videos/**/*.mp4', fingerprint: true, allowEmptyArchive: true
193
+ // }
194
+ // } finally {
195
+ // catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
196
+ // junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
197
+ // }
198
+ // catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
199
+ // sh '''docker logs $IMAGE_NAME-cypress'''
200
+ // }
201
+ // sh script: "docker stop $IMAGE_NAME-cypress", returnStatus: true
202
+ // sh script: "docker stop $IMAGE_NAME-plone", returnStatus: true
203
+ // sh script: "docker rm -v $IMAGE_NAME-plone", returnStatus: true
204
+ // sh script: "docker rm -v $IMAGE_NAME-cypress", returnStatus: true
205
+ // }
206
+ // }
207
+ // }
208
+ // }
209
+ // }
117
210
  }
118
- )
211
+ }
212
+ }
213
+ post {
214
+ always {
215
+ sh script: "docker rmi $IMAGE_NAME-frontend", returnStatus: true
216
+ }
119
217
  }
120
218
  }
121
219
 
122
- // stage('Integration tests') {
220
+ // stage('Report to SonarQube') {
123
221
  // when {
124
222
  // anyOf {
125
223
  // allOf {
@@ -129,60 +227,30 @@ pipeline {
129
227
  // allOf {
130
228
  // environment name: 'CHANGE_ID', value: ''
131
229
  // anyOf {
132
- // not { changelog '.*^Automated release [0-9\\.]+$' }
230
+ // allOf {
231
+ // branch 'develop'
232
+ // not { changelog '.*^Automated release [0-9\\.]+$' }
233
+ // }
133
234
  // branch 'master'
134
235
  // }
135
236
  // }
136
237
  // }
137
238
  // }
138
239
  // steps {
139
- // parallel(
140
-
141
- // "Cypress": {
142
- // node(label: 'docker') {
143
- // script {
144
- // try {
145
- // sh '''docker pull plone; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
146
- // sh '''docker pull plone/volto-addon-ci:15.x; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e VOLTO=$VOLTO -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=test plone/volto-addon-ci:15.x cypress'''
147
- // } finally {
148
- // try {
149
- // sh '''rm -rf cypress-reports cypress-results cypress-coverage'''
150
- // sh '''mkdir -p cypress-reports cypress-results cypress-coverage'''
151
- // sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/videos cypress-reports/'''
152
- // sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/reports cypress-results/'''
153
- // coverage = sh script: '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/coverage cypress-coverage/''', returnStatus: true
154
- // if ( coverage == 0 ) {
155
- // publishHTML (target : [allowMissing: false,
156
- // alwaysLinkToLastBuild: true,
157
- // keepAll: true,
158
- // reportDir: 'cypress-coverage/coverage/lcov-report',
159
- // reportFiles: 'index.html',
160
- // reportName: 'CypressCoverage',
161
- // reportTitles: 'Integration Tests Code Coverage'])
162
- // }
163
- // sh '''touch empty_file; for ok_test in $(grep -E 'file=.*failures="0"' $(grep 'testsuites .*failures="0"' $(find cypress-results -name *.xml) empty_file | awk -F: '{print $1}') empty_file | sed 's/.* file="\\(.*\\)" time.*/\\1/' | sed 's#^cypress/integration/##g' | sed 's#^../../../node_modules/@eeacms/##g'); do rm -f cypress-reports/videos/$ok_test.mp4; rm -f cypress-reports/$ok_test.mp4; done'''
164
- // archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: true
165
- // stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true
166
- // }
167
- // finally {
168
- // catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
169
- // junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
170
- // }
171
- // sh script: "docker stop $BUILD_TAG-plone", returnStatus: true
172
- // sh script: "docker rm -v $BUILD_TAG-plone", returnStatus: true
173
- // sh script: "docker rm -v $BUILD_TAG-cypress", returnStatus: true
174
-
175
- // }
176
- // }
177
- // }
178
- // }
240
+ // script {
241
+ // def scannerHome = tool 'SonarQubeScanner'
242
+ // def nodeJS = tool 'NodeJS'
243
+ // withSonarQubeEnv('Sonarqube') {
244
+ // sh '''sed -i "s#/app/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
245
+ // sh '''sed -i "s#src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
246
+ // sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
247
+ // sh '''try=5; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 15; try=\$(( \$try - 1 )); fi; done'''
179
248
  // }
180
-
181
- // )
249
+ // }
182
250
  // }
183
251
  // }
184
252
 
185
- // stage('Report to SonarQube') {
253
+ // stage('SonarQube compare to master') {
186
254
  // when {
187
255
  // anyOf {
188
256
  // allOf {
@@ -191,65 +259,25 @@ pipeline {
191
259
  // }
192
260
  // allOf {
193
261
  // environment name: 'CHANGE_ID', value: ''
194
- // anyOf {
195
- // allOf {
196
- // branch 'develop'
197
- // not { changelog '.*^Automated release [0-9\\.]+$' }
198
- // }
199
- // branch 'master'
200
- // }
262
+ // branch 'develop'
263
+ // not { changelog '.*^Automated release [0-9\\.]+$' }
201
264
  // }
202
265
  // }
203
266
  // }
204
267
  // steps {
205
- // node(label: 'swarm') {
206
- // script{
207
- // checkout scm
208
- // unstash "xunit-reports"
209
- // unstash "cypress-coverage"
210
- // def scannerHome = tool 'SonarQubeScanner';
211
- // def nodeJS = tool 'NodeJS';
212
- // withSonarQubeEnv('Sonarqube') {
213
- // sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
214
- // sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
215
- // sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done'''
216
- // }
268
+ // script {
269
+ // sh '''echo "Error" > checkresult.txt'''
270
+ // catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
271
+ // sh '''set -o pipefail; docker run -i --rm --pull always --name="$IMAGE_NAME-gitflow-sn" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" eeacms/gitflow /checkSonarqubemaster.sh | grep -v "Found script" | tee checkresult.txt'''
217
272
  // }
273
+
274
+ // 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',
275
+ // text: readFile(file: 'checkresult.txt'), conclusion: "${currentBuild.currentResult}",
276
+ // detailsURL: "${env.BUILD_URL}display/redirect"
218
277
  // }
219
278
  // }
220
279
  // }
221
- /*
222
- stage('SonarQube compare to master') {
223
- when {
224
- anyOf {
225
- allOf {
226
- not { environment name: 'CHANGE_ID', value: '' }
227
- environment name: 'CHANGE_TARGET', value: 'develop'
228
- }
229
- allOf {
230
- environment name: 'CHANGE_ID', value: ''
231
- branch 'develop'
232
- not { changelog '.*^Automated release [0-9\\.]+$' }
233
- }
234
- }
235
- }
236
- steps {
237
- node(label: 'docker') {
238
- script {
239
- sh '''docker pull eeacms/gitflow'''
240
- sh '''echo "Error" > checkresult.txt'''
241
- catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
242
- 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'''
243
- }
244
280
 
245
- 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",
246
- text: readFile(file: 'checkresult.txt'), conclusion: "${currentBuild.currentResult}",
247
- detailsURL: "${env.BUILD_URL}display/redirect"
248
- }
249
- }
250
- }
251
- }
252
- */
253
281
  stage('Pull Request') {
254
282
  when {
255
283
  not {
@@ -258,20 +286,16 @@ pipeline {
258
286
  environment name: 'CHANGE_TARGET', value: 'master'
259
287
  }
260
288
  steps {
261
- node(label: 'docker') {
262
- script {
263
- if ( env.CHANGE_BRANCH != "develop" ) {
264
- error "Pipeline aborted due to PR not made from develop branch"
265
- }
266
- withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) {
267
- sh '''docker pull eeacms/gitflow'''
268
- sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-pr" -e GIT_CHANGE_TARGET="$CHANGE_TARGET" -e GIT_CHANGE_BRANCH="$CHANGE_BRANCH" -e GIT_CHANGE_AUTHOR="$CHANGE_AUTHOR" -e GIT_CHANGE_TITLE="$CHANGE_TITLE" -e GIT_TOKEN="$GITHUB_TOKEN" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e GIT_ORG="$GIT_ORG" -e GIT_NAME="$GIT_NAME" -e LANGUAGE=javascript eeacms/gitflow'''
269
- }
289
+ script {
290
+ if (env.CHANGE_BRANCH != 'develop') {
291
+ error 'Pipeline aborted due to PR not made from develop branch'
292
+ }
293
+ withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) {
294
+ sh '''docker run --pull always -i --rm --name="$IMAGE_NAME-gitflow-pr" -e GIT_CHANGE_TARGET="$CHANGE_TARGET" -e GIT_CHANGE_BRANCH="$CHANGE_BRANCH" -e GIT_CHANGE_AUTHOR="$CHANGE_AUTHOR" -e GIT_CHANGE_TITLE="$CHANGE_TITLE" -e GIT_TOKEN="$GITHUB_TOKEN" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e GIT_ORG="$GIT_ORG" -e GIT_NAME="$GIT_NAME" -e LANGUAGE=javascript eeacms/gitflow'''
270
295
  }
271
296
  }
272
297
  }
273
298
  }
274
-
275
299
  }
276
300
 
277
301
  post {
package/Makefile CHANGED
@@ -46,10 +46,15 @@ endif
46
46
  DIR=$(shell basename $$(pwd))
47
47
  NODE_MODULES?="../../../node_modules"
48
48
  PLONE_VERSION?=6
49
- VOLTO_VERSION?=16
49
+ VOLTO_VERSION?=16.31.1
50
50
  ADDON_PATH="${DIR}"
51
51
  ADDON_NAME="@eeacms/${ADDON_PATH}"
52
52
  DOCKER_COMPOSE=PLONE_VERSION=${PLONE_VERSION} VOLTO_VERSION=${VOLTO_VERSION} ADDON_NAME=${ADDON_NAME} ADDON_PATH=${ADDON_PATH} docker compose
53
+ RAZZLE_INTERNAL_API_PATH?="http://localhost:8080/Plone"
54
+ RAZZLE_DEV_PROXY_API_PATH?="${RAZZLE_INTERNAL_API_PATH}"
55
+ CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}"
56
+
57
+
53
58
 
54
59
  # Top-level targets
55
60
  .PHONY: all
@@ -77,11 +82,11 @@ shell: ## Start a shell in the frontend container
77
82
 
78
83
  .PHONY: cypress-open
79
84
  cypress-open: ## Open cypress integration tests
80
- NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open
85
+ CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress open
81
86
 
82
87
  .PHONY: cypress-run
83
88
  cypress-run: ## Run cypress integration tests
84
- NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run
89
+ CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run --browser chrome
85
90
 
86
91
  .PHONY: test
87
92
  test: ## Run jest tests
@@ -129,3 +134,28 @@ i18n: ## i18n
129
134
  help: ## Show this help.
130
135
  @echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
131
136
  head -n 14 Makefile
137
+
138
+ .PHONY: ci-fix
139
+ ci-fix:
140
+ echo "Running lint-fix"
141
+ make lint-fix
142
+ echo "Running prettier-fix"
143
+ make prettier-fix
144
+ echo "Running stylelint-fix"
145
+ make stylelint-fix
146
+
147
+ .PHONY: test-ci
148
+ test-ci:
149
+ cd /app
150
+ RAZZLE_JEST_CONFIG=src/addons/${ADDON_PATH}/jest-addon.config.js CI=true yarn test src/addons/${ADDON_PATH}/src --watchAll=false --reporters=default --reporters=jest-junit --collectCoverage --coverageReporters lcov cobertura text
151
+
152
+ .PHONY: start-ci
153
+ start-ci:
154
+ cp .coverage.babel.config.js /app/babel.config.js
155
+ cd ../..
156
+ yarn start
157
+
158
+ .PHONY: cypress-ci
159
+ cypress-ci:
160
+ $(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
161
+ NODE_ENV=development make cypress-run
@@ -1,7 +1,7 @@
1
- require('dotenv').config({ path: __dirname + '/.env' })
1
+ require('dotenv').config({ path: __dirname + '/.env' });
2
2
 
3
3
  module.exports = {
4
- testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
4
+ testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s(x)?'],
5
5
  collectCoverageFrom: [
6
6
  'src/addons/**/src/**/*.{js,jsx,ts,tsx}',
7
7
  '!src/**/*.d.ts',
@@ -11,11 +11,11 @@ module.exports = {
11
11
  '@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
12
12
  '@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
13
13
  '@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
14
- '@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
14
+ '@package/(.*)$': '<rootDir>/src/$1',
15
15
  '@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
16
16
  '@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
17
17
  '@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
18
- '@plone/volto-slate$':
18
+ '@plone/volto-slate':
19
19
  '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
20
20
  '@plone/volto-slate/(.*)$':
21
21
  '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src/$1',
@@ -23,15 +23,15 @@ module.exports = {
23
23
  'load-volto-addons':
24
24
  '<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
25
25
  },
26
- transformIgnorePatterns: [
27
- '/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
28
- ],
29
26
  transform: {
30
27
  '^.+\\.js(x)?$': 'babel-jest',
31
28
  '^.+\\.(png)$': 'jest-file',
32
29
  '^.+\\.(jpg)$': 'jest-file',
33
30
  '^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
34
31
  },
32
+ transformIgnorePatterns: [
33
+ 'node_modules/(?!(@eeacms/volto-clms-utils/|@eeacms/volto-tabs-block/|@plone/volto/|slick-carousel|react-input-range))',
34
+ ],
35
35
  coverageThreshold: {
36
36
  global: {
37
37
  branches: 5,
@@ -40,9 +40,5 @@ module.exports = {
40
40
  statements: 5,
41
41
  },
42
42
  },
43
- ...(process.env.JEST_USE_SETUP === 'ON' && {
44
- setupFilesAfterEnv: [
45
- '<rootDir>/node_modules/@eeacms/volto-arcgis-block/jest.setup.js',
46
- ],
47
- }),
48
- }
43
+ setupFilesAfterEnv: ['<rootDir>/src/addons/volto-arcgis-block/jest.setup.js'],
44
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.366",
3
+ "version": "0.1.368",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -1082,10 +1082,20 @@ class MenuWidget extends React.Component {
1082
1082
  button.setAttribute('aria-expanded', 'true');
1083
1083
  }
1084
1084
  }
1085
+ //a comment to test develop branch
1085
1086
  let productDropdown = node.closest('.map-menu-product-dropdown');
1086
1087
  if (productDropdown) {
1087
1088
  let scrollPosition = productDropdown.offsetTop;
1088
1089
  if (dataset) {
1090
+ let familyDropdown = node.closest('.map-menu-family-dropdown');
1091
+ if (familyDropdown) {
1092
+ let button = familyDropdown.querySelector(
1093
+ '.ccl-expandable__button',
1094
+ );
1095
+ if (button) {
1096
+ button.setAttribute('aria-expanded', 'true');
1097
+ }
1098
+ }
1089
1099
  let datasetDropdown = node.closest('.map-menu-product-dropdown');
1090
1100
  if (datasetDropdown) {
1091
1101
  let button = datasetDropdown.querySelector(
@@ -1401,13 +1411,14 @@ class MenuWidget extends React.Component {
1401
1411
  );
1402
1412
  }
1403
1413
 
1404
- metodProcessFamily(family, familyTitle, inheritedIndex, checkProduct) {
1414
+ metodProcessFamily(family, familyTitle, inheritedIndex, checkFamily) {
1405
1415
  var dataset_def = [];
1406
1416
  var datasets = [];
1407
1417
  var index = 0;
1408
1418
  var familyId = familyTitle.replace(/\s+/g, '');
1409
- var inheritedIndexProduct = inheritedIndex + '_' + familyId;
1410
- checkProduct = 'map_product_' + inheritedIndexProduct;
1419
+ var inheritedIndexFamily = inheritedIndex + '_' + familyId;
1420
+ checkFamily = 'map_family_' + inheritedIndexFamily;
1421
+ var checkProduct = 'map_product_' + inheritedIndex;
1411
1422
  var familyTitleName = '';
1412
1423
  this.tax.tree.forEach((element) => {
1413
1424
  element.children.forEach((element) => {
@@ -1418,38 +1429,23 @@ class MenuWidget extends React.Component {
1418
1429
  });
1419
1430
  if (family && Array.isArray(family)) {
1420
1431
  for (var i in family) {
1421
- // if (this.filtersApplied) {
1422
- // dataset_def = document
1423
- // .querySelector('#' + checkProduct)
1424
- // ?.getAttribute('defcheck');
1425
- // } else if (
1426
- // product.Datasets[i] &&
1427
- // product.Datasets[i].Default_active === true
1428
- // ) {
1429
- // var idDataset = 'map_dataset_' + inheritedIndexProduct + '_' + index;
1430
- // dataset_def.push(idDataset);
1431
- // }
1432
-
1433
- // CLMS-1545
1434
- // if (!product.Datasets[i].MarkAsDownloadableNoServiceToVisualize) {
1435
1432
  if (family[i]) {
1436
1433
  datasets.push(
1437
1434
  this.metodProcessDataset(
1438
1435
  family[i],
1439
1436
  index,
1440
- inheritedIndexProduct,
1441
- checkProduct,
1437
+ inheritedIndex,
1438
+ checkFamily,
1442
1439
  ),
1443
1440
  );
1444
1441
  index++;
1445
1442
  }
1446
- // }
1447
1443
  }
1448
1444
  }
1449
1445
 
1450
1446
  // Empty vector, add the first dataset
1451
1447
  if (!dataset_def.length) {
1452
- var idDatasetB = 'map_dataset_' + inheritedIndexProduct + '_0';
1448
+ var idDatasetB = 'map_dataset_' + inheritedIndexFamily + '_0';
1453
1449
  dataset_def.push(idDatasetB);
1454
1450
  }
1455
1451
  let style = this.props.download ? { display: 'none' } : {};
@@ -1457,13 +1453,13 @@ class MenuWidget extends React.Component {
1457
1453
  return (
1458
1454
  <div
1459
1455
  className="map-menu-family-dropdown"
1460
- id={'family_' + inheritedIndexProduct}
1456
+ id={'family_' + inheritedIndexFamily}
1461
1457
  familyid={familyId}
1462
1458
  key={'a' + familyId}
1463
1459
  >
1464
1460
  <fieldset className="ccl-fieldset" key={'b' + familyId}>
1465
1461
  <div
1466
- id={'dropdown_' + inheritedIndexProduct}
1462
+ id={'dropdown_' + inheritedIndexFamily}
1467
1463
  className="ccl-expandable__button"
1468
1464
  aria-expanded="false"
1469
1465
  key={'c' + familyId}
@@ -1480,7 +1476,8 @@ class MenuWidget extends React.Component {
1480
1476
  <div className="ccl-form-group" key={'e' + familyId}>
1481
1477
  <input
1482
1478
  type="checkbox"
1483
- id={checkProduct}
1479
+ id={checkFamily}
1480
+ parentid={checkProduct}
1484
1481
  name=""
1485
1482
  value="name"
1486
1483
  className="ccl-checkbox ccl-required ccl-form-check-input"
@@ -1492,7 +1489,7 @@ class MenuWidget extends React.Component {
1492
1489
  ></input>
1493
1490
  <label
1494
1491
  className="ccl-form-check-label"
1495
- htmlFor={checkProduct}
1492
+ htmlFor={checkFamily}
1496
1493
  key={'f' + familyId}
1497
1494
  >
1498
1495
  <legend className="ccl-form-legend">
@@ -1516,7 +1513,7 @@ class MenuWidget extends React.Component {
1516
1513
  </div>
1517
1514
  <div
1518
1515
  className="ccl-form map-menu-family-container"
1519
- id={'family_container_' + inheritedIndexProduct}
1516
+ id={'family_container_' + inheritedIndexFamily}
1520
1517
  >
1521
1518
  {datasets}
1522
1519
  </div>
@@ -1874,6 +1871,27 @@ class MenuWidget extends React.Component {
1874
1871
  datasetCheck.checked = trueChecks > 0;
1875
1872
 
1876
1873
  let parentId = datasetCheck.getAttribute('parentid');
1874
+ if (parentId) {
1875
+ if (parentId.includes('map_family')) {
1876
+ this.updateCheckFamily(parentId);
1877
+ } else {
1878
+ this.updateCheckProduct(parentId);
1879
+ }
1880
+ }
1881
+ }
1882
+
1883
+ updateCheckFamily(id) {
1884
+ let familyCheck = document.querySelector('#' + id);
1885
+ if (!familyCheck) return;
1886
+
1887
+ let layerChecks = Array.from(
1888
+ document.querySelectorAll('[parentid="' + id + '"]'),
1889
+ );
1890
+
1891
+ let trueChecks = layerChecks.filter((elem) => elem.checked).length;
1892
+ familyCheck.checked = trueChecks > 0;
1893
+
1894
+ let parentId = familyCheck.getAttribute('parentid');
1877
1895
  if (parentId) {
1878
1896
  this.updateCheckProduct(parentId);
1879
1897
  }