You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2020/12/14 22:28:19 UTC
[incubator-superset] 01/02: save toggle for autocomplete and poc
menu
This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch hxgh/ch231/overflow-action-menu
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
commit a15e2dc5f4e58bcc7403928d800cb661649b3ed1
Author: hughhhh <hu...@gmail.com>
AuthorDate: Mon Dec 14 17:20:14 2020 -0500
save toggle for autocomplete and poc menu
---
.../src/SqlLab/components/SqlEditor.jsx | 31 ++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/superset-frontend/src/SqlLab/components/SqlEditor.jsx b/superset-frontend/src/SqlLab/components/SqlEditor.jsx
index 044fee8..1760dbd 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditor.jsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditor.jsx
@@ -51,6 +51,9 @@ import RunQueryActionButton from './RunQueryActionButton';
import { FeatureFlag, isFeatureEnabled } from '../../featureFlags';
import { CtasEnum } from '../actions/sqlLab';
+import { Menu, Dropdown, message, Space, Switch } from 'antd';
+import Icon from 'src/components/Icon';
+
const SQL_EDITOR_PADDING = 10;
const INITIAL_NORTH_PERCENT = 30;
const INITIAL_SOUTH_PERCENT = 70;
@@ -121,6 +124,9 @@ class SqlEditor extends React.PureComponent {
this.handleWindowResize.bind(this),
WINDOW_RESIZE_THROTTLE_MS,
);
+
+ this.handleMenuClick = this.handleMenuClick.bind(this);
+ this.renderDropdown = this.renderDropdown.bind(this);
}
UNSAFE_componentWillMount() {
@@ -405,6 +411,28 @@ class SqlEditor extends React.PureComponent {
);
}
+ handleMenuClick() {
+ console.log('pressed a menu item');
+ }
+
+ renderDropdown() {
+ const menu = (
+ <Menu onClick={this.handleMenuClick}>
+ <Menu.Item>
+ {' '}
+ Autocomplete{' '}
+ <Switch
+ checked={this.state.autocompleteEnabled}
+ onChange={this.handleToggleAutocompleteEnabled}
+ />{' '}
+ </Menu.Item>
+ <Menu.Item>Set Parameters</Menu.Item>
+ <Menu.Item>Schedule Run</Menu.Item>
+ </Menu>
+ );
+ return menu;
+ }
+
renderEditorBottomBar(hotkeys) {
let ctasControls;
if (
@@ -558,6 +586,9 @@ class SqlEditor extends React.PureComponent {
</Form>
</div>
<div className="rightItems">
+ <Dropdown overlay={this.renderDropdown()} arrow>
+ <Icon name="more-horiz" />
+ </Dropdown>
<Button
data-test="autocomplete"
buttonSize="small"