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() {
|
handleBlur() {
|
||||||
|
const title = this.state.title.trim();
|
||||||
|
|
||||||
if (!this.props.canEdit) {
|
if (!this.props.canEdit) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +94,7 @@ export default class EditableTitle extends React.PureComponent {
|
||||||
isEditing: false,
|
isEditing: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.state.title.length) {
|
if (!title.length) {
|
||||||
this.setState({
|
this.setState({
|
||||||
title: this.state.lastTitle,
|
title: this.state.lastTitle,
|
||||||
});
|
});
|
||||||
|
@ -100,14 +102,14 @@ export default class EditableTitle extends React.PureComponent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.lastTitle !== this.state.title) {
|
if (this.state.lastTitle !== title) {
|
||||||
this.setState({
|
this.setState({
|
||||||
lastTitle: this.state.title,
|
lastTitle: title,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.title !== this.state.title) {
|
if (this.props.title !== title) {
|
||||||
this.props.onSaveTitle(this.state.title);
|
this.props.onSaveTitle(title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ class SliceHeader extends React.PureComponent {
|
||||||
: '')
|
: '')
|
||||||
}
|
}
|
||||||
canEdit={editMode}
|
canEdit={editMode}
|
||||||
|
emptyText=""
|
||||||
onSaveTitle={updateSliceName}
|
onSaveTitle={updateSliceName}
|
||||||
showTooltip={false}
|
showTooltip={false}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue