mirror of
https://github.com/apache/superset.git
synced 2026-04-21 17:14:57 +00:00
chore: Remove actions prop and refactor code in SQL Lab (#22231)
This commit is contained in:
@@ -30,14 +30,9 @@ import {
|
||||
SQL_TOOLBAR_HEIGHT,
|
||||
} from 'src/SqlLab/constants';
|
||||
import AceEditorWrapper from 'src/SqlLab/components/AceEditorWrapper';
|
||||
import ConnectedSouthPane from 'src/SqlLab/components/SouthPane/state';
|
||||
import SouthPane from 'src/SqlLab/components/SouthPane';
|
||||
import SqlEditor from 'src/SqlLab/components/SqlEditor';
|
||||
import QueryProvider from 'src/views/QueryProvider';
|
||||
import {
|
||||
queryEditorSetFunctionNames,
|
||||
queryEditorSetSelectedText,
|
||||
queryEditorSetSchemaOptions,
|
||||
} from 'src/SqlLab/actions/sqlLab';
|
||||
import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
|
||||
import {
|
||||
initialState,
|
||||
@@ -97,13 +92,6 @@ const setup = (props = {}, store) =>
|
||||
|
||||
describe('SqlEditor', () => {
|
||||
const mockedProps = {
|
||||
actions: {
|
||||
queryEditorSetFunctionNames,
|
||||
queryEditorSetSelectedText,
|
||||
queryEditorSetSchemaOptions,
|
||||
addDangerToast: jest.fn(),
|
||||
removeDataPreview: jest.fn(),
|
||||
},
|
||||
queryEditor: initialState.sqlLab.queryEditors[0],
|
||||
latestQuery: queries[0],
|
||||
tables: [table],
|
||||
@@ -238,7 +226,7 @@ describe('SqlEditor', () => {
|
||||
await waitForComponentToPaint(wrapper);
|
||||
const totalSize =
|
||||
parseFloat(wrapper.find(AceEditorWrapper).props().height) +
|
||||
wrapper.find(ConnectedSouthPane).props().height +
|
||||
wrapper.find(SouthPane).props().height +
|
||||
SQL_TOOLBAR_HEIGHT +
|
||||
SQL_EDITOR_GUTTER_MARGIN * 2 +
|
||||
SQL_EDITOR_GUTTER_HEIGHT;
|
||||
@@ -252,7 +240,7 @@ describe('SqlEditor', () => {
|
||||
await waitForComponentToPaint(wrapper);
|
||||
const totalSize =
|
||||
parseFloat(wrapper.find(AceEditorWrapper).props().height) +
|
||||
wrapper.find(ConnectedSouthPane).props().height +
|
||||
wrapper.find(SouthPane).props().height +
|
||||
SQL_TOOLBAR_HEIGHT +
|
||||
SQL_EDITOR_GUTTER_MARGIN * 2 +
|
||||
SQL_EDITOR_GUTTER_HEIGHT;
|
||||
|
||||
@@ -76,7 +76,7 @@ import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
|
||||
import { EmptyStateBig } from 'src/components/EmptyState';
|
||||
import { isEmpty } from 'lodash';
|
||||
import TemplateParamsEditor from '../TemplateParamsEditor';
|
||||
import ConnectedSouthPane from '../SouthPane/state';
|
||||
import SouthPane from '../SouthPane';
|
||||
import SaveQuery from '../SaveQuery';
|
||||
import ScheduleQueryButton from '../ScheduleQueryButton';
|
||||
import EstimateQueryCostButton from '../EstimateQueryCostButton';
|
||||
@@ -135,7 +135,6 @@ const StyledSidebar = styled.div`
|
||||
`;
|
||||
|
||||
const propTypes = {
|
||||
actions: PropTypes.object.isRequired,
|
||||
tables: PropTypes.array.isRequired,
|
||||
queryEditor: PropTypes.object.isRequired,
|
||||
defaultQueryLimit: PropTypes.number.isRequired,
|
||||
@@ -146,7 +145,6 @@ const propTypes = {
|
||||
};
|
||||
|
||||
const SqlEditor = ({
|
||||
actions,
|
||||
tables,
|
||||
queryEditor,
|
||||
defaultQueryLimit,
|
||||
@@ -617,10 +615,9 @@ const SqlEditor = ({
|
||||
/>
|
||||
{renderEditorBottomBar(hotkeys)}
|
||||
</div>
|
||||
<ConnectedSouthPane
|
||||
<SouthPane
|
||||
queryEditorId={queryEditor.id}
|
||||
latestQueryId={latestQuery?.id}
|
||||
actions={actions}
|
||||
height={southPaneHeight}
|
||||
displayLimit={displayLimit}
|
||||
defaultQueryLimit={defaultQueryLimit}
|
||||
|
||||
Reference in New Issue
Block a user