mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-06-14 06:01:04 +00:00
Add network state to UI (#128)
This commit is contained in:
committed by
Maciej Hirsz
parent
1058cd965c
commit
8fa36118b5
@@ -35,7 +35,8 @@ export default class App extends React.Component<{}, State> {
|
||||
finalized: false,
|
||||
finalizedhash: false,
|
||||
blockpropagation: true,
|
||||
blocklasttime: false
|
||||
blocklasttime: false,
|
||||
networkstate: false,
|
||||
},
|
||||
(settings) => this.setState({ settings })
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import Identicon from 'polkadot-identicon';
|
||||
import { Types, Maybe, timestamp } from '@dotstats/common';
|
||||
import { formatNumber, milliOrSecond, secondsWithPrecision } from '../../utils';
|
||||
import { formatNumber, getHashData, milliOrSecond, secondsWithPrecision } from '../../utils';
|
||||
import { State as AppState, Node } from '../../state';
|
||||
import { PersistentSet } from '../../persist';
|
||||
import { Truncate } from './';
|
||||
@@ -281,6 +281,17 @@ export class Row extends React.Component<Row.Props, Row.State> {
|
||||
setting: 'blocklasttime',
|
||||
render: ({ blockTimestamp }) => <Ago when={blockTimestamp} />
|
||||
},
|
||||
{
|
||||
label: 'NetworkState',
|
||||
icon: networkIdIcon,
|
||||
width: 100,
|
||||
setting: 'networkstate',
|
||||
render: ({ id }) => {
|
||||
const chainLabel = getHashData().chain;
|
||||
const uri = encodeURI(`/network_state/${chainLabel}/${id}/`);
|
||||
return React.createElement('a', {href: uri, target: "_blank"}, "Network state");
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
public static Header = (props: HeaderProps) => {
|
||||
|
||||
@@ -174,6 +174,7 @@ export namespace State {
|
||||
blocktime: boolean;
|
||||
blockpropagation: boolean;
|
||||
blocklasttime: boolean;
|
||||
networkstate: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user