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/09 23:24:02 UTC

[incubator-superset] 01/01: setting up POC

This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch hxgh/ch235/new-limit-selector
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit f32a7be9ab5784315e0265419c67e6612c689481
Author: hughhhh <hu...@gmail.com>
AuthorDate: Wed Dec 9 15:23:14 2020 -0800

    setting up POC
---
 .../src/SqlLab/components/LimitControl.tsx         |  1 +
 .../src/SqlLab/components/SqlEditor.jsx            | 38 ++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/superset-frontend/src/SqlLab/components/LimitControl.tsx b/superset-frontend/src/SqlLab/components/LimitControl.tsx
index d771f37..5dd0f9e 100644
--- a/superset-frontend/src/SqlLab/components/LimitControl.tsx
+++ b/superset-frontend/src/SqlLab/components/LimitControl.tsx
@@ -23,6 +23,7 @@ import { t, styled } from '@superset-ui/core';
 import Popover from 'src/common/components/Popover';
 import Button from 'src/components/Button';
 import Label from 'src/components/Label';
+import Dropdown from 'src/common/components/Dropdown';
 import ControlHeader from '../../explore/components/ControlHeader';
 
 export interface LimitControlProps {
diff --git a/superset-frontend/src/SqlLab/components/SqlEditor.jsx b/superset-frontend/src/SqlLab/components/SqlEditor.jsx
index 044fee8..d003007 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditor.jsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditor.jsx
@@ -31,6 +31,7 @@ import Button from 'src/components/Button';
 import Checkbox from 'src/components/Checkbox';
 import Timer from 'src/components/Timer';
 import Hotkeys from 'src/components/Hotkeys';
+import { Dropdown, Menu as AntdMenu } from 'src/common/components';
 
 import LimitControl from './LimitControl';
 import TemplateParamsEditor from './TemplateParamsEditor';
@@ -51,6 +52,35 @@ import RunQueryActionButton from './RunQueryActionButton';
 import { FeatureFlag, isFeatureEnabled } from '../../featureFlags';
 import { CtasEnum } from '../actions/sqlLab';
 
+const menuDropdown = (
+  <AntdMenu>
+    <AntdMenu.Item>
+      <a
+        target="_blank"
+        rel="noopener noreferrer"
+        href="http://www.alipay.com/"
+      >
+        1st menu item
+      </a>
+    </AntdMenu.Item>
+    <AntdMenu.Item>
+      <a
+        target="_blank"
+        rel="noopener noreferrer"
+        href="http://www.taobao.com/"
+      >
+        2nd menu item
+      </a>
+    </AntdMenu.Item>
+    <AntdMenu.Item>
+      <a target="_blank" rel="noopener noreferrer" href="http://www.tmall.com/">
+        3rd menu item
+      </a>
+    </AntdMenu.Item>
+    <AntdMenu.Item danger>a danger item</AntdMenu.Item>
+  </AntdMenu>
+);
+
 const SQL_EDITOR_PADDING = 10;
 const INITIAL_NORTH_PERCENT = 30;
 const INITIAL_SOUTH_PERCENT = 70;
@@ -551,6 +581,14 @@ class SqlEditor extends React.PureComponent {
                 maxRow={this.props.maxRow}
                 onChange={this.setQueryLimit.bind(this)}
               />
+              <Dropdown overlay={menuDropdown}>
+                <a
+                  className="ant-dropdown-link"
+                  onClick={e => e.preventDefault()}
+                >
+                  LIMIT DROPDOWN
+                </a>
+              </Dropdown>
             </span>
             <span>
               <Hotkeys header={t('Keyboard shortcuts')} hotkeys={hotkeys} />