mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
Allow user update slice title in visualize flow (#3466)
* 1. after user make sql query and visualize, allow user click title to update slice title, and create a new slice at the same time. 2. don't save new title if it is empty. Will still show old title. * change saveSlice call response and update explore view
This commit is contained in:
committed by
Maxime Beauchemin
parent
5718d6bbaf
commit
3949d39478
@@ -153,15 +153,22 @@ class ChartContainer extends React.PureComponent {
|
||||
this.props.actions.runQuery(this.props.formData, true, this.props.timeout);
|
||||
}
|
||||
|
||||
updateChartTitle(newTitle) {
|
||||
updateChartTitleOrSaveSlice(newTitle) {
|
||||
const isNewSlice = !this.props.slice;
|
||||
const params = {
|
||||
slice_name: newTitle,
|
||||
action: 'overwrite',
|
||||
action: isNewSlice ? 'saveas' : 'overwrite',
|
||||
};
|
||||
const saveUrl = getExploreUrl(this.props.formData, 'base', false, null, params);
|
||||
this.props.actions.saveSlice(saveUrl)
|
||||
.then(() => {
|
||||
this.props.actions.updateChartTitle(newTitle);
|
||||
.then((data) => {
|
||||
if (isNewSlice) {
|
||||
this.props.actions.createNewSlice(
|
||||
data.can_add, data.can_download, data.can_overwrite,
|
||||
data.slice, data.form_data);
|
||||
} else {
|
||||
this.props.actions.updateChartTitle(newTitle);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -263,8 +270,8 @@ class ChartContainer extends React.PureComponent {
|
||||
>
|
||||
<EditableTitle
|
||||
title={this.renderChartTitle()}
|
||||
canEdit={this.props.can_overwrite}
|
||||
onSaveTitle={this.updateChartTitle.bind(this)}
|
||||
canEdit={!this.props.slice || this.props.can_overwrite}
|
||||
onSaveTitle={this.updateChartTitleOrSaveSlice.bind(this)}
|
||||
/>
|
||||
|
||||
{this.props.slice &&
|
||||
|
||||
Reference in New Issue
Block a user