@eeacms/volto-tableau 8.0.7 → 8.1.1

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,18 @@ 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
+ ### [8.1.1](https://github.com/eea/volto-tableau/compare/8.1.0...8.1.1) - 11 October 2024
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: Increase wait time EEA Screenshooter when saving preview image - refs #277935 [dobri1408 - [`f9e5d01`](https://github.com/eea/volto-tableau/commit/f9e5d01033fd011c1b411b2cb3e271dfc140f19b)]
12
+
13
+ ### [8.1.0](https://github.com/eea/volto-tableau/compare/8.0.7...8.1.0) - 13 September 2024
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - Update version [dobri1408 - [`dc7280a`](https://github.com/eea/volto-tableau/commit/dc7280ae0a99dd91af2c589715ee16a789eae9f9)]
18
+ - Make an extra cleaning step for the action [dobri1408 - [`cec9ff9`](https://github.com/eea/volto-tableau/commit/cec9ff98dde77a729c04339bac889463949f3d1c)]
7
19
  ### [8.0.7](https://github.com/eea/volto-tableau/compare/8.0.6...8.0.7) - 9 September 2024
8
20
 
9
21
  #### :house: Internal changes
@@ -27,13 +27,18 @@ describe('Blocks Tests', () => {
27
27
  afterEach(slateAfterEach);
28
28
 
29
29
  it('Add Tableau block', () => {
30
+ cy.intercept('GET', `/**/*?expand*`, {
31
+ statusCode: 200,
32
+ }).as('content');
30
33
  // when I add a maps block
31
34
  cy.addNewBlock('tableau');
32
35
 
33
36
  cy.get(
34
37
  `.sidebar-container .field-wrapper-tableau_vis_url #field-tableau_vis_url`,
35
38
  ).type('/path/to/dashboard', { force: true });
39
+ cy.wait('@content');
36
40
  cy.get('#toolbar-save').click({ force: true });
41
+ cy.intercept('GET', `/**/*?expand*`).as('content');
37
42
  cy.wait('@content');
38
43
  cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
39
44
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-tableau",
3
- "version": "8.0.7",
3
+ "version": "8.1.1",
4
4
  "description": "@eeacms/volto-tableau: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -433,7 +433,7 @@ const Tableau = forwardRef((props, ref) => {
433
433
  }
434
434
  return v;
435
435
  });
436
- if (value.length) {
436
+ if (value?.length) {
437
437
  workbook.changeParameterValueAsync(fieldName, value);
438
438
  }
439
439
  }
@@ -1,6 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import { withRouter } from 'react-router';
3
3
  import { connect } from 'react-redux';
4
+ import { injectIntl } from 'react-intl';
4
5
  import { compose } from 'redux';
5
6
  import { isEqual } from 'lodash';
6
7
  import { Modal, Button, Grid } from 'semantic-ui-react';
@@ -125,12 +126,16 @@ const VisualizationWidget = (props) => {
125
126
  * Get schema
126
127
  */
127
128
  React.useEffect(() => {
128
- getSchema({ config, viz: viz.current, vizState, data: value }).then(
129
- (schema) => {
130
- setSchema(schema);
131
- },
132
- );
133
- }, [vizState, value]);
129
+ getSchema({
130
+ config,
131
+ viz: viz.current,
132
+ vizState,
133
+ data: value,
134
+ intl: props.intl,
135
+ }).then((schema) => {
136
+ setSchema(schema);
137
+ });
138
+ }, [vizState, value, props.intl]);
134
139
 
135
140
  React.useEffect(() => {
136
141
  if (value && value.url && value.preview_url_loaded !== value.url) {
@@ -139,7 +144,7 @@ const VisualizationWidget = (props) => {
139
144
  '',
140
145
  )}/cors-proxy/https://screenshot.eea.europa.eu/api/v1/retrieve_image_for_url?url=${encodeURIComponent(
141
146
  value.url,
142
- )}&w=1920&h=1000&waitfor=4000`,
147
+ )}&w=1920&h=1000&waitfor=8000`,
143
148
  )
144
149
  .then((e) => e.blob())
145
150
  .then((myBlob) => {
@@ -260,5 +265,6 @@ const VisualizationWidget = (props) => {
260
265
 
261
266
  export default compose(
262
267
  withRouter,
268
+ injectIntl,
263
269
  connect((state) => ({ content: state?.content?.data })),
264
270
  )(VisualizationWidget);
@@ -1,9 +1,21 @@
1
+ import { defineMessages } from 'react-intl';
1
2
  import { find, includes } from 'lodash';
2
3
  import {
3
4
  getSheetnamesChoices,
4
5
  canChangeVizData,
5
6
  } from '@eeacms/volto-tableau/Tableau/helpers';
6
7
 
8
+ const messages = defineMessages({
9
+ CSSHeight: {
10
+ id: 'CSS height',
11
+ defaultMessage: 'CSS height',
12
+ },
13
+ CSSTableauHeightDescription: {
14
+ id: 'Tableau height',
15
+ defaultMessage: 'Tableau height',
16
+ },
17
+ });
18
+
7
19
  async function getUrlParametersSchema({ viz, vizState, data }) {
8
20
  const tableauParameters =
9
21
  vizState.loaded && viz ? await viz.getWorkbook().getParametersAsync() : [];
@@ -170,7 +182,7 @@ const breakpointUrlSchema = (config) => {
170
182
  };
171
183
  };
172
184
 
173
- const schema = async ({ config, viz, vizState, data }) => {
185
+ const schema = async ({ config, viz, vizState, data, intl }) => {
174
186
  const isDisabled = !canChangeVizData(viz, vizState);
175
187
 
176
188
  return {
@@ -189,6 +201,7 @@ const schema = async ({ config, viz, vizState, data }) => {
189
201
  'hideTabs',
190
202
  'hideToolbar',
191
203
  'autoScale',
204
+ 'tableau_height',
192
205
  'toolbarPosition',
193
206
  'breakpointUrls',
194
207
  ],
@@ -230,6 +243,18 @@ const schema = async ({ config, viz, vizState, data }) => {
230
243
  description: 'Scale down tableau according to width',
231
244
  isDisabled,
232
245
  },
246
+ tableau_height: {
247
+ title: (
248
+ <a
249
+ rel="noopener noreferrer"
250
+ target="_blank"
251
+ href="https://developer.mozilla.org/en-US/docs/Web/CSS/height"
252
+ >
253
+ {intl.formatMessage(messages.CSSHeight)}
254
+ </a>
255
+ ),
256
+ description: intl.formatMessage(messages.CSSTableauHeightDescription),
257
+ },
233
258
  toolbarPosition: {
234
259
  title: 'Toolbar position',
235
260
  choices: [
@@ -3,6 +3,33 @@ import {
3
3
  UPDATE_CONTENT,
4
4
  } from '@plone/volto/constants/ActionTypes';
5
5
 
6
+ const cleanAction = (action) => {
7
+ if (action?.request?.data?.tableau_visualization) {
8
+ const tableauVisualizationData = {
9
+ ...action.request.data.tableau_visualization,
10
+ };
11
+
12
+ if (
13
+ tableauVisualizationData.preview &&
14
+ tableauVisualizationData.preview_url_loaded
15
+ )
16
+ delete tableauVisualizationData.preview;
17
+ delete tableauVisualizationData.preview_url_loaded;
18
+
19
+ return {
20
+ ...action,
21
+ request: {
22
+ ...action.request,
23
+ data: {
24
+ ...action.request.data,
25
+
26
+ tableau_visualization: tableauVisualizationData,
27
+ },
28
+ },
29
+ };
30
+ } else return action;
31
+ };
32
+
6
33
  export const preview_image = (middlewares) => [
7
34
  (store) => (next) => (action) => {
8
35
  if (![CREATE_CONTENT, UPDATE_CONTENT].includes(action.type)) {
@@ -22,37 +49,14 @@ export const preview_image = (middlewares) => [
22
49
  contentData.preview_image_saved ||
23
50
  !action?.request?.data?.tableau_visualization?.preview
24
51
  ) {
25
- return next(action);
52
+ return next(cleanAction(action));
26
53
  }
27
54
 
28
55
  if (
29
56
  lastPreviewImage &&
30
57
  lastPreviewImage !== 'preview_image_generated_tableau_visualization.png'
31
58
  ) {
32
- if (action?.request?.data?.tableau_visualization) {
33
- const tableauVisualizationData = {
34
- ...action.request.data.tableau_visualization,
35
- };
36
-
37
- if (
38
- tableauVisualizationData.preview &&
39
- tableauVisualizationData.preview_url_loaded
40
- )
41
- delete tableauVisualizationData.preview;
42
- delete tableauVisualizationData.preview_url_loaded;
43
-
44
- return next({
45
- ...action,
46
- request: {
47
- ...action.request,
48
- data: {
49
- ...action.request.data,
50
-
51
- tableau_visualization: tableauVisualizationData,
52
- },
53
- },
54
- });
55
- } else return next(action);
59
+ return next(cleanAction(action));
56
60
  }
57
61
 
58
62
  try {