diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-07-18 20:59:17 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-07-18 20:59:17 -0700 |
commit | 859bb8c99fbe285f839373c66028910eb5595604 (patch) | |
tree | a319a55af7289aa006e32909fca92c24a436c19e /web/src/js/components/Header/MainMenu.jsx | |
parent | 00b0d47db6961849c8a00af3d7805f5d9a9e5e2d (diff) | |
parent | 92026d26ea6d8d9134b2725cf83753ba9e5c3579 (diff) | |
download | mitmproxy-859bb8c99fbe285f839373c66028910eb5595604.tar.gz mitmproxy-859bb8c99fbe285f839373c66028910eb5595604.tar.bz2 mitmproxy-859bb8c99fbe285f839373c66028910eb5595604.zip |
Merge remote-tracking branch 'jason/ui'
Diffstat (limited to 'web/src/js/components/Header/MainMenu.jsx')
-rw-r--r-- | web/src/js/components/Header/MainMenu.jsx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/web/src/js/components/Header/MainMenu.jsx b/web/src/js/components/Header/MainMenu.jsx index 48fea5a2..27a4be60 100644 --- a/web/src/js/components/Header/MainMenu.jsx +++ b/web/src/js/components/Header/MainMenu.jsx @@ -3,6 +3,7 @@ import { connect } from 'react-redux' import FilterInput from './FilterInput' import { Query } from '../../actions.js' import { update as updateSettings } from '../../ducks/settings' +import { updateQuery, setSelectedInput } from '../../ducks/ui' class MainMenu extends Component { @@ -12,8 +13,8 @@ class MainMenu extends Component { static propTypes = { query: PropTypes.object.isRequired, settings: PropTypes.object.isRequired, - updateLocation: PropTypes.func.isRequired, updateSettings: PropTypes.func.isRequired, + updateQuery: PropTypes.func.isRequired, } constructor(props, context) { @@ -22,12 +23,19 @@ class MainMenu extends Component { this.onHighlightChange = this.onHighlightChange.bind(this) } + componentWillReceiveProps(nextProps) { + if(this.refs[nextProps.selectedInput]) { + this.refs[nextProps.selectedInput].select() + } + this.props.setSelectedInput(undefined) + } + onSearchChange(val) { - this.props.updateLocation(undefined, { [Query.SEARCH]: val }) + this.props.updateQuery({ [Query.SEARCH]: val }) } onHighlightChange(val) { - this.props.updateLocation(undefined, { [Query.HIGHLIGHT]: val }) + this.props.updateQuery({ [Query.HIGHLIGHT]: val }) } render() { @@ -70,9 +78,12 @@ class MainMenu extends Component { export default connect( state => ({ settings: state.settings.settings, + selectedInput: state.ui.selectedInput }), { updateSettings, + updateQuery, + setSelectedInput }, null, { |