Skip to content

Commit 1ebad13

Browse files
Merge pull request #694 from contactashish13/issue-691
Gutenberg: Make UI more intuitive when a chart is missing
2 parents 843e95b + ad2fd91 commit 1ebad13

File tree

6 files changed

+64
-8
lines changed

6 files changed

+64
-8
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11

2+
### v3.4.3 - 2020-05-04
3+
**Changes:**
4+
* [Feat] Improved chart creation UX
5+
* [Feat] New option to control the number of charts per page in the Charts Library
6+
* [Feat] New option for filtering/ordering charts in the Charts Library
7+
* [Feat] Support for custom codes for the boolean data type in Table charts
8+
* [Fix] Support for displaying apostrophes in charts
9+
* [Fix] Visualizer button layout in the Classic block
10+
* [Fix] Bulk activation of plugin aborts activation of subsequent plugins
11+
212
### v3.4.2 - 2020-02-17
313
**Changes:**
414
* New Cypress tests for the Gutenberg block

classes/Visualizer/Gutenberg/build/block.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

classes/Visualizer/Gutenberg/src/Editor.js

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const {
2929
ButtonGroup,
3030
Dashicon,
3131
Placeholder,
32+
Notice,
3233
Spinner
3334
} = wp.components;
3435

@@ -78,11 +79,20 @@ class Editor extends Component {
7879

7980
// Fetch review again if block loaded after saving.
8081
if ( this.props.attributes.id ) {
81-
let result = await apiFetch({ path: `wp/v2/visualizer/${this.props.attributes.id}` });
82-
83-
this.setState({
84-
chart: result['chart_data']
85-
});
82+
let result = await apiFetch({ path: `wp/v2/visualizer/${this.props.attributes.id}` }).catch( function( error ) {
83+
});
84+
85+
if ( result ) {
86+
this.setState({
87+
chart: result['chart_data']
88+
});
89+
} else {
90+
91+
// if the chart is not found.
92+
this.setState({
93+
route: 'error'
94+
});
95+
}
8696
}
8797
}
8898

@@ -92,6 +102,7 @@ class Editor extends Component {
92102
});
93103

94104
let result = await apiFetch({ path: `wp/v2/visualizer/${id}` });
105+
console.log( 'getChart', id, result );
95106

96107
this.setState({
97108
route: 'chartSelect',
@@ -297,6 +308,7 @@ class Editor extends Component {
297308
});
298309

299310
let result = await apiFetch({ path: `wp/v2/visualizer/${id}` });
311+
console.log( 'getChartData', id, result );
300312

301313
let chart = { ...this.state.chart };
302314

@@ -406,6 +418,18 @@ class Editor extends Component {
406418
}
407419

408420
render() {
421+
if ( 'error' === this.state.route ) {
422+
return (
423+
<Notice
424+
status="error"
425+
isDismissible={ false }
426+
>
427+
<Dashicon icon="chart-pie" />
428+
{ __( 'This chart is not available; it might have been deleted. Please delete this block and resubmit your chart.' ) }
429+
</Notice>
430+
);
431+
}
432+
409433
if ( 'renderChart' === this.state.route && null !== this.state.chart ) {
410434
return (
411435
<ChartRender

readme.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,17 @@ Pay attention that to turn your shortcodes into graphs, your theme has to have `
162162
13. Bar chart
163163

164164
## Changelog ##
165+
### 3.4.3 - 2020-05-04 ###
166+
167+
* [Feat] Improved chart creation UX
168+
* [Feat] New option to control the number of charts per page in the Charts Library
169+
* [Feat] New option for filtering/ordering charts in the Charts Library
170+
* [Feat] Support for custom codes for the boolean data type in Table charts
171+
* [Fix] Support for displaying apostrophes in charts
172+
* [Fix] Visualizer button layout in the Classic block
173+
* [Fix] Bulk activation of plugin aborts activation of subsequent plugins
174+
175+
165176
### 3.4.2 - 2020-02-17 ###
166177

167178
* New Cypress tests for the Gutenberg block
@@ -542,4 +553,4 @@ Pay attention that to turn your shortcodes into graphs, your theme has to have `
542553
* The bug with CSV file uploading was fixed.
543554

544555
### 1.0.0 ###
545-
* The first version of what wil be the best wp charts plugin.
556+
* The first version of what wil be the best wp charts plugin.

readme.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,17 @@ Pay attention that to turn your shortcodes into graphs, your theme has to have `
162162
13. Bar chart
163163

164164
== Changelog ==
165+
= 3.4.3 - 2020-05-04 =
166+
167+
* [Feat] Improved chart creation UX
168+
* [Feat] New option to control the number of charts per page in the Charts Library
169+
* [Feat] New option for filtering/ordering charts in the Charts Library
170+
* [Feat] Support for custom codes for the boolean data type in Table charts
171+
* [Fix] Support for displaying apostrophes in charts
172+
* [Fix] Visualizer button layout in the Classic block
173+
* [Fix] Bulk activation of plugin aborts activation of subsequent plugins
174+
175+
165176
= 3.4.2 - 2020-02-17 =
166177

167178
* New Cypress tests for the Gutenberg block

themeisle-hash.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"index.php":"1c0c5ae1729bc8087c5c2bef281bd2e6"}
1+
{"index.php":"2701e13e479319c5fdcf252bd9f44f77"}

0 commit comments

Comments
 (0)