mirror of https://github.com/apache/superset.git
fix(explore): CUSTOM SQL tab should automatically update (#14194)
* fix(explore): CUSTOM SQL tab should automatically update * fix(explore): CUSTOM SQL tab should automatically update * fix: lint * fix(explore): default value Co-authored-by: Yongjie Zhao <yongjiezhao@apache.org> Co-authored-by: liuyaozong <liuyaozong@baijiahulian.com> Co-authored-by: stephenLYZ <vueact@gmail.com> Co-authored-by: Yongjie Zhao <yongjiezhao@apache.org>
This commit is contained in:
parent
0dfb32cf08
commit
852e840575
|
@ -64,11 +64,13 @@ export default class AdhocFilterEditPopover extends React.Component {
|
||||||
this.onMouseUp = this.onMouseUp.bind(this);
|
this.onMouseUp = this.onMouseUp.bind(this);
|
||||||
this.onAdhocFilterChange = this.onAdhocFilterChange.bind(this);
|
this.onAdhocFilterChange = this.onAdhocFilterChange.bind(this);
|
||||||
this.adjustHeight = this.adjustHeight.bind(this);
|
this.adjustHeight = this.adjustHeight.bind(this);
|
||||||
|
this.onTabChange = this.onTabChange.bind(this);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
adhocFilter: this.props.adhocFilter,
|
adhocFilter: this.props.adhocFilter,
|
||||||
width: startingWidth,
|
width: startingWidth,
|
||||||
height: startingHeight,
|
height: startingHeight,
|
||||||
|
activeKey: this.props?.adhocFilter?.expressionType || 'SIMPLE',
|
||||||
};
|
};
|
||||||
|
|
||||||
this.popoverContentRef = React.createRef();
|
this.popoverContentRef = React.createRef();
|
||||||
|
@ -118,6 +120,12 @@ export default class AdhocFilterEditPopover extends React.Component {
|
||||||
document.removeEventListener('mousemove', this.onMouseMove);
|
document.removeEventListener('mousemove', this.onMouseMove);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onTabChange(activeKey) {
|
||||||
|
this.setState({
|
||||||
|
activeKey,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
adjustHeight(heightDifference) {
|
adjustHeight(heightDifference) {
|
||||||
this.setState(state => ({ height: state.height + heightDifference }));
|
this.setState(state => ({ height: state.height + heightDifference }));
|
||||||
}
|
}
|
||||||
|
@ -154,6 +162,7 @@ export default class AdhocFilterEditPopover extends React.Component {
|
||||||
data-test="adhoc-filter-edit-tabs"
|
data-test="adhoc-filter-edit-tabs"
|
||||||
style={{ minHeight: this.state.height, width: this.state.width }}
|
style={{ minHeight: this.state.height, width: this.state.width }}
|
||||||
allowOverflow
|
allowOverflow
|
||||||
|
onChange={this.onTabChange}
|
||||||
>
|
>
|
||||||
<Tabs.TabPane
|
<Tabs.TabPane
|
||||||
className="adhoc-filter-edit-tab"
|
className="adhoc-filter-edit-tab"
|
||||||
|
@ -185,6 +194,7 @@ export default class AdhocFilterEditPopover extends React.Component {
|
||||||
onChange={this.onAdhocFilterChange}
|
onChange={this.onAdhocFilterChange}
|
||||||
options={this.props.options}
|
options={this.props.options}
|
||||||
height={this.state.height}
|
height={this.state.height}
|
||||||
|
activeKey={this.state.activeKey}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="custom-sql-disabled-message">
|
<div className="custom-sql-disabled-message">
|
||||||
|
|
|
@ -42,6 +42,7 @@ const propTypes = {
|
||||||
]),
|
]),
|
||||||
).isRequired,
|
).isRequired,
|
||||||
height: PropTypes.number.isRequired,
|
height: PropTypes.number.isRequired,
|
||||||
|
activeKey: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class AdhocFilterEditPopoverSqlTabContent extends React.Component {
|
export default class AdhocFilterEditPopoverSqlTabContent extends React.Component {
|
||||||
|
|
Loading…
Reference in New Issue