@eeacms/volto-tableau 7.2.0 → 7.2.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.
- package/.env +1 -0
- package/.eslintrc.js +65 -0
- package/CHANGELOG.md +7 -3
- package/Jenkinsfile +8 -1
- package/Makefile +6 -3
- package/jest-addon.config.js +10 -4
- package/package.json +3 -2
- package/src/Blocks/EmbedTableauVisualization/__snapshots__/Edit.test.jsx.snap +1 -1
- package/src/Blocks/EmbedTableauVisualization/schema.js +1 -1
- package/src/Tableau/helpers.js +4 -4
- package/src/Widgets/VisualizationWidget.jsx +5 -4
- package/.project.eslintrc.js +0 -47
package/.env
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
JEST_USE_SETUP=ON
|
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const projectRootPath = fs.realpathSync(__dirname + '/../../../');
|
|
4
|
+
|
|
5
|
+
let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
|
|
6
|
+
let configFile;
|
|
7
|
+
if (fs.existsSync(`${projectRootPath}/tsconfig.json`))
|
|
8
|
+
configFile = `${projectRootPath}/tsconfig.json`;
|
|
9
|
+
else if (fs.existsSync(`${projectRootPath}/jsconfig.json`))
|
|
10
|
+
configFile = `${projectRootPath}/jsconfig.json`;
|
|
11
|
+
|
|
12
|
+
if (configFile) {
|
|
13
|
+
const jsConfig = require(configFile).compilerOptions;
|
|
14
|
+
const pathsConfig = jsConfig.paths;
|
|
15
|
+
if (pathsConfig['@plone/volto'])
|
|
16
|
+
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
|
|
20
|
+
const reg = new AddonConfigurationRegistry(projectRootPath);
|
|
21
|
+
|
|
22
|
+
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
|
|
23
|
+
const addonAliases = Object.keys(reg.packages).map((o) => [
|
|
24
|
+
o,
|
|
25
|
+
reg.packages[o].modulePath,
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
const addonExtenders = reg.getEslintExtenders().map((m) => require(m));
|
|
29
|
+
|
|
30
|
+
const defaultConfig = {
|
|
31
|
+
extends: `${voltoPath}/.eslintrc`,
|
|
32
|
+
settings: {
|
|
33
|
+
'import/resolver': {
|
|
34
|
+
alias: {
|
|
35
|
+
map: [
|
|
36
|
+
['@plone/volto', '@plone/volto/src'],
|
|
37
|
+
['@plone/volto-slate', '@plone/volto/packages/volto-slate/src'],
|
|
38
|
+
...addonAliases,
|
|
39
|
+
['@package', `${__dirname}/src`],
|
|
40
|
+
['@root', `${__dirname}/src`],
|
|
41
|
+
['~', `${__dirname}/src`],
|
|
42
|
+
],
|
|
43
|
+
extensions: ['.js', '.jsx', '.json'],
|
|
44
|
+
},
|
|
45
|
+
'babel-plugin-root-import': {
|
|
46
|
+
rootPathSuffix: 'src',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
rules: {
|
|
51
|
+
'react/jsx-no-target-blank': [
|
|
52
|
+
'error',
|
|
53
|
+
{
|
|
54
|
+
allowReferrer: true,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const config = addonExtenders.reduce(
|
|
61
|
+
(acc, extender) => extender.modify(acc),
|
|
62
|
+
defaultConfig,
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
module.exports = config;
|
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
|
-
### [7.2.
|
|
7
|
+
### [7.2.1](https://github.com/eea/volto-tableau/compare/7.2.0...7.2.1) - 31 January 2024
|
|
8
8
|
|
|
9
|
-
#### :
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
10
|
|
|
11
|
-
-
|
|
11
|
+
- fix tests [Razvan - [`e370ea4`](https://github.com/eea/volto-tableau/commit/e370ea49343f52b1a07dbe402ce48c9ef53b6a7b)]
|
|
12
|
+
- fix eslint [Razvan - [`82f9311`](https://github.com/eea/volto-tableau/commit/82f9311fadd7c269321c23d4a3e029c2d5a133c6)]
|
|
13
|
+
- test: Update jest,Jenkinsfile,lint to volto-addons-template PR30 [valentinab25 - [`6a19c5c`](https://github.com/eea/volto-tableau/commit/6a19c5ceaf229d944f3f15ee32a833ae37619d74)]
|
|
14
|
+
- fallbacks [Razvan - [`efcc619`](https://github.com/eea/volto-tableau/commit/efcc6196c454df58cb83801297332fd2d98edd97)]
|
|
15
|
+
### [7.2.0](https://github.com/eea/volto-tableau/compare/7.1.0...7.2.0) - 17 January 2024
|
|
12
16
|
|
|
13
17
|
#### :bug: Bug Fixes
|
|
14
18
|
|
package/Jenkinsfile
CHANGED
|
@@ -162,10 +162,16 @@ pipeline {
|
|
|
162
162
|
script {
|
|
163
163
|
try {
|
|
164
164
|
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'''
|
|
165
|
-
sh '''docker run -d --shm-size=
|
|
165
|
+
sh '''docker run -d --shm-size=4g --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'''
|
|
166
|
+
frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make check-ci''', returnStatus: true
|
|
167
|
+
if ( frontend != 0 ) {
|
|
168
|
+
sh '''docker logs $IMAGE_NAME-cypress; exit 1'''
|
|
169
|
+
}
|
|
170
|
+
|
|
166
171
|
sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make cypress-ci'''
|
|
167
172
|
} finally {
|
|
168
173
|
try {
|
|
174
|
+
if ( frontend == 0 ) {
|
|
169
175
|
sh '''rm -rf cypress-videos cypress-results cypress-coverage cypress-screenshots'''
|
|
170
176
|
sh '''mkdir -p cypress-videos cypress-results cypress-coverage cypress-screenshots'''
|
|
171
177
|
videos = sh script: '''docker cp $IMAGE_NAME-cypress:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos/''', returnStatus: true
|
|
@@ -189,6 +195,7 @@ pipeline {
|
|
|
189
195
|
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'''
|
|
190
196
|
archiveArtifacts artifacts: 'cypress-videos/**/*.mp4', fingerprint: true, allowEmptyArchive: true
|
|
191
197
|
}
|
|
198
|
+
}
|
|
192
199
|
} finally {
|
|
193
200
|
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
|
|
194
201
|
junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
|
package/Makefile
CHANGED
|
@@ -86,7 +86,7 @@ cypress-open: ## Open cypress integration tests
|
|
|
86
86
|
|
|
87
87
|
.PHONY: cypress-run
|
|
88
88
|
cypress-run: ## Run cypress integration tests
|
|
89
|
-
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" 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
|
|
90
90
|
|
|
91
91
|
.PHONY: test
|
|
92
92
|
test: ## Run jest tests
|
|
@@ -155,8 +155,11 @@ start-ci:
|
|
|
155
155
|
cd ../..
|
|
156
156
|
yarn start
|
|
157
157
|
|
|
158
|
+
.PHONY: check-ci
|
|
159
|
+
check-ci:
|
|
160
|
+
$(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
|
|
161
|
+
|
|
158
162
|
.PHONY: cypress-ci
|
|
159
163
|
cypress-ci:
|
|
160
164
|
$(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
|
|
161
|
-
NODE_ENV=development
|
|
162
|
-
|
|
165
|
+
CYPRESS_API_PATH="${RAZZLE_DEV_PROXY_API_PATH}" NODE_ENV=development $(NODE_MODULES)/cypress/bin/cypress run --browser chromium
|
package/jest-addon.config.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require('dotenv').config({ path: __dirname + '/.env' })
|
|
2
|
+
|
|
1
3
|
module.exports = {
|
|
2
4
|
testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
|
|
3
5
|
collectCoverageFrom: [
|
|
@@ -13,6 +15,8 @@ module.exports = {
|
|
|
13
15
|
'@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
14
16
|
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
|
|
15
17
|
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
|
|
18
|
+
'@plone/volto-slate$':
|
|
19
|
+
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
|
|
16
20
|
'@plone/volto-slate/(.*)$':
|
|
17
21
|
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src/$1',
|
|
18
22
|
'~/(.*)$': '<rootDir>/src/$1',
|
|
@@ -36,7 +40,9 @@ module.exports = {
|
|
|
36
40
|
statements: 5,
|
|
37
41
|
},
|
|
38
42
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
...(process.env.JEST_USE_SETUP === 'ON' && {
|
|
44
|
+
setupFilesAfterEnv: [
|
|
45
|
+
'<rootDir>/node_modules/@eeacms/volto-tableau/jest.setup.js',
|
|
46
|
+
],
|
|
47
|
+
}),
|
|
48
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-tableau",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.1",
|
|
4
4
|
"description": "@eeacms/volto-tableau: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
33
33
|
"husky": "^8.0.3",
|
|
34
34
|
"lint-staged": "^14.0.1",
|
|
35
|
-
"md5": "^2.3.0"
|
|
35
|
+
"md5": "^2.3.0",
|
|
36
|
+
"dotenv": "^16.3.2"
|
|
36
37
|
},
|
|
37
38
|
"lint-staged": {
|
|
38
39
|
"src/**/*.{js,jsx,ts,tsx,json}": [
|
package/src/Tableau/helpers.js
CHANGED
|
@@ -28,8 +28,8 @@ export function getQuery({
|
|
|
28
28
|
export function getTableauVisualization({
|
|
29
29
|
isBlock,
|
|
30
30
|
data,
|
|
31
|
-
tableauContent,
|
|
32
|
-
content,
|
|
31
|
+
tableauContent = {},
|
|
32
|
+
content = {},
|
|
33
33
|
}) {
|
|
34
34
|
const mergedContent =
|
|
35
35
|
(isBlock
|
|
@@ -37,12 +37,12 @@ export function getTableauVisualization({
|
|
|
37
37
|
: {
|
|
38
38
|
...content,
|
|
39
39
|
tableau_visualization: {
|
|
40
|
-
...(content
|
|
40
|
+
...(content.tableau_visualization || {}),
|
|
41
41
|
...pickMetadata(content),
|
|
42
42
|
},
|
|
43
43
|
}) || {};
|
|
44
44
|
const tableau_visualization =
|
|
45
|
-
mergedContent
|
|
45
|
+
mergedContent.tableau_visualization || data?.tableau_visualization || {};
|
|
46
46
|
return {
|
|
47
47
|
...tableau_visualization,
|
|
48
48
|
...(isBlock ? pickMetadata(mergedContent) : {}),
|
|
@@ -19,6 +19,7 @@ import '@eeacms/volto-tableau/less/tableau.less';
|
|
|
19
19
|
|
|
20
20
|
const VisualizationWidget = (props) => {
|
|
21
21
|
const { location, content } = props;
|
|
22
|
+
const ogValue = props.value || {};
|
|
22
23
|
const viz = React.useRef();
|
|
23
24
|
const [schema, setSchema] = React.useState(null);
|
|
24
25
|
const [vizState, setVizState] = React.useState({
|
|
@@ -27,7 +28,7 @@ const VisualizationWidget = (props) => {
|
|
|
27
28
|
error: null,
|
|
28
29
|
});
|
|
29
30
|
const [open, setOpen] = React.useState(false);
|
|
30
|
-
const [value, setValue] = React.useState(
|
|
31
|
+
const [value, setValue] = React.useState(ogValue);
|
|
31
32
|
|
|
32
33
|
const [tableauVisualization, setTableauVisualization] = useState(() =>
|
|
33
34
|
getTableauVisualization({
|
|
@@ -57,13 +58,13 @@ const VisualizationWidget = (props) => {
|
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
const handleClose = () => {
|
|
60
|
-
setValue(
|
|
61
|
+
setValue(ogValue);
|
|
61
62
|
setOpen(false);
|
|
62
63
|
};
|
|
63
64
|
|
|
64
65
|
React.useEffect(() => {
|
|
65
|
-
if (!open && !isEqual(props.value, value)) {
|
|
66
|
-
setValue(props.value);
|
|
66
|
+
if (!open && !isEqual(props.value || {}, value)) {
|
|
67
|
+
setValue(props.value || {});
|
|
67
68
|
}
|
|
68
69
|
}, [props.value, value, open]);
|
|
69
70
|
|
package/.project.eslintrc.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const projectRootPath = fs.existsSync('./project')
|
|
5
|
-
? fs.realpathSync('./project')
|
|
6
|
-
: fs.realpathSync('./../../../');
|
|
7
|
-
const packageJson = require(path.join(projectRootPath, 'package.json'));
|
|
8
|
-
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json'))
|
|
9
|
-
.compilerOptions;
|
|
10
|
-
|
|
11
|
-
const pathsConfig = jsConfig.paths;
|
|
12
|
-
|
|
13
|
-
let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
|
|
14
|
-
|
|
15
|
-
Object.keys(pathsConfig).forEach((pkg) => {
|
|
16
|
-
if (pkg === '@plone/volto') {
|
|
17
|
-
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
|
|
21
|
-
const reg = new AddonConfigurationRegistry(projectRootPath);
|
|
22
|
-
|
|
23
|
-
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
|
|
24
|
-
const addonAliases = Object.keys(reg.packages).map((o) => [
|
|
25
|
-
o,
|
|
26
|
-
reg.packages[o].modulePath,
|
|
27
|
-
]);
|
|
28
|
-
|
|
29
|
-
module.exports = {
|
|
30
|
-
extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
|
|
31
|
-
settings: {
|
|
32
|
-
'import/resolver': {
|
|
33
|
-
alias: {
|
|
34
|
-
map: [
|
|
35
|
-
['@plone/volto', '@plone/volto/src'],
|
|
36
|
-
...addonAliases,
|
|
37
|
-
['@package', `${__dirname}/src`],
|
|
38
|
-
['~', `${__dirname}/src`],
|
|
39
|
-
],
|
|
40
|
-
extensions: ['.js', '.jsx', '.json'],
|
|
41
|
-
},
|
|
42
|
-
'babel-plugin-root-import': {
|
|
43
|
-
rootPathSuffix: 'src',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|