Skip to content

Commit 5193bff

Browse files
committed
Filter out Table chart
Filter out datatable chart until proper support has been added. Fixes #336
1 parent fa30eea commit 5193bff

File tree

4 files changed

+38
-31
lines changed

4 files changed

+38
-31
lines changed

classes/Visualizer/Gutenberg/build/block.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

classes/Visualizer/Gutenberg/build/handsontable.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

classes/Visualizer/Gutenberg/src/Components/Charts.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,20 @@ class Charts extends Component {
9191
title = `#${charts[i].id}`;
9292
}
9393

94-
// Format chart type for Gauge chart.
95-
if ( 0 <= [ 'gauge', 'table', 'timeline' ].indexOf( data['visualizer-chart-type']) ) {
96-
chart = startCase( data['visualizer-chart-type']);
94+
if ( 0 <= [ 'gauge', 'table', 'timeline', 'dataTable' ].indexOf( data['visualizer-chart-type']) ) {
95+
if ( 'dataTable' === data['visualizer-chart-type']) {
96+
chart = data['visualizer-chart-type'];
97+
} else {
98+
chart = startCase( data['visualizer-chart-type']);
99+
}
97100
} else {
98101
chart = `${ startCase( data['visualizer-chart-type']) }Chart`;
99102
}
100103

104+
if ( 'dataTable' === chart ) {
105+
return;
106+
}
107+
101108
return (
102109
<div className="visualizer-settings__charts-single">
103110

classes/Visualizer/Render/Layout.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static function _renderFauxEditor( $args ) {
6464
*/
6565
public static function _renderDbQuery( $args ) {
6666
$query = $args[1];
67-
?>
67+
?>
6868
<div id='visualizer-db-query' style="display: none">
6969
<div class="visualizer-db-query-form">
7070
<div>
@@ -86,7 +86,7 @@ public static function _renderDbQuery( $args ) {
8686
<div class='db-wizard-results'></div>
8787

8888
</div>
89-
<?php
89+
<?php
9090
}
9191

9292
/**
@@ -98,32 +98,32 @@ public static function _renderDbWizardResults( $args ) {
9898
$headers = $args[1];
9999
$results = $args[2];
100100
ob_start();
101-
?>
101+
?>
102102
<table cellspacing="0" width="100%" id="results">
103103
<thead>
104104
<tr>
105-
<?php
106-
foreach ( $headers as $header ) {
107-
echo '<th>' . $header['label'] . '</th>';
108-
}
109-
?>
105+
<?php
106+
foreach ( $headers as $header ) {
107+
echo '<th>' . $header['label'] . '</th>';
108+
}
109+
?>
110110
</tr>
111111
</thead>
112112
<tfoot>
113113
</tfoot>
114114
<tbody>
115-
<?php
116-
foreach ( $results as $result ) {
117-
echo '<tr>';
118-
foreach ( $result as $r ) {
119-
echo '<td>' . $r . '</td>';
115+
<?php
116+
foreach ( $results as $result ) {
117+
echo '<tr>';
118+
foreach ( $result as $r ) {
119+
echo '<td>' . $r . '</td>';
120+
}
121+
echo '</tr>';
120122
}
121-
echo '</tr>';
122-
}
123-
?>
123+
?>
124124
</tbody>
125125
</table>
126-
<?php
126+
<?php
127127
return ob_get_clean();
128128
}
129129
}

0 commit comments

Comments
 (0)