From 98592247bd58895bd253411cfce981e639093e85 Mon Sep 17 00:00:00 2001 From: dana-cfc4 Date: Tue, 17 Jan 2023 10:10:23 +0200 Subject: [PATCH 1/3] Fix default tableau version, add privacy protection, add style wrapper, add title for tableau edit --- src/Blocks/EmbedEEATableauBlock/Edit.jsx | 28 +++++++-- src/Blocks/EmbedEEATableauBlock/View.jsx | 74 ++++++++++++++++------- src/ConnectedTableau/ConnectedTableau.jsx | 1 + src/Tableau/View.jsx | 6 +- src/TableauBlock/View.jsx | 2 +- src/Widgets/VisualizationWidget.jsx | 45 ++++++++------ src/less/tableau.less | 6 +- 7 files changed, 115 insertions(+), 47 deletions(-) diff --git a/src/Blocks/EmbedEEATableauBlock/Edit.jsx b/src/Blocks/EmbedEEATableauBlock/Edit.jsx index 320cc52..be6df3e 100644 --- a/src/Blocks/EmbedEEATableauBlock/Edit.jsx +++ b/src/Blocks/EmbedEEATableauBlock/Edit.jsx @@ -4,11 +4,16 @@ import { SidebarPortal } from '@plone/volto/components'; import { getContent } from '@plone/volto/actions'; import View from './View'; import Schema from './schema'; + +import { BlockStyleWrapperEdit } from '@eeacms/volto-block-style/BlockStyleWrapper'; +import cx from 'classnames'; + import { connect } from 'react-redux'; import { compose } from 'redux'; const Edit = (props) => { - const { data, block, onChangeBlock, id } = props; + const { block, onChangeBlock, id } = props; + const data = React.useMemo(() => props.data || {}, [props.data]); const schema = React.useMemo(() => Schema(props), [props]); React.useEffect(() => { @@ -21,8 +26,21 @@ const Edit = (props) => { }, [block, data, onChangeBlock]); return ( - <> - + + { formData={data} /> - + ); }; @@ -51,4 +69,4 @@ export default compose( getContent, }, ), -)(Edit); +)(React.memo(Edit)); diff --git a/src/Blocks/EmbedEEATableauBlock/View.jsx b/src/Blocks/EmbedEEATableauBlock/View.jsx index 08defed..c3f8862 100644 --- a/src/Blocks/EmbedEEATableauBlock/View.jsx +++ b/src/Blocks/EmbedEEATableauBlock/View.jsx @@ -1,6 +1,10 @@ import React from 'react'; import ConnectedTableau from '../../ConnectedTableau/ConnectedTableau'; import { Sources } from '../../Sources'; +import { PrivacyProtection } from '@eeacms/volto-embed'; + +import { StyleWrapperView } from '@eeacms/volto-block-style/StyleWrapper'; +import cx from 'classnames'; import { getContent } from '@plone/volto/actions'; @@ -8,7 +12,8 @@ import { connect } from 'react-redux'; import { compose } from 'redux'; const View = (props) => { - const { data, data_provenance, tableau_visualization } = props || {}; + const { data_provenance, tableau_visualization } = props || {}; + const data = React.useMemo(() => props.data || {}, [props.data]); const { vis_url = '' } = data; const show_sources = data?.show_sources ?? false; @@ -20,25 +25,52 @@ const View = (props) => { }, [vis_url]); return ( - <> - {data?.vis_url ? ( - <> - - {show_sources && - data_provenance && - data_provenance?.data?.data_provenance && - tableau_visualization ? ( - - ) : show_sources ? ( -
Data provenance is not set in the visualization
- ) : ( - '' - )} - - ) : ( -
Please select a visualization from block editor.
- )} - + + + {data?.vis_url ? ( + <> +
+ {props.mode === 'edit' ? ( +
+

+ == Tableau{' '} + {tableau_visualization?.general?.version || '2.8.0'} loaded + == +

+
+ ) : ( + '' + )} + +
+ + {show_sources && + data_provenance && + data_provenance?.data?.data_provenance && + tableau_visualization ? ( + + ) : show_sources ? ( +
Data provenance is not set in the visualization
+ ) : ( + '' + )} + + ) : ( +
Please select a visualization from block editor.
+ )} +
+
); }; @@ -53,4 +85,4 @@ export default compose( getContent, }, ), -)(View); +)(React.memo(View)); diff --git a/src/ConnectedTableau/ConnectedTableau.jsx b/src/ConnectedTableau/ConnectedTableau.jsx index f5f581e..1986488 100644 --- a/src/ConnectedTableau/ConnectedTableau.jsx +++ b/src/ConnectedTableau/ConnectedTableau.jsx @@ -14,6 +14,7 @@ const ConnectedTableau = (props) => { data={{ ...props?.general, ...props?.options, ...props?.extraOptions }} url={props?.general?.url} version={props?.general?.version} + {...props} /> ); diff --git a/src/Tableau/View.jsx b/src/Tableau/View.jsx index 80cc48e..47568ac 100644 --- a/src/Tableau/View.jsx +++ b/src/Tableau/View.jsx @@ -212,7 +212,11 @@ const Tableau = (props) => { '' ) : (
- Loading Tableau v{version} + + {mode === 'edit' + ? 'Loading...' + : `Loading Tableau v${version}`} +
)} diff --git a/src/TableauBlock/View.jsx b/src/TableauBlock/View.jsx index f9d4326..e88a141 100644 --- a/src/TableauBlock/View.jsx +++ b/src/TableauBlock/View.jsx @@ -69,7 +69,7 @@ const View = (props) => {
{props.mode === 'edit' ? (
-

== Tableau {version} ==

+

== Tableau {version} loaded ==

{!props.data.url ?

URL required

: ''} {error ?

{error}

: ''}
diff --git a/src/Widgets/VisualizationWidget.jsx b/src/Widgets/VisualizationWidget.jsx index 0148b89..5f16d07 100644 --- a/src/Widgets/VisualizationWidget.jsx +++ b/src/Widgets/VisualizationWidget.jsx @@ -53,6 +53,14 @@ const VisualizationWidget = (props) => { let schema = Schema(config); React.useEffect(() => { + if (!intValue?.general || !intValue?.general?.version) { + setIntValue({ + ...intValue, + general: { + version: '2.8.0', + }, + }); + } if (!intValue?.options) { setIntValue({ ...intValue, @@ -111,18 +119,17 @@ const VisualizationWidget = (props) => { tableauError ? ( ) : ( - '' +
+ +
)} -
- -
@@ -144,15 +151,17 @@ const VisualizationWidget = (props) => { tableauError ? ( ) : ( - '' + )} - - ); }; -export default VisualizationWidget; +export default React.memo(VisualizationWidget); diff --git a/src/less/tableau.less b/src/less/tableau.less index 80f143a..d5c0905 100644 --- a/src/less/tableau.less +++ b/src/less/tableau.less @@ -9,7 +9,11 @@ .tableau-block { .tableau-info { h3.tableau-version { - margin-right: 0.5rem; + display: flex; + height: 75px; + align-items: center; + justify-content: center; + background-color: #f4f4f1; color: @tableauTitleColor; } From e557a0561a46fa7de139d733e72dc17affa8f5e1 Mon Sep 17 00:00:00 2001 From: dana-cfc4 Date: Tue, 17 Jan 2023 10:43:52 +0200 Subject: [PATCH 2/3] Add volto-embed and volto-block-style addons --- package.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 775ed2f..48fbf08 100644 --- a/package.json +++ b/package.json @@ -17,10 +17,14 @@ "url": "git@github.com:eea/volto-tableau.git" }, "addons": [ - "@eeacms/volto-resize-helper" + "@eeacms/volto-resize-helper", + "@eeacms/volto-embed", + "@eeacms/volto-block-style" ], "dependencies": { - "@eeacms/volto-resize-helper": "^0.2.4" + "@eeacms/volto-resize-helper": "^0.2.4", + "@eeacms/volto-embed": "5.0.0", + "@eeacms/volto-block-style": "4.1.0" }, "devDependencies": { "@cypress/code-coverage": "^3.9.5", From bdd8aef1b2783cfc425b4da3d7be8fd387b61dd5 Mon Sep 17 00:00:00 2001 From: EEA Jenkins <@users.noreply.github.com> Date: Tue, 17 Jan 2023 10:06:38 +0000 Subject: [PATCH 3/3] Automated release 3.0.3 --- CHANGELOG.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f3dabe..3aa65d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +### [3.0.3](https://github.com/eea/volto-tableau/compare/3.0.2...3.0.3) - 17 January 2023 + +#### :hammer_and_wrench: Others + +- Add volto-embed and volto-block-style addons [dana-cfc4 - [`e557a05`](https://github.com/eea/volto-tableau/commit/e557a0561a46fa7de139d733e72dc17affa8f5e1)] +- 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)] ### [3.0.2](https://github.com/eea/volto-tableau/compare/3.0.1...3.0.2) - 13 January 2023 #### :hammer_and_wrench: Others diff --git a/package.json b/package.json index 488fc27..6c79c1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eeacms/volto-tableau", - "version": "3.0.2", + "version": "3.0.3", "description": "@eeacms/volto-tableau: Volto add-on", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team",