aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/views/MainPane.js
diff options
context:
space:
mode:
authorEmiliano Ciavatta2020-07-08 11:21:13 +0000
committerEmiliano Ciavatta2020-07-08 11:21:13 +0000
commit7d05d0cea014b370601546a30f9e616d1efe5178 (patch)
tree50e3e1a6f14cbd0a4a9f65a78e1e2cf79ab09287 /frontend/src/views/MainPane.js
parentbcf5a985996c9988315bad5c3b745af4e48726c5 (diff)
Add connections display formats
Diffstat (limited to 'frontend/src/views/MainPane.js')
-rw-r--r--frontend/src/views/MainPane.js27
1 files changed, 10 insertions, 17 deletions
diff --git a/frontend/src/views/MainPane.js b/frontend/src/views/MainPane.js
index e84f94c..69de725 100644
--- a/frontend/src/views/MainPane.js
+++ b/frontend/src/views/MainPane.js
@@ -3,32 +3,25 @@ import './MainPane.scss';
import Connections from "./Connections";
import ConnectionContent from "../components/ConnectionContent";
import {withRouter} from "react-router-dom";
-import axios from 'axios'
+import axios from 'axios';
class MainPane extends Component {
constructor(props) {
super(props);
this.state = {
- id: null,
+ selectedConnection: null
};
}
- componentDidUpdate() {
- if (this.props.match.params.id !== this.state.id) {
- const id = this.props.match.params.id;
- this.setState({id: id});
-
- axios.get(`/api/streams/${id}`).then(res => this.setState({connectionContent: res.data}));
- }
- }
-
componentDidMount() {
- if (this.props.match.params.id !== this.state.id) {
+ if ('id' in this.props.match.params) {
const id = this.props.match.params.id;
- this.setState({id: id});
-
- axios.get(`/api/streams/${id}`).then(res => this.setState({connectionContent: res.data}));
+ axios.get(`/api/connections/${id}`).then(res => {
+ if (res.status === 200) {
+ this.setState({selectedConnection: res.data});
+ }
+ });
}
}
@@ -38,10 +31,10 @@ class MainPane extends Component {
<div className="container-fluid">
<div className="row">
<div className="col-md-6 pane">
- <Connections/>
+ <Connections onSelected={(c) => this.setState({selectedConnection: c})} />
</div>
<div className="col-md-6 pl-0 pane">
- <ConnectionContent connectionPayload={this.state.connectionContent}/>
+ <ConnectionContent connection={this.state.selectedConnection}/>
</div>
</div>
</div>