Fix local transactions without condition. (#5716)

This commit is contained in:
Tomasz Drwięga 2017-06-03 14:41:31 +02:00 committed by Gav Wood
parent 45d8cc706c
commit 5ec5d2fa0b

View File

@ -210,22 +210,24 @@ class TxRow extends Component {
if (!isCancelOpen && !isEditOpen) {
const pendingStatus = this.getCondition();
const isPending = pendingStatus === 'pending';
if (pendingStatus === 'submitting') {
return (
<div className={ styles.pending }>
{
isPending
? (
<div className={ styles.pending }>
<div />
<div className={ styles.uppercase }>
<FormattedMessage
id='ui.txList.txRow.submitting'
defaultMessage='Submitting'
defaultMessage='Pending'
/>
</div>
</div>
);
}
return (
<div className={ styles.pending }>
) : (
<div>
<span>
{ pendingStatus }
</span>
@ -235,6 +237,9 @@ class TxRow extends Component {
defaultMessage='Scheduled'
/>
</div>
</div>
)
}
<a onClick={ this.setEdit } className={ styles.uppercase }>
<FormattedMessage
id='ui.txList.txRow.edit'
@ -248,6 +253,16 @@ class TxRow extends Component {
defaultMessage='Cancel'
/>
</a>
{ isPending
? (
<div>
<FormattedMessage
id='ui.txList.txRow.cancelWarning'
defaultMessage='Warning: Editing or Canceling the transaction may not succeed!'
/>
</div>
) : null
}
</div>
);
}
@ -319,11 +334,10 @@ class TxRow extends Component {
getCondition = () => {
const { blockNumber, tx } = this.props;
let { time, block } = tx.condition || {};
let { time, block = 0 } = tx.condition || {};
if (time) {
if ((time.getTime() - Date.now()) >= 0) {
// return `${dateDifference(new Date(), time, { compact: true })} left`;
return (
<FormattedMessage
id='ui.txList.txRow.pendingStatus.time'
@ -333,14 +347,11 @@ class TxRow extends Component {
} }
/>
);
} else {
return 'submitting';
}
} else if (blockNumber && block) {
}
if (blockNumber) {
block = blockNumber.minus(block);
// return (block.toNumber() < 0)
// ? block.abs().toFormat(0) + ' blocks left'
// : 'submitting';
if (block.toNumber() < 0) {
return (
<FormattedMessage
@ -351,10 +362,10 @@ class TxRow extends Component {
} }
/>
);
} else {
return 'submitting';
}
}
return 'pending';
}
cancelTx = () => {