From d1ba150ea79689a55898efa760f7d77ca5ed601c Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Thu, 18 Sep 2014 21:13:50 +0200 Subject: web: detailpane impl --- web/src/js/components/mainview.jsx.js | 69 +++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 web/src/js/components/mainview.jsx.js (limited to 'web/src/js/components/mainview.jsx.js') diff --git a/web/src/js/components/mainview.jsx.js b/web/src/js/components/mainview.jsx.js new file mode 100644 index 00000000..10ecfed0 --- /dev/null +++ b/web/src/js/components/mainview.jsx.js @@ -0,0 +1,69 @@ +/** @jsx React.DOM */ + +var MainView = React.createClass({ + getInitialState: function() { + return { + flows: [], + }; + }, + componentDidMount: function () { + console.log("get view"); + this.flowStore = FlowStore.getView(); + this.flowStore.addListener("change",this.onFlowChange); + }, + componentWillUnmount: function () { + this.flowStore.removeListener("change",this.onFlowChange); + this.flowStore.close(); + }, + onFlowChange: function () { + this.setState({ + flows: this.flowStore.getAll() + }); + }, + selectFlow: function(flow) { + if(flow){ + ReactRouter.replaceWith( + "flow", + { + flowId: flow.id, + detailTab: this.props.params.detailTab || "request" + } + ); + this.refs.flowTable.scrollIntoView(flow); + } else { + ReactRouter.replaceWith("flows"); + } + }, + selectDetailTab: function(panel) { + ReactRouter.replaceWith( + "flow", + { + flowId: this.props.params.flowId, + detailTab: panel + } + ); + }, + render: function() { + var selected = _.find(this.state.flows, { id: this.props.params.flowId }); + + var details = null; + if(selected){ + details = ( + + ); + } + + return ( +
+ + {details} +
+ ); + } +}); \ No newline at end of file -- cgit v1.2.3