mirror of https://github.com/apache/superset.git
[Dashboard] Hide slice titles when they're empty (#8018)
This commit is contained in:
parent
5375745193
commit
0754f294e9
|
@ -84,6 +84,8 @@ export default class EditableTitle extends React.PureComponent {
|
|||
}
|
||||
|
||||
handleBlur() {
|
||||
const title = this.state.title.trim();
|
||||
|
||||
if (!this.props.canEdit) {
|
||||
return;
|
||||
}
|
||||
|
@ -92,7 +94,7 @@ export default class EditableTitle extends React.PureComponent {
|
|||
isEditing: false,
|
||||
});
|
||||
|
||||
if (!this.state.title.length) {
|
||||
if (!title.length) {
|
||||
this.setState({
|
||||
title: this.state.lastTitle,
|
||||
});
|
||||
|
@ -100,14 +102,14 @@ export default class EditableTitle extends React.PureComponent {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.state.lastTitle !== this.state.title) {
|
||||
if (this.state.lastTitle !== title) {
|
||||
this.setState({
|
||||
lastTitle: this.state.title,
|
||||
lastTitle: title,
|
||||
});
|
||||
}
|
||||
|
||||
if (this.props.title !== this.state.title) {
|
||||
this.props.onSaveTitle(this.state.title);
|
||||
if (this.props.title !== title) {
|
||||
this.props.onSaveTitle(title);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@ class SliceHeader extends React.PureComponent {
|
|||
: '')
|
||||
}
|
||||
canEdit={editMode}
|
||||
emptyText=""
|
||||
onSaveTitle={updateSliceName}
|
||||
showTooltip={false}
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue