Skip to content

Commit 34ceaf9

Browse files
committed
Remove version chooser
1 parent 03216e3 commit 34ceaf9

File tree

8 files changed

+37
-97
lines changed

8 files changed

+37
-97
lines changed

src/Blocks/EmbedEEATableauBlock/View.jsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const View = (props) => {
1616
const data = React.useMemo(() => props.data || {}, [props.data]);
1717
const { vis_url = '' } = data;
1818
const show_sources = data?.show_sources ?? false;
19+
const version = '2.8.0';
1920

2021
React.useEffect(() => {
2122
if (vis_url) {
@@ -36,15 +37,13 @@ const View = (props) => {
3637
<PrivacyProtection data={data} {...props}>
3738
{data?.vis_url ? (
3839
<>
39-
{tableau_visualization?.general?.url &&
40-
tableau_visualization?.general?.version ? (
40+
{tableau_visualization?.general?.url ? (
4141
<>
4242
<div className="tableau-block">
4343
{props.mode === 'edit' ? (
4444
<div className="tableau-info">
4545
<h3 className="tableau-version">
46-
== Tableau {tableau_visualization?.general?.version}{' '}
47-
loaded ==
46+
== Tableau {version} loaded ==
4847
</h3>
4948
</div>
5049
) : (
@@ -69,9 +68,7 @@ const View = (props) => {
6968
</>
7069
) : !tableau_visualization?.general?.url ? (
7170
<div>Url is not set in the visualization</div>
72-
) : (
73-
<div>Version is not set in the visualization</div>
74-
)}
71+
) : null}
7572
</>
7673
) : (
7774
<div>Please select a visualization from block editor.</div>

src/ConnectedTableau/ConnectedTableau.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const ConnectedTableau = (props) => {
1313
setLoaded={setLoaded}
1414
data={{ ...props?.general, ...props?.options, ...props?.extraOptions }}
1515
url={props?.general?.url}
16-
version={props?.general?.version}
1716
{...props}
1817
/>
1918
</div>

src/Tableau/View.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const Tableau = (props) => {
2323
screen = {},
2424
setError = () => {},
2525
setLoaded = () => {},
26-
version = '',
26+
version = '2.8.0',
2727
} = props;
2828
const {
2929
autoScale = false,

src/TableauBlock/View.jsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,12 @@ const View = (props) => {
3434
description = null,
3535
autoScale = false,
3636
} = data;
37-
const version = props.data.version || config.settings.tableauVersion;
3837
const device = getDevice(config, screen.page?.width || Infinity);
3938
const breakpointUrl = breakpointUrls.filter(
4039
(breakpoint) => breakpoint.device === device,
4140
)[0]?.url;
4241
const url = breakpointUrl || data.url;
43-
44-
const displayCondition = url && version;
42+
const version = '2.8.0';
4543

4644
React.useEffect(() => {
4745
setMounted(true);
@@ -69,15 +67,10 @@ const View = (props) => {
6967
return mounted ? (
7068
<div className="tableau-block">
7169
<div className="tableau-info">
72-
{displayCondition && props.mode === 'edit' ? (
70+
{url && props.mode === 'edit' ? (
7371
<h3 className="tableau-version">== Tableau {version} loaded ==</h3>
7472
) : null}
7573
{!url ? <p className="tableau-error">URL required</p> : ''}
76-
{url && !version ? (
77-
<p className="tableau-error">Version required</p>
78-
) : (
79-
''
80-
)}
8174
{error ? <p className="tableau-error">{error}</p> : ''}
8275
</div>
8376

@@ -87,7 +80,7 @@ const View = (props) => {
8780
) : (
8881
''
8982
)}
90-
{displayCondition ? (
83+
{url ? (
9184
<Tableau
9285
{...props}
9386
canUpdateUrl={!breakpointUrl}

src/TableauBlock/schema.js

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default (config) => ({
4646
{
4747
id: 'default',
4848
title: 'Default',
49-
fields: ['version', 'url', 'title', 'description'],
49+
fields: ['url', 'title', 'description'],
5050
},
5151
{
5252
id: 'options',
@@ -66,24 +66,6 @@ export default (config) => ({
6666
},
6767
],
6868
properties: {
69-
version: {
70-
title: 'Version',
71-
type: 'array',
72-
choices: [
73-
...[
74-
'2.8.0',
75-
'2.7.0',
76-
'2.6.0',
77-
'2.5.0',
78-
'2.4.0',
79-
'2.3.0',
80-
'2.2.2',
81-
'2.1.2',
82-
'2.0.3',
83-
].map((version) => [version, `tableau-${version}`]),
84-
],
85-
default: config.settings.tableauVersion,
86-
},
8769
url: {
8870
title: 'Url',
8971
widget: 'textarea',
@@ -138,5 +120,5 @@ export default (config) => ({
138120
description: 'Set different vizualization for specific breakpoint',
139121
},
140122
},
141-
required: ['version', 'url'],
123+
required: ['url'],
142124
});

src/Views/VisualizationView.jsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ const VisualizationView = (props) => {
1212
<div className="tableau-info">
1313
{!tableau_visualization_data.general?.url ? (
1414
<p className="tableau-error">URL required</p>
15-
) : !tableau_visualization_data.general?.version ? (
16-
<p className="tableau-error">Version required</p>
1715
) : tableauError ? (
1816
<p className="tableau-error">{tableauError}</p>
1917
) : (
@@ -25,9 +23,7 @@ const VisualizationView = (props) => {
2523
};
2624
return (
2725
<div>
28-
{!tableau_visualization_data?.general?.url ||
29-
!tableau_visualization_data?.general?.version ||
30-
tableauError ? (
26+
{!tableau_visualization_data?.general?.url || tableauError ? (
3127
<TableauNotDisplayed />
3228
) : (
3329
<TableauView

src/Widgets/VisualizationWidget.jsx

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ const VisualizationWidget = (props) => {
4040
<div className="tableau-info">
4141
{intValue && intValue.general && !intValue.general.url ? (
4242
<p className="tableau-error">URL required</p>
43-
) : intValue && intValue.general && !intValue.general.version ? (
44-
<p className="tableau-error">Version required</p>
4543
) : tableauError ? (
4644
<p className="tableau-error">{tableauError}</p>
4745
) : (
@@ -55,15 +53,14 @@ const VisualizationWidget = (props) => {
5553
let schema = Schema(config);
5654

5755
React.useEffect(() => {
58-
if (!intValue?.general || !intValue?.general?.version) {
59-
setIntValue({
60-
...intValue,
61-
general: {
62-
url: intValue?.general?.url,
63-
version: '',
64-
},
65-
});
66-
}
56+
// if (!intValue?.general) {
57+
// setIntValue({
58+
// ...intValue,
59+
// general: {
60+
// url: intValue?.general?.url,
61+
// },
62+
// });
63+
// }
6764
if (!intValue?.options) {
6865
setIntValue({
6966
...intValue,
@@ -118,9 +115,7 @@ const VisualizationWidget = (props) => {
118115
/>
119116
</Grid.Column>
120117
<Grid.Column mobile={12} tablet={12} computer={7}>
121-
{(intValue &&
122-
intValue.general &&
123-
(!intValue.general.url || !intValue.general.version)) ||
118+
{(intValue && intValue.general && !intValue.general.url) ||
124119
tableauError ? (
125120
<TableauNotDisplayed />
126121
) : (
@@ -152,9 +147,7 @@ const VisualizationWidget = (props) => {
152147
</Modal.Actions>
153148
</Modal>
154149
)}
155-
{(intValue &&
156-
intValue.general &&
157-
(!intValue.general.url || !intValue.general.version)) ||
150+
{(intValue && intValue.general && !intValue.general.url) ||
158151
tableauError ? (
159152
<TableauNotDisplayed />
160153
) : (

src/Widgets/schema.js

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,21 @@
1-
const generalSchema = (config) => {
2-
return {
3-
title: 'General',
1+
const generalSchema = {
2+
title: 'General',
43

5-
fieldsets: [
6-
{
7-
id: 'general',
8-
title: 'General',
9-
fields: ['version', 'url'],
10-
},
11-
],
4+
fieldsets: [
5+
{
6+
id: 'general',
7+
title: 'General',
8+
fields: ['url'],
9+
},
10+
],
1211

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,
31-
},
32-
url: {
33-
title: 'Url',
34-
type: 'textarea',
35-
},
12+
properties: {
13+
url: {
14+
title: 'Url',
15+
type: 'textarea',
3616
},
37-
required: ['url', 'version'],
38-
};
17+
},
18+
required: ['url'],
3919
};
4020

4121
const optionsSchema = {
@@ -186,7 +166,7 @@ export default (config) => {
186166
schemas: [
187167
{
188168
id: 'general',
189-
schema: generalSchema(config),
169+
schema: generalSchema,
190170
},
191171
{
192172
id: 'options',

0 commit comments

Comments
 (0)