@eeacms/volto-tableau 6.0.4 → 6.0.6

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,6 +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
+ ### [6.0.6](https://github.com/eea/volto-tableau/compare/6.0.5...6.0.6) - 17 November 2023
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: clean up [Miu Razvan - [`73ff5c0`](https://github.com/eea/volto-tableau/commit/73ff5c0f61c947067006cecf3bd3ad003249d78c)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - tests: add cypress for tableau [nileshgulia1 - [`6eca683`](https://github.com/eea/volto-tableau/commit/6eca6834b85cdab4ed82367fee32fdbbb35b0f5e)]
16
+ - tests: update unit tests [nileshgulia1 - [`96cae09`](https://github.com/eea/volto-tableau/commit/96cae09eab2e737f032c97eb401a3efa88e68ec6)]
17
+ - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`c7e81cb`](https://github.com/eea/volto-tableau/commit/c7e81cb0768f755dd4107a4998253d9bccc33809)]
18
+ - comment test [Miu Razvan - [`a459525`](https://github.com/eea/volto-tableau/commit/a459525fdccf8ee61651d4cb2e04eb253e841c61)]
19
+ ### [6.0.5](https://github.com/eea/volto-tableau/compare/6.0.4...6.0.5) - 15 November 2023
20
+
21
+ #### :rocket: New Features
22
+
23
+ - feat: add enlarge option for tableau [kreafox - [`4af7c29`](https://github.com/eea/volto-tableau/commit/4af7c29462302b318a5d24118288ef982cc1cd1c)]
24
+
7
25
  ### [6.0.4](https://github.com/eea/volto-tableau/compare/6.0.3...6.0.4) - 15 November 2023
8
26
 
9
27
  #### :bug: Bug Fixes
@@ -23,6 +41,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
23
41
 
24
42
  #### :house: Internal changes
25
43
 
44
+ - chore: [JENKINS] Refactor automated testing [valentinab25 - [`903b90a`](https://github.com/eea/volto-tableau/commit/903b90a2df0abc183aa68d99a89bb688de3a0c73)]
26
45
 
27
46
  #### :hammer_and_wrench: Others
28
47
 
@@ -32,6 +51,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
32
51
  - tests: increase coverage [kreafox - [`ecb9262`](https://github.com/eea/volto-tableau/commit/ecb92625a44365faf4c39f0ff3f02ccc4ca21656)]
33
52
  - Fix tableau height [kreafox - [`6194c24`](https://github.com/eea/volto-tableau/commit/6194c2405e2bd93aba9865caed76292cd55193d3)]
34
53
  - Show share & download button on widget view [kreafox - [`a66e253`](https://github.com/eea/volto-tableau/commit/a66e2537d08dc7129e249c28e1daa27246c88815)]
54
+ - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`9d2189d`](https://github.com/eea/volto-tableau/commit/9d2189d4edb13dd449d75cd6dd9052bbed67304d)]
55
+ - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`f2fa3f9`](https://github.com/eea/volto-tableau/commit/f2fa3f9ccabab918586179ac16ead44e2eba8498)]
56
+ - test: [JENKINS] Improve cypress time [valentinab25 - [`5748183`](https://github.com/eea/volto-tableau/commit/5748183c27dae18a4ebbc067d659cbc24cad8f71)]
35
57
  - use toolbar from volto-embed [Miu Razvan - [`1a232a1`](https://github.com/eea/volto-tableau/commit/1a232a15f2bbe05da75307800590d0a0a1c4996b)]
36
58
  ## [6.0.0](https://github.com/eea/volto-tableau/compare/5.0.2...6.0.0) - 30 October 2023
37
59
 
@@ -89,6 +111,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
89
111
  - test: change volto version in Jenkinsfile [ana-oprea - [`347aceb`](https://github.com/eea/volto-tableau/commit/347aceb07d152fddeebbf3a7e7a6ac9c55dc21ba)]
90
112
  - test: increase cypress timeout [ana-oprea - [`bdf4408`](https://github.com/eea/volto-tableau/commit/bdf44083cd84c96b4914d3f8a3bb17c5187f191c)]
91
113
  - test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`caff974`](https://github.com/eea/volto-tableau/commit/caff9742a703b224133a8dd2a969629e70c9fd33)]
114
+ - test: Fix eslint and yarn i18n [Alin Voinea - [`b8be7fb`](https://github.com/eea/volto-tableau/commit/b8be7fb9ab10faed0a1be8ce7e3d4e7c78ebe020)]
92
115
  - i18n: Add en [Alin Voinea - [`c5e20dd`](https://github.com/eea/volto-tableau/commit/c5e20ddea25c830ac80665ee9a71e557e8cd117d)]
93
116
  - test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`2116ff9`](https://github.com/eea/volto-tableau/commit/2116ff95c6454e813bdca44e6c3aa81fa0a916b8)]
94
117
  ## [5.0.0](https://github.com/eea/volto-tableau/compare/4.1.1...5.0.0) - 25 July 2023
@@ -100,17 +123,21 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
100
123
  #### :hammer_and_wrench: Others
101
124
 
102
125
  - Release 5.0.0 [Alin Voinea - [`97c98e9`](https://github.com/eea/volto-tableau/commit/97c98e98b1295a4ad45756326dc20cd59517515f)]
126
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`2acb3a5`](https://github.com/eea/volto-tableau/commit/2acb3a5490f62ce0a95ebbd03c32874ac3a42603)]
103
127
  ### [4.1.1](https://github.com/eea/volto-tableau/compare/4.1.0...4.1.1) - 21 July 2023
104
128
 
105
129
  #### :hammer_and_wrench: Others
106
130
 
107
131
  - Add VisualizationViewWidget [Tiberiu Ichim - [`fa881cb`](https://github.com/eea/volto-tableau/commit/fa881cbc3643a46697fb16d1c86ada1d4121a46a)]
132
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`cbcbad2`](https://github.com/eea/volto-tableau/commit/cbcbad26f7aa3683122199c8d5cbd142903df93b)]
133
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`51abe6d`](https://github.com/eea/volto-tableau/commit/51abe6d4db80825fe2e396e04c7003c6ad79b480)]
108
134
  ### [4.1.0](https://github.com/eea/volto-tableau/compare/4.0.0...4.1.0) - 15 June 2023
109
135
 
110
136
  ## [4.0.0](https://github.com/eea/volto-tableau/compare/3.0.8...4.0.0) - 13 June 2023
111
137
 
112
138
  #### :house: Internal changes
113
139
 
140
+ - chore: [JENKINS] Remove alpha testing version [valentinab25 - [`e33bb21`](https://github.com/eea/volto-tableau/commit/e33bb21eb429c33e3a15d771487a1c9af8ccb0d5)]
114
141
 
115
142
  #### :hammer_and_wrench: Others
116
143
 
@@ -142,6 +169,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
142
169
 
143
170
  #### :hammer_and_wrench: Others
144
171
 
172
+ - Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`f5deccd`](https://github.com/eea/volto-tableau/commit/f5deccd84372752908b300c5cfd78134818e5ce4)]
145
173
  ### [3.0.6](https://github.com/eea/volto-tableau/compare/3.0.5...3.0.6) - 30 January 2023
146
174
 
147
175
  ### [3.0.5](https://github.com/eea/volto-tableau/compare/3.0.4...3.0.5) - 26 January 2023
@@ -213,6 +241,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
213
241
  - Update commands.js [Nilesh - [`7c48437`](https://github.com/eea/volto-tableau/commit/7c4843780efb9b85a4728de73c00d831c1d8fdcf)]
214
242
  - Update e2e.js [Nilesh - [`f67b45c`](https://github.com/eea/volto-tableau/commit/f67b45c170f58f8d0301192994226f173e4cb00a)]
215
243
  - latest volto compatibility refs #154757 [nileshgulia1 - [`881ba48`](https://github.com/eea/volto-tableau/commit/881ba482dc9b82e7fdac16549d41e80a6d26b3de)]
244
+ - Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`58e25df`](https://github.com/eea/volto-tableau/commit/58e25df2291add09670143bee54cde103ee835b9)]
216
245
  ### [1.3.0](https://github.com/eea/volto-tableau/compare/1.2.5...1.3.0) - 28 September 2022
217
246
 
218
247
  #### :hammer_and_wrench: Others
@@ -226,11 +255,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
226
255
  - Use volto 16 alpha 14 [Miu Razvan - [`93641be`](https://github.com/eea/volto-tableau/commit/93641be4c2393f49008aff789400cf7c947949fd)]
227
256
  - Revert volto-tableau group to common [Andrei Grigore - [`9d24c6d`](https://github.com/eea/volto-tableau/commit/9d24c6d2767fed6a840cddaee55dbd5cecb544b5)]
228
257
  - Tableaugroup typo fix [Andrei Grigore - [`b0b5378`](https://github.com/eea/volto-tableau/commit/b0b5378a437043120a96c9e5e8802584145daa22)]
258
+ - Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`3234347`](https://github.com/eea/volto-tableau/commit/3234347e524cc0ed4918242f503fe9e7dba266b2)]
229
259
  - Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`d237e1c`](https://github.com/eea/volto-tableau/commit/d237e1c72817d7e68a3eb698563674d1514db24f)]
230
260
  ### [1.2.4](https://github.com/eea/volto-tableau/compare/1.2.3...1.2.4) - 25 October 2021
231
261
 
232
262
  #### :hammer_and_wrench: Others
233
263
 
264
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`2b19679`](https://github.com/eea/volto-tableau/commit/2b19679e2c7bcdc83082d1c73a595eea8b86d14f)]
265
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`384ccae`](https://github.com/eea/volto-tableau/commit/384ccaebed8c414a5c90eb96c6ce0a2b091f249c)]
266
+ - Add Sonarqube tag using frontend addons list [EEA Jenkins - [`589258e`](https://github.com/eea/volto-tableau/commit/589258e9b3cbba9cee37c57bb85ca5b707bc65d7)]
234
267
  ### [1.2.3](https://github.com/eea/volto-tableau/compare/1.2.2...1.2.3) - 14 June 2021
235
268
 
236
269
  #### :hammer_and_wrench: Others
package/Jenkinsfile CHANGED
@@ -159,7 +159,8 @@ pipeline {
159
159
  script {
160
160
  try {
161
161
  sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
162
- sh '''timeout -s 9 3600 docker run --shm-size=2g --cpu-quota=150000 --link $IMAGE_NAME-plone:plone --entrypoint=make --name="$IMAGE_NAME-cypress" --workdir=/app/src/addons/${GIT_NAME} -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" $IMAGE_NAME-frontend cypress-ci'''
162
+ sh '''docker run -d --shm-size=3g --link $IMAGE_NAME-plone:plone --name="$IMAGE_NAME-cypress" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend start-ci'''
163
+ sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make cypress-ci'''
163
164
  } finally {
164
165
  try {
165
166
  sh '''rm -rf cypress-videos cypress-results cypress-coverage cypress-screenshots'''
@@ -189,6 +190,10 @@ pipeline {
189
190
  catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
190
191
  junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
191
192
  }
193
+ catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
194
+ sh '''docker logs $IMAGE_NAME-cypress'''
195
+ }
196
+ sh script: "docker stop $IMAGE_NAME-cypress", returnStatus: true
192
197
  sh script: "docker stop $IMAGE_NAME-plone", returnStatus: true
193
198
  sh script: "docker rm -v $IMAGE_NAME-plone", returnStatus: true
194
199
  sh script: "docker rm -v $IMAGE_NAME-cypress", returnStatus: true
package/Makefile CHANGED
@@ -151,14 +151,12 @@ test-ci:
151
151
 
152
152
  .PHONY: start-ci
153
153
  start-ci:
154
+ cp .coverage.babel.config.js /app/babel.config.js
154
155
  cd ../..
155
- yarn start &
156
+ yarn start
156
157
 
157
158
  .PHONY: cypress-ci
158
159
  cypress-ci:
159
- cp .coverage.babel.config.js /app/babel.config.js
160
- make start-ci
161
160
  $(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
162
161
  NODE_ENV=development make cypress-run
163
162
 
164
-
@@ -0,0 +1,45 @@
1
+ import { slateAfterEach } from '../support/e2e';
2
+
3
+ describe('Blocks Tests', () => {
4
+ beforeEach((contentType = 'Document') => {
5
+ cy.intercept('GET', `/**/*?expand*`).as('content');
6
+ cy.intercept('GET', '/**/Document').as('schema');
7
+ cy.autologin();
8
+ cy.createContent({
9
+ contentType: 'Document',
10
+ contentId: 'cypress',
11
+ contentTitle: 'Cypress',
12
+ });
13
+ cy.createContent({
14
+ contentType: contentType,
15
+ contentId: 'my-page',
16
+ contentTitle: 'My Page',
17
+ path: 'cypress',
18
+ });
19
+ cy.visit('/cypress/my-page');
20
+ // cy.waitForResourceToLoad('@navigation');
21
+ // cy.waitForResourceToLoad('@breadcrumbs');
22
+ // cy.waitForResourceToLoad('@actions');
23
+ // cy.waitForResourceToLoad('@types');
24
+ cy.waitForResourceToLoad('my-page');
25
+ cy.navigate('/cypress/my-page/edit');
26
+ });
27
+ afterEach(slateAfterEach);
28
+
29
+ it('Add Tableau block', () => {
30
+ // when I add a maps block
31
+ cy.addNewBlock('tableau');
32
+
33
+ cy.get(`.sidebar-container .field-wrapper-url #field-url`).type(
34
+ 'https://tableau-public.discomap.eea.europa.eu/views/GHGProjections/Dashboard1&:jsdebug=n',
35
+ );
36
+ cy.get('#toolbar-save').click();
37
+ cy.wait('@content');
38
+ cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
39
+
40
+ // then the page view should contain the maps block
41
+ cy.get('#page-document iframe')
42
+ .should('have.attr', 'src')
43
+ .and('match', /\/\/tableau-public.discomap.eea.europa.eu\//);
44
+ });
45
+ });
@@ -71,8 +71,7 @@ Cypress.Commands.add(
71
71
  id: contentId,
72
72
  title: contentTitle,
73
73
  image: {
74
- data:
75
- 'iVBORw0KGgoAAAANSUhEUgAAANcAAAA4CAMAAABZsZ3QAAAAM1BMVEX29fK42OU+oMvn7u9drtIP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QX+z9ce7A8GqEEucllLxePuZwdJl1Lezu0hoswvTPt61DrFcRuujV/2cmlxaGBC7Aw6cpovGANwRiSdOAWJ5AGy4gLL64dl0QhUEAuEUNws+XxV+OKGPdw/hESGYF9XEGaFC7sNLMSXWJjHsnanYi87VK428N2uxpOjOFANcagLM5l+7mSycM8KknZpKLcGi6jmzWGr/vLurZ/0g4u9AZuAoeb5r1ceQhyiTPY1E4wUR6u/F3H2ojSpXMMriBPT9cezTto8Cx+MsglHL4fv1Rxrb1LVw9yvyQpJ3AhFnLZfuRLH2QsOG3FGGD20X/th/u5bFAt16Bt308KjF+MNOXgl/SquIEySX3GhaZvc67KZbDxcCDORz2N8yCWPaY5lyQZO7lQ29fnZbt3Xu6qoge4+DjXl/MocySPOp9rlvdyznahRyHEYd77v3LhugOXDv4J65QXfl803BDAdaWBEDhfVx7nKofjoVCgxnUAqw/UAUDPn788BDvQuG4TDtdtUPvzjSlXAB8DvaDOhhrmhwbywylXAm8CvaouikJTL93gs3y7Yy4VYbIxOHrcMizPqWOjqO9l3Uz52kibQy4xxOgqhJvD+w5rvokOcAlGvNCfeqCv1ste1stzLm0f71Iq3ZfTrPfuE5nhPtF+LvQE2lffQC7pYtQy3tdzdrKvd5TLVVzDetScS3nEKmmwDyt1Cev1kX3YfbvzNK4fzrlw+cB6vm+uiUgf2zdXI62241LawCb7Pi5FXFPF8KpzDoF/Sw2lg+GrHNbno1mhPu+VCF/vfMnw06PnUl6j48dVHD3jHNHPua+fc3o/5yp/zsGi0vYtzi3Pz5mHd4T6BWMIlewacd63AAAAAElFTkSuQmCC',
76
75
  encoding: 'base64',
77
76
  filename: 'image.png',
78
77
  'content-type': 'image/png',
@@ -535,3 +534,42 @@ Cypress.Commands.add(
535
534
  });
536
535
  },
537
536
  );
537
+
538
+ Cypress.Commands.add('addNewBlock', (blockName, createNewSlate = false) => {
539
+ let block;
540
+ block = cy.getSlate(createNewSlate).type(`/${blockName}{enter}`);
541
+ return block;
542
+ });
543
+
544
+ Cypress.Commands.add('getSlate', (createNewSlate = false) => {
545
+ let slate;
546
+ if (createNewSlate) {
547
+ cy.get('.block.inner').last().type('{moveToEnd}{enter}');
548
+ }
549
+ cy.getIfExists(
550
+ SLATE_SELECTOR,
551
+ () => {
552
+ slate = cy.get(SLATE_SELECTOR).last();
553
+ },
554
+ () => {
555
+ slate = cy.get(SLATE_SELECTOR, { timeout: 10000 }).last();
556
+ },
557
+ );
558
+ return slate;
559
+ });
560
+
561
+ function getIfExists(
562
+ selector,
563
+ successAction = () => {},
564
+ failAction = () => {},
565
+ ) {
566
+ cy.get('body').then((body) => {
567
+ if (body.find(selector).length > 0 && successAction) {
568
+ successAction();
569
+ } else if (failAction) {
570
+ failAction();
571
+ }
572
+ });
573
+ }
574
+
575
+ Cypress.Commands.add('getIfExists', getIfExists);
@@ -35,10 +35,10 @@ export const slateBeforeEach = (contentType = 'Document') => {
35
35
  path: 'cypress',
36
36
  });
37
37
  cy.visit('/cypress/my-page');
38
- cy.waitForResourceToLoad('@navigation');
39
- cy.waitForResourceToLoad('@breadcrumbs');
40
- cy.waitForResourceToLoad('@actions');
41
- cy.waitForResourceToLoad('@types');
38
+ // cy.waitForResourceToLoad('@navigation');
39
+ // cy.waitForResourceToLoad('@breadcrumbs');
40
+ // cy.waitForResourceToLoad('@actions');
41
+ // cy.waitForResourceToLoad('@types');
42
42
  cy.waitForResourceToLoad('my-page');
43
43
  cy.navigate('/cypress/my-page/edit');
44
44
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-tableau",
3
- "version": "6.0.4",
3
+ "version": "6.0.6",
4
4
  "description": "@eeacms/volto-tableau: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { connect } from 'react-redux';
3
3
  import { compose } from 'redux';
4
+ import { Message } from 'semantic-ui-react';
4
5
  import { flattenToAppURL } from '@plone/volto/helpers';
5
6
  import { getContent } from '@plone/volto/actions';
6
7
  import { PrivacyProtection } from '@eeacms/volto-embed';
@@ -14,6 +15,7 @@ const View = (props) => {
14
15
  with_more_info = true,
15
16
  with_download = true,
16
17
  with_share = true,
18
+ with_enlarge = true,
17
19
  tableau_height = 700,
18
20
  } = data;
19
21
  const { figure_note = [], data_provenance = {}, tableau_visualization } =
@@ -28,38 +30,43 @@ const View = (props) => {
28
30
  // eslint-disable-next-line
29
31
  }, [tableau_vis_url]);
30
32
 
33
+ if (props.mode === 'edit' && !tableau_vis_url) {
34
+ return (
35
+ <Message>
36
+ Please select a tableau visualization from block editor.
37
+ </Message>
38
+ );
39
+ }
40
+
41
+ if (props.mode === 'edit' && !tableau_visualization?.url) {
42
+ return <Message>Url is not set in the visualization</Message>;
43
+ }
44
+
45
+ if (!tableau_visualization?.url) {
46
+ return null;
47
+ }
48
+
31
49
  return (
32
50
  <div className="embed-tableau">
33
51
  <PrivacyProtection
34
52
  {...props}
35
53
  data={{ ...data, url: tableau_visualization?.url }}
36
54
  >
37
- {!tableau_vis_url && (
38
- <div>Please select a tableau visualization from block editor.</div>
39
- )}
40
- {!!tableau_vis_url && (
41
- <>
42
- {!tableau_visualization?.url && props.mode === 'edit' && (
43
- <div>Url is not set in the visualization</div>
44
- )}
45
- {!!tableau_visualization?.url && (
46
- <Tableau
47
- data={{
48
- ...tableau_visualization,
49
- with_notes,
50
- with_sources,
51
- with_more_info,
52
- with_download,
53
- with_share,
54
- tableau_height,
55
- tableau_vis_url,
56
- }}
57
- figure_note={figure_note}
58
- sources={data_provenance.data || []}
59
- />
60
- )}
61
- </>
62
- )}
55
+ <Tableau
56
+ data={{
57
+ ...tableau_visualization,
58
+ with_notes,
59
+ with_sources,
60
+ with_more_info,
61
+ with_download,
62
+ with_share,
63
+ with_enlarge,
64
+ tableau_height,
65
+ tableau_vis_url,
66
+ }}
67
+ figure_note={figure_note}
68
+ sources={data_provenance.data || []}
69
+ />
63
70
  </PrivacyProtection>
64
71
  </div>
65
72
  );
@@ -34,11 +34,12 @@ describe('View', () => {
34
34
  };
35
35
 
36
36
  it('should render the component', () => {
37
- const { container } = render(
37
+ const { asFragment } = render(
38
38
  <Provider store={store}>
39
39
  <View data={data} />
40
40
  </Provider>,
41
41
  );
42
- expect(container.querySelector('.embed-tableau')).toBeInTheDocument();
42
+ expect(asFragment()).toMatchSnapshot();
43
+ //expect(container.querySelector('.embed-tableau')).toBeInTheDocument();
43
44
  });
44
45
  });
@@ -0,0 +1,3 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`View should render the component 1`] = `<DocumentFragment />`;
@@ -58,6 +58,7 @@ export default () => {
58
58
  'with_more_info',
59
59
  'with_download',
60
60
  'with_share',
61
+ 'with_enlarge',
61
62
  ],
62
63
  },
63
64
  {
@@ -87,6 +88,11 @@ export default () => {
87
88
  type: 'boolean',
88
89
  defaultValue: true,
89
90
  },
91
+ with_enlarge: {
92
+ title: 'Show enlarge button',
93
+ type: 'boolean',
94
+ defaultValue: true,
95
+ },
90
96
  with_download: {
91
97
  title: 'Show download button',
92
98
  type: 'boolean',
@@ -22,6 +22,7 @@ const View = React.forwardRef((props, ref) => {
22
22
  with_sources = true,
23
23
  with_download = true,
24
24
  with_share = true,
25
+ with_enlarge = true,
25
26
  sources,
26
27
  } = data;
27
28
 
@@ -75,7 +76,13 @@ const View = React.forwardRef((props, ref) => {
75
76
  ref={viz}
76
77
  mode={mode}
77
78
  block={block}
78
- data={{ ...data, with_sources, with_download, with_share }}
79
+ data={{
80
+ ...data,
81
+ with_sources,
82
+ with_download,
83
+ with_share,
84
+ with_enlarge,
85
+ }}
79
86
  sources={sources}
80
87
  extraFilters={extraFilters}
81
88
  extraOptions={extraOptions}
@@ -100,6 +100,7 @@ export default (config, viz, vizState) => {
100
100
  'with_sources',
101
101
  'with_download',
102
102
  'with_share',
103
+ 'with_enlarge',
103
104
  ],
104
105
  },
105
106
  {
@@ -147,6 +148,11 @@ export default (config, viz, vizState) => {
147
148
  type: 'boolean',
148
149
  defaultValue: true,
149
150
  },
151
+ with_enlarge: {
152
+ title: 'Show enlarge button',
153
+ type: 'boolean',
154
+ defaultValue: true,
155
+ },
150
156
  with_sources: {
151
157
  title: 'Show sources',
152
158
  type: 'boolean',
@@ -19,6 +19,7 @@ import {
19
19
  Sources,
20
20
  MoreInfo,
21
21
  Share,
22
+ Enlarge,
22
23
  } from '@eeacms/volto-embed/Toolbar';
23
24
  import { useTableau } from '@eeacms/volto-tableau/hooks';
24
25
  import { JsonCodeSnippet, Download } from '@eeacms/volto-tableau/Utils';
@@ -107,6 +108,7 @@ const Tableau = forwardRef((props, ref) => {
107
108
  with_more_info = true,
108
109
  with_download = true,
109
110
  with_share = true,
111
+ with_enlarge = true,
110
112
  tableau_height = 700,
111
113
  } = data;
112
114
  const device = useMemo(
@@ -444,6 +446,22 @@ const Tableau = forwardRef((props, ref) => {
444
446
  {with_more_info && <MoreInfo href={tableau_vis_url || data.url} />}
445
447
  </div>
446
448
  <div className="right-col">
449
+ {with_enlarge && loaded && (
450
+ <Enlarge>
451
+ <Tableau
452
+ {...props}
453
+ data={{
454
+ ...props.data,
455
+ with_notes: false,
456
+ with_sources: false,
457
+ with_more_info: false,
458
+ with_enlarge: false,
459
+ with_share: false,
460
+ with_download: false,
461
+ }}
462
+ />
463
+ </Enlarge>
464
+ )}
447
465
  {with_download && loaded && <Download viz={viz.current} />}
448
466
  {with_share && loaded && (
449
467
  <Share href={tableau_vis_url || data.url} />
@@ -21,6 +21,7 @@ const VisualizationView = (props) => {
21
21
  with_sources: false,
22
22
  with_more_info: false,
23
23
  with_share: false,
24
+ with_enlarge: false,
24
25
  with_download: true,
25
26
  }}
26
27
  breakpoints={
@@ -10,8 +10,9 @@ export default function VisualizationViewWidget(props) {
10
10
  ...value,
11
11
  with_notes: false,
12
12
  with_sources: false,
13
- with_more_info: true,
13
+ with_more_info: false,
14
14
  with_share: true,
15
+ with_enlarge: true,
15
16
  with_download: true,
16
17
  }}
17
18
  breakpoints={
@@ -78,6 +78,7 @@ const VisualizationWidget = (props) => {
78
78
  with_sources: false,
79
79
  with_more_info: false,
80
80
  with_share: false,
81
+ with_enlarge: false,
81
82
  with_download: false,
82
83
  }}
83
84
  mode="edit"
@@ -127,6 +128,7 @@ const VisualizationWidget = (props) => {
127
128
  with_sources: false,
128
129
  with_more_info: false,
129
130
  with_share: false,
131
+ with_enlarge: false,
130
132
  with_download: false,
131
133
  }}
132
134
  breakpoints={