Fixes pending/mined transactions in registry dApp (#3004)
* Fixing React Errors * Fixes pending and mined events in Registry dApp (#2930) * PR grumbles (#2930)
This commit is contained in:
parent
568a18d8bd
commit
8bf577e0fe
@ -36,6 +36,8 @@ export default class Accounts extends Component {
|
|||||||
render () {
|
render () {
|
||||||
const { all, selected } = this.props;
|
const { all, selected } = this.props;
|
||||||
|
|
||||||
|
const origin = { horizontal: 'right', vertical: 'top' };
|
||||||
|
|
||||||
const accountsButton = (
|
const accountsButton = (
|
||||||
<IconButton className={ styles.button }>
|
<IconButton className={ styles.button }>
|
||||||
{ selected
|
{ selected
|
||||||
@ -49,7 +51,9 @@ export default class Accounts extends Component {
|
|||||||
value={ selected ? this.renderAccount(selected) : null }
|
value={ selected ? this.renderAccount(selected) : null }
|
||||||
onChange={ this.onAccountSelect }
|
onChange={ this.onAccountSelect }
|
||||||
iconButtonElement={ accountsButton }
|
iconButtonElement={ accountsButton }
|
||||||
animated={ false }
|
|
||||||
|
anchorOrigin={ origin }
|
||||||
|
targetOrigin={ origin }
|
||||||
>
|
>
|
||||||
{ Object.values(all).map(this.renderAccount) }
|
{ Object.values(all).map(this.renderAccount) }
|
||||||
</IconMenu>
|
</IconMenu>
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
|
|
||||||
import getMuiTheme from 'material-ui/styles/getMuiTheme';
|
import getMuiTheme from 'material-ui/styles/getMuiTheme';
|
||||||
@ -35,6 +34,7 @@ export default class Application extends Component {
|
|||||||
muiTheme: PropTypes.object.isRequired,
|
muiTheme: PropTypes.object.isRequired,
|
||||||
api: PropTypes.object.isRequired
|
api: PropTypes.object.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
getChildContext () {
|
getChildContext () {
|
||||||
return { muiTheme, api: window.parity.api };
|
return { muiTheme, api: window.parity.api };
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,37 @@ export default class Events extends Component {
|
|||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { subscriptions, pending, accounts, contacts } = this.props;
|
const { subscriptions, pending, accounts, contacts } = this.props;
|
||||||
|
|
||||||
|
const eventsObject = this.props.events
|
||||||
|
.filter((e) => eventTypes[e.type])
|
||||||
|
.reduce((eventsObject, event) => {
|
||||||
|
const txHash = event.transaction;
|
||||||
|
|
||||||
|
if (
|
||||||
|
(eventsObject[txHash] && eventsObject[txHash].state === 'pending') ||
|
||||||
|
!eventsObject[txHash]
|
||||||
|
) {
|
||||||
|
eventsObject[txHash] = event;
|
||||||
|
}
|
||||||
|
|
||||||
|
return eventsObject;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
const events = Object
|
||||||
|
.values(eventsObject)
|
||||||
|
.sort((evA, evB) => {
|
||||||
|
if (evA.state === 'pending') {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evB.state === 'pending') {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return evB.timestamp - evA.timestamp;
|
||||||
|
})
|
||||||
|
.map((e) => eventTypes[e.type](e, accounts, contacts));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className={ styles.events }>
|
<Card className={ styles.events }>
|
||||||
<CardHeader title='Event Log' />
|
<CardHeader title='Event Log' />
|
||||||
@ -122,11 +153,7 @@ export default class Events extends Component {
|
|||||||
<CardText>
|
<CardText>
|
||||||
<table className={ styles.eventsList }>
|
<table className={ styles.eventsList }>
|
||||||
<tbody>
|
<tbody>
|
||||||
{
|
{ events }
|
||||||
this.props.events
|
|
||||||
.filter((e) => eventTypes[e.type])
|
|
||||||
.map((e) => eventTypes[e.type](e, accounts, contacts))
|
|
||||||
}
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</CardText>
|
</CardText>
|
||||||
|
@ -29,12 +29,19 @@ import styles from './names.css';
|
|||||||
const useSignerText = (<p>Use the <a href='/#/signer' className={ styles.link } target='_blank'>Signer</a> to authenticate the following changes.</p>);
|
const useSignerText = (<p>Use the <a href='/#/signer' className={ styles.link } target='_blank'>Signer</a> to authenticate the following changes.</p>);
|
||||||
|
|
||||||
const renderNames = (names) => {
|
const renderNames = (names) => {
|
||||||
const out = [];
|
const values = Object.values(names);
|
||||||
for (let name of names) {
|
|
||||||
out.push((<code>{ name }</code>), ', ');
|
return values
|
||||||
}
|
.map((name, index) => (
|
||||||
out.pop();
|
<span key={ index }>
|
||||||
return out;
|
<code>{ name }</code>
|
||||||
|
{
|
||||||
|
index < values.length - 1
|
||||||
|
? (<span>, </span>)
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
</span>
|
||||||
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderQueue = (queue) => {
|
const renderQueue = (queue) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user