Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

Commit

Permalink
fix: default validators store method returns all validators
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-calavera authored and sunnygleason committed Sep 9, 2019
1 parent 632d35d commit fda3c89
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/v2/components/TourDeSol/Cards/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const Cards = ({
}) => {
const classes = useStyles();
const {
validators,
activeValidators,
inactiveValidators,
supply,
totalStaked,
Expand Down Expand Up @@ -77,7 +77,7 @@ const Cards = ({
},
{
title: 'Active Validators',
value: validators.length,
value: activeValidators.length,
changes: '',
period: 'since yesterday',
helpText:
Expand Down
8 changes: 4 additions & 4 deletions src/v2/components/TourDeSol/Table/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const ValidatorsTable = ({separate}: {separate: boolean}) => {
const classes = useStyles();
const theme = useTheme();
const showTable = useMediaQuery(theme.breakpoints.up('md'));
const {validators} = NodesStore;
const {activeValidators} = NodesStore;

const renderRow = row => {
const uptime = getUptime(row);
Expand Down Expand Up @@ -82,7 +82,7 @@ const ValidatorsTable = ({separate}: {separate: boolean}) => {
term=""
/>
</Typography>
<Typography variant="h5">{validators.length}</Typography>
<Typography variant="h5">{activeValidators.length}</Typography>
{!separate && (
<Link to="/validators/all" className={classes.link}>
See all &gt;
Expand All @@ -104,12 +104,12 @@ const ValidatorsTable = ({separate}: {separate: boolean}) => {
root: classes.body,
}}
>
{map(renderRow)(validators)}
{map(renderRow)(activeValidators)}
</TableBody>
</Table>
) : (
<div className={cn(classes.list, separate && classes.vertical)}>
{map(renderCard)(validators)}
{map(renderCard)(activeValidators)}
</div>
)}
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/v2/components/Validators/All/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import ValidatorsTable from '../Table';
import useStyles from './styles';

const ValidatorsAll = () => {
const {validators, inactiveValidators} = NodesStore;
const {activeValidators, inactiveValidators} = NodesStore;
const classes = useStyles();
return (
<Container>
<SectionHeader title="Validators">
<div className={classes.total}>
{validators.length + inactiveValidators.length}
{activeValidators.length + inactiveValidators.length}
</div>
</SectionHeader>
<ValidatorsTable separate />
Expand Down
8 changes: 4 additions & 4 deletions src/v2/components/Validators/Table/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const ValidatorsTable = ({separate}: {separate: boolean}) => {
const classes = useStyles();
const theme = useTheme();
const showTable = useMediaQuery(theme.breakpoints.up('md'));
const {validators, inactiveValidators} = NodesStore;
const {activeValidators, inactiveValidators} = NodesStore;
const renderRow = row => {
const uptime = row.uptime && getUptime(row);
const {identity = {}, nodePubkey, activatedStake, commission} = row;
Expand Down Expand Up @@ -88,7 +88,7 @@ const ValidatorsTable = ({separate}: {separate: boolean}) => {
<div className={classes.header}>
<Typography>Validators</Typography>
<Typography variant="h5">
{validators.length + inactiveValidators.length}
{activeValidators.length + inactiveValidators.length}
</Typography>

<Link to="/validators/all" className={classes.link}>
Expand All @@ -111,13 +111,13 @@ const ValidatorsTable = ({separate}: {separate: boolean}) => {
root: classes.body,
}}
>
{map(renderRow)(validators)}
{map(renderRow)(activeValidators)}
{map(renderRow)(inactiveValidators)}
</TableBody>
</Table>
) : (
<div className={cn(classes.list, separate && classes.vertical)}>
{map(renderCard)(validators)}
{map(renderCard)(activeValidators)}
{map(renderCard)(inactiveValidators)}
</div>
)}
Expand Down
5 changes: 5 additions & 0 deletions src/v2/stores/nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class Store {
}

get validators() {
return filter(node => node.what === 'Validator')(this.network);
}

get activeValidators() {
return filter(node => node.what === 'Validator' && node.activatedStake)(
this.network,
);
Expand All @@ -73,6 +77,7 @@ decorate(Store, {
updateClusterInfo: action.bound,
mapMarkers: computed,
validators: computed,
activeValidators: computed,
inactiveValidators: computed,
fetchClusterInfo: action.bound,
});
Expand Down

0 comments on commit fda3c89

Please sign in to comment.