@eeacms/volto-tableau 3.0.0 → 3.0.2

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,7 +4,19 @@ 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.0](https://github.com/eea/volto-tableau/compare/2.0.0...3.0.0) - 12 January 2023
7
+ ### [3.0.2](https://github.com/eea/volto-tableau/compare/3.0.1...3.0.2) - 13 January 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Add version choice to widget [dana-cfc4 - [`0689e40`](https://github.com/eea/volto-tableau/commit/0689e403e4ef427f0996dedd718f6d095d8df33f)]
12
+ - Take sources from eea core metadata [dana-cfc4 - [`a46848d`](https://github.com/eea/volto-tableau/commit/a46848d84bd12e39badad503429c768c15ef1631)]
13
+ - Add data provenance [dana-cfc4 - [`2a96c25`](https://github.com/eea/volto-tableau/commit/2a96c254ae7c3b56423204fa3696c0c5093c1f88)]
14
+ ### [3.0.1](https://github.com/eea/volto-tableau/compare/3.0.0...3.0.1) - 13 January 2023
15
+
16
+ #### :hammer_and_wrench: Others
17
+
18
+ - helper comments [andreiggr - [`b13abfd`](https://github.com/eea/volto-tableau/commit/b13abfd3fe5813f872b98de66de63c98f4721c62)]
19
+ ## [3.0.0](https://github.com/eea/volto-tableau/compare/2.0.0...3.0.0) - 13 January 2023
8
20
 
9
21
  #### :hammer_and_wrench: Others
10
22
 
@@ -39,6 +51,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
39
51
  - Update commands.js [Nilesh - [`7c48437`](https://github.com/eea/volto-tableau/commit/7c4843780efb9b85a4728de73c00d831c1d8fdcf)]
40
52
  - Update e2e.js [Nilesh - [`f67b45c`](https://github.com/eea/volto-tableau/commit/f67b45c170f58f8d0301192994226f173e4cb00a)]
41
53
  - latest volto compatibility refs #154757 [nileshgulia1 - [`881ba48`](https://github.com/eea/volto-tableau/commit/881ba482dc9b82e7fdac16549d41e80a6d26b3de)]
54
+ - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`58e25df`](https://github.com/eea/volto-tableau/commit/58e25df2291add09670143bee54cde103ee835b9)]
42
55
  ### [1.3.0](https://github.com/eea/volto-tableau/compare/1.2.5...1.3.0) - 28 September 2022
43
56
 
44
57
  #### :hammer_and_wrench: Others
@@ -52,11 +65,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
52
65
  - Use volto 16 alpha 14 [Miu Razvan - [`93641be`](https://github.com/eea/volto-tableau/commit/93641be4c2393f49008aff789400cf7c947949fd)]
53
66
  - Revert volto-tableau group to common [Andrei Grigore - [`9d24c6d`](https://github.com/eea/volto-tableau/commit/9d24c6d2767fed6a840cddaee55dbd5cecb544b5)]
54
67
  - Tableaugroup typo fix [Andrei Grigore - [`b0b5378`](https://github.com/eea/volto-tableau/commit/b0b5378a437043120a96c9e5e8802584145daa22)]
68
+ - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`3234347`](https://github.com/eea/volto-tableau/commit/3234347e524cc0ed4918242f503fe9e7dba266b2)]
55
69
  - Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`d237e1c`](https://github.com/eea/volto-tableau/commit/d237e1c72817d7e68a3eb698563674d1514db24f)]
56
70
  ### [1.2.4](https://github.com/eea/volto-tableau/compare/1.2.3...1.2.4) - 25 October 2021
57
71
 
58
72
  #### :hammer_and_wrench: Others
59
73
 
74
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`2b19679`](https://github.com/eea/volto-tableau/commit/2b19679e2c7bcdc83082d1c73a595eea8b86d14f)]
75
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`384ccae`](https://github.com/eea/volto-tableau/commit/384ccaebed8c414a5c90eb96c6ce0a2b091f249c)]
76
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`589258e`](https://github.com/eea/volto-tableau/commit/589258e9b3cbba9cee37c57bb85ca5b707bc65d7)]
60
77
  ### [1.2.3](https://github.com/eea/volto-tableau/compare/1.2.2...1.2.3) - 14 June 2021
61
78
 
62
79
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-tableau",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "@eeacms/volto-tableau: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -45,8 +45,7 @@ export default compose(
45
45
  connect(
46
46
  (state, props) => ({
47
47
  block_data: state.content.data,
48
- data_provenance:
49
- state.content.subrequests?.[props.id]?.data?.data_provenance,
48
+ data_provenance: state.content.subrequests?.[props.id]?.data_provenance,
50
49
  }),
51
50
  {
52
51
  getContent,
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import ConnectedTableau from '../../ConnectedTableau/ConnectedTableau';
3
+ import { Sources } from '../../Sources';
3
4
 
4
5
  import { getContent } from '@plone/volto/actions';
5
6
 
@@ -7,7 +8,7 @@ import { connect } from 'react-redux';
7
8
  import { compose } from 'redux';
8
9
 
9
10
  const View = (props) => {
10
- const { data } = props || {};
11
+ const { data, data_provenance, tableau_visualization } = props || {};
11
12
  const { vis_url = '' } = data;
12
13
  const show_sources = data?.show_sources ?? false;
13
14
 
@@ -24,9 +25,10 @@ const View = (props) => {
24
25
  <>
25
26
  <ConnectedTableau {...props.tableau_visualization} id={props.id} />
26
27
  {show_sources &&
27
- data.tableauSources &&
28
- props.tableau_visualization ? (
29
- ''
28
+ data_provenance &&
29
+ data_provenance?.data?.data_provenance &&
30
+ tableau_visualization ? (
31
+ <Sources sources={data_provenance.data.data_provenance} />
30
32
  ) : show_sources ? (
31
33
  <div>Data provenance is not set in the visualization</div>
32
34
  ) : (
@@ -43,8 +45,7 @@ const View = (props) => {
43
45
  export default compose(
44
46
  connect(
45
47
  (state, props) => ({
46
- data_provenance:
47
- state.content.subrequests?.[props.id]?.data?.data_provenance,
48
+ data_provenance: state.content.subrequests?.[props.id],
48
49
  tableau_visualization:
49
50
  state.content.subrequests?.[props.id]?.data?.tableau_visualization_data,
50
51
  }),
@@ -13,6 +13,7 @@ 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}
16
17
  />
17
18
  </div>
18
19
  );
@@ -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
+ }
@@ -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',
package/src/helpers.js CHANGED
@@ -25,16 +25,29 @@ const loadTableauScript = (callback, version) => {
25
25
 
26
26
  const isMyScriptLoaded = (version) => {
27
27
  //check for loaded Tableau script in dom scripts
28
- var scripts = document.getElementsByTagName('script');
29
- for (var i = scripts.length; i--; ) {
30
- // eslint-disable-next-line eqeqeq
31
- if (
32
- scripts[i].src ===
33
- `https://public.tableau.com/javascripts/api/tableau-${version}.min.js`
34
- )
35
- return true;
28
+ var scripts = __CLIENT__ && document.getElementsByTagName('script');
29
+ if (scripts) {
30
+ for (var i = scripts.length; i--; ) {
31
+ // eslint-disable-next-line eqeqeq
32
+ if (
33
+ scripts[i].src ===
34
+ `https://public.tableau.com/javascripts/api/tableau-${version}.min.js`
35
+ )
36
+ return true;
37
+ }
36
38
  }
37
39
  return false;
38
40
  };
39
41
 
40
42
  export { loadTableauScript, isMyScriptLoaded };
43
+
44
+ //script url for each version. In case you might need to add them in the load balancer
45
+ // https://public.tableau.com/javascripts/api/tableau-2.8.0.min.js
46
+ // https://public.tableau.com/javascripts/api/tableau-2.7.0.min.js
47
+ // https://public.tableau.com/javascripts/api/tableau-2.6.0.min.js
48
+ // https://public.tableau.com/javascripts/api/tableau-2.5.0.min.js
49
+ // https://public.tableau.com/javascripts/api/tableau-2.4.0.min.js
50
+ // https://public.tableau.com/javascripts/api/tableau-2.3.0.min.js
51
+ // https://public.tableau.com/javascripts/api/tableau-2.2.2.min.js
52
+ // https://public.tableau.com/javascripts/api/tableau-2.1.2.min.js
53
+ // https://public.tableau.com/javascripts/api/tableau-2.0.3.min.js