Skip to content

Commit 033ba2c

Browse files
eevemistercrunch
authored andcommitted
Improve the chart type of Visualize in sqllab (#3241)
* Improve the chart type of Visualize in sqllab & Add some css & Fix the link address in the navbar * add vizTypes filter
1 parent cc36428 commit 033ba2c

File tree

4 files changed

+36
-8
lines changed

4 files changed

+36
-8
lines changed

superset/assets/javascripts/SqlLab/components/VisualizeModal.jsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@ import { getExploreUrl } from '../../explore/exploreUtils';
1313
import * as actions from '../actions';
1414
import { VISUALIZE_VALIDATION_ERRORS } from '../constants';
1515
import { QUERY_TIMEOUT_THRESHOLD } from '../../constants';
16+
import visTypes from '../../explore/stores/visTypes';
1617

17-
const CHART_TYPES = [
18-
{ value: 'dist_bar', label: 'Distribution - Bar Chart', requiresTime: false },
19-
{ value: 'pie', label: 'Pie Chart', requiresTime: false },
20-
{ value: 'line', label: 'Time Series - Line Chart', requiresTime: true },
21-
{ value: 'bar', label: 'Time Series - Bar Chart', requiresTime: true },
22-
];
18+
const CHART_TYPES = Object.keys(visTypes)
19+
.filter(typeName => !!visTypes[typeName].showOnExplore)
20+
.map((typeName) => {
21+
const vis = visTypes[typeName];
22+
return {
23+
value: typeName,
24+
label: vis.label,
25+
requiresTime: !!vis.requiresTime,
26+
};
27+
});
2328

2429
const propTypes = {
2530
actions: PropTypes.object.isRequired,

superset/assets/javascripts/explore/stores/visTypes.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export const sections = {
7878
export const visTypes = {
7979
dist_bar: {
8080
label: 'Distribution - Bar Chart',
81+
showOnExplore: true,
8182
controlPanelSections: [
8283
{
8384
label: 'Chart Options',
@@ -108,6 +109,7 @@ export const visTypes = {
108109

109110
pie: {
110111
label: 'Pie Chart',
112+
showOnExplore: true,
111113
controlPanelSections: [
112114
{
113115
label: null,
@@ -124,6 +126,7 @@ export const visTypes = {
124126

125127
line: {
126128
label: 'Time Series - Line Chart',
129+
showOnExplore: true,
127130
requiresTime: true,
128131
controlPanelSections: [
129132
sections.NVD3TimeSeries[0],
@@ -194,6 +197,7 @@ export const visTypes = {
194197

195198
bar: {
196199
label: 'Time Series - Bar Chart',
200+
showOnExplore: true,
197201
requiresTime: true,
198202
controlPanelSections: [
199203
sections.NVD3TimeSeries[0],

superset/assets/stylesheets/superset.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,22 @@ div.widget .slice_container {
237237
.Select-menu-outer {
238238
z-index: 10 !important;
239239
}
240+
241+
/** not found record **/
242+
.panel b {
243+
display: inline-block;
244+
width: 98%;
245+
padding: 2rem;
246+
margin: 0 1% 20px 1%;
247+
background: #f8f8f8;
248+
}
249+
250+
/** table on both sides of the gap **/
251+
.panel .table-responsive{
252+
margin: 0 1%;
253+
}
254+
@media screen and (max-width: 767px) {
255+
.panel .table-responsive{
256+
width: 98%;
257+
}
258+
}

superset/templates/appbuilder/navbar.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
</a>
3535
</li>
3636
<li>
37-
<a href="https://github.com/airbnb/superset" title="Superset's Github">
37+
<a href="https://github.com/apache/incubator-superset" title="Superset's Github">
3838
<i class="fa fa-github"></i> &nbsp;
3939
</a>
4040
</li>
4141
<li>
42-
<a href="http://airbnb.io/superset" title="Documentation">
42+
<a href="https://superset.incubator.apache.org" title="Documentation">
4343
<i class="fa fa-book"></i> &nbsp;
4444
</a>
4545
</li>

0 commit comments

Comments
 (0)