diff --git a/embark-ui/src/components/ContractLogger.js b/embark-ui/src/components/ContractLogger.js index 91de4ff67..8de946927 100644 --- a/embark-ui/src/components/ContractLogger.js +++ b/embark-ui/src/components/ContractLogger.js @@ -7,13 +7,12 @@ import { Form } from "tabler-react"; -const ANY_STATE = 'Any'; -const TX_STATES = ['Success', 'Fail', ANY_STATE]; +const TX_STATES = {Success: '0x1', Fail: '0x0', Any: ''}; class ContractLogger extends React.Component { constructor(props) { super(props); - this.state = {method: '', event: '', status: ANY_STATE}; + this.state = {method: '', event: '', status: TX_STATES['Any']}; } getMethods() { @@ -45,9 +44,12 @@ class ContractLogger extends React.Component { contractLog.events = events; return contractLog; }).filter(contractLog => { - if (this.state.method || this.state.event || this.state.status !== ANY_STATE) { - return contractLog.status === '0x1' && this.state.status === 'Success' && - (this.state.method === contractLog.functionName || contractLog.events.includes(this.state.event)); + if (this.state.status && contractLog.status !== this.state.status) { + return false; + } + + if (this.state.method || this.state.event) { + return this.state.method === contractLog.functionName || contractLog.events.includes(this.state.event); } return true; @@ -77,14 +79,14 @@ class ContractLogger extends React.Component { - {TX_STATES.map(state => ( + {Object.keys(TX_STATES).map(key => ( this.updateState('status', event.target.value)} - checked={state === this.state.status} + checked={TX_STATES[key] === this.state.status} /> ))} @@ -114,7 +116,7 @@ class ContractLogger extends React.Component { return ( {`${log.name}.${log.functionName}(${log.paramString})`} - {log.events.join(' ')} + {log.events.join(', ')} {log.gasUsed} {log.blockNumber} {log.status}