diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | ui/app/actions.js | 11 | ||||
-rw-r--r-- | ui/app/components/pending-tx.js | 35 | ||||
-rw-r--r-- | ui/app/conf-tx.js | 7 |
4 files changed, 39 insertions, 15 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e1956ad5..50de1a465 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Current Master - Readded loose keyring label back into the account list. +- Added button to reject all transactions (thanks [davidp94](https://github.com/davidp94)!) - Remove cryptonator from chrome permissions. - Add info on token contract addresses. - Add validation preventing users from inputting their own addresses as token tracking addresses. diff --git a/ui/app/actions.js b/ui/app/actions.js index eebe65ba2..e793e6a21 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -104,6 +104,7 @@ var actions = { txError: txError, nextTx: nextTx, previousTx: previousTx, + cancelAllTx: cancelAllTx, viewPendingTx: viewPendingTx, VIEW_PENDING_TX: 'VIEW_PENDING_TX', // app messages @@ -457,6 +458,16 @@ function cancelTx (txData) { } } +function cancelAllTx (txsData) { + return (dispatch) => { + txsData.forEach((txData, i) => { + background.cancelTransaction(txData.id, () => { + dispatch(actions.completedTx(txData.id)) + i === txsData.length - 1 ? dispatch(actions.goHome()) : null + }) + }) + } +} // // initialize screen // diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index 5324ccd64..4e7eeaecf 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -66,6 +66,7 @@ PendingTx.prototype.render = function () { const balanceBn = hexToBn(balance) const insufficientBalance = balanceBn.lt(maxCost) + const buyDisabled = insufficientBalance || !this.state.valid || !isValidAddress || this.state.submitting this.inputs = [] @@ -297,14 +298,6 @@ PendingTx.prototype.render = function () { margin: '14px 25px', }, }, [ - - - insufficientBalance ? - h('button.btn-green', { - onClick: props.buyEth, - }, 'Buy Ether') - : null, - h('button', { onClick: (event) => { this.resetGasFields() @@ -312,18 +305,30 @@ PendingTx.prototype.render = function () { }, }, 'Reset'), - // Accept Button - h('input.confirm.btn-green', { - type: 'submit', - value: 'SUBMIT', - style: { marginLeft: '10px' }, - disabled: insufficientBalance || !this.state.valid || !isValidAddress || this.state.submitting, - }), + // Accept Button or Buy Button + insufficientBalance ? h('button.btn-green', { onClick: props.buyEth }, 'Buy Ether') : + h('input.confirm.btn-green', { + type: 'submit', + value: 'SUBMIT', + style: { marginLeft: '10px' }, + disabled: buyDisabled, + }), h('button.cancel.btn-red', { onClick: props.cancelTransaction, }, 'Reject'), ]), + h('.flex-row.flex-space-around.conf-buttons', { + style: { + display: 'flex', + justifyContent: 'flex-end', + margin: '14px 25px', + }, + }, [ + h('button.cancel.btn-red', { + onClick: props.cancelAllTransactions, + }, 'Reject All'), + ]), ]), ]) ) diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index 34727ff78..8d819181f 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -105,6 +105,7 @@ ConfirmTxScreen.prototype.render = function () { buyEth: this.buyEth.bind(this, txParams.from || props.selectedAddress), sendTransaction: this.sendTransaction.bind(this), cancelTransaction: this.cancelTransaction.bind(this, txData), + cancelAllTransactions: this.cancelAllTransactions.bind(this, unconfTxList), signMessage: this.signMessage.bind(this, txData), signPersonalMessage: this.signPersonalMessage.bind(this, txData), cancelMessage: this.cancelMessage.bind(this, txData), @@ -151,6 +152,12 @@ ConfirmTxScreen.prototype.cancelTransaction = function (txData, event) { this.props.dispatch(actions.cancelTx(txData)) } +ConfirmTxScreen.prototype.cancelAllTransactions = function (unconfTxList, event) { + this.stopPropagation(event) + event.preventDefault() + this.props.dispatch(actions.cancelAllTx(unconfTxList)) +} + ConfirmTxScreen.prototype.signMessage = function (msgData, event) { log.info('conf-tx.js: signing message') var params = msgData.msgParams |