From 13a76f3c27145741ee8e883e3e9d077882b0233c Mon Sep 17 00:00:00 2001 From: alanna scott Date: Wed, 22 Mar 2017 13:55:26 -0700 Subject: [PATCH 1/4] use fast filter for tables select --- .../SqlLab/components/SqlEditorLeftBar.jsx | 45 +++++++++---------- superset/assets/package.json | 2 + 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/superset/assets/javascripts/SqlLab/components/SqlEditorLeftBar.jsx b/superset/assets/javascripts/SqlLab/components/SqlEditorLeftBar.jsx index 13f0f865b0bc..b3ecab4011e9 100644 --- a/superset/assets/javascripts/SqlLab/components/SqlEditorLeftBar.jsx +++ b/superset/assets/javascripts/SqlLab/components/SqlEditorLeftBar.jsx @@ -1,9 +1,14 @@ const $ = window.$ = require('jquery'); import React from 'react'; -import Select from 'react-select'; import { Label, Button } from 'react-bootstrap'; import TableElement from './TableElement'; import AsyncSelect from '../../components/AsyncSelect'; +import Select from 'react-virtualized-select'; +import createFilterOptions from 'react-select-fast-filter-options'; + +import 'react-select/dist/react-select.css'; +import 'react-virtualized/styles.css'; +import 'react-virtualized-select/styles.css'; const propTypes = { queryEditor: React.PropTypes.object.isRequired, @@ -129,6 +134,8 @@ ${this.props.queryEditor.schema}/${input}`; networkAlert =

; } const shouldShowReset = window.location.search === '?reset=1'; + const options = this.state.tableOptions; + const filterOptions = createFilterOptions({ options }); return (
@@ -148,6 +155,8 @@ ${this.props.queryEditor.schema}/${input}`; mutator={this.dbMutator.bind(this)} placeholder="Select a database" /> +
+
- } - {!this.props.queryEditor.schema && - - } + + {this.props.queryEditor.schema && + + }

From f6abb808212260a255d47752a8ddbe33fcced1b1 Mon Sep 17 00:00:00 2001 From: alanna scott Date: Thu, 23 Mar 2017 12:47:52 -0700 Subject: [PATCH 4/4] import styles in same place as react-select css import --- .../SqlLab/components/SqlEditorLeftBar.jsx | 4 --- .../stylesheets/react-select/select.less | 28 +++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/superset/assets/javascripts/SqlLab/components/SqlEditorLeftBar.jsx b/superset/assets/javascripts/SqlLab/components/SqlEditorLeftBar.jsx index 2cc91f6967d2..5a2c2d312ee5 100644 --- a/superset/assets/javascripts/SqlLab/components/SqlEditorLeftBar.jsx +++ b/superset/assets/javascripts/SqlLab/components/SqlEditorLeftBar.jsx @@ -6,10 +6,6 @@ import AsyncSelect from '../../components/AsyncSelect'; import Select from 'react-virtualized-select'; import createFilterOptions from 'react-select-fast-filter-options'; -import 'react-select/dist/react-select.css'; -import 'react-virtualized/styles.css'; -import 'react-virtualized-select/styles.css'; - const propTypes = { queryEditor: React.PropTypes.object.isRequired, tables: React.PropTypes.array, diff --git a/superset/assets/stylesheets/react-select/select.less b/superset/assets/stylesheets/react-select/select.less index 9fe319e1e340..4cc94dc1790d 100644 --- a/superset/assets/stylesheets/react-select/select.less +++ b/superset/assets/stylesheets/react-select/select.less @@ -91,3 +91,31 @@ @import "../../node_modules/react-select/less/mixins.less"; @import "../../node_modules/react-select/less/multi.less"; @import "../../node_modules/react-select/less/spinner.less"; +@import "../../node_modules/react-virtualized/styles.css"; + +// importing css from "../../node_modules/react-virtualized-select/styles.css"; +// so the background color of a selected option matches the other selects +.VirtualSelectGrid { + z-index: 1; +} +.VirtualizedSelectOption { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + padding: 0 .5rem; +} +.VirtualizedSelectFocusedOption { + background-color: rgba(0, 0, 0, 0.1); +} +.VirtualizedSelectFocusedOption:hover { + cursor: pointer; +} +.VirtualizedSelectDisabledOption { + opacity: 0.5; +} +.VirtualizedSelectSelectedOption { + font-weight: bold; +}