Fixing JS lints

This commit is contained in:
Tomasz Drwięga 2016-11-17 14:00:53 +01:00
parent 5c62e38a7c
commit be6eb79296
3 changed files with 33 additions and 19 deletions

View File

@ -135,7 +135,9 @@ export default class Parity {
.then(transactions => { .then(transactions => {
Object.values(transactions) Object.values(transactions)
.filter(tx => tx.transaction) .filter(tx => tx.transaction)
.map(tx => tx.transaction = outTransaction(tx.transaction)); .map(tx => {
tx.transaction = outTransaction(tx.transaction);
});
return transactions; return transactions;
}); });
} }

View File

@ -137,13 +137,11 @@ export class Transaction extends BaseTransaction {
render () { render () {
const { isLocal, stats, transaction, idx } = this.props; const { isLocal, stats, transaction, idx } = this.props;
const blockNo = new BigNumber(stats.firstSeen);
const clazz = classnames(styles.transaction, { const clazz = classnames(styles.transaction, {
[styles.local]: isLocal [styles.local]: isLocal
}); });
const noOfPeers = Object.keys(stats.propagatedTo).length;
const noOfPropagations = Object.values(stats.propagatedTo).reduce((sum, val) => sum + val, 0);
const blockNo = new BigNumber(stats.firstSeen);
return ( return (
<tr className={ clazz }> <tr className={ clazz }>
@ -232,7 +230,7 @@ export class LocalTransaction extends BaseTransaction {
const { isResubmitting, gasPrice } = this.state; const { isResubmitting, gasPrice } = this.state;
this.setState({ this.setState({
isResubmitting: !isResubmitting, isResubmitting: !isResubmitting
}); });
if (gasPrice === null) { if (gasPrice === null) {
@ -243,6 +241,18 @@ export class LocalTransaction extends BaseTransaction {
} }
}; };
setGasPrice = el => {
this.setState({
gasPrice: el.target.value
});
};
setGas = el => {
this.setState({
gas: el.target.value
});
};
sendTransaction = () => { sendTransaction = () => {
const { transaction } = this.props; const { transaction } = this.props;
const { gasPrice, gas } = this.state; const { gasPrice, gas } = this.state;
@ -317,18 +327,20 @@ export class LocalTransaction extends BaseTransaction {
const { details } = this.props; const { details } = this.props;
let state = { let state = {
'pending': () => `In queue: Pending`, 'pending': () => 'In queue: Pending',
'future': () => `In queue: Future`, 'future': () => 'In queue: Future',
'mined': () => `Mined`, 'mined': () => 'Mined',
'dropped': () => `Dropped because of queue limit`, 'dropped': () => 'Dropped because of queue limit',
'invalid': () => `Transaction is invalid`, 'invalid': () => 'Transaction is invalid',
'rejected': () => `Rejected: ${details.error}`, 'rejected': () => `Rejected: ${details.error}`,
'replaced': () => `Replaced by ${ this.shortHash(details.hash) }`, 'replaced': () => `Replaced by ${this.shortHash(details.hash)}`
}[this.props.status]; }[this.props.status];
return state ? state() : 'unknown'; return state ? state() : 'unknown';
} }
// TODO [ToDr] Gas Price / Gas selection is not needed
// when signer supports gasPrice/gas tunning.
renderResubmit () { renderResubmit () {
const { transaction } = this.props; const { transaction } = this.props;
const { gasPrice, gas } = this.state; const { gasPrice, gas } = this.state;
@ -350,12 +362,12 @@ export class LocalTransaction extends BaseTransaction {
<input <input
type='text' type='text'
value={ gasPrice } value={ gasPrice }
onChange={ el => this.setState({ gasPrice: el.target.value }) } onChange={ this.setGasPrice }
/> />
<input <input
type='text' type='text'
value={ gas } value={ gas }
onChange={ el => this.setState({ gas: el.target.value }) } onChange={ this.setGas }
/> />
</td> </td>
<td colSpan='2'> <td colSpan='2'>