mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
remove lastFileUpload field
This commit is contained in:
parent
f578bf5122
commit
0aedea6e60
@ -18,7 +18,7 @@ ContentView.propTypes = {
|
||||
ContentView.isContentTooLarge = msg => msg.contentLength > 1024 * 1024 * (ContentViews.ViewImage.matches(msg) ? 10 : 0.2)
|
||||
|
||||
function ContentView(props) {
|
||||
const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, lastFileUpload, uploadContent, onContentChange, content, readonly } = props
|
||||
const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, uploadContent, onContentChange, content, readonly } = props
|
||||
|
||||
if (message.contentLength === 0) {
|
||||
return <MetaViews.ContentEmpty {...props}/>
|
||||
@ -36,11 +36,11 @@ function ContentView(props) {
|
||||
return (
|
||||
<div>
|
||||
{View.textView ? (
|
||||
<ContentLoader flow={flow} lastFileUpload={lastFileUpload} readonly={readonly} message={message}>
|
||||
<ContentLoader flow={flow} readonly={readonly} message={message}>
|
||||
<View readonly={readonly} onChange={onContentChange} content="" />
|
||||
</ContentLoader>
|
||||
) : (
|
||||
<View flow={flow} lastFileUpload={lastFileUpload} readonly={readonly} content={content} message={message} />
|
||||
<View flow={flow} readonly={readonly} content={content} message={message} />
|
||||
)}
|
||||
<div className="view-options text-center">
|
||||
<ViewSelector onSelectView={selectView} active={View} message={message}/>
|
||||
@ -72,11 +72,10 @@ export default connect(
|
||||
state => ({
|
||||
contentView: state.ui.flow.contentView,
|
||||
displayLarge: state.ui.flow.displayLarge,
|
||||
lastFileUpload: state.ui.flow.lastFileUpload
|
||||
}),
|
||||
{
|
||||
selectView: setContentView,
|
||||
displayLarge,
|
||||
updateEdit,
|
||||
updateEdit
|
||||
}
|
||||
)(ContentView)
|
||||
|
@ -60,10 +60,10 @@ ViewAuto.propTypes = {
|
||||
flow: React.PropTypes.object.isRequired,
|
||||
}
|
||||
|
||||
export function ViewAuto({ message, flow, readonly, lastFileUpload }) {
|
||||
export function ViewAuto({ message, flow, readonly }) {
|
||||
const View = ViewAuto.findView(message)
|
||||
if (View.textView) {
|
||||
return <ContentLoader message={message} lastFileUpload={lastFileUpload} flow={flow}><View readonly={readonly} content="" /></ContentLoader>
|
||||
return <ContentLoader message={message} flow={flow}><View readonly={readonly} content="" /></ContentLoader>
|
||||
} else {
|
||||
return <View readonly={readonly} message={message} flow={flow} />
|
||||
}
|
||||
|
@ -9,7 +9,8 @@ import ValidateEditor from '../ValueEditor/ValidateEditor'
|
||||
import ValueEditor from '../ValueEditor/ValueEditor'
|
||||
|
||||
import Headers from './Headers'
|
||||
import { startEdit, updateEdit, uploadContent } from '../../ducks/ui/flow'
|
||||
import { startEdit, updateEdit } from '../../ducks/ui/flow'
|
||||
import * as FlowActions from '../../ducks/flows'
|
||||
import ToggleEdit from './ToggleEdit'
|
||||
|
||||
function RequestLine({ flow, readonly, updateFlow }) {
|
||||
@ -73,7 +74,7 @@ const Message = connect(
|
||||
}),
|
||||
{
|
||||
updateFlow: updateEdit,
|
||||
uploadContent: uploadContent
|
||||
uploadContent: FlowActions.uploadContent
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -112,7 +112,7 @@ export function update(flow, data) {
|
||||
return dispatch => fetchApi.put(`/flows/${flow.id}`, data)
|
||||
}
|
||||
|
||||
export function updateContent(flow, file, type) {
|
||||
export function uploadContent(flow, file, type) {
|
||||
const body = new FormData()
|
||||
if (typeof file !== File)
|
||||
file = new Blob([file], {type: 'plain/text'})
|
||||
|
@ -16,7 +16,6 @@ const defaultState = {
|
||||
displayLarge: false,
|
||||
modifiedFlow: false,
|
||||
contentView: 'ViewAuto',
|
||||
lastFileUpload: false,
|
||||
tab: 'request',
|
||||
}
|
||||
|
||||
@ -42,12 +41,6 @@ export default function reducer(state = defaultState, action) {
|
||||
modifiedFlow: false
|
||||
}
|
||||
|
||||
case UPLOAD_CONTENT:
|
||||
return {
|
||||
... state,
|
||||
lastFileUpload: new Date()
|
||||
}
|
||||
|
||||
case flowsActions.SELECT:
|
||||
return {
|
||||
...state,
|
||||
@ -98,13 +91,6 @@ export function updateEdit(update) {
|
||||
return { type: UPDATE_EDIT, update }
|
||||
}
|
||||
|
||||
export function uploadContent(flow, content, type){
|
||||
return (dispatch) => {
|
||||
dispatch(flowsActions.updateContent(flow, content, type))
|
||||
dispatch({ type: UPLOAD_CONTENT })
|
||||
}
|
||||
}
|
||||
|
||||
export function stopEdit(flow, modified_flow) {
|
||||
let diff = getDiff(flow, modified_flow)
|
||||
return (dispatch) => {
|
||||
|
Loading…
Reference in New Issue
Block a user