EugeneTorap commented on a change in pull request #18148: URL: https://github.com/apache/superset/pull/18148#discussion_r791076337
########## File path: superset-frontend/src/SqlLab/components/SqlEditor/index.tsx ########## @@ -0,0 +1,742 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React, { FC, useState, useEffect, useRef } from 'react'; +import { CSSTransition } from 'react-transition-group'; +import { useDispatch, useSelector } from 'react-redux'; +import Split from 'react-split'; +import { t, styled, useTheme } from '@superset-ui/core'; +import debounce from 'lodash/debounce'; +import throttle from 'lodash/throttle'; +import StyledModal from 'src/components/Modal'; +import Mousetrap from 'mousetrap'; +import Button from 'src/components/Button'; +import Timer from 'src/components/Timer'; +import { + Dropdown, + Menu as AntdMenu, + Menu, + Switch, + Input, +} from 'src/common/components'; +import { DatabaseObject } from 'src/components/DatabaseSelector'; +import { QueryEditor, Query } from 'src/SqlLab/types'; +import Icons from 'src/components/Icons'; +import { detectOS } from 'src/utils/common'; +import { + addQueryEditor, + CtasEnum, + estimateQueryCost, + persistEditorHeight, + postStopQuery, + queryEditorSetAutorun, + queryEditorSetQueryLimit, + queryEditorSetSql, + queryEditorSetTemplateParams, + runQuery, + saveQuery, + addSavedQueryToTabState, + scheduleQuery, + setActiveSouthPaneTab, + updateSavedQuery, + validateQuery, +} from 'src/SqlLab/actions/sqlLab'; +import { + STATE_TYPE_MAP, + SQL_EDITOR_GUTTER_HEIGHT, + SQL_EDITOR_GUTTER_MARGIN, + SQL_TOOLBAR_HEIGHT, +} from 'src/SqlLab/constants'; +import { + getItem, + LocalStorageKeys, + setItem, +} from 'src/utils/localStorageHelpers'; +import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; +import rootReducer from 'src/SqlLab/reducers'; +import TemplateParamsEditor from '../TemplateParamsEditor'; +import ConnectedSouthPane from '../SouthPane/state'; +import SaveQuery from '../SaveQuery'; +import ScheduleQueryButton from '../ScheduleQueryButton'; +import EstimateQueryCostButton from '../EstimateQueryCostButton'; +import ShareSqlLabQuery from '../ShareSqlLabQuery'; +import SqlEditorLeftBar from '../SqlEditorLeftBar'; +import AceEditorWrapper from '../AceEditorWrapper'; +import RunQueryActionButton from '../RunQueryActionButton'; + +type RootState = ReturnType<typeof rootReducer>; + +const LIMIT_DROPDOWN = [10, 100, 1000, 10000, 100000]; +const SQL_EDITOR_PADDING = 10; +const INITIAL_NORTH_PERCENT = 30; +const INITIAL_SOUTH_PERCENT = 70; +const SET_QUERY_EDITOR_SQL_DEBOUNCE_MS = 2000; +const VALIDATION_DEBOUNCE_MS = 600; +const WINDOW_RESIZE_THROTTLE_MS = 100; + +const appContainer = document.getElementById('app'); +const bootstrapData = JSON.parse( + appContainer.getAttribute('data-bootstrap') || '{}', +); +const validatorMap = + bootstrapData?.common?.conf?.SQL_VALIDATORS_BY_ENGINE || {}; +const scheduledQueriesConf = bootstrapData?.common?.conf?.SCHEDULED_QUERIES; + +interface SqlEditorProps { + actions: object; + database?: DatabaseObject; + latestQuery?: Query; + tables: any[]; + editorQueries: QueryEditor[]; + dataPreviewQueries: object[]; + queryEditorId: string; + hideLeftBar?: boolean; + defaultQueryLimit: number; + maxRow: number; + displayLimit: number; + saveQueryWarning?: string; + scheduleQueryWarning?: string; Review comment: @geido Do we have interface for all sqlLab `actions` & `dataPreviewQueries`? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org