diff options
author | Maximilian Hils <git@maximilianhils.com> | 2017-10-25 14:00:33 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2017-10-25 14:00:33 +0200 |
commit | f870ccd949ca46e6a1ca48a6d5e40589fad41ce2 (patch) | |
tree | 7bd7d08ccdad49c408b35c24e4832d5aacb81463 /web | |
parent | 51d3fb8ea14423331f39dcf615493dab34ee81a8 (diff) | |
download | mitmproxy-f870ccd949ca46e6a1ca48a6d5e40589fad41ce2.tar.gz mitmproxy-f870ccd949ca46e6a1ca48a6d5e40589fad41ce2.tar.bz2 mitmproxy-f870ccd949ca46e6a1ca48a6d5e40589fad41ce2.zip |
[web] remove prompt
Diffstat (limited to 'web')
-rw-r--r-- | web/src/css/app.less | 1 | ||||
-rw-r--r-- | web/src/css/prompt.less | 27 | ||||
-rw-r--r-- | web/src/js/components/FlowView.jsx | 3 | ||||
-rw-r--r-- | web/src/js/components/Header/FileMenu.jsx | 6 | ||||
-rwxr-xr-x | web/src/js/components/Prompt.jsx | 67 |
5 files changed, 4 insertions, 100 deletions
diff --git a/web/src/css/app.less b/web/src/css/app.less index b9b5b310..1f246b19 100644 --- a/web/src/css/app.less +++ b/web/src/css/app.less @@ -14,7 +14,6 @@ html { @import (less) "flowtable.less"; @import (less) "flowdetail.less"; @import (less) "flowview.less"; -@import (less) "prompt.less"; @import (less) "eventlog.less"; @import (less) "footer.less"; @import (less) "codemirror.less"; diff --git a/web/src/css/prompt.less b/web/src/css/prompt.less deleted file mode 100644 index eee0426d..00000000 --- a/web/src/css/prompt.less +++ /dev/null @@ -1,27 +0,0 @@ -.prompt-dialog { - top: 0; - bottom: 0; - left: 0; - right: 0; - position: fixed; - z-index: 100; - background-color: rgba(0, 0, 0, 0.1); -} - -.prompt-content { - position: fixed; - bottom: 0; - left: 0; - right: 0; - height: 25px; - padding: 2px 5px; - background-color: white; - box-shadow: 0 -1px 3px lightgray; - - .option { - cursor: pointer; - &:not(:last-child)::after { - content: ", "; - } - } -}
\ No newline at end of file diff --git a/web/src/js/components/FlowView.jsx b/web/src/js/components/FlowView.jsx index d03d681a..fbdbb049 100644 --- a/web/src/js/components/FlowView.jsx +++ b/web/src/js/components/FlowView.jsx @@ -5,7 +5,6 @@ import _ from 'lodash' import Nav from './FlowView/Nav' import { Request, Response, ErrorView as Error } from './FlowView/Messages' import Details from './FlowView/Details' -import Prompt from './Prompt' import { selectTab } from '../ducks/ui/flow' @@ -80,7 +79,7 @@ class FlowView extends Component { /> <Tab ref={ tab => this.tabComponent = tab } flow={flow} updateFlow={updateFlow} /> {this.props.promptOpen && ( - <Prompt options={this.getPromptOptions()} done={this.onPromptFinish} /> + <div>fixme</div> )} </div> ) diff --git a/web/src/js/components/Header/FileMenu.jsx b/web/src/js/components/Header/FileMenu.jsx index 5cb8e507..1e3b9268 100644 --- a/web/src/js/components/Header/FileMenu.jsx +++ b/web/src/js/components/Header/FileMenu.jsx @@ -20,7 +20,7 @@ FileMenu.onNewClick = (e, clearFlows) => { clearFlows() } -export function FileMenu ({clearFlows, loadFlows, saveFlows, openModal}) { +export function FileMenu ({clearFlows, loadFlows, saveFlows, openOptions}) { return ( <Dropdown className="pull-left" btnClass="special" text="mitmproxy"> <a href="#" onClick={e => FileMenu.onNewClick(e, clearFlows)}> @@ -38,7 +38,7 @@ export function FileMenu ({clearFlows, loadFlows, saveFlows, openModal}) { </a> <HideInStatic> - <a href="#" onClick={e => { e.preventDefault(); openModal(); }}> + <a href="#" onClick={e => { e.preventDefault(); openOptions(); }}> <i className="fa fa-fw fa-cog"></i> Options </a> @@ -59,6 +59,6 @@ export default connect( clearFlows: flowsActions.clear, loadFlows: flowsActions.upload, saveFlows: flowsActions.download, - openModal: () => modalActions.setActiveModal('OptionModal'), + openOptions: () => modalActions.setActiveModal('OptionModal'), } )(FileMenu) diff --git a/web/src/js/components/Prompt.jsx b/web/src/js/components/Prompt.jsx deleted file mode 100755 index 77b07027..00000000 --- a/web/src/js/components/Prompt.jsx +++ /dev/null @@ -1,67 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' -import ReactDOM from 'react-dom' -import _ from 'lodash' - -import {Key} from '../utils.js' - -Prompt.propTypes = { - options: PropTypes.array.isRequired, - done: PropTypes.func.isRequired, - prompt: PropTypes.string, -} - -export default function Prompt({ prompt, done, options }) { - const opts = [] - - for (let i = 0; i < options.length; i++) { - let opt = options[i] - if (_.isString(opt)) { - let str = opt - while (str.length > 0 && keyTaken(str[0])) { - str = str.substr(1) - } - opt = { text: opt, key: str[0] } - } - if (!opt.text || !opt.key || keyTaken(opt.key)) { - throw 'invalid options' - } - opts.push(opt) - } - - function keyTaken(k) { - return _.map(opts, 'key').includes(k) - } - - function onKeyDown(event) { - event.stopPropagation() - event.preventDefault() - const key = opts.find(opt => Key[opt.key.toUpperCase()] === event.keyCode) - if (!key && event.keyCode !== Key.ESC && event.keyCode !== Key.ENTER) { - return - } - done(key.key || false) - } - - return ( - <div tabIndex="0" onKeyDown={onKeyDown} className="prompt-dialog"> - <div className="prompt-content"> - {prompt || <strong>Select: </strong> } - {opts.map(opt => { - const idx = opt.text.indexOf(opt.key) - function onClick(event) { - done(opt.key) - event.stopPropagation() - } - return ( - <span key={opt.key} className="option" onClick={onClick}> - {idx !== -1 ? opt.text.substring(0, idx) : opt.text + '('} - <strong className="text-primary">{opt.key}</strong> - {idx !== -1 ? opt.text.substring(idx + 1) : ')'} - </span> - ) - })} - </div> - </div> - ) -} |