Skip to content

Commit

Permalink
Merge pull request #26 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
avoinea authored Jan 16, 2024
2 parents 1265f8e + 21271e9 commit abdab9b
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 47 deletions.
30 changes: 9 additions & 21 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [4.3.0](https://github.com/eea/volto-call-to-action-block/compare/4.2.2...4.3.0) - 16 January 2024

#### :bug: Bug Fixes

- fix: cleanup call-to-action widget to correctly parse internalUrls refs#144165 [nileshgulia1 - [`3cfd827`](https://github.com/eea/volto-call-to-action-block/commit/3cfd8275970cb588fb46543975772aae37dc10dd)]

#### :hammer_and_wrench: Others

- Release 4.3.0 [Alin Voinea - [`b491422`](https://github.com/eea/volto-call-to-action-block/commit/b4914228e57f318fbca137f411dd49f3712df9c8)]
### [4.2.2](https://github.com/eea/volto-call-to-action-block/compare/4.2.1...4.2.2) - 2 November 2023

#### :house: Internal changes

- chore: [JENKINS] Refactor automated testing [valentinab25 - [`478cf6c`](https://github.com/eea/volto-call-to-action-block/commit/478cf6c50122dada7bb1f7859bd8e9795828db49)]
- chore: husky, lint-staged use fixed versions [valentinab25 - [`67f68bc`](https://github.com/eea/volto-call-to-action-block/commit/67f68bcc6fde8888cb44b0c483b4c1933d207e54)]
- chore:volto 16 in tests, update docs, fix stylelint overrides [valentinab25 - [`e958386`](https://github.com/eea/volto-call-to-action-block/commit/e95838603735d0ebfa7829359d1503a4e06a39ac)]

#### :hammer_and_wrench: Others

- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`6a58b9c`](https://github.com/eea/volto-call-to-action-block/commit/6a58b9cde2882d1f0996a5329823bb3a6e03011b)]
- Update README.md [ana-oprea - [`f9b73a5`](https://github.com/eea/volto-call-to-action-block/commit/f9b73a50664cf4a4f1292eb2d5a93dd156e70639)]
### [4.2.1](https://github.com/eea/volto-call-to-action-block/compare/4.2.0...4.2.1) - 29 September 2023

Expand Down Expand Up @@ -46,7 +53,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`8522a41`](https://github.com/eea/volto-call-to-action-block/commit/8522a4181a5a622c2e30482dee26cd740d6c3d09)]
- i18n: Add en [Alin Voinea - [`be35c5d`](https://github.com/eea/volto-call-to-action-block/commit/be35c5dc9ba4f29d5abd6c8eb261371e8daf23bf)]
- test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`567a4ac`](https://github.com/eea/volto-call-to-action-block/commit/567a4ac159360e799ddc5fdcdbef5ec1e453dbe9)]
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`647da7b`](https://github.com/eea/volto-call-to-action-block/commit/647da7bcd410cf2731835f4246888ec97a793bb5)]
### [4.1.4](https://github.com/eea/volto-call-to-action-block/compare/4.1.3...4.1.4) - 16 June 2023

### [4.1.3](https://github.com/eea/volto-call-to-action-block/compare/4.1.2...4.1.3) - 14 June 2023
Expand All @@ -55,13 +61,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :house: Internal changes

- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`2e2d8ad`](https://github.com/eea/volto-call-to-action-block/commit/2e2d8ad039cd60ac5391b63d5359b5bf7cb4d4a5)]

#### :hammer_and_wrench: Others

- test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`e9c4a3f`](https://github.com/eea/volto-call-to-action-block/commit/e9c4a3f6fd4ecad1e1ff2ef28876dcb500ecd4b3)]
- test: Fix test config, coverage Refs #253277 [valentinab25 - [`8a67d7f`](https://github.com/eea/volto-call-to-action-block/commit/8a67d7f21794a33976bbf46b84309cca0c9e58fd)]
- Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`3ae3cb5`](https://github.com/eea/volto-call-to-action-block/commit/3ae3cb51c08b53530cca88921fd8bbc097fa6b70)]
### [4.1.1](https://github.com/eea/volto-call-to-action-block/compare/4.1.0...4.1.1) - 4 April 2023

#### :nail_care: Enhancements
Expand All @@ -73,8 +77,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :hammer_and_wrench: Others

- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`8911bba`](https://github.com/eea/volto-call-to-action-block/commit/8911bbadbe3036432c8d083cc836d3ab7f36c01c)]
- Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`d58685c`](https://github.com/eea/volto-call-to-action-block/commit/d58685ca755e59cd77090ddeb446855d56a73876)]
## [4.0.0](https://github.com/eea/volto-call-to-action-block/compare/3.0.1...4.0.0) - 7 February 2023

#### :nail_care: Enhancements
Expand All @@ -94,17 +96,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :hammer_and_wrench: Others

- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`e46fb39`](https://github.com/eea/volto-call-to-action-block/commit/e46fb392ba15f9280e1a2d91b38e4acaa3105486)]
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`184e4d5`](https://github.com/eea/volto-call-to-action-block/commit/184e4d527764cbb754398b7c1975268c0eacdc86)]
- Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`8ff40cc`](https://github.com/eea/volto-call-to-action-block/commit/8ff40cc8fb5087bd0f56fbc3e38a26f5d61d63fa)]
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`d1ba7b8`](https://github.com/eea/volto-call-to-action-block/commit/d1ba7b844f114305604e7f8c8b3158746dd59a7b)]
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`4dea109`](https://github.com/eea/volto-call-to-action-block/commit/4dea10962560c760c2c44db27d3446a4268ded57)]
- Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`fd6b7f3`](https://github.com/eea/volto-call-to-action-block/commit/fd6b7f31d28e05ed254a32bb213ad662e2635c96)]
- yarn 3 [Alin Voinea - [`8bfd09a`](https://github.com/eea/volto-call-to-action-block/commit/8bfd09a161d1d0b3174585c172a3804e56315dea)]
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`440cd71`](https://github.com/eea/volto-call-to-action-block/commit/440cd71451fd5d5ef0316b5c74b61e66170444a7)]
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`e05f0dd`](https://github.com/eea/volto-call-to-action-block/commit/e05f0dd0cf782872b4105f3305c7f40ccb69cbb9)]
- Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`6d44be8`](https://github.com/eea/volto-call-to-action-block/commit/6d44be88d8aabd57a8b74a3e16be7032dfda5eee)]
- Add Sonarqube tag using forests-frontend addons list [EEA Jenkins - [`4867cf3`](https://github.com/eea/volto-call-to-action-block/commit/4867cf362a91ea38bded8598d1937d33b35a12ab)]
## [2.0.0](https://github.com/eea/volto-call-to-action-block/compare/1.0.0...2.0.0) - 16 November 2022

#### :nail_care: Enhancements
Expand All @@ -114,7 +106,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### :hammer_and_wrench: Others

- test(estlint): Fix .project.eslintrc.js [Alin Voinea - [`39e8df4`](https://github.com/eea/volto-call-to-action-block/commit/39e8df468509414924327917154f035235ec5798)]
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`0e06348`](https://github.com/eea/volto-call-to-action-block/commit/0e06348412feed9eeea6ae5d06ae59b8c21e4eff)]
- test(cypress): Rename [Alin Voinea - [`ef8b823`](https://github.com/eea/volto-call-to-action-block/commit/ef8b82323a0c108e58f73c180f5b4cb23ed04f0e)]
## [1.0.0](https://github.com/eea/volto-call-to-action-block/compare/0.2.4...1.0.0) - 28 October 2022

Expand All @@ -128,15 +119,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- test(cypress): Fix typo [Alin Voinea - [`f3cc342`](https://github.com/eea/volto-call-to-action-block/commit/f3cc3424ace81d26b296882b8484d6b6b12b0d28)]
- Cleanup [Alin Voinea - [`2e63ef6`](https://github.com/eea/volto-call-to-action-block/commit/2e63ef665d3812d44b6a87bac6c7f657e40e2147)]
- Update dependencies [Alin Voinea - [`cfb5062`](https://github.com/eea/volto-call-to-action-block/commit/cfb50627df9a9a15ebe67adc43dac97379c64efb)]
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`09c7c14`](https://github.com/eea/volto-call-to-action-block/commit/09c7c14265b0e63f054c3373530ba1dfbd39f4f7)]
### [0.2.4](https://github.com/eea/volto-call-to-action-block/compare/0.2.3...0.2.4) - 30 June 2022

### [0.2.3](https://github.com/eea/volto-call-to-action-block/compare/0.2.2...0.2.3) - 30 June 2022

#### :hammer_and_wrench: Others

- Add tertiary theming option [Alin Voinea - [`c133291`](https://github.com/eea/volto-call-to-action-block/commit/c133291f17c7a8800271bafe96c008dae3b4ee79)]
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`720a9a6`](https://github.com/eea/volto-call-to-action-block/commit/720a9a62f1505906b5e6e0667272e07598a67972)]
### [0.2.2](https://github.com/eea/volto-call-to-action-block/compare/0.2.1...0.2.2) - 2 June 2022

### [0.2.1](https://github.com/eea/volto-call-to-action-block/compare/0.2.0...0.2.1) - 2 June 2022
Expand All @@ -159,5 +148,4 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :hammer_and_wrench: Others

- yarn bootstrap [Alin Voinea - [`12f3e83`](https://github.com/eea/volto-call-to-action-block/commit/12f3e834d6d3e257cb9e7b6dde80dab783613a01)]
- Initial commit [Alin Voinea - [`00f39c8`](https://github.com/eea/volto-call-to-action-block/commit/00f39c8a36327a821cc613a772bf228451a71e67)]
22 changes: 15 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
pipeline {
tools {
jdk 'Java17'
}
agent {
node { label 'docker-host' }
}
Expand Down Expand Up @@ -74,7 +77,7 @@ pipeline {
stage('Build test image') {
steps {
checkout scm
sh '''docker build --build-arg="VOLTO_VERSION=$VOLTO" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend'''
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'''
}
}

Expand Down Expand Up @@ -159,12 +162,13 @@ pipeline {
script {
try {
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'''
sh '''docker run --link $IMAGE_NAME-plone:plone --entrypoint=make --name="$IMAGE_NAME-cypress" --workdir=/app/src/addons/${GIT_NAME} -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" $IMAGE_NAME-frontend cypress-ci'''
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'''
sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make cypress-ci'''
} finally {
try {
sh '''rm -rf cypress-videos cypress-results cypress-coverage cypress-screenshots'''
sh '''mkdir -p cypress-videos cypress-results cypress-coverage cypress-screenshots'''
sh '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos/'''
videos = sh script: '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos/''', returnStatus: true
sh '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/reports cypress-results/'''
screenshots = sh script: '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/screenshots cypress-screenshots''', returnStatus: true

Expand All @@ -181,12 +185,18 @@ pipeline {
reportName: 'CypressCoverage',
reportTitles: 'Integration Tests Code Coverage'])
}
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'''
archiveArtifacts artifacts: 'cypress-videos/**', fingerprint: true, allowEmptyArchive: true
if ( videos == 0 ) {
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'''
archiveArtifacts artifacts: 'cypress-videos/**/*.mp4', fingerprint: true, allowEmptyArchive: true
}
} finally {
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
}
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
sh '''docker logs $IMAGE_NAME-cypress'''
}
sh script: "docker stop $IMAGE_NAME-cypress", returnStatus: true
sh script: "docker stop $IMAGE_NAME-plone", returnStatus: true
sh script: "docker rm -v $IMAGE_NAME-plone", returnStatus: true
sh script: "docker rm -v $IMAGE_NAME-cypress", returnStatus: true
Expand Down Expand Up @@ -231,8 +241,6 @@ pipeline {
withSonarQubeEnv('Sonarqube') {
sh '''sed -i "s#/app/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
sh '''sed -i "s#src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
sh '''cat xunit-reports/coverage/lcov.info'''
sh '''cat cypress-coverage/coverage/lcov.info'''
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"
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'''
}
Expand Down
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ VOLTO_VERSION?=16
ADDON_PATH="${DIR}"
ADDON_NAME="@eeacms/${ADDON_PATH}"
DOCKER_COMPOSE=PLONE_VERSION=${PLONE_VERSION} VOLTO_VERSION=${VOLTO_VERSION} ADDON_NAME=${ADDON_NAME} ADDON_PATH=${ADDON_PATH} docker compose
RAZZLE_INTERNAL_API_PATH?="${RAZZLE_DEV_PROXY_API_PATH}"
RAZZLE_INTERNAL_API_PATH?="http://localhost:8080/Plone"
RAZZLE_DEV_PROXY_API_PATH?="${RAZZLE_INTERNAL_API_PATH}"
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}"

Expand Down Expand Up @@ -86,7 +86,7 @@ cypress-open: ## Open cypress integration tests

.PHONY: cypress-run
cypress-run: ## Run cypress integration tests
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run --browser chromium

.PHONY: test
test: ## Run jest tests
Expand Down Expand Up @@ -151,14 +151,12 @@ test-ci:

.PHONY: start-ci
start-ci:
cp .coverage.babel.config.js /app/babel.config.js
cd ../..
yarn start &
yarn start

.PHONY: cypress-ci
cypress-ci:
cp .coverage.babel.config.js /app/babel.config.js
make start-ci
$(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
NODE_ENV=development make cypress-run


6 changes: 3 additions & 3 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ const { defineConfig } = require('cypress');

module.exports = defineConfig({
viewportWidth: 1280,
defaultCommandTimeout: 5000,
defaultCommandTimeout: 8888,
chromeWebSecurity: false,
reporter: 'junit',
video: true,
video: false,
retries: {
runMode: 1,
runMode: 2,
openMode: 0,
},
reporterOptions: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-call-to-action-block",
"version": "4.2.2",
"version": "4.3.0",
"description": "@eeacms/volto-call-to-action-block: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
3 changes: 0 additions & 3 deletions src/components/Schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ export const EditSchema = ({ intl }) => ({
href: {
title: intl.formatMessage(messages.Link),
widget: 'call_to_action',
mode: 'link',
selectedItemAttrs: ['Title', 'Description', 'hasPreviewImage'],
allowExternals: true,
},
target: {
title: intl.formatMessage(messages.Target),
Expand Down
6 changes: 2 additions & 4 deletions src/components/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Content = ({ data }) =>

const View = ({ data, isEditMode }) => {
const [hasLink, setHasLink] = React.useState(false);

const href = data.href?.[0]?.['@id'] || data.href;
React.useEffect(() => {
if (isEditMode) {
setHasLink(false);
Expand All @@ -35,9 +35,7 @@ const View = ({ data, isEditMode }) => {
}
}, [isEditMode, data.href]);

const url = hasLink
? flattenToAppURL(data.href?.[0]?.['@id'] || data.href)
: '';
const url = hasLink && isInternalURL(href) ? flattenToAppURL(href) : href;
const As = hasLink && isInternalURL(url) ? Link : 'a';
return (
<div className={cx('block call-to-action align', data.styles?.align)}>
Expand Down
5 changes: 3 additions & 2 deletions src/components/Widget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export const CallToActionWidget = (props) => {
const inputId = `field-${id}`;

const [value, setValue] = useState(
props?.value?.length
isInternalURL(props.value?.[0]?.['@id'] || props.value)
? flattenToAppURL(props.value?.[0]?.['@id'] || props.value)
: '',
: props.value,
);
const [isInvalid, setIsInvalid] = useState(false);
/**
Expand Down Expand Up @@ -133,6 +133,7 @@ export const CallToActionWidget = (props) => {
props.openObjectBrowser({
mode: 'link',
overlay: true,
allowExternals: true,
onSelectItem: (url) => {
onChangeValue(url);
},
Expand Down

0 comments on commit abdab9b

Please sign in to comment.