diff options
author | Matthew Shao <me@matshao.com> | 2017-07-26 15:09:11 +0800 |
---|---|---|
committer | Matthew Shao <me@matshao.com> | 2017-07-26 15:09:11 +0800 |
commit | c7e41b32abba017210ef5c2dc3961554a9b6b9b3 (patch) | |
tree | bb61a9011dc9b8b4a59344e8f50b2c852be2c46c | |
parent | 9d16cc7079984661c9268a36c4e45bdcb5c7ea19 (diff) | |
download | mitmproxy-c7e41b32abba017210ef5c2dc3961554a9b6b9b3.tar.gz mitmproxy-c7e41b32abba017210ef5c2dc3961554a9b6b9b3.tar.bz2 mitmproxy-c7e41b32abba017210ef5c2dc3961554a9b6b9b3.zip |
[web] Update options auto dump for frontend.
-rw-r--r-- | web/src/js/components/Modal/Option.jsx | 2 | ||||
-rw-r--r-- | web/src/js/components/Modal/OptionModal.jsx | 18 | ||||
-rw-r--r-- | web/src/js/ducks/options.js | 12 |
3 files changed, 6 insertions, 26 deletions
diff --git a/web/src/js/components/Modal/Option.jsx b/web/src/js/components/Modal/Option.jsx index 58b863d1..38e2f239 100644 --- a/web/src/js/components/Modal/Option.jsx +++ b/web/src/js/components/Modal/Option.jsx @@ -74,7 +74,7 @@ export function ChoicesOption({ value, onChange, choices, ...props }) { return ( <select onChange={(e) => onChange(e.target.value)} - selected={value} + value={value} {...props} > { choices.map( diff --git a/web/src/js/components/Modal/OptionModal.jsx b/web/src/js/components/Modal/OptionModal.jsx index 6595717d..bc25214a 100644 --- a/web/src/js/components/Modal/OptionModal.jsx +++ b/web/src/js/components/Modal/OptionModal.jsx @@ -3,7 +3,6 @@ import { connect } from "react-redux" import * as modalAction from "../../ducks/ui/modal" import * as optionAction from "../../ducks/options" import Option from "./Option" -import FileChooser from '../../components/common/FileChooser' import _ from "lodash" function PureOptionHelp({help}){ @@ -54,13 +53,14 @@ class PureOptionModal extends Component { } render() { - const { hideModal, options, download, upload } = this.props + const { hideModal, options, dump } = this.props const { title } = this.state return ( <div> <div className="modal-header"> <button type="button" className="close" data-dismiss="modal" onClick={() => { hideModal() + dump() }}> <i className="fa fa-fw fa-times"></i> </button> @@ -90,17 +90,6 @@ class PureOptionModal extends Component { </div> <div className="modal-footer"> - <button type="button" className="btn btn-default" onClick={download}> - <i className="fa fa-download"></i> - Download - </button> - - <FileChooser - icon="fa-upload" - onOpenFile={file => {upload(file); alert('Option configuration loaded!')}} - text="Load" - className="btn btn-primary" - /> </div> </div> ) @@ -113,7 +102,6 @@ export default connect( }), { hideModal: modalAction.hideModal, - download: optionAction.download, - upload: optionAction.upload, + dump: optionAction.dump, } )(PureOptionModal) diff --git a/web/src/js/ducks/options.js b/web/src/js/ducks/options.js index b22030a3..d319b171 100644 --- a/web/src/js/ducks/options.js +++ b/web/src/js/ducks/options.js @@ -5,7 +5,6 @@ import _ from "lodash" export const RECEIVE = 'OPTIONS_RECEIVE' export const UPDATE = 'OPTIONS_UPDATE' export const REQUEST_UPDATE = 'REQUEST_UPDATE' -export const SAVE = 'OPTION_SAVE' const defaultState = {} @@ -46,13 +45,6 @@ export function update(option, value) { } } -export function download() { - window.location = '/options/dump' - return { type: SAVE } -} - -export function upload(file) { - const body = new FormData() - body.append('file', file) - return dispatch => fetchApi('/options/dump', { method: 'POST', body }) +export function dump() { + return dispatch => fetchApi('/options/dump', { method: 'POST' }) } |