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"; import RulePane from "../components/panels/RulePane"; class MainPane extends Component { constructor(props) { super(props); this.state = { selectedConnection: null, loading: false }; } componentDidMount() { const match = this.props.location.pathname.match(/^\/connections\/([a-f0-9]{24})$/); if (match != null) { this.setState({loading: true}); backend.getJson(`/api/connections/${match[1]}`) .then(connection => this.setState({selectedConnection: connection, loading: false})) .catch(error => console.log(error)); } } render() { return (