From 4473168fe1c05a44856698b4709880f2145fda10 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 16 May 2019 15:08:18 +0200 Subject: [PATCH 1/5] fix removing el from plugin panel --- src/app/components/panel.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/components/panel.js b/src/app/components/panel.js index 0df5a4184c..844d670b88 100644 --- a/src/app/components/panel.js +++ b/src/app/components/panel.js @@ -93,6 +93,7 @@ export class AbstractPanel { const el = this.contents[name] delete this.contents[name] if (el) el.parentElement.removeChild(el) + if (name === this.active) this.active = undefined } /** From 610cc0f392a4c1394c7bb9c132e9768bc22bbb66 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 16 May 2019 15:09:52 +0200 Subject: [PATCH 2/5] Update TxBrowser --- src/app/debugger/debuggerUI.js | 3 +- src/app/debugger/debuggerUI/TxBrowser.js | 57 ++++++++++++------------ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/app/debugger/debuggerUI.js b/src/app/debugger/debuggerUI.js index 30f69c8f1d..425115eff0 100644 --- a/src/app/debugger/debuggerUI.js +++ b/src/app/debugger/debuggerUI.js @@ -128,10 +128,10 @@ class DebuggerUI { }) this.listenToEvents() - this.debugger.debug(blockNumber, txNumber, tx, () => { self.stepManager = new StepManagerUI(this.debugger.step_manager) self.vmDebugger = new VmDebugger(this.debugger.vmDebuggerLogic) + self.txBrowser.setState({ blockNumber, txNumber, debugging: true }) self.renderDebugger() }) }) @@ -167,6 +167,7 @@ class DebuggerUI { yo.update(this.stepManagerView, yo`
`) if (this.vmDebugger) this.vmDebugger.remove() if (this.stepManager) this.stepManager.remove() + if (this.txBrowser) this.txBrowser.setState({debugging: false}) this.vmDebugger = null this.stepManager = null this.event.trigger('traceUnloaded') diff --git a/src/app/debugger/debuggerUI/TxBrowser.js b/src/app/debugger/debuggerUI/TxBrowser.js index 6659a466f1..3d6430b1dc 100644 --- a/src/app/debugger/debuggerUI/TxBrowser.js +++ b/src/app/debugger/debuggerUI/TxBrowser.js @@ -43,32 +43,16 @@ function TxBrowser () { this.blockNumber this.txNumber this.view - this.setDefaultValues() + this.debugging = false } -TxBrowser.prototype.setDefaultValues = function () { - this.connectInfo = '' - if (this.view) { - yo.update(this.view, this.render()) - } -} - -TxBrowser.prototype.submit = function (tx) { - this.event.trigger('requestDebug', [this.blockNumber, this.txNumber, tx]) -} - -TxBrowser.prototype.update = function (error, tx) { - if (error) { - this.view.querySelector('#error').innerHTML = error - return +TxBrowser.prototype.submit = function () { + if (this.debugging) { + this.unload() + } else { + this.event.trigger('requestDebug', [this.blockNumber, this.txNumber]) } - - if (!tx) { - this.view.querySelector('#error').innerHTML = 'Cannot find transaction with reference. Block number: ' + this.blockNumber + '. Transaction index/hash: ' + this.txNumber - return - } - - this.view.querySelector('#error').innerHTML = '' + yo.update(this.view, this.render()) } TxBrowser.prototype.updateBlockN = function (ev) { @@ -83,9 +67,25 @@ TxBrowser.prototype.load = function (txHash, tx) { this.txNumber = txHash } -TxBrowser.prototype.unload = function (txHash) { +TxBrowser.prototype.unload = function () { this.event.trigger('unloadRequested') - this.setDefaultValues() +} + +TxBrowser.prototype.setState = function (state) { + if (state.debugging !== undefined) this.debugging = state.debugging + if (state.blockNumber !== undefined) this.blockNumber = state.blockNumber + if (state.txNumber !== undefined) this.txNumber = state.txNumber + if (this.view) { + yo.update(this.view, this.render()) + } +} + +TxBrowser.prototype.setTx = function (blockNumber, txNumber) { + this.blockNumber = blockNumber + this.txNumber = txNumber + if (this.view) { + yo.update(this.view, this.render()) + } } TxBrowser.prototype.render = function () { @@ -93,12 +93,11 @@ TxBrowser.prototype.render = function () { var view = yo`
- - + +
- - +
From 27b3922e42a69b89f7354430d4094e19912878b1 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 16 May 2019 15:10:07 +0200 Subject: [PATCH 3/5] fix unloading the debugger --- src/app/debugger/debuggerUI.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/debugger/debuggerUI.js b/src/app/debugger/debuggerUI.js index 425115eff0..27cf609a40 100644 --- a/src/app/debugger/debuggerUI.js +++ b/src/app/debugger/debuggerUI.js @@ -1,6 +1,7 @@ var TxBrowser = require('./debuggerUI/TxBrowser') var StepManagerUI = require('./debuggerUI/StepManager') var VmDebugger = require('./debuggerUI/VmDebugger') +var toaster = require('../ui/tooltip') var Debugger = require('remix-debug').TransactionDebugger @@ -104,14 +105,12 @@ class DebuggerUI { startDebugging (blockNumber, txNumber, tx) { const self = this - if (this.debugger) delete this.debugger + if (this.debugger) this.unLoad() let compilers = this.registry.get('compilersartefacts').api let lastCompilationResult if (compilers['__last']) lastCompilationResult = compilers['__last'] - // TODO debugging with source highlight is disabled. see line 98 - executionContext.detectNetwork((error, network) => { let web3 if (error || !network) { @@ -133,6 +132,9 @@ class DebuggerUI { self.vmDebugger = new VmDebugger(this.debugger.vmDebuggerLogic) self.txBrowser.setState({ blockNumber, txNumber, debugging: true }) self.renderDebugger() + }).catch((error) => { + toaster(error) + this.unLoad() }) }) } @@ -170,6 +172,7 @@ class DebuggerUI { if (this.txBrowser) this.txBrowser.setState({debugging: false}) this.vmDebugger = null this.stepManager = null + if (this.debugger) delete this.debugger this.event.trigger('traceUnloaded') } From 90a274959bf916cc91717093316bb154adab07dd Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 16 May 2019 15:10:18 +0200 Subject: [PATCH 4/5] styling --- src/app/debugger/debuggerUI/TxBrowser.js | 16 +++++----------- src/app/debugger/debuggerUI/VmDebugger.js | 2 ++ .../debuggerUI/vmDebugger/DropdownPanel.js | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/app/debugger/debuggerUI/TxBrowser.js b/src/app/debugger/debuggerUI/TxBrowser.js index 3d6430b1dc..90a957fbca 100644 --- a/src/app/debugger/debuggerUI/TxBrowser.js +++ b/src/app/debugger/debuggerUI/TxBrowser.js @@ -80,21 +80,13 @@ TxBrowser.prototype.setState = function (state) { } } -TxBrowser.prototype.setTx = function (blockNumber, txNumber) { - this.blockNumber = blockNumber - this.txNumber = txNumber - if (this.view) { - yo.update(this.view, this.render()) - } -} - TxBrowser.prototype.render = function () { var self = this var view = yo`
- - + +
@@ -102,7 +94,9 @@ TxBrowser.prototype.render = function () {
` - + if (this.debugging) { + view.querySelectorAll('input').forEach(element => { element.setAttribute('disabled', '') }) + } if (!this.view) { this.view = view } diff --git a/src/app/debugger/debuggerUI/VmDebugger.js b/src/app/debugger/debuggerUI/VmDebugger.js index 46c1e8f734..7c1ef392ba 100644 --- a/src/app/debugger/debuggerUI/VmDebugger.js +++ b/src/app/debugger/debuggerUI/VmDebugger.js @@ -16,8 +16,10 @@ var DropdownPanel = require('./vmDebugger/DropdownPanel') var css = csjs` .asmCode { + width: 100%; } .stepDetail { + width: 100%; } .vmheadView { margin-top:10px; diff --git a/src/app/debugger/debuggerUI/vmDebugger/DropdownPanel.js b/src/app/debugger/debuggerUI/vmDebugger/DropdownPanel.js index 6d67cfffcb..4c8f29b74c 100644 --- a/src/app/debugger/debuggerUI/vmDebugger/DropdownPanel.js +++ b/src/app/debugger/debuggerUI/vmDebugger/DropdownPanel.js @@ -121,7 +121,7 @@ DropdownPanel.prototype.render = function (overridestyle, node) {
` var view = yo` -
+