@eeacms/volto-clms-theme 1.1.29 → 1.1.31

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,26 @@ 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.1.31](https://github.com/eea/volto-clms-theme/compare/1.1.30...1.1.31) - 3 August 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - fix historic download [ionlizarazu - [`8676d52`](https://github.com/eea/volto-clms-theme/commit/8676d52151bc5843c57552953e5927a49804db29)]
12
+ - add HistoricHOC to all downloads view [ionlizarazu - [`f1634fb`](https://github.com/eea/volto-clms-theme/commit/f1634fbeec45fd3c1b1c9dd391cd5784f78d5636)]
13
+ ### [1.1.30](https://github.com/eea/volto-clms-theme/compare/1.1.29...1.1.30) - 3 August 2023
14
+
15
+ #### :house: Documentation changes
16
+
17
+ - docs: Cleanup Makefile, update DEVELOP documentation, i18n - refs #254894 [valentinab25 - [`4ad3273`](https://github.com/eea/volto-clms-theme/commit/4ad32731b97cd60e4183715c445e4c6a7e2d07ad)]
18
+
19
+ #### :hammer_and_wrench: Others
20
+
21
+ - remove CLMSHistoricDownloadView and reuse CLMSDownloadView for the render [ionlizarazu - [`a366c4d`](https://github.com/eea/volto-clms-theme/commit/a366c4d85ea3c92ea041ff2ad8e6095a9ce5be4b)]
22
+ - comment some cypress related Jenkinsfile tests [ionlizarazu - [`82a48f3`](https://github.com/eea/volto-clms-theme/commit/82a48f34040c72cb71fb1204edab7bb920ae1d18)]
23
+ - uncomment Integration tests at Jenkinsfile [ionlizarazu - [`281ce68`](https://github.com/eea/volto-clms-theme/commit/281ce6821223b1e9a4ba4f0c07cc72d593d03403)]
24
+ - add sonarcube reporting to Jenkinsfile [ionlizarazu - [`4411c40`](https://github.com/eea/volto-clms-theme/commit/4411c40c648d0783e5c302c2f1c5a4f2f5a79f6f)]
25
+ - sonarcube tests [ionlizarazu - [`23c76d4`](https://github.com/eea/volto-clms-theme/commit/23c76d48c0c3006952496edb829191294439ce87)]
26
+ - move FAQ to the 4th position in the Search Block filters [ionlizarazu - [`9a6f4a9`](https://github.com/eea/volto-clms-theme/commit/9a6f4a963dac5bdc37c98e2d318584758c00bbee)]
7
27
  ### [1.1.29](https://github.com/eea/volto-clms-theme/compare/1.1.28...1.1.29) - 18 July 2023
8
28
 
9
29
  #### :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-clms-theme.git
9
+ cd volto-clms-theme
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-clms-theme/
23
+ ```
24
+
25
+ ### Or add @eeacms/volto-clms-theme 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`
@@ -50,3 +72,37 @@ Before starting make sure your development environment is properly set. See [Vol
50
72
 
51
73
  $ cd src/addons/volto-clms-theme/
52
74
 
75
+
76
+ ## Cypress
77
+
78
+ To run cypress locally, first make sure you don't have any Volto/Plone running on ports `8080` and `3000`.
79
+
80
+ You don't have to be in a `clean-volto-project`, you can be in any Volto Frontend
81
+ project where you added `volto-clms-theme` to `mrs.developer.json`
82
+
83
+ Go to:
84
+
85
+ ```BASH
86
+ cd src/addons/volto-clms-theme/
87
+ ```
88
+
89
+ Start:
90
+
91
+ ```Bash
92
+ make
93
+ make start
94
+ ```
95
+
96
+ This will build and start with Docker a clean `Plone backend` and `Volto Frontend` with `volto-clms-theme` block installed.
97
+
98
+ Open Cypress Interface:
99
+
100
+ ```Bash
101
+ make cypress-open
102
+ ```
103
+
104
+ Or run it:
105
+
106
+ ```Bash
107
+ make cypress-run
108
+ ```
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
@@ -165,37 +165,63 @@ pipeline {
165
165
  // }
166
166
  // }
167
167
 
168
- // stage('Report to SonarQube') {
169
- // when {
170
- // allOf {
171
- // environment name: 'CHANGE_ID', value: ''
172
- // anyOf {
173
- // branch 'master'
174
- // allOf {
175
- // branch 'develop'
176
- // not { changelog '.*^Automated release [0-9\\.]+$' }
177
- // }
178
- // }
179
- // }
180
- // }
181
- // steps {
182
- // node(label: 'swarm') {
183
- // script{
184
- // checkout scm
185
- // unstash "xunit-reports"
186
- // unstash "cypress-coverage"
187
- // def scannerHome = tool 'SonarQubeScanner';
188
- // def nodeJS = tool 'NodeJS';
189
- // withSonarQubeEnv('Sonarqube') {
190
- // sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
191
- // sh '''sed -i "s#src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
192
- // 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"
193
- // 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'''
194
- // }
195
- // }
196
- // }
197
- // }
198
- // }
168
+ stage('Report to SonarQube') {
169
+ when {
170
+ allOf {
171
+ environment name: 'CHANGE_ID', value: ''
172
+ anyOf {
173
+ branch 'master'
174
+ allOf {
175
+ branch 'develop'
176
+ not { changelog '.*^Automated release [0-9\\.]+$' }
177
+ }
178
+ }
179
+ }
180
+ }
181
+ steps {
182
+ node(label: 'swarm') {
183
+ script{
184
+ checkout scm
185
+ unstash "xunit-reports"
186
+ // unstash "cypress-coverage"
187
+ def scannerHome = tool 'SonarQubeScanner';
188
+ def nodeJS = tool 'NodeJS';
189
+ withSonarQubeEnv('Sonarqube') {
190
+ sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
191
+ sh '''sed -i "s#src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
192
+ // 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"
193
+ sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
194
+ 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'''
195
+ }
196
+ }
197
+ }
198
+ }
199
+ }
200
+
201
+ stage('SonarQube compare to master') {
202
+ when {
203
+ allOf {
204
+ environment name: 'CHANGE_ID', value: ''
205
+ branch 'develop'
206
+ not { changelog '.*^Automated release [0-9\\.]+$' }
207
+ }
208
+ }
209
+ steps {
210
+ node(label: 'docker') {
211
+ script {
212
+ sh '''docker pull eeacms/gitflow'''
213
+ sh '''echo "Error" > checkresult.txt'''
214
+ catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
215
+ 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'''
216
+ }
217
+
218
+ 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",
219
+ text: readFile(file: 'checkresult.txt'), conclusion: "${currentBuild.currentResult}",
220
+ detailsURL: "${env.BUILD_URL}display/redirect"
221
+ }
222
+ }
223
+ }
224
+ }
199
225
 
200
226
  stage('Pull Request') {
201
227
  when {
package/Makefile CHANGED
@@ -1,39 +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-clms-theme"
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 :)"
126
+ head -n 14 Makefile
package/README.md CHANGED
@@ -14,23 +14,35 @@
14
14
  [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-clms-theme-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-clms-theme-develop)
15
15
  [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-clms-theme-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-clms-theme-develop)
16
16
 
17
+
17
18
  [Volto](https://github.com/plone/volto) add-on
18
19
 
19
20
  ## Features
20
21
 
22
+ Demo GIF
23
+
21
24
  ## Getting started
22
25
 
23
- 1. Create new volto project if you don't already have one:
26
+ ### Try volto-clms-theme with Docker
24
27
 
25
- ```
26
- $ npm install -g yo @plone/generator-volto
27
- $ yo @plone/volto my-volto-project --addon @eeacms/volto-clms-theme
28
+ git clone https://github.com/eea/volto-clms-theme.git
29
+ cd volto-clms-theme
30
+ make
31
+ make start
32
+
33
+ Go to http://localhost:3000
34
+
35
+ ### Add volto-clms-theme to your Volto project
36
+
37
+ 1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone
28
38
 
29
- $ cd my-volto-project
30
- $ yarn add -W @eeacms/volto-clms-theme
39
+ ```Bash
40
+ docker compose up backend
31
41
  ```
32
42
 
33
- 1. If you already have a volto project, just update `package.json`:
43
+ 1. Start Volto frontend
44
+
45
+ * If you already have a volto project, just update `package.json`:
34
46
 
35
47
  ```JSON
36
48
  "addons": [
@@ -38,95 +50,32 @@
38
50
  ],
39
51
 
40
52
  "dependencies": {
41
- "@eeacms/volto-clms-theme": "^1.0.0"
53
+ "@eeacms/volto-clms-theme": "*"
42
54
  }
43
55
  ```
44
56
 
45
- 1. Install new add-ons and restart Volto:
46
-
47
- ```
48
- $ yarn
49
- $ yarn start
50
- ```
51
-
52
- 1. Go to http://localhost:3000
53
-
54
- 1. Happy editing!
55
-
56
- ## Release
57
-
58
- ### Automatic release using Jenkins
59
-
60
- * The automatic release is started by creating a [Pull Request](../../compare/master...develop) from `develop` to `master`. The pull request status checks correlated to the branch and PR Jenkins jobs need to be processed successfully. 1 review from a github user with rights is mandatory.
61
- * It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits.
62
- * The automatic release is done by [Jenkins](https://ci.eionet.europa.eu). The status of the release job can be seen both in the `README.md` badges and the green check/red cross/yellow circle near the last commit information. If you click on the icon, you will have the list of checks that were run. The `continuous-integration/jenkins/branch` link goes to the Jenkins job execution webpage.
63
- * Automated release scripts are located in the `eeacms/gitflow` docker image, specifically [js-release.sh](https://github.com/eea/eea.docker.gitflow/blob/master/src/js-release.sh) script. It uses the `release-it` tool.
64
- * As long as a PR request is open from develop to master, the PR Jenkins job will automatically re-create the CHANGELOG.md and package.json files to be production-ready.
65
- * The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0).
66
- * You can manually change the version in `package.json`. The new version must not be already present in the tags/releases of the repository, otherwise it will be automatically increased by the script. Any changes to the version will trigger a `CHANGELOG.md` re-generation.
67
- * Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file.
68
-
69
- ### Manual release from the develop branch ( beta release )
70
-
71
- #### Installation and configuration of release-it
72
-
73
- You need to first install the [release-it](https://github.com/release-it/release-it) client.
74
-
75
- ```
76
- npm install -g release-it
77
- ```
78
-
79
- Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
80
-
81
- Release-it is a tool that automates 4 important steps in the release process:
82
-
83
- 1. Version increase in `package.json` ( increased from the current version in `package.json`)
84
- 2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases )
85
- 3. GitHub release on the commit with the changelog and package.json modification on the develop branch
86
- 4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
87
-
88
- To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
57
+ * If not, create one:
89
58
 
90
59
  ```
91
- export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
60
+ npm install -g yo @plone/generator-volto
61
+ yo @plone/volto my-volto-project --canary --addon @eeacms/volto-clms-theme
62
+ cd my-volto-project
92
63
  ```
93
64
 
94
- To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
65
+ 1. Install new add-ons and restart Volto:
95
66
 
96
67
  ```
97
- echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
68
+ yarn
69
+ yarn start
98
70
  ```
99
71
 
100
- #### Using release-it tool
101
-
102
- There are 3 yarn scripts that can be run to do the release
103
-
104
- ##### yarn release-beta
105
-
106
- Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
107
-
108
- ```
109
- ? Select increment (next version):
110
- ❯ prepatch (0.1.1-beta.0)
111
- preminor (0.2.0-beta.0)
112
- premajor (1.0.0-beta.0)
113
- Other, please specify...
114
- ```
115
-
116
- ##### yarn release-major-beta
117
-
118
- Same as `yarn release-beta`, but with premajor version pre-selected.
119
-
120
- ##### yarn release
121
-
122
- Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
123
-
124
- #### Important notes
72
+ 1. Go to http://localhost:3000
125
73
 
126
- > Do not use release-it tool on master branch, the commit on CHANGELOG.md file and the version increase in the package.json file can't be done without a PULL REQUEST.
74
+ 1. Happy editing!
127
75
 
128
- > Do not keep Pull Requests from develop to master branches open when you are doing beta releases from the develop branch. As long as a PR to master is open, an automatic script will run on every commit and will update both the version and the changelog to a production-ready state - ( MAJOR.MINOR.PATCH mandatory format for version).
76
+ ## Release
129
77
 
78
+ See [RELEASE.md](https://github.com/eea/volto-clms-theme/blob/master/RELEASE.md).
130
79
 
131
80
  ## How to contribute
132
81
 
@@ -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-clms-theme",
3
- "version": "1.1.29",
3
+ "version": "1.1.31",
4
4
  "description": "volto-clms-theme: Volto theme for CLMS site",
5
5
  "main": "src/index.js",
6
6
  "author": "CodeSyntax for the European Environment Agency",
@@ -45,13 +45,13 @@ const rewriteOptions = (name, choices) => {
45
45
  'Product',
46
46
  'DataSet',
47
47
  'TechnicalLibrary',
48
+ 'FAQ',
48
49
  'UseCase',
49
50
  'News Item',
50
51
  'eea.meeting',
51
52
  'Tender',
52
53
  'WorkOpportunity',
53
54
  'Document',
54
- 'FAQ',
55
55
  ];
56
56
 
57
57
  const dataset_geographical_classification = [
@@ -50,13 +50,19 @@ const CLMSDownloadsView = (props) => {
50
50
  id: 'Downloads',
51
51
  defaultMessage: 'Downloads',
52
52
  },
53
+ HistoricCartDownloads: {
54
+ id: 'Historic downloads',
55
+ defaultMessage: 'Historic downloads',
56
+ },
53
57
  });
54
58
 
55
59
  useEffect(() => {
56
60
  dispatch(
57
61
  getExtraBreadcrumbItems([
58
62
  {
59
- title: formatMessage(messages.CartDownloads),
63
+ title: props.historicView
64
+ ? formatMessage(messages.HistoricCartDownloads)
65
+ : formatMessage(messages.CartDownloads),
60
66
  pathname: props.location.pathname,
61
67
  },
62
68
  ]),
@@ -69,7 +75,9 @@ const CLMSDownloadsView = (props) => {
69
75
  dispatch,
70
76
  formatMessage,
71
77
  messages.CartDownloads,
78
+ messages.HistoricCartDownloads,
72
79
  props.location.pathname,
80
+ props.historicView,
73
81
  ]);
74
82
 
75
83
  function getUIDList(download_data) {
@@ -137,9 +145,16 @@ const CLMSDownloadsView = (props) => {
137
145
  }, [dispatch, downloadtool.delete_download_in_progress]);
138
146
 
139
147
  return (
140
- <>
148
+ <div className="ccl-container ">
141
149
  <Helmet
142
- title={helmetTitle(formatMessage(messages.CartDownloads), content)}
150
+ title={
151
+ props.historicView
152
+ ? helmetTitle(
153
+ formatMessage(messages.HistoricCartDownloads),
154
+ content,
155
+ )
156
+ : helmetTitle(formatMessage(messages.CartDownloads), content)
157
+ }
143
158
  />
144
159
  <div className="ui container">
145
160
  {!isLoggedIn && (
@@ -160,20 +175,22 @@ const CLMSDownloadsView = (props) => {
160
175
  {isLoggedIn && (
161
176
  <>
162
177
  <h1 className="page-title">
163
- {formatMessage(messages.CartDownloads)}
178
+ {props.historicView
179
+ ? formatMessage(messages.HistoricCartDownloads)
180
+ : formatMessage(messages.CartDownloads)}
164
181
  </h1>
165
182
  <div className="ccl-container">
166
183
  <Segment
167
184
  basic
168
185
  loading={downloadtool.loading || datasetsByUid.loading}
169
186
  >
170
- <CLMSDownloadTask />
187
+ <CLMSDownloadTask all={props.historicView} />
171
188
  </Segment>
172
189
  </div>
173
190
  </>
174
191
  )}
175
192
  </div>
176
- </>
193
+ </div>
177
194
  );
178
195
  };
179
196
 
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+
3
+ const HistoricHOC = (CLMSDownloadsView) =>
4
+ function Component(props) {
5
+ return <CLMSDownloadsView {...props} {...{ historicView: true }} />;
6
+ };
7
+ export default HistoricHOC;
@@ -2,11 +2,6 @@
2
2
  @element: 'custom';
3
3
  @import (multiple) '../../theme.config';
4
4
 
5
- h1,
6
- p {
7
- font-family: Lato;
8
- }
9
-
10
5
  body {
11
6
  margin: 0;
12
7
  }
@@ -42,7 +37,7 @@ body {
42
37
  display: flex;
43
38
  flex-wrap: wrap;
44
39
  }
45
- @media (ma-width: 770px) {
40
+ @media (max-width: 770px) {
46
41
  .lightgallery .lg-react-element {
47
42
  justify-content: center;
48
43
  }
@@ -21,7 +21,7 @@ function CclTab(props) {
21
21
  currentLocation = '',
22
22
  } = props;
23
23
  const token = useSelector((state) => state.userSession?.token);
24
- function onTabClick() {
24
+ function onTabClick(e) {
25
25
  onClick(tabId);
26
26
  }
27
27
  const [redirecting, setRedirecting] = React.useState(false);
@@ -27,7 +27,7 @@ const TextareaWidget = (props) => {
27
27
  const [lengthError, setlengthError] = useState('');
28
28
 
29
29
  const onhandleChange = (id, value) => {
30
- if (maxLength & value?.length) {
30
+ if (maxLength && value?.length) {
31
31
  let remlength = maxLength - value.length;
32
32
  if (remlength < 0) {
33
33
  setlengthError(
package/src/index.js CHANGED
@@ -10,7 +10,7 @@ import CLMSDatasetDetailView from '@eeacms/volto-clms-theme/components/CLMSDatas
10
10
  import CLMSDownloadCartView from './components/CLMSDownloadCartView/CLMSDownloadCartView';
11
11
  import CLMSDownloadableFileView from '@eeacms/volto-clms-theme/components/CLMSDownloadableFileView/CLMSDownloadableFileView';
12
12
  import CLMSDownloadsView from './components/CLMSDownloadsView/CLMSDownloadsView';
13
- import CLMSHistoricDownloadsView from './components/CLMSDownloadsView/CLMSHistoricDownloadsView';
13
+ import HistoricHOC from './components/CLMSDownloadsView/HistoricHOC';
14
14
  import CLMSMapViewerView from './components/CLMSMapViewerView/CLMSMapViewerView';
15
15
  import CLMSMeetingEmailView from '@eeacms/volto-clms-theme/components/CLMSMeetingView/CLMSMeetingEmailView';
16
16
  import CLMSMeetingEmailsView from '@eeacms/volto-clms-theme/components/CLMSMeetingView/CLMSMeetingEmailsView';
@@ -275,7 +275,7 @@ const applyConfig = (config) => {
275
275
  },
276
276
  {
277
277
  path: '/**/all-downloads',
278
- component: CLMSHistoricDownloadsView,
278
+ component: HistoricHOC(CLMSDownloadsView),
279
279
  },
280
280
  {
281
281
  path: `/(${config.settings.supportedLanguages.join('|')})/sitemap`,
@@ -1,180 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { defineMessages, useIntl } from 'react-intl';
3
- import { useDispatch, useSelector } from 'react-redux';
4
- import { Segment } from 'semantic-ui-react';
5
-
6
- import { Forbidden, Unauthorized } from '@plone/volto/components';
7
- import { Helmet } from '@plone/volto/helpers';
8
- import { helmetTitle } from '@eeacms/volto-clms-theme/components/CclUtils';
9
- import useCartState from '@eeacms/volto-clms-utils/cart/useCartState';
10
-
11
- import {
12
- getDatasetsByUid,
13
- getExtraBreadcrumbItems,
14
- getDownloadtool,
15
- } from '../../actions';
16
- import CLMSDownloadTask from './CLMSDownloadTasks';
17
-
18
- /**
19
- * CLMSDownloadsView.
20
- * @module components/CLMSDownloadsView/CLMSDownloadsView
21
- */
22
-
23
- const useInterval = (f, delay) => {
24
- const [timer, setTimer] = useState(undefined);
25
- const start = () => {
26
- if (timer) return;
27
- setTimer(setInterval(f, delay));
28
- };
29
- const stop = () => {
30
- if (!timer) return;
31
- setTimer(clearInterval(timer));
32
- };
33
- // eslint-disable-next-line react-hooks/exhaustive-deps
34
- useEffect(() => stop, []);
35
- return start;
36
- };
37
-
38
- const CLMSDownloadsView = (props) => {
39
- const dispatch = useDispatch();
40
- const downloadtool = useSelector((state) => state.downloadtool);
41
- const datasetsByUid = useSelector((state) => state.datasetsByUid);
42
- const content = useSelector((state) => state.content.data);
43
- /* DISPATCH THE getDownloadtool ACTION EVERY 60 SECONDS */
44
- const start = useInterval((_) => dispatch(getDownloadtool()), 60000);
45
- const { isLoggedIn } = useCartState();
46
-
47
- const { formatMessage } = useIntl();
48
- const messages = defineMessages({
49
- CartDownloads: {
50
- id: 'Historic downloads',
51
- defaultMessage: 'Historic downloads',
52
- },
53
- });
54
-
55
- useEffect(() => {
56
- dispatch(
57
- getExtraBreadcrumbItems([
58
- {
59
- title: formatMessage(messages.CartDownloads),
60
- pathname: props.location.pathname,
61
- },
62
- ]),
63
- );
64
- // returned function will be called on component unmount
65
- return () => {
66
- dispatch(getExtraBreadcrumbItems([]));
67
- };
68
- }, [
69
- dispatch,
70
- formatMessage,
71
- messages.CartDownloads,
72
- props.location.pathname,
73
- ]);
74
-
75
- function getUIDList(download_data) {
76
- let uidList = [];
77
- let data_keys = Object.keys(download_data);
78
- if (data_keys?.length !== 0) {
79
- uidList = [
80
- ...new Set(
81
- data_keys
82
- .map((taskID) =>
83
- download_data[taskID].Datasets.map(
84
- (dataset) => dataset.DatasetID,
85
- ),
86
- )
87
- .reduce((elem1, elem2) => elem1.concat(elem2)),
88
- ),
89
- ];
90
- }
91
- return uidList;
92
- }
93
-
94
- useEffect(() => {
95
- if (
96
- downloadtool?.download_queued &&
97
- downloadtool?.download_in_progress &&
98
- downloadtool?.download_finished_ok &&
99
- downloadtool?.download_finished_nok &&
100
- downloadtool?.download_rejected &&
101
- downloadtool?.download_cancelled
102
- ) {
103
- let queuedUidsList = getUIDList(downloadtool.download_queued);
104
- let downloadInProgressUidsList = getUIDList(
105
- downloadtool?.download_in_progress,
106
- );
107
- let finishedOKUidsList = getUIDList(downloadtool?.download_finished_ok);
108
- let finishedNOKUidsList = getUIDList(downloadtool?.download_finished_nok);
109
- let rejectedUidsList = getUIDList(downloadtool?.download_rejected);
110
- let cancelledUidsList = getUIDList(downloadtool?.download_cancelled);
111
- let uidsList = [
112
- ...new Set(
113
- rejectedUidsList.concat(
114
- finishedNOKUidsList.concat(
115
- finishedOKUidsList.concat(
116
- downloadInProgressUidsList.concat(
117
- queuedUidsList.concat(cancelledUidsList),
118
- ),
119
- ),
120
- ),
121
- ),
122
- ),
123
- ];
124
- if (uidsList.length > 0) {
125
- dispatch(getDatasetsByUid(uidsList));
126
- }
127
- }
128
- // eslint-disable-next-line react-hooks/exhaustive-deps
129
- }, [downloadtool, dispatch]);
130
-
131
- useEffect(() => {
132
- if (downloadtool.delete_download_in_progress) {
133
- dispatch(getDownloadtool());
134
- start();
135
- }
136
- // eslint-disable-next-line react-hooks/exhaustive-deps
137
- }, [dispatch, downloadtool.delete_download_in_progress]);
138
-
139
- return (
140
- <div className="ccl-container ">
141
- <Helmet
142
- title={helmetTitle(formatMessage(messages.CartDownloads), content)}
143
- />
144
- <div className="ui container">
145
- {!isLoggedIn && (
146
- <>
147
- {props.token ? (
148
- <Forbidden
149
- pathname={props.pathname}
150
- staticContext={props.staticContext}
151
- />
152
- ) : (
153
- <Unauthorized
154
- pathname={props.pathname}
155
- staticContext={props.staticContext}
156
- />
157
- )}
158
- </>
159
- )}
160
- {isLoggedIn && (
161
- <>
162
- <h1 className="page-title">
163
- {formatMessage(messages.CartDownloads)}
164
- </h1>
165
- <div className="ccl-container">
166
- <Segment
167
- basic
168
- loading={downloadtool.loading || datasetsByUid.loading}
169
- >
170
- <CLMSDownloadTask all={true} />
171
- </Segment>
172
- </div>
173
- </>
174
- )}
175
- </div>
176
- </div>
177
- );
178
- };
179
-
180
- export default CLMSDownloadsView;