@eeacms/volto-n2k 0.1.12 → 0.1.14
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 +7 -3
- package/Jenkinsfile +58 -58
- package/package.json +2 -1
- package/src/components/manage/Blocks/Landing/DefalutView.jsx +17 -0
- package/src/components/manage/Blocks/Landing/Edit.jsx +20 -1
- package/src/components/manage/Blocks/Landing/View.jsx +20 -1
- package/src/components/theme/Header/Header.jsx +7 -2
- package/src/components/theme/LanguageSelector/LanguageSelector.jsx +19 -8
- package/src/components/theme/LanguageSelector/styles.less +7 -0
- package/src/components/theme/Navigation/Navigation.jsx +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,15 @@ 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.
|
|
7
|
+
### [0.1.14](https://github.com/eea/volto-n2k/compare/0.1.13...0.1.14) - 18 October 2022
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
- Prettier fix [Miu Razvan - [`0a9192d`](https://github.com/eea/volto-n2k/commit/0a9192dd9d51620f68b4adcc76aa0a58435700ca)]
|
|
12
|
+
- Multilanguage landing page [Miu Razvan - [`a7ceedf`](https://github.com/eea/volto-n2k/commit/a7ceedf0fe304f0a220aa1b6f2737c86537e15da)]
|
|
13
|
+
### [0.1.13](https://github.com/eea/volto-n2k/compare/0.1.12...0.1.13) - 30 September 2022
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
### [0.1.12](https://github.com/eea/volto-n2k/compare/0.1.11...0.1.12) - 30 September 2022
|
|
12
16
|
|
|
13
17
|
#### :hammer_and_wrench: Others
|
|
14
18
|
|
package/Jenkinsfile
CHANGED
|
@@ -108,62 +108,62 @@ pipeline {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
167
|
|
|
168
168
|
stage('Report to SonarQube') {
|
|
169
169
|
when {
|
|
@@ -183,12 +183,12 @@ pipeline {
|
|
|
183
183
|
script{
|
|
184
184
|
checkout scm
|
|
185
185
|
unstash "xunit-reports"
|
|
186
|
-
|
|
186
|
+
unstash "cypress-coverage"
|
|
187
187
|
def scannerHome = tool 'SonarQubeScanner';
|
|
188
188
|
def nodeJS = tool 'NodeJS';
|
|
189
189
|
withSonarQubeEnv('Sonarqube') {
|
|
190
190
|
sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
|
|
191
|
-
|
|
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
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
193
|
}
|
|
194
194
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-n2k",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "volto-n2k: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@cypress/code-coverage": "^3.9.5",
|
|
42
|
+
"md5": "^2.3.0",
|
|
42
43
|
"babel-plugin-transform-class-properties": "^6.24.1"
|
|
43
44
|
},
|
|
44
45
|
"scripts": {
|
|
@@ -4,6 +4,7 @@ import { generatePath } from 'react-router';
|
|
|
4
4
|
import { Grid } from 'semantic-ui-react';
|
|
5
5
|
import { UniversalLink } from '@plone/volto/components';
|
|
6
6
|
import { withLocalStorage } from '@eeacms/volto-n2k/hocs';
|
|
7
|
+
import LanguageSelector from '@eeacms/volto-n2k/components/theme/LanguageSelector/LanguageSelector';
|
|
7
8
|
import hiker from './images/hiker.webp';
|
|
8
9
|
import { tiles, tileProps, getStyle } from './index';
|
|
9
10
|
|
|
@@ -18,6 +19,21 @@ const DefaultView = (props) => {
|
|
|
18
19
|
>
|
|
19
20
|
<Grid className="landing-page" container columns="12">
|
|
20
21
|
<Grid.Row>
|
|
22
|
+
<Grid.Column
|
|
23
|
+
{...{
|
|
24
|
+
mobile: 12,
|
|
25
|
+
tablet: 12,
|
|
26
|
+
computer: 12,
|
|
27
|
+
largeScreen: 12,
|
|
28
|
+
widescreen: 12,
|
|
29
|
+
}}
|
|
30
|
+
style={{ zIndex: 1, marginBottom: '1rem' }}
|
|
31
|
+
>
|
|
32
|
+
<LanguageSelector
|
|
33
|
+
navigation={props.navigation}
|
|
34
|
+
className="landingpage-variation"
|
|
35
|
+
/>
|
|
36
|
+
</Grid.Column>
|
|
21
37
|
<Grid.Column
|
|
22
38
|
className="landing-page-description"
|
|
23
39
|
widescreen="6"
|
|
@@ -79,5 +95,6 @@ const DefaultView = (props) => {
|
|
|
79
95
|
};
|
|
80
96
|
|
|
81
97
|
export default connect((state) => ({
|
|
98
|
+
navigation: state.navigation,
|
|
82
99
|
screen: state.screen,
|
|
83
100
|
}))(withLocalStorage(DefaultView));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { connect } from 'react-redux';
|
|
2
3
|
import { Grid, Button } from 'semantic-ui-react';
|
|
3
4
|
import { isEmpty } from 'lodash';
|
|
4
5
|
import EditBlockWrapper from './EditBlockWrapper';
|
|
@@ -8,6 +9,7 @@ import { SidebarPortal, UniversalLink } from '@plone/volto/components';
|
|
|
8
9
|
import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
|
|
9
10
|
import config from '@plone/volto/registry';
|
|
10
11
|
import settingsSVG from '@plone/volto/icons/settings.svg';
|
|
12
|
+
import LanguageSelector from '@eeacms/volto-n2k/components/theme/LanguageSelector/LanguageSelector';
|
|
11
13
|
import DefaultView from './DefalutView';
|
|
12
14
|
import getSchema from './schema';
|
|
13
15
|
import hiker from './images/hiker.webp';
|
|
@@ -98,6 +100,21 @@ const Edit = (props) => {
|
|
|
98
100
|
>
|
|
99
101
|
<Grid className="landing-page" container columns="12">
|
|
100
102
|
<Grid.Row>
|
|
103
|
+
<Grid.Column
|
|
104
|
+
{...{
|
|
105
|
+
mobile: 12,
|
|
106
|
+
tablet: 12,
|
|
107
|
+
computer: 12,
|
|
108
|
+
largeScreen: 12,
|
|
109
|
+
widescreen: 12,
|
|
110
|
+
}}
|
|
111
|
+
style={{ zIndex: 1, marginBottom: '1rem' }}
|
|
112
|
+
>
|
|
113
|
+
<LanguageSelector
|
|
114
|
+
navigation={props.navigation}
|
|
115
|
+
className="landingpage-variation"
|
|
116
|
+
/>
|
|
117
|
+
</Grid.Column>
|
|
101
118
|
<Grid.Column
|
|
102
119
|
className="landing-page-description"
|
|
103
120
|
widescreen="6"
|
|
@@ -216,4 +233,6 @@ const Edit = (props) => {
|
|
|
216
233
|
);
|
|
217
234
|
};
|
|
218
235
|
|
|
219
|
-
export default
|
|
236
|
+
export default connect((state) => ({
|
|
237
|
+
navigation: state.navigation,
|
|
238
|
+
}))(Edit);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { connect } from 'react-redux';
|
|
2
3
|
import { Grid } from 'semantic-ui-react';
|
|
3
4
|
import { RenderBlocks, UniversalLink } from '@plone/volto/components';
|
|
5
|
+
import LanguageSelector from '@eeacms/volto-n2k/components/theme/LanguageSelector/LanguageSelector';
|
|
4
6
|
import DefaultView from './DefalutView';
|
|
5
7
|
import hiker from './images/hiker.webp';
|
|
6
8
|
import { tileProps, getStyle } from './index';
|
|
@@ -17,6 +19,21 @@ const View = (props) => {
|
|
|
17
19
|
) : (
|
|
18
20
|
<div className="landing-page-wrapper full-width" style={getStyle(props)}>
|
|
19
21
|
<Grid className="landing-page" container columns="12">
|
|
22
|
+
<Grid.Column
|
|
23
|
+
{...{
|
|
24
|
+
mobile: 12,
|
|
25
|
+
tablet: 12,
|
|
26
|
+
computer: 12,
|
|
27
|
+
largeScreen: 12,
|
|
28
|
+
widescreen: 12,
|
|
29
|
+
}}
|
|
30
|
+
style={{ zIndex: 1, marginBottom: '1rem' }}
|
|
31
|
+
>
|
|
32
|
+
<LanguageSelector
|
|
33
|
+
navigation={props.navigation}
|
|
34
|
+
className="landingpage-variation"
|
|
35
|
+
/>
|
|
36
|
+
</Grid.Column>
|
|
20
37
|
<Grid.Row>
|
|
21
38
|
<Grid.Column
|
|
22
39
|
className="landing-page-description"
|
|
@@ -62,4 +79,6 @@ const View = (props) => {
|
|
|
62
79
|
);
|
|
63
80
|
};
|
|
64
81
|
|
|
65
|
-
export default
|
|
82
|
+
export default connect((state) => ({
|
|
83
|
+
navigation: state.navigation,
|
|
84
|
+
}))(View);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { useEffect, useContext } from 'react';
|
|
7
|
-
import { withRouter } from 'react-router';
|
|
7
|
+
import { matchPath, withRouter } from 'react-router';
|
|
8
8
|
import { Container, Sticky } from 'semantic-ui-react';
|
|
9
9
|
import { connect } from 'react-redux';
|
|
10
10
|
import { Portal } from 'react-portal';
|
|
@@ -47,6 +47,11 @@ const Navbar = (props) => {
|
|
|
47
47
|
const Header = (props) => {
|
|
48
48
|
const [isSticky, setIsSticky] = React.useState(false);
|
|
49
49
|
const { stickyRef } = useContext(StickyContext);
|
|
50
|
+
const isRoot = !!matchPath(props.pathname, {
|
|
51
|
+
path: config.settings.multilingualRoot,
|
|
52
|
+
exact: true,
|
|
53
|
+
strict: false,
|
|
54
|
+
});
|
|
50
55
|
|
|
51
56
|
useEffect(() => {
|
|
52
57
|
if (!props.localStorage.get('N2K_LANGUAGE')) {
|
|
@@ -55,7 +60,7 @@ const Header = (props) => {
|
|
|
55
60
|
/* eslint-disable-next-line */
|
|
56
61
|
}, []);
|
|
57
62
|
|
|
58
|
-
return
|
|
63
|
+
return isRoot ? (
|
|
59
64
|
''
|
|
60
65
|
) : (
|
|
61
66
|
<>
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { withRouter, matchPath, generatePath } from 'react-router';
|
|
8
8
|
import { useSelector } from 'react-redux';
|
|
9
|
+
import cx from 'classnames';
|
|
9
10
|
import { langmap } from '@plone/volto/helpers';
|
|
10
11
|
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
11
12
|
import { Dropdown } from 'semantic-ui-react';
|
|
@@ -21,21 +22,31 @@ const LanguageSelector = (props) => {
|
|
|
21
22
|
const localStorage = props.localStorage;
|
|
22
23
|
const pathname = props.location.pathname;
|
|
23
24
|
const currentLang = localStorage.get('N2K_LANGUAGE');
|
|
24
|
-
const
|
|
25
|
+
const matchRoot = matchPath(pathname, {
|
|
26
|
+
path: settings.multilingualRoot,
|
|
27
|
+
exact: true,
|
|
28
|
+
strict: false,
|
|
29
|
+
});
|
|
30
|
+
const matchChild = matchPath(pathname, {
|
|
25
31
|
path: settings.multilingualPath,
|
|
26
32
|
exact: true,
|
|
27
33
|
strict: false,
|
|
28
34
|
});
|
|
35
|
+
const match = matchRoot || matchChild;
|
|
29
36
|
const hasMultilingualSupport =
|
|
30
37
|
match && settings.supportedLanguages.includes(match.params.lang);
|
|
31
38
|
const translations = hasMultilingualSupport
|
|
32
|
-
? settings.supportedLanguages.map((lang) =>
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
? settings.supportedLanguages.map((lang) => {
|
|
40
|
+
return {
|
|
41
|
+
path: matchRoot
|
|
42
|
+
? `/natura2000/${lang}`
|
|
43
|
+
: generatePath(settings.multilingualPath, {
|
|
44
|
+
...match.params,
|
|
45
|
+
lang,
|
|
46
|
+
}),
|
|
35
47
|
lang,
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}))
|
|
48
|
+
};
|
|
49
|
+
})
|
|
39
50
|
: [];
|
|
40
51
|
const supportedLanguagesOptions = settings.supportedLanguages.map((lang) => ({
|
|
41
52
|
key: lang,
|
|
@@ -44,7 +55,7 @@ const LanguageSelector = (props) => {
|
|
|
44
55
|
}));
|
|
45
56
|
|
|
46
57
|
return (
|
|
47
|
-
<div className=
|
|
58
|
+
<div className={cx('language-selector', props.className)}>
|
|
48
59
|
<Dropdown
|
|
49
60
|
aria-label="Language selector"
|
|
50
61
|
disabled={content.get.loading}
|
|
@@ -102,6 +102,7 @@ class Navigation extends Component {
|
|
|
102
102
|
this.state = {
|
|
103
103
|
isMobileMenuOpen: false,
|
|
104
104
|
isSdf: false,
|
|
105
|
+
language: this.props.localStorage.get('N2K_LANGUAGE'),
|
|
105
106
|
};
|
|
106
107
|
this.container = React.createRef();
|
|
107
108
|
}
|
|
@@ -260,7 +261,7 @@ class Navigation extends Component {
|
|
|
260
261
|
/>
|
|
261
262
|
</div>
|
|
262
263
|
<Menu.Item className="home-button logo">
|
|
263
|
-
<Link title="Natura 2000" to=
|
|
264
|
+
<Link title="Natura 2000" to={`/natura2000/${this.state.language}`}>
|
|
264
265
|
<Icon name={n2kLogo} size={44} />
|
|
265
266
|
</Link>
|
|
266
267
|
</Menu.Item>
|