diff --git a/superset/assets/javascripts/explore/components/controls/VizTypeControl.jsx b/superset/assets/javascripts/explore/components/controls/VizTypeControl.jsx index 8fdd3f2d5b..0b454ac862 100644 --- a/superset/assets/javascripts/explore/components/controls/VizTypeControl.jsx +++ b/superset/assets/javascripts/explore/components/controls/VizTypeControl.jsx @@ -25,17 +25,27 @@ export default class VizTypeControl extends React.PureComponent { }; this.toggleModal = this.toggleModal.bind(this); this.changeSearch = this.changeSearch.bind(this); + this.setSearchRef = this.setSearchRef.bind(this); + this.focusSearch = this.focusSearch.bind(this); } onChange(vizType) { this.props.onChange(vizType); this.setState({ showModal: false }); } + setSearchRef(searchRef) { + this.searchRef = searchRef; + } toggleModal() { this.setState({ showModal: !this.state.showModal }); } changeSearch(event) { this.setState({ filter: event.target.value }); } + focusSearch() { + if (this.searchRef) { + this.searchRef.focus(); + } + } renderVizType(vizType) { const vt = vizType; return ( @@ -82,7 +92,13 @@ export default class VizTypeControl extends React.PureComponent { {visTypes[this.props.value].label} - + Select a visualization type @@ -90,6 +106,7 @@ export default class VizTypeControl extends React.PureComponent { { this.setSearchRef(ref); }} type="text" bsSize="sm" value={this.state.filter}