move debugger to sidebar; fix config issue

This commit is contained in:
Iuri Matias 2018-10-24 13:10:31 -04:00
parent 29ebd9c8e0
commit 5efda2c428
7 changed files with 47 additions and 31 deletions

View File

@ -57,12 +57,14 @@ class ContractDebugger extends Component {
render() { render() {
return ( return (
<div>
<Row> <Row>
<Col> <Col>
<Input name="txHash" id="txHash" onChange={(e) => this.handleChange(e)}/> <Input name="txHash" id="txHash" onChange={(e) => this.handleChange(e)}/>
<Button color="primary" onClick={(e) => this.debug(e)}>Debug Tx</Button> <Button color="primary" onClick={(e) => this.debug(e)}>Debug Tx</Button>
</Col> </Col>
</Row>
<Row>
<Col> <Col>
<Button color="light" className="btn-square debugButton jumpBack" alt="jump to previous breakpoint" onClick={(e) => this.debugJumpBack(e)}></Button> <Button color="light" className="btn-square debugButton jumpBack" alt="jump to previous breakpoint" onClick={(e) => this.debugJumpBack(e)}></Button>
<Button color="light" className="btn-square debugButton jumpForward" alt="jump to revious breakpoint" onClick={(e) => this.debugJumpForward(e)}></Button> <Button color="light" className="btn-square debugButton jumpForward" alt="jump to revious breakpoint" onClick={(e) => this.debugJumpForward(e)}></Button>
@ -71,7 +73,8 @@ class ContractDebugger extends Component {
<Button color="light" className="btn-square debugButton stepIntoForward" alt="step into" onClick={(e) => this.debugStepIntoForward(e)}></Button> <Button color="light" className="btn-square debugButton stepIntoForward" alt="step into" onClick={(e) => this.debugStepIntoForward(e)}></Button>
<Button color="light" className="btn-square debugButton stepIntoBack" alt="step out" onClick={(e) => this.debugStepIntoBackward(e)}></Button> <Button color="light" className="btn-square debugButton stepIntoBack" alt="step out" onClick={(e) => this.debugStepIntoBackward(e)}></Button>
</Col> </Col>
</Row>
<Row>
<Col> <Col>
<br /><strong>Scopes</strong> <br /><strong>Scopes</strong>
<div> <div>
@ -79,6 +82,7 @@ class ContractDebugger extends Component {
</div> </div>
</Col> </Col>
</Row> </Row>
</div>
); );
} }
} }

View File

@ -41,6 +41,9 @@ const TextEditorToolbar = (props) => (
Logger Logger
</Button> </Button>
<span className="mx-2">|</span> <span className="mx-2">|</span>
<Button size="sm" color="primary" onClick={() => props.openAsideTab('debugger')}>
Debugger
</Button>
</React.Fragment> </React.Fragment>
} }
<Button size="sm" color="primary" onClick={() => props.openAsideTab('browser')}> <Button size="sm" color="primary" onClick={() => props.openAsideTab('browser')}>

View File

@ -9,6 +9,7 @@ import {getContractsByPath} from "../reducers/selectors";
import ContractDetail from '../components/ContractDetail'; import ContractDetail from '../components/ContractDetail';
import ContractLoggerContainer from '../containers/ContractLoggerContainer'; import ContractLoggerContainer from '../containers/ContractLoggerContainer';
import ContractOverviewContainer from '../containers/ContractOverviewContainer'; import ContractOverviewContainer from '../containers/ContractOverviewContainer';
import ContractDebuggerContainer from '../containers/ContractDebuggerContainer';
class TextEditorAsideContainer extends Component { class TextEditorAsideContainer extends Component {
componentDidMount() { componentDidMount() {
@ -19,6 +20,17 @@ class TextEditorAsideContainer extends Component {
switch(this.props.currentAsideTab) { switch(this.props.currentAsideTab) {
case 'browser': case 'browser':
return <Preview /> return <Preview />
case 'debugger':
return this.props.contracts.map((contract, index) => {
return (
<Card>
<CardBody>
<CardTitle style={{"font-size": "2em"}}>{contract.className} - Details</CardTitle>
<ContractDebuggerContainer key={index} contract={contract} />
</CardBody>
</Card>
)
})
case 'detail': case 'detail':
return this.props.contracts.map((contract, index) => { return this.props.contracts.map((contract, index) => {
return ( return (

View File

@ -12,12 +12,14 @@ const TextEditorContainer = (props) => (
<TextEditor file={props.currentFile} <TextEditor file={props.currentFile}
breakpoints={props.breakpoints} breakpoints={props.breakpoints}
toggleBreakpoint={props.toggleBreakpoint} toggleBreakpoint={props.toggleBreakpoint}
debuggerLine={props.debuggerLine}
onFileContentChange={props.onFileContentChange} /> onFileContentChange={props.onFileContentChange} />
) )
function mapStateToProps(state, props) { function mapStateToProps(state, props) {
const breakpoints = getBreakpointsByFilename(state, props.currentFile.name); const breakpoints = getBreakpointsByFilename(state, props.currentFile.name);
return {breakpoints}; const debuggerLine = getDebuggerLine(state);
return {breakpoints, debuggerLine};
} }
TextEditorContainer.propTypes = { TextEditorContainer.propTypes = {

View File

@ -11,7 +11,7 @@ contract SimpleStorage {
function set(uint x) public { function set(uint x) public {
storedData = x; storedData = x;
require(msg.sender != owner); require(msg.sender == 0x0);
storedData = x + 2; storedData = x + 2;
} }

View File

@ -4,7 +4,7 @@ import React, { Component } from 'react';
import EmbarkJS from 'Embark/EmbarkJS'; import EmbarkJS from 'Embark/EmbarkJS';
import SimpleStorage from 'Embark/contracts/SimpleStorage'; import SimpleStorage from 'Embark/contracts/SimpleStorage';
import Test from 'Embark/contracts/Test'; import Test from 'Embark/contracts/Test';
import Assert from 'Embark/contracts/Assert'; //import Assert from 'Embark/contracts/Assert';
import SimpleStorageTest from 'Embark/contracts/SimpleStorageTest'; import SimpleStorageTest from 'Embark/contracts/SimpleStorageTest';
window.SimpleStorageTest = SimpleStorageTest window.SimpleStorageTest = SimpleStorageTest
@ -26,7 +26,7 @@ import { Navbar, Jumbotron, Button } from 'react-bootstrap';
window.EmbarkJS = EmbarkJS; window.EmbarkJS = EmbarkJS;
window.SimpleStorage = SimpleStorage; window.SimpleStorage = SimpleStorage;
window.Test = Test; window.Test = Test;
window.Assert = Assert; //window.Assert = Assert;
window.React = React; window.React = React;

View File

@ -18,11 +18,6 @@
"nodiscover": true, "nodiscover": true,
"maxpeers": 0, "maxpeers": 0,
"targetGasLimit": 8000000, "targetGasLimit": 8000000,
"account": {
"numAccounts": 3,
"balance": "5 ether",
"password": "config/privatenet/password"
},
"proxy": true "proxy": true
}, },
"privatenet": { "privatenet": {