From 7ee8fe851f1b5ef822d7df59402874341bec7dab Mon Sep 17 00:00:00 2001 From: Squirrel Date: Fri, 4 Jun 2021 08:38:15 +0100 Subject: [PATCH] Remove network state from frontend (#345) --- frontend/nginx/default | 7 --- frontend/src/App.tsx | 1 - frontend/src/common/types.ts | 1 - .../src/components/List/Column/Column.tsx | 4 +- .../List/Column/NetworkStateColumn.tsx | 44 ------------------- frontend/src/components/List/Column/index.ts | 1 - frontend/src/components/List/Row.tsx | 2 - frontend/src/state.ts | 1 - 8 files changed, 1 insertion(+), 60 deletions(-) delete mode 100644 frontend/src/components/List/Column/NetworkStateColumn.tsx diff --git a/frontend/nginx/default b/frontend/nginx/default index b2ad03a..26e9e04 100644 --- a/frontend/nginx/default +++ b/frontend/nginx/default @@ -39,13 +39,6 @@ server { limit_req zone=zone burst=5; } - location /network_state/ { - proxy_pass http://127.0.0.1:8000; - proxy_http_version 1.1; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - limit_req zone=zone burst=5; - } - location /health/ { proxy_pass http://127.0.0.1:8000; proxy_http_version 1.1; diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 65281e1..30c87c4 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -55,7 +55,6 @@ export default class App extends React.Component<{}, {}> { blockpropagation: true, blocklasttime: false, uptime: false, - networkstate: false, }, (settings) => { const selectedColumns = this.selectedColumns(settings); diff --git a/frontend/src/common/types.ts b/frontend/src/common/types.ts index eb8fdca..a4ca403 100644 --- a/frontend/src/common/types.ts +++ b/frontend/src/common/types.ts @@ -25,7 +25,6 @@ export type CPUUse = Opaque; export type Bytes = Opaque; export type BytesPerSecond = Opaque; export type NetworkId = Opaque; -export type NetworkState = Opaque; export type BlockDetails = [ BlockNumber, diff --git a/frontend/src/components/List/Column/Column.tsx b/frontend/src/components/List/Column/Column.tsx index b84d91d..6d1d948 100644 --- a/frontend/src/components/List/Column/Column.tsx +++ b/frontend/src/components/List/Column/Column.tsx @@ -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 { diff --git a/frontend/src/components/List/Column/NetworkStateColumn.tsx b/frontend/src/components/List/Column/NetworkStateColumn.tsx deleted file mode 100644 index 6f71397..0000000 --- a/frontend/src/components/List/Column/NetworkStateColumn.tsx +++ /dev/null @@ -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 { - 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 -; - } - - const uri = `${URI_BASE}${encodeURIComponent(chainLabel)}/${id}/`; - - return ( - - - - - - ); - } -} diff --git a/frontend/src/components/List/Column/index.ts b/frontend/src/components/List/Column/index.ts index 87cecdf..a080871 100644 --- a/frontend/src/components/List/Column/index.ts +++ b/frontend/src/components/List/Column/index.ts @@ -17,4 +17,3 @@ export * from './BlockTimeColumn'; export * from './BlockPropagationColumn'; export * from './LastBlockColumn'; export * from './UptimeColumn'; -export * from './NetworkStateColumn'; diff --git a/frontend/src/components/List/Row.tsx b/frontend/src/components/List/Row.tsx index b349fac..482f82b 100644 --- a/frontend/src/components/List/Row.tsx +++ b/frontend/src/components/List/Row.tsx @@ -22,7 +22,6 @@ import { BlockPropagationColumn, LastBlockColumn, UptimeColumn, - NetworkStateColumn, } from './'; import './Row.css'; @@ -64,7 +63,6 @@ export class Row extends React.Component { BlockPropagationColumn, LastBlockColumn, UptimeColumn, - NetworkStateColumn, ]; private renderedChangeRef = 0; diff --git a/frontend/src/state.ts b/frontend/src/state.ts index b5e6e81..6eee391 100644 --- a/frontend/src/state.ts +++ b/frontend/src/state.ts @@ -238,7 +238,6 @@ export namespace State { blockpropagation: boolean; blocklasttime: boolean; uptime: boolean; - networkstate: boolean; } export interface SortBy {