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

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

View File

@ -59,7 +59,7 @@ class BaseTransaction extends Component {
} }
return ( 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 { api.util.fromWei(transaction.gasPrice, 'shannon').toFormat(2) }&nbsp;shannon
</span> </span>
); );
@ -72,7 +72,7 @@ class BaseTransaction extends Component {
return ( return (
<span title={ `${transaction.gas.toFormat(0)} Gas` }> <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> </span>
); );
} }
@ -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,17 +230,29 @@ 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) {
this.setState({ this.setState({
gasPrice: `0x${ transaction.gasPrice.toString(16) }`, gasPrice: `0x${transaction.gasPrice.toString(16)}`,
gas: `0x${ transaction.gas.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 = () => { 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'>