* ui-signer pureComponentify * ui-react pureCompify * Status queue prop * ui-app Button * ui-app InputExtrinsic * apps, app-rpc, ui-app, ui-react * app-extrinsics, app-explorer, apps * fixes for tslint * more linter fixes * Update index.tsx * Update index.tsx * Update Nonce.tsx * Update index.tsx * Update Results.tsx * Update index.tsx * Update Queries.tsx * Update NodeInfo.tsx * Update index.tsx * Update Item.tsx * style fixes * TSLINTs
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
// Copyright 2017-2018 @polkadot/app-rpc authors & contributors
|
|
// This software may be modified and distributed under the terms
|
|
// of the ISC license. See the LICENSE file for details.
|
|
|
|
import { BareProps } from '@polkadot/ui-app/types';
|
|
import { QueueTx } from '@polkadot/ui-signer/types';
|
|
|
|
import React from 'react';
|
|
|
|
import Output from '@polkadot/ui-app/Output';
|
|
import classes from '@polkadot/ui-app/util/classes';
|
|
import isUndefined from '@polkadot/util/is/undefined';
|
|
|
|
import resultToText from './resultToText';
|
|
|
|
type Props = BareProps & {
|
|
queue: Array<QueueTx>
|
|
};
|
|
|
|
export default class Results extends React.PureComponent<Props> {
|
|
render () {
|
|
const { className, queue = [], style } = this.props;
|
|
|
|
const filtered = queue
|
|
.filter(({ error, result }) =>
|
|
!isUndefined(error) || !isUndefined(result)
|
|
)
|
|
.reverse();
|
|
|
|
if (!filtered.length) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<div
|
|
className={classes('rpc--Results', className)}
|
|
style={style}
|
|
>
|
|
{filtered.map(({ error, id, result, rpc: { section, name } }) => (
|
|
<Output
|
|
isError={!!error}
|
|
key={id}
|
|
label={`${id}: ${section}.${name}`}
|
|
value={
|
|
error
|
|
? error.message
|
|
: resultToText(result)
|
|
}
|
|
/>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|
|
}
|