diff options
author | Maximilian Hils <git@maximilianhils.com> | 2017-02-09 23:21:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-09 23:21:44 +0100 |
commit | 74c991d70b3448439b483cb07cf30e3ebebfb373 (patch) | |
tree | 29150b3b749aa2b367c8681b8bfcb8cec76ea6f3 | |
parent | d6465b907f238f50c20c51304723260c9aaa61ab (diff) | |
parent | fb06c664379fc009c68dc780120fe600cd74cf5f (diff) | |
download | mitmproxy-74c991d70b3448439b483cb07cf30e3ebebfb373.tar.gz mitmproxy-74c991d70b3448439b483cb07cf30e3ebebfb373.tar.bz2 mitmproxy-74c991d70b3448439b483cb07cf30e3ebebfb373.zip |
Merge pull request #2002 from mitmproxy/content_views_edit
Content views edit
-rw-r--r-- | web/src/js/components/ContentView/ContentViewOptions.jsx | 4 | ||||
-rw-r--r-- | web/src/js/components/ContentView/ViewSelector.jsx | 15 | ||||
-rw-r--r-- | web/src/js/ducks/ui/flow.js | 2 |
3 files changed, 6 insertions, 15 deletions
diff --git a/web/src/js/components/ContentView/ContentViewOptions.jsx b/web/src/js/components/ContentView/ContentViewOptions.jsx index 6bc66db2..1ec9013e 100644 --- a/web/src/js/components/ContentView/ContentViewOptions.jsx +++ b/web/src/js/components/ContentView/ContentViewOptions.jsx @@ -12,13 +12,13 @@ ContentViewOptions.propTypes = { function ContentViewOptions({ flow, message, uploadContent, readonly, contentViewDescription }) { return ( <div className="view-options"> - <ViewSelector message={message}/> + {readonly ? <ViewSelector message={message}/> : <span><b>View:</b> edit</span>} <DownloadContentButton flow={flow} message={message}/> {!readonly && <UploadContentButton uploadContent={uploadContent}/> } - <span>{contentViewDescription}</span> + {readonly && <span>{contentViewDescription}</span>} </div> ) } diff --git a/web/src/js/components/ContentView/ViewSelector.jsx b/web/src/js/components/ContentView/ViewSelector.jsx index fcdc3ee3..43a53995 100644 --- a/web/src/js/components/ContentView/ViewSelector.jsx +++ b/web/src/js/components/ContentView/ViewSelector.jsx @@ -1,6 +1,5 @@ import React, { PropTypes, Component } from 'react' import { connect } from 'react-redux' -import * as ContentViews from './ContentViews' import { setContentView } from '../../ducks/ui/flow'; import Dropdown from '../common/Dropdown' @@ -8,27 +7,20 @@ import Dropdown from '../common/Dropdown' ViewSelector.propTypes = { contentViews: PropTypes.array.isRequired, activeView: PropTypes.string.isRequired, - isEdit: PropTypes.bool.isRequired, setContentView: PropTypes.func.isRequired } -function ViewSelector ({contentViews, activeView, isEdit, setContentView}){ - let edit = ContentViews.Edit.displayName - let inner = <span> <b>View:</b> {activeView} <span className="caret"></span> </span> +function ViewSelector ({contentViews, activeView, setContentView}){ + let inner = <span> <b>View:</b> {activeView.toLowerCase()} <span className="caret"></span> </span> return ( <Dropdown dropup className="pull-left" btnClass="btn btn-default btn-xs" text={inner}> {contentViews.map(name => - <a href="#" key={name} onClick={e => {e.preventDefault(); setContentView(name)}}> + <a href="#" key={name} onClick={e => {e.preventDefault(); setContentView(name)}}> {name.toLowerCase().replace('_', ' ')} </a> ) } - {isEdit && - <a href="#" onClick={e => {e.preventDefault(); setContentView(edit)}}> - {edit.toLowerCase()} - </a> - } </Dropdown> ) } @@ -37,7 +29,6 @@ export default connect ( state => ({ contentViews: state.settings.contentViews, activeView: state.ui.flow.contentView, - isEdit: !!state.ui.flow.modifiedFlow, }), { setContentView, } diff --git a/web/src/js/ducks/ui/flow.js b/web/src/js/ducks/ui/flow.js index b5f6f78b..fa7474d2 100644 --- a/web/src/js/ducks/ui/flow.js +++ b/web/src/js/ducks/ui/flow.js @@ -89,7 +89,7 @@ export default function reducer(state = defaultState, action) { ...state, tab: action.tab ? action.tab : 'request', displayLarge: false, - showFullContent: false + showFullContent: state.contentView == 'Edit' } case SET_CONTENT_VIEW: |