diff --git a/addon/web/client/src/App.js b/addon/web/client/src/App.js index 7ab7d1a..3b7eb01 100644 --- a/addon/web/client/src/App.js +++ b/addon/web/client/src/App.js @@ -4,6 +4,8 @@ import Form from 'react-bootstrap/Form' import Button from 'react-bootstrap/Button' import './App.css' +import BreakPoint from './components/BreakPoint' + import { FlowManager } from './flow' import { isTextResponse, getSize } from './utils' import { parseMessage, sendMessageEnum, buildMessageEdit, buildMessageMeta } from './message' @@ -20,10 +22,6 @@ class App extends React.Component { flow: null, flowTab: 'Headers', // Headers, Preview, Response - - // TODO: change to rules - interceptUriInputing: '', - interceptUri: '', } this.ws = null @@ -195,7 +193,7 @@ class App extends React.Component { } render() { - const { flows, interceptUriInputing, interceptUri } = this.state + const { flows } = this.state return (
@@ -216,23 +214,10 @@ class App extends React.Component {
-
- { - this.setState({ interceptUriInputing: e.target.value || '' }) - }}> - - { - interceptUri ? {`Intercept:${interceptUri}`} : null - } -
+ { + const msg = buildMessageMeta(sendMessageEnum.changeBreakPointRules, rules) + this.ws.send(msg) + }} />
diff --git a/addon/web/client/src/components/BreakPoint.js b/addon/web/client/src/components/BreakPoint.js new file mode 100644 index 0000000..00b63c0 --- /dev/null +++ b/addon/web/client/src/components/BreakPoint.js @@ -0,0 +1,109 @@ +import React from 'react' +import Button from 'react-bootstrap/Button' +import Modal from 'react-bootstrap/Modal' +import Form from 'react-bootstrap/Form' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' + +class BreakPoint extends React.Component { + constructor(props) { + super(props) + + this.state = { + show: false, + + rule: { + method: 'ALL', + url: '', + action: '1', + } + } + + this.handleClose = this.handleClose.bind(this) + this.handleShow = this.handleShow.bind(this) + this.handleSave = this.handleSave.bind(this) + } + + handleClose() { + this.setState({ show: false }) + } + + handleShow() { + this.setState({ show: true }) + } + + handleSave() { + const { rule } = this.state + const rules = [] + if (rule.url) { + rules.push({ + method: rule.method === 'ALL' ? '' : rule.method, + url: rule.url, + action: parseInt(rule.action) + }) + } + + this.props.onSave(rules) + this.handleClose() + } + + render() { + const { rule } = this.state + + return ( +
+ + + + + Set BreakPoint + + + +
+ + Method +
+ { this.setState({ rule: { ...rule, method: e.target.value } }) }}> + + + + + + + + + + + URL + { this.setState({ rule: { ...rule, url: e.target.value } }) }} /> + + + + Action + + { this.setState({ rule: { ...rule, action: e.target.value } }) }}> + + + + + + + + + + + + + + + + ) + } +} + +export default BreakPoint