@eeacms/volto-tableau 3.0.8 → 4.0.0

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 (44) hide show
  1. package/CHANGELOG.md +14 -7
  2. package/Jenkinsfile +2 -0
  3. package/jest-addon.config.js +2 -2
  4. package/package.json +1 -1
  5. package/src/Blocks/EmbedTableauVisualization/Edit.jsx +31 -0
  6. package/src/Blocks/EmbedTableauVisualization/View.jsx +63 -0
  7. package/src/Blocks/EmbedTableauVisualization/index.js +30 -0
  8. package/src/Blocks/{EmbedEEATableauBlock → EmbedTableauVisualization}/schema.js +29 -13
  9. package/src/{TableauBlock → Blocks/TableauBlock}/Edit.jsx +3 -2
  10. package/src/{TableauBlock → Blocks/TableauBlock}/View.jsx +29 -40
  11. package/src/Blocks/TableauBlock/index.js +30 -0
  12. package/src/{TableauBlock → Blocks/TableauBlock}/schema.js +50 -2
  13. package/src/Blocks/index.js +9 -0
  14. package/src/Tableau/Tableau.jsx +263 -0
  15. package/src/Utils/Download/Download.jsx +72 -0
  16. package/src/Utils/Share/Share.jsx +21 -0
  17. package/src/Utils/Sources/Sources.jsx +66 -0
  18. package/src/Views/VisualizationView.jsx +12 -32
  19. package/src/Widgets/VisualizationWidget.jsx +60 -124
  20. package/src/Widgets/schema.js +62 -131
  21. package/src/helpers.js +15 -34
  22. package/src/hooks.js +18 -0
  23. package/src/icons/download.svg +5 -0
  24. package/src/index.js +4 -66
  25. package/src/less/tableau.less +131 -72
  26. package/src/less/tableau.variables +6 -13
  27. package/src/Blocks/EmbedEEATableauBlock/Edit.jsx +0 -56
  28. package/src/Blocks/EmbedEEATableauBlock/View.jsx +0 -74
  29. package/src/ConnectedTableau/ConnectedTableau.jsx +0 -29
  30. package/src/CustomWidgets/UrlParamsWidget.jsx +0 -29
  31. package/src/DownloadExtras/TableauDownload.jsx +0 -124
  32. package/src/DownloadExtras/TableauFullscreen.jsx +0 -78
  33. package/src/DownloadExtras/TableauShare.jsx +0 -81
  34. package/src/DownloadExtras/style.less +0 -152
  35. package/src/Sources/Sources.jsx +0 -50
  36. package/src/Sources/index.js +0 -3
  37. package/src/Sources/style.css +0 -7
  38. package/src/Tableau/View.jsx +0 -254
  39. package/src/Widgets/style.less +0 -8
  40. package/src/actions.js +0 -9
  41. package/src/constants.js +0 -1
  42. package/src/downloadHelpers/downloadHelpers.js +0 -25
  43. package/src/middleware.js +0 -39
  44. package/src/store.js +0 -72
package/CHANGELOG.md CHANGED
@@ -4,12 +4,25 @@ 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
+ ### [4.0.0](https://github.com/eea/volto-tableau/compare/3.0.8...4.0.0) - 13 June 2023
8
+
9
+ #### :house: Internal changes
10
+
11
+
12
+ #### :hammer_and_wrench: Others
13
+
14
+ - update [Miu Razvan - [`02db357`](https://github.com/eea/volto-tableau/commit/02db357750d3c8d2db29b61af9e09c6880599089)]
15
+ - update [Miu Razvan - [`543312b`](https://github.com/eea/volto-tableau/commit/543312bcf7a7a8c385087f6c38717ba4effa938e)]
16
+ - prettier [Miu Razvan - [`f318c80`](https://github.com/eea/volto-tableau/commit/f318c800e6051b06053490a99c4f4923aa04c72d)]
17
+ - Prepeare 4.0.0 release -> require eea.api.dataconnector@4.7 [Miu Razvan - [`0a26f69`](https://github.com/eea/volto-tableau/commit/0a26f6980d3c35b7d2ac2c404a94abb0e9b89619)]
18
+ - refact: improve tableau + cleanup [Miu Razvan - [`6729fa0`](https://github.com/eea/volto-tableau/commit/6729fa0ebded7419d588bc87dc64bc2b47a9f572)]
19
+ - test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`0c63253`](https://github.com/eea/volto-tableau/commit/0c632532d6d1bd79fbc553af003f949788ca6303)]
20
+ - test: Fix test config, coverage Refs #253277 [valentinab25 - [`04f79a3`](https://github.com/eea/volto-tableau/commit/04f79a32af3463818768e6ce614245583faf2731)]
7
21
  ### [3.0.8](https://github.com/eea/volto-tableau/compare/3.0.7...3.0.8) - 18 May 2023
8
22
 
9
23
  #### :bug: Bug Fixes
10
24
 
11
25
  - fix: resolution for countup #252559 [Andrei Grigore - [`9851b63`](https://github.com/eea/volto-tableau/commit/9851b6335e710022d9402f659b2e3ec333130e2c)]
12
- - fix: load screenshot of tableau in privacy protection #252559 [Andrei Grigore - [`fdc2f1b`](https://github.com/eea/volto-tableau/commit/fdc2f1b0cf0c212e5e14eefa721585686dff338d)]
13
26
 
14
27
  #### :hammer_and_wrench: Others
15
28
 
@@ -26,7 +39,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
26
39
 
27
40
  #### :hammer_and_wrench: Others
28
41
 
29
- - Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`f5deccd`](https://github.com/eea/volto-tableau/commit/f5deccd84372752908b300c5cfd78134818e5ce4)]
30
42
  ### [3.0.6](https://github.com/eea/volto-tableau/compare/3.0.5...3.0.6) - 30 January 2023
31
43
 
32
44
  ### [3.0.5](https://github.com/eea/volto-tableau/compare/3.0.4...3.0.5) - 26 January 2023
@@ -98,7 +110,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
98
110
  - Update commands.js [Nilesh - [`7c48437`](https://github.com/eea/volto-tableau/commit/7c4843780efb9b85a4728de73c00d831c1d8fdcf)]
99
111
  - Update e2e.js [Nilesh - [`f67b45c`](https://github.com/eea/volto-tableau/commit/f67b45c170f58f8d0301192994226f173e4cb00a)]
100
112
  - latest volto compatibility refs #154757 [nileshgulia1 - [`881ba48`](https://github.com/eea/volto-tableau/commit/881ba482dc9b82e7fdac16549d41e80a6d26b3de)]
101
- - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`58e25df`](https://github.com/eea/volto-tableau/commit/58e25df2291add09670143bee54cde103ee835b9)]
102
113
  ### [1.3.0](https://github.com/eea/volto-tableau/compare/1.2.5...1.3.0) - 28 September 2022
103
114
 
104
115
  #### :hammer_and_wrench: Others
@@ -112,15 +123,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
112
123
  - Use volto 16 alpha 14 [Miu Razvan - [`93641be`](https://github.com/eea/volto-tableau/commit/93641be4c2393f49008aff789400cf7c947949fd)]
113
124
  - Revert volto-tableau group to common [Andrei Grigore - [`9d24c6d`](https://github.com/eea/volto-tableau/commit/9d24c6d2767fed6a840cddaee55dbd5cecb544b5)]
114
125
  - Tableaugroup typo fix [Andrei Grigore - [`b0b5378`](https://github.com/eea/volto-tableau/commit/b0b5378a437043120a96c9e5e8802584145daa22)]
115
- - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`3234347`](https://github.com/eea/volto-tableau/commit/3234347e524cc0ed4918242f503fe9e7dba266b2)]
116
126
  - Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`d237e1c`](https://github.com/eea/volto-tableau/commit/d237e1c72817d7e68a3eb698563674d1514db24f)]
117
127
  ### [1.2.4](https://github.com/eea/volto-tableau/compare/1.2.3...1.2.4) - 25 October 2021
118
128
 
119
129
  #### :hammer_and_wrench: Others
120
130
 
121
- - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`2b19679`](https://github.com/eea/volto-tableau/commit/2b19679e2c7bcdc83082d1c73a595eea8b86d14f)]
122
- - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`384ccae`](https://github.com/eea/volto-tableau/commit/384ccaebed8c414a5c90eb96c6ce0a2b091f249c)]
123
- - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`589258e`](https://github.com/eea/volto-tableau/commit/589258e9b3cbba9cee37c57bb85ca5b707bc65d7)]
124
131
  ### [1.2.3](https://github.com/eea/volto-tableau/compare/1.2.2...1.2.3) - 14 June 2021
125
132
 
126
133
  #### :hammer_and_wrench: Others
package/Jenkinsfile CHANGED
@@ -6,6 +6,7 @@ pipeline {
6
6
  NAMESPACE = "@eeacms"
7
7
  SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,biodiversity.europa.eu,water.europa.eu-freshwater,water.europa.eu-marine,industry.eea.europa.eu"
8
8
  DEPENDENCIES = ""
9
+ VOLTO = ""
9
10
  }
10
11
 
11
12
  stages {
@@ -187,6 +188,7 @@ pipeline {
187
188
  def nodeJS = tool 'NodeJS';
188
189
  withSonarQubeEnv('Sonarqube') {
189
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'''
190
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"
191
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'''
192
194
  }
@@ -5,18 +5,18 @@ module.exports = {
5
5
  '!src/**/*.d.ts',
6
6
  ],
7
7
  moduleNameMapper: {
8
+ '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
8
9
  '@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
9
10
  '@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
10
11
  '@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
11
12
  '@package/(.*)$': '<rootDir>/src/$1',
12
13
  '@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
13
- '@eeacms/(.*?)/(.*)$': '<rootDir>/src/addons/$1/src/$2',
14
+ '@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
14
15
  '@plone/volto-slate':
15
16
  '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
16
17
  '~/(.*)$': '<rootDir>/src/$1',
17
18
  'load-volto-addons':
18
19
  '<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
19
- '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
20
20
  },
21
21
  transform: {
22
22
  '^.+\\.js(x)?$': 'babel-jest',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-tableau",
3
- "version": "3.0.8",
3
+ "version": "4.0.0",
4
4
  "description": "@eeacms/volto-tableau: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
3
+ import { SidebarPortal } from '@plone/volto/components';
4
+ import View from './View';
5
+ import getSchema from './schema';
6
+
7
+ const Edit = (props) => {
8
+ const schema = React.useMemo(() => getSchema(props), [props]);
9
+
10
+ return (
11
+ <React.Fragment>
12
+ <View {...props} mode="edit" />
13
+ <SidebarPortal selected={props.selected}>
14
+ <BlockDataForm
15
+ block={props.block}
16
+ schema={schema}
17
+ title={schema.title}
18
+ onChangeField={(id, value) => {
19
+ props.onChangeBlock(props.block, {
20
+ ...props.data,
21
+ [id]: value,
22
+ });
23
+ }}
24
+ formData={props.data}
25
+ />
26
+ </SidebarPortal>
27
+ </React.Fragment>
28
+ );
29
+ };
30
+
31
+ export default Edit;
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import { PrivacyProtection } from '@eeacms/volto-embed';
3
+ import Tableau from '@eeacms/volto-tableau/Tableau/Tableau';
4
+
5
+ import { flattenToAppURL } from '@plone/volto/helpers';
6
+ import { getContent } from '@plone/volto/actions';
7
+
8
+ import { connect } from 'react-redux';
9
+ import { compose } from 'redux';
10
+
11
+ const View = (props) => {
12
+ const data = props.data;
13
+ const { data_provenance, tableau_visualization } =
14
+ props.tableau_visualization_data || {};
15
+ const tableau_vis_url = flattenToAppURL(data.tableau_vis_url || '');
16
+
17
+ React.useEffect(() => {
18
+ if (tableau_vis_url) {
19
+ props.getContent(tableau_vis_url, null, props.id);
20
+ }
21
+ // eslint-disable-next-line
22
+ }, [tableau_vis_url]);
23
+
24
+ return (
25
+ <div className="embed-container">
26
+ <PrivacyProtection
27
+ {...props}
28
+ data={{ ...data, url: tableau_visualization?.url }}
29
+ >
30
+ {!tableau_vis_url && (
31
+ <div>Please select a visualization from block editor.</div>
32
+ )}
33
+ {!!tableau_vis_url && (
34
+ <>
35
+ {!tableau_visualization?.url && props.mode === 'edit' && (
36
+ <div>Url is not set in the visualization</div>
37
+ )}
38
+ {!!tableau_visualization?.url && (
39
+ <Tableau
40
+ data={tableau_visualization}
41
+ with_sources={true}
42
+ with_download={true}
43
+ with_share={true}
44
+ sources={data_provenance.data || []}
45
+ />
46
+ )}
47
+ </>
48
+ )}
49
+ </PrivacyProtection>
50
+ </div>
51
+ );
52
+ };
53
+
54
+ export default compose(
55
+ connect(
56
+ (state, props) => ({
57
+ tableau_visualization_data: state.content.subrequests?.[props.id]?.data,
58
+ }),
59
+ {
60
+ getContent,
61
+ },
62
+ ),
63
+ )(React.memo(View));
@@ -0,0 +1,30 @@
1
+ import EmbedTableauVisualizatonEdit from './Edit';
2
+ import EmbedTableauVisualizatonView from './View';
3
+
4
+ import sliderSVG from '@plone/volto/icons/slider.svg';
5
+
6
+ export default (config) => {
7
+ config.blocks.blocksConfig.embed_tableau_visualization = {
8
+ id: 'embed_tableau_visualization',
9
+ title: 'Embed EEA Tableau visualization',
10
+ icon: sliderSVG,
11
+ group: 'common',
12
+ edit: EmbedTableauVisualizatonEdit,
13
+ view: EmbedTableauVisualizatonView,
14
+ restricted: false,
15
+ mostUsed: false,
16
+ sidebarTab: 1,
17
+ blocks: {},
18
+ security: {
19
+ addPermission: [],
20
+ view: [],
21
+ },
22
+ breakpoints: {
23
+ desktop: [Infinity, 982],
24
+ tablet: [981, 768],
25
+ mobile: [767, 0],
26
+ },
27
+ };
28
+
29
+ return config;
30
+ };
@@ -1,4 +1,4 @@
1
- const ProtectionSchema = () => ({
1
+ const getProtectionSchema = () => ({
2
2
  title: 'Data Protection',
3
3
 
4
4
  fieldsets: [
@@ -40,33 +40,49 @@ const ProtectionSchema = () => ({
40
40
  required: [],
41
41
  });
42
42
 
43
- const Schema = (props) => {
43
+ export default () => {
44
44
  return {
45
- title: 'Embed EEA Tableau',
45
+ title: 'Embed EEA Tableau visualization',
46
46
  fieldsets: [
47
47
  {
48
48
  id: 'default',
49
49
  title: 'Default',
50
- fields: ['vis_url', 'show_sources', 'dataprotection'],
50
+ fields: [
51
+ 'tableau_vis_url',
52
+ 'with_sources',
53
+ 'with_download',
54
+ 'with_share',
55
+ ],
56
+ },
57
+ {
58
+ id: 'privacy',
59
+ title: 'Privacy',
60
+ fields: ['dataprotection'],
51
61
  },
52
62
  ],
53
63
  properties: {
54
- vis_url: {
55
- widget: 'object_by_path',
56
- title: 'Visualization',
64
+ tableau_vis_url: {
65
+ title: 'Tableau visualization',
66
+ widget: 'url',
67
+ },
68
+ with_download: {
69
+ title: 'Show download button',
70
+ type: 'boolean',
57
71
  },
58
- show_sources: {
59
- title: 'Toggle sources',
72
+ with_share: {
73
+ title: 'Show share button',
74
+ type: 'boolean',
75
+ },
76
+ with_sources: {
77
+ title: 'Show sources',
60
78
  type: 'boolean',
61
79
  },
62
80
  dataprotection: {
63
81
  widget: 'object',
64
- schema: ProtectionSchema(),
82
+ schema: getProtectionSchema(),
65
83
  },
66
84
  },
67
85
 
68
- required: ['vis_url'],
86
+ required: ['tableau_vis_url'],
69
87
  };
70
88
  };
71
-
72
- export default Schema;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { SidebarPortal } from '@plone/volto/components';
3
- import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
3
+ import BlockDataForm from '@plone/volto/components/manage/Form/InlineForm';
4
4
  import config from '@plone/volto/registry';
5
5
  import getSchema from './schema';
6
6
  import View from './View';
@@ -12,7 +12,8 @@ const Edit = (props) => {
12
12
  <>
13
13
  <View {...props} mode="edit" />
14
14
  <SidebarPortal selected={props.selected}>
15
- <InlineForm
15
+ <BlockDataForm
16
+ block={props.block}
16
17
  schema={schema}
17
18
  title={schema.title}
18
19
  onChangeField={(id, value) => {
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { connect } from 'react-redux';
3
3
  import { compose } from 'redux';
4
4
  import { withRouter } from 'react-router';
5
- import Tableau from '@eeacms/volto-tableau/Tableau/View';
5
+ import Tableau from '@eeacms/volto-tableau/Tableau/Tableau';
6
6
  import config from '@plone/volto/registry';
7
7
  import qs from 'querystring';
8
8
  import '@eeacms/volto-tableau/less/tableau.less';
@@ -22,9 +22,11 @@ const getDevice = (config, width) => {
22
22
  };
23
23
 
24
24
  const View = (props) => {
25
- const [error, setError] = React.useState(null);
26
- const [loaded, setLoaded] = React.useState(null);
27
- const [mounted, setMounted] = React.useState(false);
25
+ const [vizState, setVizState] = React.useState({
26
+ loaded: false,
27
+ loading: false,
28
+ error: null,
29
+ });
28
30
  const [extraFilters, setExtraFilters] = React.useState({});
29
31
  const { data = {}, query = {}, screen = {} } = props;
30
32
  const {
@@ -33,6 +35,10 @@ const View = (props) => {
33
35
  title = null,
34
36
  description = null,
35
37
  autoScale = false,
38
+ with_sources = true,
39
+ with_download = true,
40
+ with_share = true,
41
+ sources,
36
42
  } = data;
37
43
  const device = getDevice(config, screen.page?.width || Infinity);
38
44
  const breakpointUrl = breakpointUrls.filter(
@@ -40,16 +46,6 @@ const View = (props) => {
40
46
  )[0]?.url;
41
47
  const url = breakpointUrl || data.url;
42
48
 
43
- React.useEffect(() => {
44
- setMounted(true);
45
- /* eslint-disable-next-line */
46
- }, []);
47
-
48
- React.useEffect(() => {
49
- if (props.setTableauError) props.setTableauError(error);
50
- /* eslint-disable-next-line */
51
- }, [error]);
52
-
53
49
  React.useEffect(() => {
54
50
  const newExtraFilters = { ...extraFilters };
55
51
  urlParameters.forEach((element) => {
@@ -63,38 +59,31 @@ const View = (props) => {
63
59
  /* eslint-disable-next-line */
64
60
  }, [JSON.stringify(query), JSON.stringify(urlParameters)]);
65
61
 
66
- return mounted ? (
62
+ return (
67
63
  <div className="tableau-block">
68
- <div className="tableau-info">
69
- {loaded && url && props.mode === 'edit' ? (
70
- <h3 className="tableau-version">== Tableau ==</h3>
71
- ) : null}
72
- {!url ? <p className="tableau-error">URL required</p> : ''}
73
- {error ? <p className="tableau-error">{error}</p> : ''}
74
- </div>
75
-
76
- {loaded && title ? <h3 className="tableau-title">{title}</h3> : ''}
77
- {loaded && description ? (
64
+ {vizState.loaded && title ? (
65
+ <h3 className="tableau-title">{title}</h3>
66
+ ) : (
67
+ ''
68
+ )}
69
+ {vizState.loaded && description ? (
78
70
  <p className="tableau-description">{description}</p>
79
71
  ) : (
80
72
  ''
81
73
  )}
82
- {url ? (
83
- <Tableau
84
- {...props}
85
- canUpdateUrl={!breakpointUrl}
86
- extraFilters={extraFilters}
87
- extraOptions={{ device: autoScale ? 'desktop' : device }}
88
- error={error}
89
- loaded={loaded}
90
- setError={setError}
91
- setLoaded={setLoaded}
92
- url={url}
93
- />
94
- ) : null}
74
+ <Tableau
75
+ {...props}
76
+ canUpdateUrl={!breakpointUrl}
77
+ extraFilters={extraFilters}
78
+ extraOptions={{ device: autoScale ? 'desktop' : device }}
79
+ url={url}
80
+ with_sources={with_sources}
81
+ with_download={with_download}
82
+ with_share={with_share}
83
+ sources={sources}
84
+ setVizState={setVizState}
85
+ />
95
86
  </div>
96
- ) : (
97
- ''
98
87
  );
99
88
  };
100
89
 
@@ -0,0 +1,30 @@
1
+ import TableauEdit from './Edit';
2
+ import TableauView from './View';
3
+
4
+ import sliderSVG from '@plone/volto/icons/slider.svg';
5
+
6
+ export default (config) => {
7
+ config.blocks.blocksConfig.tableau_block = {
8
+ id: 'tableau_block',
9
+ title: 'Tableau',
10
+ icon: sliderSVG,
11
+ group: 'common',
12
+ edit: TableauEdit,
13
+ view: TableauView,
14
+ restricted: false,
15
+ mostUsed: false,
16
+ sidebarTab: 1,
17
+ blocks: {},
18
+ security: {
19
+ addPermission: [],
20
+ view: [],
21
+ },
22
+ breakpoints: {
23
+ desktop: [Infinity, 982],
24
+ tablet: [981, 768],
25
+ mobile: [767, 0],
26
+ },
27
+ };
28
+
29
+ return config;
30
+ };
@@ -40,13 +40,42 @@ const breakpointUrlSchema = (config) => {
40
40
  };
41
41
  };
42
42
 
43
+ const sourceSchema = {
44
+ title: 'Source',
45
+ fieldsets: [
46
+ {
47
+ id: 'default',
48
+ title: 'Default',
49
+ fields: ['title', 'organisation', 'link'],
50
+ },
51
+ ],
52
+ properties: {
53
+ title: {
54
+ title: 'Title',
55
+ },
56
+ organisation: {
57
+ title: 'Organization',
58
+ },
59
+ link: {
60
+ title: 'Link',
61
+ widget: 'url',
62
+ },
63
+ },
64
+ required: [],
65
+ };
66
+
43
67
  export default (config) => ({
44
68
  title: 'Tableau',
45
69
  fieldsets: [
46
70
  {
47
71
  id: 'default',
48
72
  title: 'Default',
49
- fields: ['url', 'title', 'description'],
73
+ fields: ['url', 'title', 'description', 'with_download', 'with_share'],
74
+ },
75
+ {
76
+ id: 'sources',
77
+ title: 'Sources',
78
+ fields: ['with_sources', 'sources'],
50
79
  },
51
80
  {
52
81
  id: 'options',
@@ -78,6 +107,26 @@ export default (config) => ({
78
107
  title: 'Description',
79
108
  widget: 'textarea',
80
109
  },
110
+ with_download: {
111
+ title: 'Show download button',
112
+ type: 'boolean',
113
+ defaultValue: true,
114
+ },
115
+ with_share: {
116
+ title: 'Show share button',
117
+ type: 'boolean',
118
+ defaultValue: true,
119
+ },
120
+ with_sources: {
121
+ title: 'Show sources',
122
+ type: 'boolean',
123
+ defaultValue: true,
124
+ },
125
+ sources: {
126
+ title: 'Sources',
127
+ widget: 'object_list',
128
+ schema: sourceSchema,
129
+ },
81
130
  sheetname: {
82
131
  title: 'Sheetname',
83
132
  type: 'text',
@@ -100,7 +149,6 @@ export default (config) => ({
100
149
  },
101
150
  toolbarPosition: {
102
151
  title: 'Toolbar position',
103
- type: 'array',
104
152
  choices: [
105
153
  ['Top', 'Top'],
106
154
  ['Bottom', 'Bottom'],
@@ -0,0 +1,9 @@
1
+ import installEmbedTableauVisualization from './EmbedTableauVisualization';
2
+ import installTableauBlock from './TableauBlock';
3
+
4
+ export default (config) => {
5
+ return [installEmbedTableauVisualization, installTableauBlock].reduce(
6
+ (acc, apply) => apply(acc),
7
+ config,
8
+ );
9
+ };