mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 02:10:59 +00:00
Merge pull request #2002 from mitmproxy/content_views_edit
Content views edit
This commit is contained in:
commit
74c991d70b
@ -12,13 +12,13 @@ ContentViewOptions.propTypes = {
|
|||||||
function ContentViewOptions({ flow, message, uploadContent, readonly, contentViewDescription }) {
|
function ContentViewOptions({ flow, message, uploadContent, readonly, contentViewDescription }) {
|
||||||
return (
|
return (
|
||||||
<div className="view-options">
|
<div className="view-options">
|
||||||
<ViewSelector message={message}/>
|
{readonly ? <ViewSelector message={message}/> : <span><b>View:</b> edit</span>}
|
||||||
|
|
||||||
<DownloadContentButton flow={flow} message={message}/>
|
<DownloadContentButton flow={flow} message={message}/>
|
||||||
|
|
||||||
{!readonly && <UploadContentButton uploadContent={uploadContent}/> }
|
{!readonly && <UploadContentButton uploadContent={uploadContent}/> }
|
||||||
|
|
||||||
<span>{contentViewDescription}</span>
|
{readonly && <span>{contentViewDescription}</span>}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import React, { PropTypes, Component } from 'react'
|
import React, { PropTypes, Component } from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import * as ContentViews from './ContentViews'
|
|
||||||
import { setContentView } from '../../ducks/ui/flow';
|
import { setContentView } from '../../ducks/ui/flow';
|
||||||
import Dropdown from '../common/Dropdown'
|
import Dropdown from '../common/Dropdown'
|
||||||
|
|
||||||
@ -8,13 +7,11 @@ import Dropdown from '../common/Dropdown'
|
|||||||
ViewSelector.propTypes = {
|
ViewSelector.propTypes = {
|
||||||
contentViews: PropTypes.array.isRequired,
|
contentViews: PropTypes.array.isRequired,
|
||||||
activeView: PropTypes.string.isRequired,
|
activeView: PropTypes.string.isRequired,
|
||||||
isEdit: PropTypes.bool.isRequired,
|
|
||||||
setContentView: PropTypes.func.isRequired
|
setContentView: PropTypes.func.isRequired
|
||||||
}
|
}
|
||||||
|
|
||||||
function ViewSelector ({contentViews, activeView, isEdit, setContentView}){
|
function ViewSelector ({contentViews, activeView, setContentView}){
|
||||||
let edit = ContentViews.Edit.displayName
|
let inner = <span> <b>View:</b> {activeView.toLowerCase()} <span className="caret"></span> </span>
|
||||||
let inner = <span> <b>View:</b> {activeView} <span className="caret"></span> </span>
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown dropup className="pull-left" btnClass="btn btn-default btn-xs" text={inner}>
|
<Dropdown dropup className="pull-left" btnClass="btn btn-default btn-xs" text={inner}>
|
||||||
@ -24,11 +21,6 @@ function ViewSelector ({contentViews, activeView, isEdit, setContentView}){
|
|||||||
</a>
|
</a>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
{isEdit &&
|
|
||||||
<a href="#" onClick={e => {e.preventDefault(); setContentView(edit)}}>
|
|
||||||
{edit.toLowerCase()}
|
|
||||||
</a>
|
|
||||||
}
|
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -37,7 +29,6 @@ export default connect (
|
|||||||
state => ({
|
state => ({
|
||||||
contentViews: state.settings.contentViews,
|
contentViews: state.settings.contentViews,
|
||||||
activeView: state.ui.flow.contentView,
|
activeView: state.ui.flow.contentView,
|
||||||
isEdit: !!state.ui.flow.modifiedFlow,
|
|
||||||
}), {
|
}), {
|
||||||
setContentView,
|
setContentView,
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ export default function reducer(state = defaultState, action) {
|
|||||||
...state,
|
...state,
|
||||||
tab: action.tab ? action.tab : 'request',
|
tab: action.tab ? action.tab : 'request',
|
||||||
displayLarge: false,
|
displayLarge: false,
|
||||||
showFullContent: false
|
showFullContent: state.contentView == 'Edit'
|
||||||
}
|
}
|
||||||
|
|
||||||
case SET_CONTENT_VIEW:
|
case SET_CONTENT_VIEW:
|
||||||
|
Loading…
Reference in New Issue
Block a user