From 0d2b86212b72e06d4ab81804395eda0c2919aeb8 Mon Sep 17 00:00:00 2001 From: dana-cfc4 Date: Thu, 12 Jan 2023 16:41:37 +0200 Subject: [PATCH] Remove sources from schema --- src/Blocks/EmbedEEATableauBlock/View.jsx | 11 +++--- src/Blocks/EmbedEEATableauBlock/schema.js | 40 -------------------- src/Sources/Sources.jsx | 46 ----------------------- src/Sources/index.js | 3 -- src/Sources/style.css | 7 ---- src/less/tableau.less | 24 ++++++------ 6 files changed, 18 insertions(+), 113 deletions(-) delete mode 100644 src/Sources/Sources.jsx delete mode 100644 src/Sources/index.js delete mode 100644 src/Sources/style.css diff --git a/src/Blocks/EmbedEEATableauBlock/View.jsx b/src/Blocks/EmbedEEATableauBlock/View.jsx index 38ff94c..664f64c 100644 --- a/src/Blocks/EmbedEEATableauBlock/View.jsx +++ b/src/Blocks/EmbedEEATableauBlock/View.jsx @@ -1,7 +1,6 @@ import React from 'react'; import ConnectedTableau from '../../ConnectedTableau/ConnectedTableau'; -import { Sources } from '../../Sources'; import { getContent } from '@plone/volto/actions'; import { connect } from 'react-redux'; @@ -10,7 +9,7 @@ import { compose } from 'redux'; const View = (props) => { const { data } = props || {}; const { vis_url = '' } = data; - const with_sources = data?.with_sources ?? false; + const show_sources = data?.show_sources ?? false; React.useEffect(() => { if (vis_url) { @@ -24,12 +23,14 @@ const View = (props) => { {data?.vis_url ? ( <> - {with_sources && + {show_sources && data.tableauSources && props.tableau_visualization ? ( - - ) : ( + '' + ) : show_sources ? (
Data provenance is not set in the visualization
+ ) : ( + '' )} ) : ( diff --git a/src/Blocks/EmbedEEATableauBlock/schema.js b/src/Blocks/EmbedEEATableauBlock/schema.js index bac14e3..f62918e 100644 --- a/src/Blocks/EmbedEEATableauBlock/schema.js +++ b/src/Blocks/EmbedEEATableauBlock/schema.js @@ -1,28 +1,3 @@ -const sourceSchema = { - title: 'Source', - - fieldsets: [ - { - id: 'default', - title: 'Default', - fields: ['source', 'source_link'], - }, - ], - - properties: { - source: { - title: 'Source', - widget: 'textarea', - }, - source_link: { - title: 'Link', - type: 'string', - }, - }, - - required: ['source'], -}; - const Schema = (props) => { return { title: 'Embed EEA Tableau', @@ -32,11 +7,6 @@ const Schema = (props) => { title: 'Default', fields: ['vis_url', 'height', 'show_sources'], }, - { - id: 'sources', - title: 'Sources', - fields: ['tableauSources', 'with_sources'], - }, ], properties: { vis_url: { @@ -48,20 +18,10 @@ const Schema = (props) => { type: 'number', default: 450, }, - tableauSources: { - widget: 'object_list', - title: 'Sources', - schema: sourceSchema, - }, show_sources: { title: 'Toggle sources', type: 'boolean', }, - with_sources: { - title: 'Sources visible', - type: 'boolean', - defaultValue: true, - }, }, required: ['vis_url'], diff --git a/src/Sources/Sources.jsx b/src/Sources/Sources.jsx deleted file mode 100644 index 421239f..0000000 --- a/src/Sources/Sources.jsx +++ /dev/null @@ -1,46 +0,0 @@ -/* eslint-disable jsx-a11y/no-static-element-interactions */ -/* eslint-disable jsx-a11y/click-events-have-key-events */ -/* eslint-disable jsx-a11y/anchor-is-valid */ - -import React from 'react'; -import { UniversalLink, Icon } from '@plone/volto/components'; - -import rightKeySVG from '@plone/volto/icons/right-key.svg'; -import downKeySVG from '@plone/volto/icons/down-key.svg'; - -import './style.css'; - -const SourcesWidget = ({ data }) => { - const [expand, setExpand] = React.useState(true); - return ( -
- setExpand(!expand)}> -

- - Sources: -

-
- {expand && ( -
    - {data && - data.map((param, i) => ( -
  • - - {param.source} - -
  • - ))} -
- )} -
- ); -}; - -export default SourcesWidget; diff --git a/src/Sources/index.js b/src/Sources/index.js deleted file mode 100644 index 79775f1..0000000 --- a/src/Sources/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Sources from './Sources'; - -export { Sources }; diff --git a/src/Sources/style.css b/src/Sources/style.css deleted file mode 100644 index 55c8013..0000000 --- a/src/Sources/style.css +++ /dev/null @@ -1,7 +0,0 @@ -.embed-sources-header { - cursor: pointer; -} - -.embed-sources-param-description { - margin-left: 5px; -} diff --git a/src/less/tableau.less b/src/less/tableau.less index fa02707..80f143a 100644 --- a/src/less/tableau.less +++ b/src/less/tableau.less @@ -50,10 +50,10 @@ } .not_displayed_tableau { - min-width: 633px; width: 100%; - min-height: 200px; + min-width: 633px; height: 100%; + min-height: 200px; background-color: #ebebeb; } @@ -63,18 +63,16 @@ padding: 10px; } } - + .tableau-loader { - margin: auto; + display: flex; + overflow: hidden; width: 100%; height: 100%; - display: flex; - justify-content: center; - border-radius: 5px; align-items: center; - height: 100%; - overflow: hidden; - background-size: 100px 100px; + justify-content: center; + margin: auto; + animation: anim 1s linear infinite; background-image: linear-gradient( -45deg, #5ac5f1 25%, @@ -84,21 +82,23 @@ #5ac5f1 75%, #96bbde 75% ); - animation: anim 1s linear infinite; + background-size: 100px 100px; + border-radius: 5px; } } .tableau-loader span { margin: 6px auto; - text-align: center; color: white; font-weight: bold; + text-align: center; } @keyframes anim { 0% { background-position: 0 0; } + 100% { background-position: 50px 50px; }