fix(explorer): minoxde details page (#1715)

* fix(explorer): minoxde details page

* feat(explorer): add mix_id column in mixnodes list
This commit is contained in:
Pierre Dommerc
2022-10-27 17:16:30 +02:00
committed by GitHub
parent 3ae9ea5de6
commit 8656abcbde
5 changed files with 30 additions and 7 deletions
+1
View File
@@ -24,6 +24,7 @@ pub(crate) enum MixnodeStatus {
pub(crate) struct PrettyDetailedMixNodeBond {
// I leave this to @MS to refactor this type as a lot of things here are redundant thanks to
// the existence of `MixNodeDetails`
pub mix_id: MixId,
pub location: Option<Location>,
pub status: MixnodeStatus,
pub pledge_amount: Coin,
+1
View File
@@ -154,6 +154,7 @@ impl ThreadsafeMixNodesCache {
let rewarding_info = &node.mixnode_details.rewarding_details;
PrettyDetailedMixNodeBond {
mix_id,
location: location.and_then(|l| l.location.clone()),
status: mixnodes_guard.determine_node_status(mix_id),
pledge_amount: truncate_reward(rewarding_info.operator, denom),
@@ -2,6 +2,7 @@
import { MixNodeResponse, MixNodeResponseItem, MixnodeStatus } from '../../typeDefs/explorer-api';
export type MixnodeRowType = {
mix_id: number;
id: string;
status: MixnodeStatus;
owner: string;
@@ -29,6 +30,7 @@ export function mixNodeResponseItemToMixnodeRowType(item: MixNodeResponseItem):
const profitPercentage = item.mix_node.profit_margin_percent || 0;
const stakeSaturation = typeof item.stake_saturation === 'number' ? item.stake_saturation * 100 : 0;
return {
mix_id: item.mix_id,
id: item.owner,
status: item.status,
owner: item.owner,
+25 -7
View File
@@ -81,6 +81,24 @@ export const PageMixnodes: React.FC = () => {
};
const columns: GridColDef[] = [
{
field: 'mix_id',
headerName: 'Mix ID',
renderHeader: () => <CustomColumnHeading headingTitle="Mix ID" />,
headerClassName: 'MuiDataGrid-header-override',
width: 100,
headerAlign: 'left',
renderCell: (params: GridRenderCellParams) => (
<MuiLink
sx={getCellStyles(theme, params.row)}
component={RRDLink}
to={`/network-components/mixnode/${params.value}`}
data-testid="mix-id"
>
{params.value}
</MuiLink>
),
},
{
field: 'identity_key',
headerName: 'Identity Key',
@@ -98,7 +116,7 @@ export const PageMixnodes: React.FC = () => {
<MuiLink
sx={getCellStyles(theme, params.row)}
component={RRDLink}
to={`/network-components/mixnode/${params.value}`}
to={`/network-components/mixnode/${params.row.mix_id}`}
data-testid="identity-link"
>
{splice(7, 29, params.value)}
@@ -118,7 +136,7 @@ export const PageMixnodes: React.FC = () => {
<MuiLink
sx={getCellStyles(theme, params.row)}
component={RRDLink}
to={`/network-components/mixnode/${params.row.identity_key}`}
to={`/network-components/mixnode/${params.row.mix_id}`}
>
{currencyToString(params.value)}
</MuiLink>
@@ -143,7 +161,7 @@ export const PageMixnodes: React.FC = () => {
...getCellStyles(theme, params.row, params.value > 100 ? 'theme.palette.warning.main' : undefined),
}}
component={RRDLink}
to={`/network-components/mixnode/${params.row.identity_key}`}
to={`/network-components/mixnode/${params.row.mix_id}`}
>
{`${params.value.toFixed(2)} %`}
</MuiLink>
@@ -161,7 +179,7 @@ export const PageMixnodes: React.FC = () => {
<MuiLink
sx={getCellStyles(theme, params.row)}
component={RRDLink}
to={`/network-components/mixnode/${params.row.identity_key}`}
to={`/network-components/mixnode/${params.row.mix_id}`}
>
{currencyToString(params.value)}
</MuiLink>
@@ -183,7 +201,7 @@ export const PageMixnodes: React.FC = () => {
<MuiLink
sx={{ ...getCellStyles(theme, params.row), textAlign: 'left' }}
component={RRDLink}
to={`/network-components/mixnode/${params.row.identity_key}`}
to={`/network-components/mixnode/${params.row.mix_id}`}
>
{params.value}
</MuiLink>
@@ -205,7 +223,7 @@ export const PageMixnodes: React.FC = () => {
<MuiLink
sx={{ ...getCellStyles(theme, params.row), textAlign: 'left' }}
component={RRDLink}
to={`/network-components/mixnode/${params.row.identity_key}`}
to={`/network-components/mixnode/${params.row.mix_id}`}
>
{params.value}
</MuiLink>
@@ -286,7 +304,7 @@ export const PageMixnodes: React.FC = () => {
<MuiLink
sx={getCellStyles(theme, params.row)}
component={RRDLink}
to={`/network-components/mixnode/${params.row.identity_key}`}
to={`/network-components/mixnode/${params.row.mix_id}`}
>
{params.value}
</MuiLink>
+1
View File
@@ -70,6 +70,7 @@ export const toMixnodeStatus = (status?: MixnodeStatusWithAll): MixnodeStatus |
};
export interface MixNodeResponseItem {
mix_id: number;
pledge_amount: Amount;
total_delegation: Amount;
owner: string;