From 561828c2f890e179c4116f773cc7507103804dc6 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Tue, 30 Aug 2016 11:08:41 -0700 Subject: [PATCH] [SQL Lab] moving the db/schema/table select to the left (#1038) --- .../SqlLab/components/LeftPane.jsx | 2 - .../SqlLab/components/QueryLink.jsx | 3 - .../SqlLab/components/SouthPane.jsx | 14 ++-- .../SqlLab/components/SqlEditor.jsx | 47 ++++++----- ...EditorTopToolbar.jsx => SqlEditorLeft.jsx} | 84 ++----------------- ...eWorkspaceElement.jsx => TableElement.jsx} | 48 ++++++----- caravel/assets/javascripts/SqlLab/index.jsx | 6 +- caravel/assets/javascripts/SqlLab/main.css | 23 ++++- caravel/assets/javascripts/css-theme.js | 1 + .../stylesheets/react-select/select.less | 2 +- 10 files changed, 88 insertions(+), 142 deletions(-) rename caravel/assets/javascripts/SqlLab/components/{SqlEditorTopToolbar.jsx => SqlEditorLeft.jsx} (70%) rename caravel/assets/javascripts/SqlLab/components/{TableWorkspaceElement.jsx => TableElement.jsx} (69%) diff --git a/caravel/assets/javascripts/SqlLab/components/LeftPane.jsx b/caravel/assets/javascripts/SqlLab/components/LeftPane.jsx index fc2190a2bfe36..e4ff0517575cf 100644 --- a/caravel/assets/javascripts/SqlLab/components/LeftPane.jsx +++ b/caravel/assets/javascripts/SqlLab/components/LeftPane.jsx @@ -5,8 +5,6 @@ import { bindActionCreators } from 'redux'; import * as Actions from '../actions'; import QueryLink from './QueryLink'; -import 'react-select/dist/react-select.css'; - const LeftPane = (props) => { let queryElements; if (props.workspaceQueries.length > 0) { diff --git a/caravel/assets/javascripts/SqlLab/components/QueryLink.jsx b/caravel/assets/javascripts/SqlLab/components/QueryLink.jsx index f59390effb614..da9f0b5d21bf3 100644 --- a/caravel/assets/javascripts/SqlLab/components/QueryLink.jsx +++ b/caravel/assets/javascripts/SqlLab/components/QueryLink.jsx @@ -5,9 +5,6 @@ import { bindActionCreators } from 'redux'; import * as Actions from '../actions'; import shortid from 'shortid'; -// CSS -import 'react-select/dist/react-select.css'; - class QueryLink extends React.Component { popTab() { const qe = { diff --git a/caravel/assets/javascripts/SqlLab/components/SouthPane.jsx b/caravel/assets/javascripts/SqlLab/components/SouthPane.jsx index 4c078fbf4e763..3957f5932ad0c 100644 --- a/caravel/assets/javascripts/SqlLab/components/SouthPane.jsx +++ b/caravel/assets/javascripts/SqlLab/components/SouthPane.jsx @@ -1,4 +1,4 @@ -import { Alert, Panel, Tab, Tabs } from 'react-bootstrap'; +import { Alert, Tab, Tabs } from 'react-bootstrap'; import QueryHistory from './QueryHistory'; import ResultSet from './ResultSet'; import React from 'react'; @@ -21,16 +21,12 @@ const SouthPane = function (props) { return ( - -
- {results} -
-
+
+ {results} +
- - - +
); diff --git a/caravel/assets/javascripts/SqlLab/components/SqlEditor.jsx b/caravel/assets/javascripts/SqlLab/components/SqlEditor.jsx index 0c3fab7197daa..a76f92e2903bf 100644 --- a/caravel/assets/javascripts/SqlLab/components/SqlEditor.jsx +++ b/caravel/assets/javascripts/SqlLab/components/SqlEditor.jsx @@ -4,6 +4,7 @@ import React from 'react'; import { Button, ButtonGroup, + Col, FormGroup, InputGroup, Form, @@ -12,6 +13,7 @@ import { Label, MenuItem, OverlayTrigger, + Row, Tooltip, } from 'react-bootstrap'; @@ -29,10 +31,7 @@ import ButtonWithTooltip from './ButtonWithTooltip'; import SouthPane from './SouthPane'; import Timer from './Timer'; -import SqlEditorTopToolbar from './SqlEditorTopToolbar'; - -// CSS -import 'react-select/dist/react-select.css'; +import SqlEditorLeft from './SqlEditorLeft'; class SqlEditor extends React.Component { constructor(props) { @@ -246,23 +245,29 @@ class SqlEditor extends React.Component {
- - - {editorBottomBar} -
- + + + + + + + {editorBottomBar} +
+ + +
diff --git a/caravel/assets/javascripts/SqlLab/components/SqlEditorTopToolbar.jsx b/caravel/assets/javascripts/SqlLab/components/SqlEditorLeft.jsx similarity index 70% rename from caravel/assets/javascripts/SqlLab/components/SqlEditorTopToolbar.jsx rename to caravel/assets/javascripts/SqlLab/components/SqlEditorLeft.jsx index b1cff7f3f2bfe..7543c8ca8ef3c 100644 --- a/caravel/assets/javascripts/SqlLab/components/SqlEditorTopToolbar.jsx +++ b/caravel/assets/javascripts/SqlLab/components/SqlEditorLeft.jsx @@ -1,16 +1,13 @@ const $ = window.$ = require('jquery'); import React from 'react'; -import { Label, OverlayTrigger, Popover } from 'react-bootstrap'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import * as Actions from '../actions'; import shortid from 'shortid'; import Select from 'react-select'; -import Link from './Link'; +import TableElement from './TableElement'; -// CSS -import 'react-select/dist/react-select.css'; class SqlEditorTopToolbar extends React.Component { constructor(props) { @@ -123,7 +120,6 @@ class SqlEditorTopToolbar extends React.Component { schema: qe.schema, columns: data.columns, expanded: true, - showPopup: true, }); }) .fail(() => { @@ -135,76 +131,9 @@ class SqlEditorTopToolbar extends React.Component { } render() { const tables = this.props.tables.filter((t) => (t.queryEditorId === this.props.queryEditor.id)); - const tablesEls = tables.map((table) => { - let cols = []; - if (table.columns) { - cols = table.columns.map((col) => ( -
-
{col.name}
-
{col.type}
-
- )); - } - const popoverId = 'tblPopover_' + table.name; - const popoverTop = ( -
-
- - -
-
- -
-
- ); - const popover = ( - - {cols} - - ); - return ( - - ); - }); return (
-
+
-
+