blob: ce755d1ece97e7ab61b56af192941e72f0eb4dbc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
import React, {Component} from 'react';
import './MainPane.scss';
import Connections from "./Connections";
import ConnectionContent from "../components/ConnectionContent";
import {Route, Switch, withRouter} from "react-router-dom";
import PcapPane from "../components/panels/PcapPane";
import backend from "../backend";
class MainPane extends Component {
constructor(props) {
super(props);
this.state = {
selectedConnection: null
};
}
componentDidMount() {
if ('id' in this.props.match.params) {
const id = this.props.match.params.id;
backend.get(`/api/connections/${id}`).then(res => {
if (res.status === 200) {
this.setState({selectedConnection: res});
}
});
}
}
render() {
return (
<div className="main-pane">
<div className="container-fluid">
<div className="row">
<div className="col-md-6 pane">
<Connections onSelected={(c) => this.setState({selectedConnection: c})} />
</div>
<div className="col-md-6 pl-0 pane">
<Switch>
<Route path="/pcaps" children={<PcapPane />} />
<Route children={<ConnectionContent connection={this.state.selectedConnection} />} />
</Switch>
</div>
</div>
</div>
</div>
);
}
}
export default withRouter(MainPane);
|