|
|
|
@ -2,7 +2,6 @@ import React from 'react'
|
|
|
|
|
import Table from 'react-bootstrap/Table'
|
|
|
|
|
import Form from 'react-bootstrap/Form'
|
|
|
|
|
import Button from 'react-bootstrap/Button'
|
|
|
|
|
import scrollMonitor from 'scrollmonitor'
|
|
|
|
|
import './App.css'
|
|
|
|
|
|
|
|
|
|
import BreakPoint from './components/BreakPoint'
|
|
|
|
@ -21,17 +20,14 @@ interface IState {
|
|
|
|
|
|
|
|
|
|
const wsReconnIntervals = [1, 1, 2, 2, 4, 4, 8, 8, 16, 16, 32, 32]
|
|
|
|
|
|
|
|
|
|
interface IProps {
|
|
|
|
|
pageBottom: HTMLElement
|
|
|
|
|
}
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
|
|
|
interface IProps {}
|
|
|
|
|
|
|
|
|
|
class App extends React.Component<IProps, IState> {
|
|
|
|
|
private flowMgr: FlowManager
|
|
|
|
|
private ws: WebSocket | null
|
|
|
|
|
private wsUnmountClose: boolean
|
|
|
|
|
|
|
|
|
|
private autoScore = false
|
|
|
|
|
|
|
|
|
|
private wsReconnCount = -1
|
|
|
|
|
|
|
|
|
|
constructor(props: IProps) {
|
|
|
|
@ -48,8 +44,6 @@ class App extends React.Component<IProps, IState> {
|
|
|
|
|
|
|
|
|
|
this.ws = null
|
|
|
|
|
this.wsUnmountClose = false
|
|
|
|
|
|
|
|
|
|
this.initScrollMonitor()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
@ -112,11 +106,7 @@ class App extends React.Component<IProps, IState> {
|
|
|
|
|
if (msg.type === MessageType.REQUEST) {
|
|
|
|
|
const flow = new Flow(msg)
|
|
|
|
|
this.flowMgr.add(flow)
|
|
|
|
|
this.setState({ flows: this.flowMgr.showList() }, () => {
|
|
|
|
|
if (this.autoScore) {
|
|
|
|
|
this.props.pageBottom.scrollIntoView({ behavior: 'auto' })
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.setState({ flows: this.flowMgr.showList() })
|
|
|
|
|
}
|
|
|
|
|
else if (msg.type === MessageType.REQUEST_BODY) {
|
|
|
|
|
const flow = this.flowMgr.get(msg.id)
|
|
|
|
@ -139,16 +129,6 @@ class App extends React.Component<IProps, IState> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initScrollMonitor() {
|
|
|
|
|
const watcher = scrollMonitor.create(this.props.pageBottom)
|
|
|
|
|
watcher.enterViewport(() => {
|
|
|
|
|
this.autoScore = true
|
|
|
|
|
})
|
|
|
|
|
watcher.exitViewport(() => {
|
|
|
|
|
this.autoScore = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const { flows } = this.state
|
|
|
|
|
return (
|
|
|
|
@ -179,38 +159,41 @@ class App extends React.Component<IProps, IState> {
|
|
|
|
|
<span>status: {this.state.wsStatus}</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<Table striped bordered size="sm" style={{ tableLayout: 'fixed' }}>
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th style={{ width: '50px' }}>No</th>
|
|
|
|
|
<th style={{ width: '80px' }}>Method</th>
|
|
|
|
|
<th style={{ width: '200px' }}>Host</th>
|
|
|
|
|
<th style={{ width: 'auto' }}>Path</th>
|
|
|
|
|
<th style={{ width: '150px' }}>Type</th>
|
|
|
|
|
<th style={{ width: '80px' }}>Status</th>
|
|
|
|
|
<th style={{ width: '90px' }}>Size</th>
|
|
|
|
|
<th style={{ width: '90px' }}>Time</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
{
|
|
|
|
|
flows.map(f => {
|
|
|
|
|
const fp = f.preview()
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<FlowPreview
|
|
|
|
|
key={fp.id}
|
|
|
|
|
flow={fp}
|
|
|
|
|
isSelected={(this.state.flow && this.state.flow.id === fp.id) ? true : false}
|
|
|
|
|
onShowDetail={() => {
|
|
|
|
|
this.setState({ flow: f })
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</tbody>
|
|
|
|
|
</Table>
|
|
|
|
|
<div className="table-wrap-div">
|
|
|
|
|
<Table striped bordered size="sm" style={{ tableLayout: 'fixed' }}>
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th style={{ width: '50px' }}>No</th>
|
|
|
|
|
<th style={{ width: '80px' }}>Method</th>
|
|
|
|
|
<th style={{ width: '200px' }}>Host</th>
|
|
|
|
|
<th style={{ width: 'auto' }}>Path</th>
|
|
|
|
|
<th style={{ width: '150px' }}>Type</th>
|
|
|
|
|
<th style={{ width: '80px' }}>Status</th>
|
|
|
|
|
<th style={{ width: '90px' }}>Size</th>
|
|
|
|
|
<th style={{ width: '90px' }}>Time</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
{
|
|
|
|
|
flows.map(f => {
|
|
|
|
|
const fp = f.preview()
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<FlowPreview
|
|
|
|
|
key={fp.id}
|
|
|
|
|
flow={fp}
|
|
|
|
|
isSelected={(this.state.flow && this.state.flow.id === fp.id) ? true : false}
|
|
|
|
|
onShowDetail={() => {
|
|
|
|
|
this.setState({ flow: f })
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</tbody>
|
|
|
|
|
</Table>
|
|
|
|
|
<div id="hidden-bottom" style={{ height: '0px', visibility: 'hidden' }}></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<ViewFlow
|
|
|
|
|
flow={this.state.flow}
|
|
|
|
|