blob: fa7798eb65b6494ea85976b7d3cf17405a7a3fc6 (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
|
import React, {Component} from 'react';
import './Connections.scss';
import axios from 'axios'
import Connection from "../components/Connection";
import Table from 'react-bootstrap/Table';
import {Redirect} from 'react-router';
class Connections extends Component {
constructor(props) {
super(props);
this.state = {
connections: [],
};
}
componentDidMount() {
axios.get("/api/connections").then(res => this.setState({connections: res.data}))
}
render() {
let redirect = ""
if (this.state.selected) {
redirect = <Redirect push to={"/connections/" + this.state.selected} />;
}
return (
<div className="connections">
<div className="connections-header-padding"/>
<Table borderless size="sm">
<thead>
<tr>
<th>service</th>
<th>srcip</th>
<th>dstip</th>
<th>srcport</th>
<th>dstport</th>
<th>duration</th>
<th>up</th>
<th>down</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{
this.state.connections.map(c =>
<Connection key={c.id} data={c} onSelected={() => this.setState({selected: c.id})}
selected={this.state.selected === c.id}/>
)
}
</tbody>
</Table>
{redirect}
</div>
);
}
}
export default Connections;
|