From 665491a00b610d423fac76675a88151b668ce5b1 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 20 May 2019 11:09:17 +0200 Subject: [PATCH] keep only "tx hash" input --- src/app/debugger/debuggerUI/TxBrowser.js | 30 ++++++++++-------------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/app/debugger/debuggerUI/TxBrowser.js b/src/app/debugger/debuggerUI/TxBrowser.js index 90a957fbca..6cdcc45e85 100644 --- a/src/app/debugger/debuggerUI/TxBrowser.js +++ b/src/app/debugger/debuggerUI/TxBrowser.js @@ -40,31 +40,28 @@ var css = csjs` function TxBrowser () { this.event = new EventManager() - this.blockNumber - this.txNumber + this.state = { + txNumber: undefined, + debugging: false + } this.view - this.debugging = false } TxBrowser.prototype.submit = function () { - if (this.debugging) { + if (this.state.debugging) { this.unload() } else { - this.event.trigger('requestDebug', [this.blockNumber, this.txNumber]) + this.event.trigger('requestDebug', [undefined, this.state.txNumber]) } yo.update(this.view, this.render()) } -TxBrowser.prototype.updateBlockN = function (ev) { - this.blockNumber = ev.target.value -} - TxBrowser.prototype.updateTxN = function (ev) { - this.txNumber = ev.target.value + this.state.txNumber = ev.target.value } TxBrowser.prototype.load = function (txHash, tx) { - this.txNumber = txHash + this.state.txNumber = txHash } TxBrowser.prototype.unload = function () { @@ -72,9 +69,7 @@ TxBrowser.prototype.unload = function () { } 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 + this.state = {...this.state, ...state} if (this.view) { yo.update(this.view, this.render()) } @@ -85,16 +80,15 @@ TxBrowser.prototype.render = function () { var view = yo`
- - +
- +
` - if (this.debugging) { + if (this.state.debugging) { view.querySelectorAll('input').forEach(element => { element.setAttribute('disabled', '') }) } if (!this.view) {