Skip to content

Commit

Permalink
Merge branch 'master' into byolken/support_pex
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Yolken committed Dec 1, 2016
2 parents 31c66a7 + 2d0ebea commit 4eaeac4
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 32 deletions.
47 changes: 27 additions & 20 deletions superset/assets/javascripts/explorev2/components/ChartContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,32 @@ class ChartContainer extends React.Component {
return title;
}

renderChart() {
if (this.props.alert) {
return (
<Alert bsStyle="warning">
{this.props.alert}
<i
className="fa fa-close pull-right"
onClick={this.removeAlert.bind(this)}
style={{ cursor: 'pointer' }}
/>
</Alert>
);
}
if (this.props.isChartLoading) {
return (<img alt="loading" width="25" src="/static/assets/images/loading.gif" />);
}
return (
<div
id={this.props.containerId}
ref={(ref) => { this.chartContainerRef = ref; }}
className={this.props.viz_type}
style={{ 'overflow-x': 'scroll' }}
/>
);
}

render() {
return (
<div className="chart-container">
Expand Down Expand Up @@ -187,26 +213,7 @@ class ChartContainer extends React.Component {
</div>
}
>
{this.props.alert &&
<Alert bsStyle="warning">
{this.props.alert}
<i
className="fa fa-close pull-right"
onClick={this.removeAlert.bind(this)}
style={{ cursor: 'pointer' }}
/>
</Alert>
}
{this.props.isChartLoading ?
(<img alt="loading" width="25" src="/static/assets/images/loading.gif" />)
:
(<div
id={this.props.containerId}
ref={(ref) => { this.chartContainerRef = ref; }}
className={this.props.viz_type}
style={{ 'overflow-x': 'scroll' }}
/>)
}
{this.renderChart()}
</Panel>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ class ExploreViewContainer extends React.Component {
}

componentWillReceiveProps(nextProps) {
let refreshChart = false;
autoQueryFields.forEach((field) => {
if (nextProps.form_data[field] !== this.props.form_data[field]) {
refreshChart = true;
}
});
const refreshChart = Object.keys(nextProps.form_data).some((field) => (
nextProps.form_data[field] !== this.props.form_data[field]
&& autoQueryFields.indexOf(field) !== -1)
);
if (refreshChart) {
this.onQuery(nextProps.form_data);
}
Expand Down
23 changes: 23 additions & 0 deletions superset/assets/javascripts/explorev2/stores/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1748,4 +1748,27 @@ export function initialState(vizType = 'table', datasourceType = 'table') {
export const autoQueryFields = [
'datasource',
'viz_type',
'bar_stacked',
'show_markers',
'show_bar_value',
'order_bars',
'show_controls',
'reduce_x_ticks',
'include_series',
'pie_label_type',
'show_brush',
'include_search',
'show_bubbles',
'show_legend',
'x_axis_showminmax',
'rich_tooltip',
'y_axis_zero',
'y_log_scale',
'x_log_scale',
'donut',
'labels_outside',
'contribution',
'size',
'row_limit',
'max_bubble_size',
];
13 changes: 8 additions & 5 deletions superset/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,8 @@ def __repr__(self):

@property
def table_names(self):
return ", ".join({"{}".format(s.datasource) for s in self.slices})
return ", ".join(
{"{}".format(s.datasource.name) for s in self.slices})

@property
def url(self):
Expand Down Expand Up @@ -896,17 +897,17 @@ class SqlaTable(Model, Queryable, AuditMixinNullable, ImportMixin):
name='_customer_location_uc'),)

def __repr__(self):
return self.table_name
return self.name

@property
def description_markeddown(self):
return utils.markdown(self.description)

@property
def link(self):
table_name = escape(self.table_name)
name = escape(self.name)
return Markup(
'<a href="{self.explore_url}">{table_name}</a>'.format(**locals()))
'<a href="{self.explore_url}">{name}</a>'.format(**locals()))

@property
def schema_perm(self):
Expand All @@ -920,7 +921,9 @@ def get_perm(self):

@property
def name(self):
return self.table_name
if not self.schema:
return self.table_name
return "{}.{}".format(self.schema, self.table_name)

@property
def full_name(self):
Expand Down
2 changes: 1 addition & 1 deletion superset/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ def pre_add(self, table):
"Table [{}] could not be found, "
"please double check your "
"database connection, schema, and "
"table name".format(table.table_name))
"table name".format(table.name))

def post_add(self, table):
table.fetch_metadata()
Expand Down

0 comments on commit 4eaeac4

Please sign in to comment.