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