mirror of
https://github.com/apache/superset.git
synced 2026-04-21 00:54:44 +00:00
Re-enable rule line-between-class-members (#10862)
This commit is contained in:
committed by
GitHub
parent
91b8c8afc9
commit
e28f3d6220
@@ -128,6 +128,7 @@ class SqlEditor extends React.PureComponent {
|
||||
WINDOW_RESIZE_THROTTLE_MS,
|
||||
);
|
||||
}
|
||||
|
||||
UNSAFE_componentWillMount() {
|
||||
if (this.state.autorun) {
|
||||
this.setState({ autorun: false });
|
||||
@@ -135,6 +136,7 @@ class SqlEditor extends React.PureComponent {
|
||||
this.startQuery();
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
// We need to measure the height of the sql editor post render to figure the height of
|
||||
// the south pane so it gets rendered properly
|
||||
@@ -143,14 +145,17 @@ class SqlEditor extends React.PureComponent {
|
||||
|
||||
window.addEventListener('resize', this.handleWindowResize);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
window.removeEventListener('resize', this.handleWindowResize);
|
||||
}
|
||||
|
||||
onResizeStart() {
|
||||
// Set the heights on the ace editor and the ace content area after drag starts
|
||||
// to smooth out the visual transition to the new heights when drag ends
|
||||
document.getElementsByClassName('ace_content')[0].style.height = '100%';
|
||||
}
|
||||
|
||||
onResizeEnd([northPercent, southPercent]) {
|
||||
this.setState({ northPercent, southPercent });
|
||||
|
||||
@@ -162,6 +167,7 @@ class SqlEditor extends React.PureComponent {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
onSqlChanged(sql) {
|
||||
this.setState({ sql });
|
||||
this.setQueryEditorSqlWithDebounce(sql);
|
||||
@@ -171,12 +177,14 @@ class SqlEditor extends React.PureComponent {
|
||||
this.requestValidation();
|
||||
}
|
||||
}
|
||||
|
||||
// One layer of abstraction for easy spying in unit tests
|
||||
getSqlEditorHeight() {
|
||||
return this.sqlEditorRef.current
|
||||
? this.sqlEditorRef.current.clientHeight - SQL_EDITOR_PADDING * 2
|
||||
: 0;
|
||||
}
|
||||
|
||||
// Return the heights for the ace editor and the south pane as an object
|
||||
// given the height of the sql editor, north pane percent and south pane percent.
|
||||
getAceEditorAndSouthPaneHeights(height, northPercent, southPercent) {
|
||||
@@ -190,6 +198,7 @@ class SqlEditor extends React.PureComponent {
|
||||
(SQL_EDITOR_GUTTER_HEIGHT / 2 + SQL_EDITOR_GUTTER_MARGIN),
|
||||
};
|
||||
}
|
||||
|
||||
getHotkeyConfig() {
|
||||
return [
|
||||
{
|
||||
@@ -224,15 +233,18 @@ class SqlEditor extends React.PureComponent {
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
setQueryEditorSql(sql) {
|
||||
this.props.actions.queryEditorSetSql(this.props.queryEditor, sql);
|
||||
}
|
||||
|
||||
setQueryLimit(queryLimit) {
|
||||
this.props.actions.queryEditorSetQueryLimit(
|
||||
this.props.queryEditor,
|
||||
queryLimit,
|
||||
);
|
||||
}
|
||||
|
||||
getQueryCostEstimate() {
|
||||
if (this.props.database) {
|
||||
const qe = this.props.queryEditor;
|
||||
@@ -246,12 +258,15 @@ class SqlEditor extends React.PureComponent {
|
||||
this.props.actions.estimateQueryCost(query);
|
||||
}
|
||||
}
|
||||
|
||||
handleToggleAutocompleteEnabled = () => {
|
||||
this.setState({ autocompleteEnabled: !this.state.autocompleteEnabled });
|
||||
};
|
||||
|
||||
handleWindowResize() {
|
||||
this.setState({ height: this.getSqlEditorHeight() });
|
||||
}
|
||||
|
||||
elementStyle(dimension, elementSize, gutterSize) {
|
||||
return {
|
||||
[dimension]: `calc(${elementSize}% - ${
|
||||
@@ -259,6 +274,7 @@ class SqlEditor extends React.PureComponent {
|
||||
}px)`,
|
||||
};
|
||||
}
|
||||
|
||||
requestValidation() {
|
||||
if (this.props.database) {
|
||||
const qe = this.props.queryEditor;
|
||||
@@ -272,6 +288,7 @@ class SqlEditor extends React.PureComponent {
|
||||
this.props.actions.validateQuery(query);
|
||||
}
|
||||
}
|
||||
|
||||
canValidateQuery() {
|
||||
// Check whether or not we can validate the current query based on whether
|
||||
// or not the backend has a validator configured for it.
|
||||
@@ -281,11 +298,13 @@ class SqlEditor extends React.PureComponent {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
runQuery() {
|
||||
if (this.props.database) {
|
||||
this.startQuery();
|
||||
}
|
||||
}
|
||||
|
||||
startQuery(ctas = false, ctas_method = CtasEnum.TABLE) {
|
||||
const qe = this.props.queryEditor;
|
||||
const query = {
|
||||
@@ -307,6 +326,7 @@ class SqlEditor extends React.PureComponent {
|
||||
this.props.actions.runQuery(query);
|
||||
this.props.actions.setActiveSouthPaneTab('Results');
|
||||
}
|
||||
|
||||
stopQuery() {
|
||||
if (
|
||||
this.props.latestQuery &&
|
||||
@@ -315,15 +335,19 @@ class SqlEditor extends React.PureComponent {
|
||||
this.props.actions.postStopQuery(this.props.latestQuery);
|
||||
}
|
||||
}
|
||||
|
||||
createTableAs() {
|
||||
this.startQuery(true, CtasEnum.TABLE);
|
||||
}
|
||||
|
||||
createViewAs() {
|
||||
this.startQuery(true, CtasEnum.VIEW);
|
||||
}
|
||||
|
||||
ctasChanged(event) {
|
||||
this.setState({ ctas: event.target.value });
|
||||
}
|
||||
|
||||
queryPane() {
|
||||
const hotkeys = this.getHotkeyConfig();
|
||||
const {
|
||||
@@ -376,6 +400,7 @@ class SqlEditor extends React.PureComponent {
|
||||
</Split>
|
||||
);
|
||||
}
|
||||
|
||||
renderEditorBottomBar(hotkeys) {
|
||||
let ctasControls;
|
||||
if (
|
||||
@@ -560,6 +585,7 @@ class SqlEditor extends React.PureComponent {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div ref={this.sqlEditorRef} className="SqlEditor">
|
||||
|
||||
Reference in New Issue
Block a user