@eeacms/volto-n2k 0.1.15 → 1.0.1

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.
Files changed (40) hide show
  1. package/.coverage.babel.config.js +1 -1
  2. package/.i18n.babel.config.js +1 -0
  3. package/.project.eslintrc.js +46 -0
  4. package/CHANGELOG.md +20 -2
  5. package/README.md +1 -72
  6. package/RELEASE.md +74 -0
  7. package/babel.config.js +17 -0
  8. package/cypress.config.js +26 -0
  9. package/jest-addon.config.js +4 -4
  10. package/locales/volto.pot +69 -0
  11. package/package.json +21 -14
  12. package/src/components/index.js +3 -3
  13. package/src/components/manage/Blocks/CddaShape/View.jsx +14 -1
  14. package/src/components/manage/Blocks/ExploreHabitats/View.jsx +17 -5
  15. package/src/components/manage/Blocks/ExploreSites/View.jsx +15 -6
  16. package/src/components/manage/Blocks/ExploreSpecies/View.jsx +15 -5
  17. package/src/components/manage/Blocks/HabitatDistribution/View.jsx +14 -1
  18. package/src/components/manage/Blocks/HabitatProtectedSites/View.jsx +14 -1
  19. package/src/components/manage/Blocks/Landing/DefalutView.jsx +0 -16
  20. package/src/components/manage/Blocks/Landing/Edit.jsx +0 -16
  21. package/src/components/manage/Blocks/Landing/View.jsx +0 -16
  22. package/src/components/manage/Blocks/NavigationAnchors/View.jsx +1 -1
  23. package/src/components/manage/Blocks/SiteShape/View.jsx +14 -1
  24. package/src/components/manage/Blocks/SpeciesDistribution/View.jsx +14 -1
  25. package/src/components/manage/Blocks/SpeciesProtectedSites/View.jsx +14 -1
  26. package/src/components/theme/AppExtras/MultilingualRedirector/MultilingualRedirector.jsx +3 -3
  27. package/src/components/theme/Header/Header.jsx +58 -25
  28. package/src/components/theme/LanguageSelector/LanguageSelector.jsx +22 -14
  29. package/src/components/theme/Navigation/Navigation.jsx +37 -22
  30. package/src/components/theme/Sitemap/Sitemap.jsx +2 -2
  31. package/src/index.js +31 -29
  32. package/src/less/styles.less +10 -12
  33. package/src/static/global-line.svg +1 -0
  34. package/Jenkinsfile +0 -242
  35. package/cypress/fixtures/example.json +0 -5
  36. package/cypress/integration/block-basics.js +0 -32
  37. package/cypress/plugins/index.js +0 -26
  38. package/cypress/support/commands.js +0 -315
  39. package/cypress/support/index.js +0 -53
  40. package/cypress.json +0 -17
@@ -91,7 +91,7 @@ const getN2kItems = (items, localStorage) => {
91
91
  items.filter((item) => item.url === '/natura2000')?.[0]?.items || [];
92
92
  natura2000.forEach((item) => {
93
93
  const languageFolder = matchPath(item.url, {
94
- path: config.settings.multilingualRoot,
94
+ path: config.settings.n2k.multilingualRoot,
95
95
  exact: true,
96
96
  strict: false,
97
97
  });
@@ -100,7 +100,7 @@ const getN2kItems = (items, localStorage) => {
100
100
  }
101
101
  if (
102
102
  languageFolder &&
103
- !config.settings.supportedLanguages.includes(
103
+ !config.settings.n2k.supportedLanguages.includes(
104
104
  languageFolder.params.lang,
105
105
  ) &&
106
106
  item.url !== '/natura2000/sites' &&
package/src/index.js CHANGED
@@ -70,35 +70,37 @@ const applyConfig = (config) => {
70
70
 
71
71
  config.settings = {
72
72
  ...config.settings,
73
- multilingualRoot: '/natura2000/:lang',
74
- multilingualPath: '/natura2000/:lang/*',
75
- defaultLanguage: 'en',
76
- supportedLanguages: [
77
- 'bg',
78
- 'hr',
79
- 'cs',
80
- 'da',
81
- 'nl',
82
- 'en',
83
- 'et',
84
- 'fi',
85
- 'fr',
86
- 'de',
87
- 'el',
88
- 'hu',
89
- 'ga',
90
- 'it',
91
- 'lv',
92
- 'lt',
93
- 'mt',
94
- 'pl',
95
- 'pt',
96
- 'ro',
97
- 'sk',
98
- 'sl',
99
- 'es',
100
- 'sv',
101
- ],
73
+ n2k: {
74
+ multilingualRoot: '/natura2000/:lang',
75
+ multilingualPath: '/natura2000/:lang/*',
76
+ defaultLanguage: 'en',
77
+ supportedLanguages: [
78
+ 'bg',
79
+ 'hr',
80
+ 'cs',
81
+ 'da',
82
+ 'nl',
83
+ 'en',
84
+ 'et',
85
+ 'fi',
86
+ 'fr',
87
+ 'de',
88
+ 'el',
89
+ 'hu',
90
+ 'ga',
91
+ 'it',
92
+ 'lv',
93
+ 'lt',
94
+ 'mt',
95
+ 'pl',
96
+ 'pt',
97
+ 'ro',
98
+ 'sk',
99
+ 'sl',
100
+ 'es',
101
+ 'sv',
102
+ ],
103
+ },
102
104
  };
103
105
 
104
106
  config.settings.themes = {
@@ -347,24 +347,22 @@ body.grey-bg {
347
347
  position: absolute;
348
348
  top: 0;
349
349
  right: 0;
350
- margin: 4px 0;
350
+ margin: 0;
351
+ margin-bottom: 0;
351
352
  transform: translateX(100%) translateY(0);
352
353
 
353
354
  &:hover {
354
355
  background-color: transparent !important;
355
356
  }
356
357
 
357
- &::before {
358
- position: absolute;
359
- top: 4px;
360
- left: 50%;
361
- display: block !important;
362
- width: 6px;
363
- height: 6px;
364
- background-color: #3b7f02;
365
- border-radius: 100%;
366
- content: '';
367
- transform: translateX(-50%);
358
+ .language-selector .ui.dropdown {
359
+ display: flex;
360
+ flex-direction: row-reverse;
361
+ align-items: center;
362
+
363
+ img {
364
+ margin-right: 0.25rem;
365
+ }
368
366
  }
369
367
  }
370
368
  }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z" fill="rgba(46,62,76,1)"/></svg>
package/Jenkinsfile DELETED
@@ -1,242 +0,0 @@
1
- pipeline {
2
- agent any
3
-
4
- environment {
5
- GIT_NAME = "volto-n2k"
6
- NAMESPACE = "@eeacms"
7
- SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu"
8
- DEPENDENCIES = "volto-slate @eeacms/volto-datablocks"
9
- VOLTO = "16.0.0-alpha.14"
10
- }
11
-
12
- stages {
13
-
14
- stage('Release') {
15
- when {
16
- allOf {
17
- environment name: 'CHANGE_ID', value: ''
18
- branch 'master'
19
- }
20
- }
21
- steps {
22
- node(label: 'docker') {
23
- withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),string(credentialsId: 'eea-jenkins-npm-token', variable: 'NPM_TOKEN')]) {
24
- sh '''docker pull eeacms/gitflow'''
25
- 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'''
26
- }
27
- }
28
- }
29
- }
30
-
31
- stage('Code') {
32
- when {
33
- allOf {
34
- environment name: 'CHANGE_ID', value: ''
35
- not { changelog '.*^Automated release [0-9\\.]+$' }
36
- not { branch 'master' }
37
- }
38
- }
39
- steps {
40
- parallel(
41
-
42
- "ES lint": {
43
- node(label: 'docker') {
44
- sh '''docker run -i --rm --name="$BUILD_TAG-eslint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci eslint'''
45
- }
46
- },
47
-
48
- "Style lint": {
49
- node(label: 'docker') {
50
- sh '''docker run -i --rm --name="$BUILD_TAG-stylelint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci stylelint'''
51
- }
52
- },
53
-
54
- "Prettier": {
55
- node(label: 'docker') {
56
- sh '''docker run -i --rm --name="$BUILD_TAG-prettier" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci prettier'''
57
- }
58
- }
59
- )
60
- }
61
- }
62
-
63
- stage('Tests') {
64
- when {
65
- allOf {
66
- environment name: 'CHANGE_ID', value: ''
67
- anyOf {
68
- not { changelog '.*^Automated release [0-9\\.]+$' }
69
- branch 'master'
70
- }
71
- }
72
- }
73
- steps {
74
- parallel(
75
-
76
- "Volto": {
77
- node(label: 'docker') {
78
- script {
79
- try {
80
- sh '''docker pull plone/volto-addon-ci'''
81
- sh '''docker run -i --name="$BUILD_TAG-volto" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci'''
82
- sh '''rm -rf xunit-reports'''
83
- sh '''mkdir -p xunit-reports'''
84
- sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/coverage xunit-reports/'''
85
- sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/junit.xml xunit-reports/'''
86
- sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/unit_tests_log.txt xunit-reports/'''
87
- stash name: "xunit-reports", includes: "xunit-reports/**"
88
- archiveArtifacts artifacts: "xunit-reports/unit_tests_log.txt", fingerprint: true
89
- publishHTML (target : [
90
- allowMissing: false,
91
- alwaysLinkToLastBuild: true,
92
- keepAll: true,
93
- reportDir: 'xunit-reports/coverage/lcov-report',
94
- reportFiles: 'index.html',
95
- reportName: 'UTCoverage',
96
- reportTitles: 'Unit Tests Code Coverage'
97
- ])
98
- } finally {
99
- catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
100
- junit testResults: 'xunit-reports/junit.xml', allowEmptyResults: true
101
- }
102
- sh script: '''docker rm -v $BUILD_TAG-volto''', returnStatus: true
103
- }
104
- }
105
- }
106
- }
107
- )
108
- }
109
- }
110
-
111
- stage('Integration tests') {
112
- when {
113
- allOf {
114
- environment name: 'CHANGE_ID', value: ''
115
- anyOf {
116
- not { changelog '.*^Automated release [0-9\\.]+$' }
117
- branch 'master'
118
- }
119
- }
120
- }
121
- steps {
122
- parallel(
123
-
124
- "Cypress": {
125
- node(label: 'docker') {
126
- script {
127
- try {
128
- sh '''docker pull eeacms/plone-backend; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend'''
129
- sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -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=development -e VOLTO="$VOLTO" plone/volto-addon-ci cypress'''
130
- } finally {
131
- try {
132
- sh '''rm -rf cypress-reports cypress-results cypress-coverage'''
133
- sh '''mkdir -p cypress-reports cypress-results cypress-coverage'''
134
- sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/videos cypress-reports/'''
135
- sh '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/cypress/reports cypress-results/'''
136
- coverage = sh script: '''docker cp $BUILD_TAG-cypress:/opt/frontend/my-volto-project/src/addons/$GIT_NAME/coverage cypress-coverage/''', returnStatus: true
137
- if ( coverage == 0 ) {
138
- publishHTML (target : [allowMissing: false,
139
- alwaysLinkToLastBuild: true,
140
- keepAll: true,
141
- reportDir: 'cypress-coverage/coverage/lcov-report',
142
- reportFiles: 'index.html',
143
- reportName: 'CypressCoverage',
144
- reportTitles: 'Integration Tests Code Coverage'])
145
- }
146
- 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'''
147
- archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: true
148
- stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true
149
- }
150
- finally {
151
- catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
152
- junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
153
- }
154
- sh script: "docker stop $BUILD_TAG-plone", returnStatus: true
155
- sh script: "docker rm -v $BUILD_TAG-plone", returnStatus: true
156
- sh script: "docker rm -v $BUILD_TAG-cypress", returnStatus: true
157
-
158
- }
159
- }
160
- }
161
- }
162
- }
163
-
164
- )
165
- }
166
- }
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 "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"
192
- 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'''
193
- }
194
- }
195
- }
196
- }
197
- }
198
-
199
- stage('Pull Request') {
200
- when {
201
- not {
202
- environment name: 'CHANGE_ID', value: ''
203
- }
204
- environment name: 'CHANGE_TARGET', value: 'master'
205
- }
206
- steps {
207
- node(label: 'docker') {
208
- script {
209
- if ( env.CHANGE_BRANCH != "develop" ) {
210
- error "Pipeline aborted due to PR not made from develop branch"
211
- }
212
- withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) {
213
- sh '''docker pull eeacms/gitflow'''
214
- 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'''
215
- }
216
- }
217
- }
218
- }
219
- }
220
-
221
- }
222
-
223
- post {
224
- always {
225
- cleanWs(cleanWhenAborted: true, cleanWhenFailure: true, cleanWhenNotBuilt: true, cleanWhenSuccess: true, cleanWhenUnstable: true, deleteDirs: true)
226
- }
227
- changed {
228
- script {
229
- def details = """<h1>${env.JOB_NAME} - Build #${env.BUILD_NUMBER} - ${currentBuild.currentResult}</h1>
230
- <p>Check console output at <a href="${env.BUILD_URL}/display/redirect">${env.JOB_BASE_NAME} - #${env.BUILD_NUMBER}</a></p>
231
- """
232
- emailext(
233
- subject: '$DEFAULT_SUBJECT',
234
- body: details,
235
- attachLog: true,
236
- compressLog: true,
237
- recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'CulpritsRecipientProvider']]
238
- )
239
- }
240
- }
241
- }
242
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "Using fixtures to represent data",
3
- "email": "hello@cypress.io",
4
- "body": "Fixtures are a great way to mock data for responses to routes"
5
- }
@@ -1,32 +0,0 @@
1
- import { setupBeforeEach, tearDownAfterEach } from '../support';
2
-
3
- describe('Blocks Tests', () => {
4
- beforeEach(setupBeforeEach);
5
- afterEach(tearDownAfterEach);
6
-
7
- it('Add Block: Empty', () => {
8
- // Change page title
9
- cy.get('.documentFirstHeading > .public-DraftStyleDefault-block')
10
- .clear()
11
- .type('My Add-on Page')
12
- .get('.documentFirstHeading span[data-text]')
13
- .contains('My Add-on Page');
14
-
15
- cy.get('.documentFirstHeading > .public-DraftStyleDefault-block').type(
16
- '{enter}',
17
- );
18
-
19
- // Add block
20
- cy.get('.ui.basic.icon.button.block-add-button').first().click();
21
- cy.get('.blocks-chooser .title').contains('Media').click();
22
- cy.get('.content.active.media .button.image').contains('Image').click();
23
-
24
- // Save
25
- cy.get('#toolbar-save').click();
26
- cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
27
-
28
- // then the page view should contain our changes
29
- cy.contains('My Add-on Page');
30
- cy.get('.block.image');
31
- });
32
- });
@@ -1,26 +0,0 @@
1
- /// <reference types="cypress" />
2
- // ***********************************************************
3
- // This example plugins/index.js can be used to load plugins
4
- //
5
- // You can change the location of this file or turn off loading
6
- // the plugins file with the 'pluginsFile' configuration option.
7
- //
8
- // You can read more here:
9
- // https://on.cypress.io/plugins-guide
10
- // ***********************************************************
11
-
12
- // This function is called when a project is opened or re-opened (e.g. due to
13
- // the project's config changing)
14
-
15
- /**
16
- * @type {Cypress.PluginConfig}
17
- */
18
- module.exports = (on, config) => {
19
- // `on` is used to hook into various events Cypress emits
20
- // `config` is the resolved Cypress config
21
- /* coverage-start
22
- require('@cypress/code-coverage/task')(on, config)
23
- on('file:preprocessor', require('@cypress/code-coverage/use-babelrc'))
24
- return config
25
- coverage-end */
26
- };