From 137a8b584e9bf1d18e1fd8a465268efb603fe7f7 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 27 Jun 2016 19:29:50 +0200 Subject: [PATCH] - warn user if tx not invokation - better event name --- src/Ethdebugger.js | 24 ++++++++++++++++++++---- src/TxBrowser.js | 3 ++- src/styles/basicStyles.js | 3 +++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/Ethdebugger.js b/src/Ethdebugger.js index 64272d1e65..49b828548b 100644 --- a/src/Ethdebugger.js +++ b/src/Ethdebugger.js @@ -15,13 +15,19 @@ function Ethdebugger () { util.extend(this, new EventManager()) this.currentStepIndex = -1 this.tx + this.statusMessage = '' + + this.view this.web3 = init.loadWeb3() this.traceManager = new TraceManager(this.web3) var self = this this.txBrowser = new TxBrowser(this.web3) - this.txBrowser.register('newTxRequested', this, function (blockNumber, txIndex, tx) { + this.txBrowser.register('newTxLoading', this, function () { + self.unLoad() + }) + this.txBrowser.register('newTraceRequested', this, function (blockNumber, txIndex, tx) { self.startDebugging(blockNumber, txIndex, tx) }) this.txBrowser.register('unloadRequested', this, function (blockNumber, txIndex, tx) { @@ -36,8 +42,7 @@ function Ethdebugger () { } Ethdebugger.prototype.render = function () { - return ( - yo`
+ var view = yo`

VM Debugger

${this.txBrowser.render()} @@ -46,9 +51,13 @@ Ethdebugger.prototype.render = function () {
${this.sticker.render()}
+
${this.statusMessage}
${this.vmDebugger.render()}
` - ) + if (!this.view) { + this.view = view + } + return view } Ethdebugger.prototype.unLoad = function () { @@ -66,13 +75,20 @@ Ethdebugger.prototype.startDebugging = function (blockNumber, txIndex, tx) { if (this.traceManager.isLoading) { return } + this.statusMessage = 'Loading trace...' + yo.update(this.view, this.render()) console.log('loading trace...') this.tx = tx var self = this this.traceManager.resolveTrace(tx, function (error, result) { console.log('trace loaded ' + result + ' ' + error) if (result) { + self.statusMessage = '' + yo.update(self.view, self.render()) self.trigger('newTraceLoaded') + } else { + self.statusMessage = error + yo.update(self.view, self.render()) } }) } diff --git a/src/TxBrowser.js b/src/TxBrowser.js index 3e1e8b7e6b..82fc939778 100644 --- a/src/TxBrowser.js +++ b/src/TxBrowser.js @@ -40,6 +40,7 @@ TxBrowser.prototype.submit = function () { if (!this.txNumber) { return } + this.trigger('newTxLoading', [this.blockNumber, this.txNumber, tx]) var tx try { if (this.txNumber.indexOf('0x') !== -1) { @@ -58,7 +59,7 @@ TxBrowser.prototype.submit = function () { this.from = tx.from this.to = tx.to this.hash = tx.hash - this.trigger('newTxRequested', [this.blockNumber, this.txNumber, tx]) + this.trigger('newTraceRequested', [this.blockNumber, this.txNumber, tx]) } else { var mes = '' this.from = mes diff --git a/src/styles/basicStyles.js b/src/styles/basicStyles.js index 4cb06a09cf..4b9a22e614 100644 --- a/src/styles/basicStyles.js +++ b/src/styles/basicStyles.js @@ -7,6 +7,9 @@ module.exports = { 'margin': '10px', 'padding': '5px' }, + statusMessage: { + 'margin-left': '15px' + }, address: { 'font-style': 'italic' },