fix set disabled in debugger panel

pull/1/head
yann300 6 years ago committed by GitHub
parent 305a49c5b1
commit 2fe7b3b953
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/app/debugger/debuggerUI/TxBrowser.js

@ -62,6 +62,9 @@ TxBrowser.prototype.submit = function () {
TxBrowser.prototype.updateTxN = function (ev) { TxBrowser.prototype.updateTxN = function (ev) {
this.state.txNumber = ev.target.value this.state.txNumber = ev.target.value
if (this.view) {
yo.update(this.view, this.render())
}
} }
TxBrowser.prototype.load = function (txHash, tx) { TxBrowser.prototype.load = function (txHash, tx) {
@ -81,6 +84,7 @@ TxBrowser.prototype.setState = function (state) {
TxBrowser.prototype.render = function () { TxBrowser.prototype.render = function () {
var self = this var self = this
let action = yo`<button class='btn btn-primary btn-sm ${css.txbutton}' id='load' title='${this.state.debugging ? 'Stop' : 'Start'} debugging' onclick=${function () { self.submit() }}>${this.state.debugging ? 'Stop' : 'Start'} debugging</button>`
var view = yo`<div class="${css.container}"> var view = yo`<div class="${css.container}">
<div class="${css.txContainer}"> <div class="${css.txContainer}">
<div class="${css.txinputs} p-1 input-group"> <div class="${css.txinputs} p-1 input-group">
@ -94,7 +98,7 @@ TxBrowser.prototype.render = function () {
/> />
</div> </div>
<div class="${css.txbuttons} btn-group p-1"> <div class="${css.txbuttons} btn-group p-1">
<button class='btn btn-primary btn-sm ${css.txbutton}' disabled="${this.state.txNumber ? 'false' : 'true'}" id='load' title='${this.state.debugging ? 'Stop' : 'Start'} debugging' onclick=${function () { self.submit() }}>${this.state.debugging ? 'Stop' : 'Start'} debugging</button> ${action}
</div> </div>
</div> </div>
<span id='error'></span> <span id='error'></span>
@ -102,6 +106,9 @@ TxBrowser.prototype.render = function () {
if (this.state.debugging) { if (this.state.debugging) {
view.querySelectorAll('input').forEach(element => { element.setAttribute('disabled', '') }) view.querySelectorAll('input').forEach(element => { element.setAttribute('disabled', '') })
} }
if (!this.state.txNumber) {
action.setAttribute('disabled', 'disabled')
}
if (!this.view) { if (!this.view) {
this.view = view this.view = view
} }

Loading…
Cancel
Save