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 => {
Object.values(transactions)
.filter(tx => tx.transaction)
.map(tx => tx.transaction = outTransaction(tx.transaction));
.map(tx => {
tx.transaction = outTransaction(tx.transaction);
});
return transactions;
});
}

View File

@ -157,7 +157,7 @@ export default class Application extends Component {
transactions.map((tx, idx) => (
<Transaction
key={ tx.transaction.hash }
idx={ idx + 1}
idx={ idx + 1 }
isLocal={ tx.isLocal }
transaction={ tx.transaction }
stats={ tx.stats }

View File

@ -59,7 +59,7 @@ class BaseTransaction extends Component {
}
return (
<span title={ `${transaction.gasPrice.toFormat(0) } wei`}>
<span title={ `${transaction.gasPrice.toFormat(0)} wei` }>
{ api.util.fromWei(transaction.gasPrice, 'shannon').toFormat(2) }&nbsp;shannon
</span>
);
@ -72,7 +72,7 @@ class BaseTransaction extends Component {
return (
<span title={ `${transaction.gas.toFormat(0)} Gas` }>
{ transaction.gas.div(10**6).toFormat(3) }&nbsp;MGas
{ transaction.gas.div(10 ** 6).toFormat(3) }&nbsp;MGas
</span>
);
}
@ -137,13 +137,11 @@ export class Transaction extends BaseTransaction {
render () {
const { isLocal, stats, transaction, idx } = this.props;
const blockNo = new BigNumber(stats.firstSeen);
const clazz = classnames(styles.transaction, {
[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 (
<tr className={ clazz }>
@ -232,17 +230,29 @@ export class LocalTransaction extends BaseTransaction {
const { isResubmitting, gasPrice } = this.state;
this.setState({
isResubmitting: !isResubmitting,
isResubmitting: !isResubmitting
});
if (gasPrice === null) {
this.setState({
gasPrice: `0x${ transaction.gasPrice.toString(16) }`,
gas: `0x${ transaction.gas.toString(16) }`
gasPrice: `0x${transaction.gasPrice.toString(16)}`,
gas: `0x${transaction.gas.toString(16)}`
});
}
};
setGasPrice = el => {
this.setState({
gasPrice: el.target.value
});
};
setGas = el => {
this.setState({
gas: el.target.value
});
};
sendTransaction = () => {
const { transaction } = this.props;
const { gasPrice, gas } = this.state;
@ -317,18 +327,20 @@ export class LocalTransaction extends BaseTransaction {
const { details } = this.props;
let state = {
'pending': () => `In queue: Pending`,
'future': () => `In queue: Future`,
'mined': () => `Mined`,
'dropped': () => `Dropped because of queue limit`,
'invalid': () => `Transaction is invalid`,
'rejected': () => `Rejected: ${ details.error }`,
'replaced': () => `Replaced by ${ this.shortHash(details.hash) }`,
'pending': () => 'In queue: Pending',
'future': () => 'In queue: Future',
'mined': () => 'Mined',
'dropped': () => 'Dropped because of queue limit',
'invalid': () => 'Transaction is invalid',
'rejected': () => `Rejected: ${details.error}`,
'replaced': () => `Replaced by ${this.shortHash(details.hash)}`
}[this.props.status];
return state ? state() : 'unknown';
}
// TODO [ToDr] Gas Price / Gas selection is not needed
// when signer supports gasPrice/gas tunning.
renderResubmit () {
const { transaction } = this.props;
const { gasPrice, gas } = this.state;
@ -350,12 +362,12 @@ export class LocalTransaction extends BaseTransaction {
<input
type='text'
value={ gasPrice }
onChange={ el => this.setState({ gasPrice: el.target.value }) }
onChange={ this.setGasPrice }
/>
<input
type='text'
value={ gas }
onChange={ el => this.setState({ gas: el.target.value }) }
onChange={ this.setGas }
/>
</td>
<td colSpan='2'>