Cleanup waiting count (direct from next list) (#1527)

This commit is contained in:
Jaco Greeff 2019-08-24 08:34:08 +02:00 committed by GitHub
parent 059c568dda
commit 1323886c2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View File

@ -15,20 +15,18 @@ import { withCalls, withMulti } from '@polkadot/react-api';
import translate from '../translate';
interface Props extends I18nProps {
className?: string;
allControllers: string[];
className?: string;
currentValidatorsControllersV1OrStashesV2: string[];
lastAuthor?: string;
lastBlock: string;
staking_validatorCount?: BN;
currentValidatorsControllersV1OrStashesV2: string[];
next: string[];
}
class Summary extends React.PureComponent<Props> {
public render (): React.ReactNode {
const { className, allControllers, lastAuthor, lastBlock, style, t, staking_validatorCount, currentValidatorsControllersV1OrStashesV2 } = this.props;
const waiting = allControllers.length > currentValidatorsControllersV1OrStashesV2.length
? (allControllers.length - currentValidatorsControllersV1OrStashesV2.length)
: allControllers.length;
const { className, currentValidatorsControllersV1OrStashesV2, lastAuthor, lastBlock, next, style, staking_validatorCount, t } = this.props;
return (
<SummaryBox
@ -40,7 +38,7 @@ class Summary extends React.PureComponent<Props> {
{currentValidatorsControllersV1OrStashesV2.length}/{staking_validatorCount ? staking_validatorCount.toString() : '-'}
</CardSummary>
<CardSummary label={t('waiting')}>
{waiting}
{next.length}
</CardSummary>
</section>
<section>

View File

@ -16,9 +16,9 @@ import Summary from './Summary';
import { withApi } from '@polkadot/react-api';
import { ApiProps } from '@polkadot/react-api/types';
type Props = ApiProps & BareProps & ComponentProps & {
interface Props extends ApiProps, BareProps, ComponentProps {
chain_subscribeNewHead?: HeaderExtended;
};
}
class Overview extends React.PureComponent<Props> {
public render (): React.ReactNode {
@ -52,6 +52,7 @@ class Overview extends React.PureComponent<Props> {
currentValidatorsControllersV1OrStashesV2={currentValidatorsControllersV1OrStashesV2}
lastBlock={lastBlock}
lastAuthor={lastAuthor}
next={nextSorted}
/>
<CurrentList
currentValidatorsControllersV1OrStashesV2={currentValidatorsControllersV1OrStashesV2}