Add network state to UI (#128)

This commit is contained in:
Gregory Terzian
2019-03-26 04:22:43 +08:00
committed by Maciej Hirsz
parent 1058cd965c
commit 8fa36118b5
5 changed files with 43 additions and 3 deletions
+2 -1
View File
@@ -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 })
);
+12 -1
View File
@@ -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) => {
+1
View File
@@ -174,6 +174,7 @@ export namespace State {
blocktime: boolean;
blockpropagation: boolean;
blocklasttime: boolean;
networkstate: boolean;
}
}