@eeacms/volto-tableau 3.0.1 → 3.0.3

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 CHANGED
@@ -4,12 +4,24 @@ 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
+ ### [3.0.3](https://github.com/eea/volto-tableau/compare/3.0.2...3.0.3) - 17 January 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Add volto-embed and volto-block-style addons [dana-cfc4 - [`e557a05`](https://github.com/eea/volto-tableau/commit/e557a0561a46fa7de139d733e72dc17affa8f5e1)]
12
+ - Fix default tableau version, add privacy protection, add style wrapper, add title for tableau edit [dana-cfc4 - [`9859224`](https://github.com/eea/volto-tableau/commit/98592247bd58895bd253411cfce981e639093e85)]
13
+ ### [3.0.2](https://github.com/eea/volto-tableau/compare/3.0.1...3.0.2) - 13 January 2023
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - Add version choice to widget [dana-cfc4 - [`0689e40`](https://github.com/eea/volto-tableau/commit/0689e403e4ef427f0996dedd718f6d095d8df33f)]
18
+ - Take sources from eea core metadata [dana-cfc4 - [`a46848d`](https://github.com/eea/volto-tableau/commit/a46848d84bd12e39badad503429c768c15ef1631)]
19
+ - Add data provenance [dana-cfc4 - [`2a96c25`](https://github.com/eea/volto-tableau/commit/2a96c254ae7c3b56423204fa3696c0c5093c1f88)]
7
20
  ### [3.0.1](https://github.com/eea/volto-tableau/compare/3.0.0...3.0.1) - 13 January 2023
8
21
 
9
22
  #### :hammer_and_wrench: Others
10
23
 
11
24
  - helper comments [andreiggr - [`b13abfd`](https://github.com/eea/volto-tableau/commit/b13abfd3fe5813f872b98de66de63c98f4721c62)]
12
- - wait for client before document get [andreiggr - [`e12a3db`](https://github.com/eea/volto-tableau/commit/e12a3dbd302a33e446cc01da914d90b8cf54a024)]
13
25
  ## [3.0.0](https://github.com/eea/volto-tableau/compare/2.0.0...3.0.0) - 13 January 2023
14
26
 
15
27
  #### :hammer_and_wrench: Others
@@ -45,6 +57,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
45
57
  - Update commands.js [Nilesh - [`7c48437`](https://github.com/eea/volto-tableau/commit/7c4843780efb9b85a4728de73c00d831c1d8fdcf)]
46
58
  - Update e2e.js [Nilesh - [`f67b45c`](https://github.com/eea/volto-tableau/commit/f67b45c170f58f8d0301192994226f173e4cb00a)]
47
59
  - latest volto compatibility refs #154757 [nileshgulia1 - [`881ba48`](https://github.com/eea/volto-tableau/commit/881ba482dc9b82e7fdac16549d41e80a6d26b3de)]
60
+ - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`58e25df`](https://github.com/eea/volto-tableau/commit/58e25df2291add09670143bee54cde103ee835b9)]
48
61
  ### [1.3.0](https://github.com/eea/volto-tableau/compare/1.2.5...1.3.0) - 28 September 2022
49
62
 
50
63
  #### :hammer_and_wrench: Others
@@ -58,11 +71,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
58
71
  - Use volto 16 alpha 14 [Miu Razvan - [`93641be`](https://github.com/eea/volto-tableau/commit/93641be4c2393f49008aff789400cf7c947949fd)]
59
72
  - Revert volto-tableau group to common [Andrei Grigore - [`9d24c6d`](https://github.com/eea/volto-tableau/commit/9d24c6d2767fed6a840cddaee55dbd5cecb544b5)]
60
73
  - Tableaugroup typo fix [Andrei Grigore - [`b0b5378`](https://github.com/eea/volto-tableau/commit/b0b5378a437043120a96c9e5e8802584145daa22)]
74
+ - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`3234347`](https://github.com/eea/volto-tableau/commit/3234347e524cc0ed4918242f503fe9e7dba266b2)]
61
75
  - Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`d237e1c`](https://github.com/eea/volto-tableau/commit/d237e1c72817d7e68a3eb698563674d1514db24f)]
62
76
  ### [1.2.4](https://github.com/eea/volto-tableau/compare/1.2.3...1.2.4) - 25 October 2021
63
77
 
64
78
  #### :hammer_and_wrench: Others
65
79
 
80
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`2b19679`](https://github.com/eea/volto-tableau/commit/2b19679e2c7bcdc83082d1c73a595eea8b86d14f)]
81
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`384ccae`](https://github.com/eea/volto-tableau/commit/384ccaebed8c414a5c90eb96c6ce0a2b091f249c)]
82
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`589258e`](https://github.com/eea/volto-tableau/commit/589258e9b3cbba9cee37c57bb85ca5b707bc65d7)]
66
83
  ### [1.2.3](https://github.com/eea/volto-tableau/compare/1.2.2...1.2.3) - 14 June 2021
67
84
 
68
85
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-tableau",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "@eeacms/volto-tableau: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -17,10 +17,14 @@
17
17
  "url": "git@github.com:eea/volto-tableau.git"
18
18
  },
19
19
  "addons": [
20
- "@eeacms/volto-resize-helper"
20
+ "@eeacms/volto-resize-helper",
21
+ "@eeacms/volto-embed",
22
+ "@eeacms/volto-block-style"
21
23
  ],
22
24
  "dependencies": {
23
- "@eeacms/volto-resize-helper": "^0.2.4"
25
+ "@eeacms/volto-resize-helper": "^0.2.4",
26
+ "@eeacms/volto-embed": "5.0.0",
27
+ "@eeacms/volto-block-style": "4.1.0"
24
28
  },
25
29
  "devDependencies": {
26
30
  "@cypress/code-coverage": "^3.9.5",
@@ -4,11 +4,16 @@ import { SidebarPortal } from '@plone/volto/components';
4
4
  import { getContent } from '@plone/volto/actions';
5
5
  import View from './View';
6
6
  import Schema from './schema';
7
+
8
+ import { BlockStyleWrapperEdit } from '@eeacms/volto-block-style/BlockStyleWrapper';
9
+ import cx from 'classnames';
10
+
7
11
  import { connect } from 'react-redux';
8
12
  import { compose } from 'redux';
9
13
 
10
14
  const Edit = (props) => {
11
- const { data, block, onChangeBlock, id } = props;
15
+ const { block, onChangeBlock, id } = props;
16
+ const data = React.useMemo(() => props.data || {}, [props.data]);
12
17
  const schema = React.useMemo(() => Schema(props), [props]);
13
18
 
14
19
  React.useEffect(() => {
@@ -21,8 +26,21 @@ const Edit = (props) => {
21
26
  }, [block, data, onChangeBlock]);
22
27
 
23
28
  return (
24
- <>
25
- <View data={data} id={id} />
29
+ <BlockStyleWrapperEdit
30
+ {...props}
31
+ role="presentation"
32
+ data={{
33
+ ...(props.data || {}),
34
+ styles: {
35
+ ...(props.data?.styles || {}),
36
+ customClass: cx(
37
+ props.data?.styles?.customClass || '',
38
+ 'custom-embed-class',
39
+ ),
40
+ },
41
+ }}
42
+ >
43
+ <View {...props} data={data} id={id} mode="edit" />
26
44
  <SidebarPortal selected={props.selected}>
27
45
  <BlockDataForm
28
46
  block={block}
@@ -37,7 +55,7 @@ const Edit = (props) => {
37
55
  formData={data}
38
56
  />
39
57
  </SidebarPortal>
40
- </>
58
+ </BlockStyleWrapperEdit>
41
59
  );
42
60
  };
43
61
 
@@ -45,11 +63,10 @@ export default compose(
45
63
  connect(
46
64
  (state, props) => ({
47
65
  block_data: state.content.data,
48
- data_provenance:
49
- state.content.subrequests?.[props.id]?.data?.data_provenance,
66
+ data_provenance: state.content.subrequests?.[props.id]?.data_provenance,
50
67
  }),
51
68
  {
52
69
  getContent,
53
70
  },
54
71
  ),
55
- )(Edit);
72
+ )(React.memo(Edit));
@@ -1,5 +1,10 @@
1
1
  import React from 'react';
2
2
  import ConnectedTableau from '../../ConnectedTableau/ConnectedTableau';
3
+ import { Sources } from '../../Sources';
4
+ import { PrivacyProtection } from '@eeacms/volto-embed';
5
+
6
+ import { StyleWrapperView } from '@eeacms/volto-block-style/StyleWrapper';
7
+ import cx from 'classnames';
3
8
 
4
9
  import { getContent } from '@plone/volto/actions';
5
10
 
@@ -7,7 +12,8 @@ import { connect } from 'react-redux';
7
12
  import { compose } from 'redux';
8
13
 
9
14
  const View = (props) => {
10
- const { data } = props || {};
15
+ const { data_provenance, tableau_visualization } = props || {};
16
+ const data = React.useMemo(() => props.data || {}, [props.data]);
11
17
  const { vis_url = '' } = data;
12
18
  const show_sources = data?.show_sources ?? false;
13
19
 
@@ -19,32 +25,59 @@ const View = (props) => {
19
25
  }, [vis_url]);
20
26
 
21
27
  return (
22
- <>
23
- {data?.vis_url ? (
24
- <>
25
- <ConnectedTableau {...props.tableau_visualization} id={props.id} />
26
- {show_sources &&
27
- data.tableauSources &&
28
- props.tableau_visualization ? (
29
- ''
30
- ) : show_sources ? (
31
- <div>Data provenance is not set in the visualization</div>
32
- ) : (
33
- ''
34
- )}
35
- </>
36
- ) : (
37
- <div>Please select a visualization from block editor.</div>
38
- )}
39
- </>
28
+ <StyleWrapperView
29
+ {...props}
30
+ data={data}
31
+ styleData={{
32
+ ...data.styles,
33
+ customClass: cx(data.styles?.customClass || '', 'embed-container'),
34
+ }}
35
+ >
36
+ <PrivacyProtection data={data} {...props}>
37
+ {data?.vis_url ? (
38
+ <>
39
+ <div className="tableau-block">
40
+ {props.mode === 'edit' ? (
41
+ <div className="tableau-info">
42
+ <h3 className="tableau-version">
43
+ == Tableau{' '}
44
+ {tableau_visualization?.general?.version || '2.8.0'} loaded
45
+ ==
46
+ </h3>
47
+ </div>
48
+ ) : (
49
+ ''
50
+ )}
51
+ <ConnectedTableau
52
+ {...props.tableau_visualization}
53
+ id={props.id}
54
+ {...props}
55
+ />
56
+ </div>
57
+
58
+ {show_sources &&
59
+ data_provenance &&
60
+ data_provenance?.data?.data_provenance &&
61
+ tableau_visualization ? (
62
+ <Sources sources={data_provenance.data.data_provenance} />
63
+ ) : show_sources ? (
64
+ <div>Data provenance is not set in the visualization</div>
65
+ ) : (
66
+ ''
67
+ )}
68
+ </>
69
+ ) : (
70
+ <div>Please select a visualization from block editor.</div>
71
+ )}
72
+ </PrivacyProtection>
73
+ </StyleWrapperView>
40
74
  );
41
75
  };
42
76
 
43
77
  export default compose(
44
78
  connect(
45
79
  (state, props) => ({
46
- data_provenance:
47
- state.content.subrequests?.[props.id]?.data?.data_provenance,
80
+ data_provenance: state.content.subrequests?.[props.id],
48
81
  tableau_visualization:
49
82
  state.content.subrequests?.[props.id]?.data?.tableau_visualization_data,
50
83
  }),
@@ -52,4 +85,4 @@ export default compose(
52
85
  getContent,
53
86
  },
54
87
  ),
55
- )(View);
88
+ )(React.memo(View));
@@ -13,6 +13,8 @@ const ConnectedTableau = (props) => {
13
13
  setLoaded={setLoaded}
14
14
  data={{ ...props?.general, ...props?.options, ...props?.extraOptions }}
15
15
  url={props?.general?.url}
16
+ version={props?.general?.version}
17
+ {...props}
16
18
  />
17
19
  </div>
18
20
  );
@@ -0,0 +1,48 @@
1
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
2
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
3
+ /* eslint-disable jsx-a11y/anchor-is-valid */
4
+
5
+ import React from 'react';
6
+ import { UniversalLink, Icon } from '@plone/volto/components';
7
+
8
+ import rightKeySVG from '@plone/volto/icons/right-key.svg';
9
+ import downKeySVG from '@plone/volto/icons/down-key.svg';
10
+
11
+ import './style.css';
12
+
13
+ const SourcesWidget = ({ sources }) => {
14
+ const [expand, setExpand] = React.useState(true);
15
+ return (
16
+ <div>
17
+ <a className="embed-sources-header" onClick={() => setExpand(!expand)}>
18
+ <h3>
19
+ <Icon
20
+ name={expand ? downKeySVG : rightKeySVG}
21
+ title={expand ? 'Collapse' : 'Expand'}
22
+ size="17px"
23
+ />
24
+ Sources:
25
+ </h3>
26
+ </a>
27
+ {expand && (
28
+ <ul>
29
+ {sources &&
30
+ sources.data &&
31
+ sources.data.map((param, i) => (
32
+ <li key={i} className="embed-source-param">
33
+ <UniversalLink
34
+ className="embed-sources-param-title"
35
+ href={param.link}
36
+ >
37
+ {param.title}
38
+ </UniversalLink>
39
+ , {param.organisation}
40
+ </li>
41
+ ))}
42
+ </ul>
43
+ )}
44
+ </div>
45
+ );
46
+ };
47
+
48
+ export default SourcesWidget;
@@ -0,0 +1,3 @@
1
+ import Sources from './Sources';
2
+
3
+ export { Sources };
@@ -0,0 +1,7 @@
1
+ .embed-sources-header {
2
+ cursor: pointer;
3
+ }
4
+
5
+ .embed-sources-param-description {
6
+ margin-left: 5px;
7
+ }
@@ -212,7 +212,11 @@ const Tableau = (props) => {
212
212
  ''
213
213
  ) : (
214
214
  <div className="tableau-loader">
215
- <span>Loading Tableau v{version}</span>
215
+ <span>
216
+ {mode === 'edit'
217
+ ? 'Loading...'
218
+ : `Loading Tableau v${version}`}
219
+ </span>
216
220
  </div>
217
221
  )}
218
222
  </>
@@ -69,7 +69,7 @@ const View = (props) => {
69
69
  <div className="tableau-block">
70
70
  {props.mode === 'edit' ? (
71
71
  <div className="tableau-info">
72
- <h3 className="tableau-version">== Tableau {version} ==</h3>
72
+ <h3 className="tableau-version">== Tableau {version} loaded ==</h3>
73
73
  {!props.data.url ? <p className="tableau-error">URL required</p> : ''}
74
74
  {error ? <p className="tableau-error">{error}</p> : ''}
75
75
  </div>
@@ -53,6 +53,14 @@ const VisualizationWidget = (props) => {
53
53
  let schema = Schema(config);
54
54
 
55
55
  React.useEffect(() => {
56
+ if (!intValue?.general || !intValue?.general?.version) {
57
+ setIntValue({
58
+ ...intValue,
59
+ general: {
60
+ version: '2.8.0',
61
+ },
62
+ });
63
+ }
56
64
  if (!intValue?.options) {
57
65
  setIntValue({
58
66
  ...intValue,
@@ -111,18 +119,17 @@ const VisualizationWidget = (props) => {
111
119
  tableauError ? (
112
120
  <TableauNotDisplayed />
113
121
  ) : (
114
- ''
122
+ <div className="tableau-container">
123
+ <TableauView
124
+ setTableauError={setTableauError}
125
+ data={{
126
+ ...intValue?.general,
127
+ ...intValue?.options,
128
+ ...intValue?.extraOptions,
129
+ }}
130
+ />
131
+ </div>
115
132
  )}
116
- <div className="tableau-container">
117
- <TableauView
118
- setTableauError={setTableauError}
119
- data={{
120
- ...intValue?.general,
121
- ...intValue?.options,
122
- ...intValue?.extraOptions,
123
- }}
124
- />
125
- </div>
126
133
  </Grid.Column>
127
134
  </Grid>
128
135
  </Modal.Content>
@@ -144,15 +151,17 @@ const VisualizationWidget = (props) => {
144
151
  tableauError ? (
145
152
  <TableauNotDisplayed />
146
153
  ) : (
147
- ''
154
+ <TableauView
155
+ setTableauError={setTableauError}
156
+ data={{
157
+ ...value?.general,
158
+ ...value?.options,
159
+ ...value?.extraOptions,
160
+ }}
161
+ />
148
162
  )}
149
-
150
- <TableauView
151
- setTableauError={setTableauError}
152
- data={{ ...value?.general, ...value?.options, ...value?.extraOptions }}
153
- />
154
163
  </FormFieldWrapper>
155
164
  );
156
165
  };
157
166
 
158
- export default VisualizationWidget;
167
+ export default React.memo(VisualizationWidget);
@@ -1,21 +1,41 @@
1
- const generalSchema = {
2
- title: 'General',
1
+ const generalSchema = (config) => {
2
+ return {
3
+ title: 'General',
3
4
 
4
- fieldsets: [
5
- {
6
- id: 'general',
7
- title: 'General',
8
- fields: ['url'],
9
- },
10
- ],
5
+ fieldsets: [
6
+ {
7
+ id: 'general',
8
+ title: 'General',
9
+ fields: ['version', 'url'],
10
+ },
11
+ ],
11
12
 
12
- properties: {
13
- url: {
14
- title: 'Url',
15
- type: 'textarea',
13
+ properties: {
14
+ version: {
15
+ title: 'Version',
16
+ type: 'array',
17
+ choices: [
18
+ ...[
19
+ '2.8.0',
20
+ '2.7.0',
21
+ '2.6.0',
22
+ '2.5.0',
23
+ '2.4.0',
24
+ '2.3.0',
25
+ '2.2.2',
26
+ '2.1.2',
27
+ '2.0.3',
28
+ ].map((version) => [version, `tableau-${version}`]),
29
+ ],
30
+ default: config.settings.tableauVersion || '2.8.0',
31
+ },
32
+ url: {
33
+ title: 'Url',
34
+ type: 'textarea',
35
+ },
16
36
  },
17
- },
18
- required: ['url'],
37
+ required: ['url', 'version'],
38
+ };
19
39
  };
20
40
 
21
41
  const optionsSchema = {
@@ -158,7 +178,7 @@ export default (config) => {
158
178
  schemas: [
159
179
  {
160
180
  id: 'general',
161
- schema: generalSchema,
181
+ schema: generalSchema(config),
162
182
  },
163
183
  {
164
184
  id: 'options',
@@ -9,7 +9,11 @@
9
9
  .tableau-block {
10
10
  .tableau-info {
11
11
  h3.tableau-version {
12
- margin-right: 0.5rem;
12
+ display: flex;
13
+ height: 75px;
14
+ align-items: center;
15
+ justify-content: center;
16
+ background-color: #f4f4f1;
13
17
  color: @tableauTitleColor;
14
18
  }
15
19