From 399c51c04831381da0b9013018763b43618de614 Mon Sep 17 00:00:00 2001 From: DavidNinja Date: Mon, 14 Aug 2017 21:29:21 -0700 Subject: [PATCH 1/3] cancel all txs --- ui/app/actions.js | 8 ++++++++ ui/app/conf-tx.js | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/ui/app/actions.js b/ui/app/actions.js index eafd04b4c..d5ee3cc31 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -105,6 +105,8 @@ var actions = { txError: txError, nextTx: nextTx, previousTx: previousTx, + cancelAllTx: cancelAllTx, + CANCEL_ALL_TX: 'CANCEL_ALL_TX', viewPendingTx: viewPendingTx, VIEW_PENDING_TX: 'VIEW_PENDING_TX', // app messages @@ -470,6 +472,12 @@ function cancelTx (txData) { } } +function cancelAllTx (txsData) { + return (dispatch) => { + txsData.forEach((txData) => dispatch(actions.cancelTx(txData))) + dispatch(actions.goHome()) + } +} // // initialize screen // diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index 34727ff78..d6ceb7ff5 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -89,6 +89,18 @@ ConfirmTxScreen.prototype.render = function () { }), ]), + h('h3', { + style: { + alignSelf: 'flex-end', + display: unconfTxList.length > 1 ? 'block' : 'none', + }, + }, [ + h('i.fa.fa-trash.fa-lg.cursor-pointer', { + title: 'Cancel All Pending Transactions', + onClick: () => props.dispatch(actions.cancelAllTx(unconfTxList)), + }), + ]), + warningIfExists(props.warning), currentTxView({ From 39424cdf457e8348b50dde2588ad173aa4787fca Mon Sep 17 00:00:00 2001 From: davidp94 Date: Mon, 14 Aug 2017 21:35:57 -0700 Subject: [PATCH 2/3] remove unused action type --- ui/app/actions.js | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/app/actions.js b/ui/app/actions.js index d5ee3cc31..3b6b87b00 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -106,7 +106,6 @@ var actions = { nextTx: nextTx, previousTx: previousTx, cancelAllTx: cancelAllTx, - CANCEL_ALL_TX: 'CANCEL_ALL_TX', viewPendingTx: viewPendingTx, VIEW_PENDING_TX: 'VIEW_PENDING_TX', // app messages From f52ef5d49657d126a2575c91c83481209e8ef0ab Mon Sep 17 00:00:00 2001 From: davidp94 Date: Mon, 14 Aug 2017 21:51:39 -0700 Subject: [PATCH 3/3] fix goHome --- ui/app/actions.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/app/actions.js b/ui/app/actions.js index 3b6b87b00..a692267cb 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -473,8 +473,12 @@ function cancelTx (txData) { function cancelAllTx (txsData) { return (dispatch) => { - txsData.forEach((txData) => dispatch(actions.cancelTx(txData))) - dispatch(actions.goHome()) + txsData.forEach((txData, i) => { + background.cancelTransaction(txData.id, () => { + dispatch(actions.completedTx(txData.id)) + i === txsData.length - 1 ? dispatch(actions.goHome()) : null + }) + }) } } //