Remove network state from frontend (#345)

This commit is contained in:
Squirrel
2021-06-04 08:38:15 +01:00
committed by GitHub
parent dc6509a7ae
commit 7ee8fe851f
8 changed files with 1 additions and 60 deletions
@@ -23,7 +23,6 @@ import {
BlockPropagationColumn,
LastBlockColumn,
UptimeColumn,
NetworkStateColumn,
} from './';
export type Column =
@@ -44,8 +43,7 @@ export type Column =
| typeof BlockTimeColumn
| typeof BlockPropagationColumn
| typeof LastBlockColumn
| typeof UptimeColumn
| typeof NetworkStateColumn;
| typeof UptimeColumn;
export namespace Column {
export interface Props {
@@ -1,44 +0,0 @@
import * as React from 'react';
import { Column } from './';
import { Node } from '../../../state';
import { Icon } from '../../';
import icon from '../../../icons/network.svg';
import externalLinkIcon from '../../../icons/link-external.svg';
import { getHashData } from '../../../utils';
const URI_BASE =
window.location.protocol === 'https:'
? `/network_state/`
: `http://${window.location.hostname}:8000/network_state/`;
export class NetworkStateColumn extends React.Component<Column.Props, {}> {
public static readonly label = 'Network State';
public static readonly icon = icon;
public static readonly width = 16;
public static readonly setting = 'networkstate';
public static readonly sortBy = null;
public shouldComponentUpdate(nextProps: Column.Props) {
// Network state link changes when the node does
return this.props.node !== nextProps.node;
}
render() {
const { id } = this.props.node;
const chainLabel = getHashData().chain;
if (!chainLabel) {
return <td className="Column">-</td>;
}
const uri = `${URI_BASE}${encodeURIComponent(chainLabel)}/${id}/`;
return (
<td className="Column">
<a className="Column--a" href={uri} target="_blank">
<Icon src={externalLinkIcon} />
</a>
</td>
);
}
}
@@ -17,4 +17,3 @@ export * from './BlockTimeColumn';
export * from './BlockPropagationColumn';
export * from './LastBlockColumn';
export * from './UptimeColumn';
export * from './NetworkStateColumn';
-2
View File
@@ -22,7 +22,6 @@ import {
BlockPropagationColumn,
LastBlockColumn,
UptimeColumn,
NetworkStateColumn,
} from './';
import './Row.css';
@@ -64,7 +63,6 @@ export class Row extends React.Component<Row.Props, Row.State> {
BlockPropagationColumn,
LastBlockColumn,
UptimeColumn,
NetworkStateColumn,
];
private renderedChangeRef = 0;