mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 10:16:27 +00:00
change some style
This commit is contained in:
parent
a8aa1f2d1c
commit
9b0b007a5d
@ -5,8 +5,7 @@
|
|||||||
|
|
||||||
.flow-detail {
|
.flow-detail {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow-x: auto;
|
overflow:hidden;
|
||||||
overflow-y: scroll;
|
|
||||||
|
|
||||||
nav {
|
nav {
|
||||||
background-color: #F2F2F2;
|
background-color: #F2F2F2;
|
||||||
@ -41,6 +40,28 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.flowview-container{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 0 !important;
|
||||||
|
height:95%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flowview-body{
|
||||||
|
position:relative;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 5px 12px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flowview-footer{
|
||||||
|
flex: 0 0 auto;
|
||||||
|
box-shadow: 0 0 3px gray;
|
||||||
|
padding: 2px;
|
||||||
|
margin: 0;
|
||||||
|
height:23px;
|
||||||
|
}
|
||||||
|
|
||||||
.inline-input {
|
.inline-input {
|
||||||
display: inline;
|
display: inline;
|
||||||
margin: 0 -3px;
|
margin: 0 -3px;
|
||||||
@ -64,13 +85,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.view-options {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.view-all-content-btn{
|
.view-all-content-btn{
|
||||||
float: right;
|
float: right;
|
||||||
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flow-detail table {
|
.flow-detail table {
|
||||||
|
@ -2,12 +2,10 @@ import React, { Component, PropTypes } from 'react'
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import * as ContentViews from './ContentView/ContentViews'
|
import * as ContentViews from './ContentView/ContentViews'
|
||||||
import * as MetaViews from './ContentView/MetaViews'
|
import * as MetaViews from './ContentView/MetaViews'
|
||||||
import ViewSelector from './ContentView/ViewSelector'
|
|
||||||
import UploadContentButton from './ContentView/UploadContentButton'
|
|
||||||
import DownloadContentButton from './ContentView/DownloadContentButton'
|
|
||||||
import ShowFullContentButton from './ContentView/ShowFullContentButton'
|
import ShowFullContentButton from './ContentView/ShowFullContentButton'
|
||||||
|
|
||||||
import { setContentView, displayLarge, updateEdit } from '../ducks/ui/flow'
|
|
||||||
|
import { displayLarge, updateEdit } from '../ducks/ui/flow'
|
||||||
|
|
||||||
ContentView.propTypes = {
|
ContentView.propTypes = {
|
||||||
// It may seem a bit weird at the first glance:
|
// It may seem a bit weird at the first glance:
|
||||||
@ -20,7 +18,7 @@ ContentView.propTypes = {
|
|||||||
ContentView.isContentTooLarge = msg => msg.contentLength > 1024 * 1024 * (ContentViews.ViewImage.matches(msg) ? 10 : 0.2)
|
ContentView.isContentTooLarge = msg => msg.contentLength > 1024 * 1024 * (ContentViews.ViewImage.matches(msg) ? 10 : 0.2)
|
||||||
|
|
||||||
function ContentView(props) {
|
function ContentView(props) {
|
||||||
const { flow, message, contentView, isDisplayLarge, displayLarge, uploadContent, onContentChange, readonly, contentViewDescription } = props
|
const { flow, message, contentView, isDisplayLarge, displayLarge, onContentChange, readonly } = props
|
||||||
|
|
||||||
if (message.contentLength === 0 && readonly) {
|
if (message.contentLength === 0 && readonly) {
|
||||||
return <MetaViews.ContentEmpty {...props}/>
|
return <MetaViews.ContentEmpty {...props}/>
|
||||||
@ -39,15 +37,6 @@ function ContentView(props) {
|
|||||||
<div className="contentview">
|
<div className="contentview">
|
||||||
<View flow={flow} message={message} contentView={contentView} readonly={readonly} onChange={onContentChange}/>
|
<View flow={flow} message={message} contentView={contentView} readonly={readonly} onChange={onContentChange}/>
|
||||||
<ShowFullContentButton/>
|
<ShowFullContentButton/>
|
||||||
<div className="view-options footer navbar-fixed-bottom">
|
|
||||||
<ViewSelector message={message}/>
|
|
||||||
|
|
||||||
<DownloadContentButton flow={flow} message={message}/>
|
|
||||||
|
|
||||||
<UploadContentButton uploadContent={uploadContent}/>
|
|
||||||
|
|
||||||
<span>{contentViewDescription}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -56,7 +45,6 @@ export default connect(
|
|||||||
state => ({
|
state => ({
|
||||||
contentView: state.ui.flow.contentView,
|
contentView: state.ui.flow.contentView,
|
||||||
isDisplayLarge: state.ui.flow.displayLarge,
|
isDisplayLarge: state.ui.flow.displayLarge,
|
||||||
contentViewDescription: state.ui.flow.viewDescription
|
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
displayLarge,
|
displayLarge,
|
||||||
|
31
web/src/js/components/ContentView/ContentViewOptions.jsx
Normal file
31
web/src/js/components/ContentView/ContentViewOptions.jsx
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import React, { PropTypes } from 'react'
|
||||||
|
import { connect } from 'react-redux'
|
||||||
|
import ViewSelector from './ViewSelector'
|
||||||
|
import UploadContentButton from './UploadContentButton'
|
||||||
|
import DownloadContentButton from './DownloadContentButton'
|
||||||
|
|
||||||
|
ContentViewOptions.propTypes = {
|
||||||
|
flow: React.PropTypes.object.isRequired,
|
||||||
|
message: React.PropTypes.object.isRequired,
|
||||||
|
}
|
||||||
|
|
||||||
|
function ContentViewOptions(props) {
|
||||||
|
const { flow, message, uploadContent, readonly, contentViewDescription } = props
|
||||||
|
return (
|
||||||
|
<div className="view-options">
|
||||||
|
<ViewSelector message={message}/>
|
||||||
|
|
||||||
|
<DownloadContentButton flow={flow} message={message}/>
|
||||||
|
|
||||||
|
<UploadContentButton uploadContent={uploadContent}/>
|
||||||
|
|
||||||
|
<span>{contentViewDescription}</span>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
state => ({
|
||||||
|
contentViewDescription: state.ui.flow.viewDescription
|
||||||
|
})
|
||||||
|
)(ContentViewOptions)
|
@ -30,9 +30,8 @@ function Edit({ content, onChange }) {
|
|||||||
Edit = ContentLoader(Edit)
|
Edit = ContentLoader(Edit)
|
||||||
|
|
||||||
class ViewServer extends Component {
|
class ViewServer extends Component {
|
||||||
constructor(props){
|
static defaultProps = {
|
||||||
super(props)
|
maxLines: 80,
|
||||||
this.maxLines = 80
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount(){
|
componentWillMount(){
|
||||||
@ -50,14 +49,12 @@ class ViewServer extends Component {
|
|||||||
|
|
||||||
props.setContentViewDescription(props.contentView != this.data.description ? this.data.description : '')
|
props.setContentViewDescription(props.contentView != this.data.description ? this.data.description : '')
|
||||||
|
|
||||||
let isFullContentShown = this.data.lines.length < this.maxLines
|
let isFullContentShown = this.data.lines.length < props.maxLines
|
||||||
if (isFullContentShown) props.setShowFullContent(true)
|
if (isFullContentShown) props.setShowFullContent(true)
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
const {content, contentView, message} = this.props
|
const {content, contentView, message, maxLines} = this.props
|
||||||
|
let lines = this.props.showFullContent ? this.data.lines : this.data.lines.slice(0, maxLines)
|
||||||
let lines = this.props.showFullContent ? this.data.lines : this.data.lines.slice(0, this.maxLines)
|
|
||||||
|
|
||||||
return <div>
|
return <div>
|
||||||
<pre>
|
<pre>
|
||||||
{lines.map((line, i) =>
|
{lines.map((line, i) =>
|
||||||
|
@ -71,7 +71,7 @@ export default class FlowView extends Component {
|
|||||||
const Tab = FlowView.allTabs[_.capitalize(active)]
|
const Tab = FlowView.allTabs[_.capitalize(active)]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flow-detail" onScroll={this.adjustHead}>
|
<div className="flow-detail">
|
||||||
<Nav
|
<Nav
|
||||||
flow={flow}
|
flow={flow}
|
||||||
tabs={tabs}
|
tabs={tabs}
|
||||||
|
@ -5,6 +5,7 @@ import { connect } from 'react-redux'
|
|||||||
import { RequestUtils, isValidHttpVersion, parseUrl } from '../../flow/utils.js'
|
import { RequestUtils, isValidHttpVersion, parseUrl } from '../../flow/utils.js'
|
||||||
import { formatTimeStamp } from '../../utils.js'
|
import { formatTimeStamp } from '../../utils.js'
|
||||||
import ContentView from '../ContentView'
|
import ContentView from '../ContentView'
|
||||||
|
import ContentViewOptions from '../ContentView/ContentViewOptions'
|
||||||
import ValidateEditor from '../ValueEditor/ValidateEditor'
|
import ValidateEditor from '../ValueEditor/ValidateEditor'
|
||||||
import ValueEditor from '../ValueEditor/ValueEditor'
|
import ValueEditor from '../ValueEditor/ValueEditor'
|
||||||
|
|
||||||
@ -81,27 +82,35 @@ const Message = connect(
|
|||||||
export class Request extends Component {
|
export class Request extends Component {
|
||||||
render() {
|
render() {
|
||||||
const { flow, isEdit, updateFlow, uploadContent } = this.props
|
const { flow, isEdit, updateFlow, uploadContent } = this.props
|
||||||
|
let noContent = !isEdit && (flow.request.contentLength == 0 || flow.request.contentLength == null)
|
||||||
return (
|
return (
|
||||||
<section className="request">
|
<section className="request flowview-container">
|
||||||
<ToggleEdit/>
|
<div className="flowview-body">
|
||||||
<RequestLine
|
<ToggleEdit/>
|
||||||
flow={flow}
|
<RequestLine
|
||||||
readonly={!isEdit}
|
flow={flow}
|
||||||
updateFlow={updateFlow}/>
|
readonly={!isEdit}
|
||||||
<Headers
|
updateFlow={updateFlow}/>
|
||||||
message={flow.request}
|
<Headers
|
||||||
readonly={!isEdit}
|
message={flow.request}
|
||||||
onChange={headers => updateFlow({ request: { headers } })}
|
readonly={!isEdit}
|
||||||
/>
|
onChange={headers => updateFlow({ request: { headers } })}
|
||||||
|
/>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
<ContentView
|
<ContentView
|
||||||
readonly={!isEdit}
|
readonly={!isEdit}
|
||||||
flow={flow}
|
flow={flow}
|
||||||
onContentChange={content => updateFlow({ request: {content}})}
|
onContentChange={content => updateFlow({ request: {content}})}
|
||||||
uploadContent={content => uploadContent(flow, content, "request")}
|
message={flow.request}/>
|
||||||
message={flow.request}/>
|
</div>
|
||||||
|
<div hidden={noContent} className="flowview-footer">
|
||||||
|
<ContentViewOptions
|
||||||
|
flow={flow}
|
||||||
|
readonly={!isEdit}
|
||||||
|
message={flow.request}
|
||||||
|
uploadContent={content => uploadContent(flow, content, "request")}/>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -137,27 +146,36 @@ Request = Message(Request)
|
|||||||
export class Response extends Component {
|
export class Response extends Component {
|
||||||
render() {
|
render() {
|
||||||
const { flow, isEdit, updateFlow, uploadContent } = this.props
|
const { flow, isEdit, updateFlow, uploadContent } = this.props
|
||||||
|
let noContent = !isEdit && (flow.response.contentLength == 0 || flow.response.contentLength == null)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="response">
|
<section className="response flowview-container">
|
||||||
<ToggleEdit/>
|
<div className="flowview-body">
|
||||||
<ResponseLine
|
<ToggleEdit/>
|
||||||
flow={flow}
|
<ResponseLine
|
||||||
readonly={!isEdit}
|
flow={flow}
|
||||||
updateFlow={updateFlow}/>
|
readonly={!isEdit}
|
||||||
<Headers
|
updateFlow={updateFlow}/>
|
||||||
message={flow.response}
|
<Headers
|
||||||
readonly={!isEdit}
|
message={flow.response}
|
||||||
onChange={headers => updateFlow({ response: { headers } })}
|
readonly={!isEdit}
|
||||||
/>
|
onChange={headers => updateFlow({ response: { headers } })}
|
||||||
<hr/>
|
/>
|
||||||
<ContentView
|
<hr/>
|
||||||
readonly={!isEdit}
|
<ContentView
|
||||||
flow={flow}
|
readonly={!isEdit}
|
||||||
onContentChange={content => updateFlow({ response: {content}})}
|
flow={flow}
|
||||||
uploadContent={content => uploadContent(flow, content, "response")}
|
onContentChange={content => updateFlow({ response: {content}})}
|
||||||
message={flow.response}
|
message={flow.response}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
|
<div hidden={noContent} className="flowview-footer">
|
||||||
|
<ContentViewOptions
|
||||||
|
flow={flow}
|
||||||
|
message={flow.response}
|
||||||
|
uploadContent={content => uploadContent(flow, content, "response")}
|
||||||
|
readonly={!isEdit}/>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user