mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
[explore-v2] fix errors on table view (#1675)
* render table name if in table view * only render fave star and edit button if slice, not table * fix error when table view * use [table-name] - untitled format * remove extra fave star
This commit is contained in:
parent
18c43aaea2
commit
56b917a5c2
@ -25,6 +25,7 @@ const propTypes = {
|
||||
isChartLoading: PropTypes.bool,
|
||||
isStarred: PropTypes.bool.isRequired,
|
||||
alert: PropTypes.string,
|
||||
table_name: PropTypes.string,
|
||||
};
|
||||
|
||||
class ChartContainer extends React.Component {
|
||||
@ -133,6 +134,16 @@ class ChartContainer extends React.Component {
|
||||
visMap[this.props.viz_type](this.state.mockSlice).render();
|
||||
}
|
||||
|
||||
renderChartTitle() {
|
||||
let title;
|
||||
if (this.props.slice_name) {
|
||||
title = this.props.slice_name;
|
||||
} else {
|
||||
title = `[${this.props.table_name}] - untitled`;
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="chart-container">
|
||||
@ -143,27 +154,29 @@ class ChartContainer extends React.Component {
|
||||
id="slice-header"
|
||||
className="clearfix panel-title-large"
|
||||
>
|
||||
<div className="pull-left">
|
||||
{this.props.slice_name}
|
||||
{this.renderChartTitle()}
|
||||
|
||||
<FaveStar
|
||||
sliceId={this.props.slice_id}
|
||||
actions={this.props.actions}
|
||||
isStarred={this.props.isStarred}
|
||||
/>
|
||||
{this.props.slice_id &&
|
||||
<span>
|
||||
<FaveStar
|
||||
sliceId={this.props.slice_id}
|
||||
actions={this.props.actions}
|
||||
isStarred={this.props.isStarred}
|
||||
/>
|
||||
|
||||
<TooltipWrapper
|
||||
label="edit-desc"
|
||||
tooltip="Edit Description"
|
||||
>
|
||||
<a
|
||||
className="edit-desc-icon"
|
||||
href={`/slicemodelview/edit/${this.props.slice_id}`}
|
||||
<TooltipWrapper
|
||||
label="edit-desc"
|
||||
tooltip="Edit Description"
|
||||
>
|
||||
<i className="fa fa-edit" />
|
||||
</a>
|
||||
</TooltipWrapper>
|
||||
</div>
|
||||
<a
|
||||
className="edit-desc-icon"
|
||||
href={`/slicemodelview/edit/${this.props.slice_id}`}
|
||||
>
|
||||
<i className="fa fa-edit" />
|
||||
</a>
|
||||
</TooltipWrapper>
|
||||
</span>
|
||||
}
|
||||
|
||||
<div className="pull-right">
|
||||
<ExploreActionButtons
|
||||
@ -217,6 +230,7 @@ function mapStateToProps(state) {
|
||||
isChartLoading: state.isChartLoading,
|
||||
isStarred: state.isStarred,
|
||||
alert: state.chartAlert,
|
||||
table_name: state.viz.form_data.datasource_name,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
{% extends "superset/basic.html" %}
|
||||
|
||||
{% block title %}
|
||||
{% if slice_name %}
|
||||
[slice] {{ slice_name }}
|
||||
{% if slc %}
|
||||
[slice] {{ slc.slice_name }}
|
||||
{% else %}
|
||||
[explore] {{ table_name }}
|
||||
{% endif %}
|
||||
|
@ -1454,7 +1454,7 @@ class Superset(BaseSupersetView):
|
||||
return self.render_template(
|
||||
"superset/explorev2.html",
|
||||
bootstrap_data=json.dumps(bootstrap_data),
|
||||
slice_name=slc.slice_name,
|
||||
slice=slc,
|
||||
table_name=viz_obj.datasource.table_name)
|
||||
else:
|
||||
return self.render_template(
|
||||
|
Loading…
Reference in New Issue
Block a user