diff --git a/frontend/.eslintrc.json b/frontend/.eslintrc.json index 80b1f7e64..4bd145464 100644 --- a/frontend/.eslintrc.json +++ b/frontend/.eslintrc.json @@ -30,7 +30,7 @@ "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": [ "warn", - { + { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", "caughtErrorsIgnorePattern": "^_" diff --git a/frontend/Dockerfile.README.md b/frontend/Dockerfile.README.md index 017a63c81..c8d2305de 100644 --- a/frontend/Dockerfile.README.md +++ b/frontend/Dockerfile.README.md @@ -1,3 +1,3 @@ # substrate-telemetry-frontend -### [Documentation](https://github.com/paritytech/substrate-telemetry/blob/master/README.md) \ No newline at end of file +### [Documentation](https://github.com/paritytech/substrate-telemetry/blob/master/README.md) diff --git a/frontend/assets/index.html b/frontend/assets/index.html index 6eff0f347..be1c24ae3 100644 --- a/frontend/assets/index.html +++ b/frontend/assets/index.html @@ -1,23 +1,25 @@ - - - + + + Polkadot Telemetry - + - +
diff --git a/frontend/assets/mock.image.js b/frontend/assets/mock.image.js index 1b627634a..2c2042e78 100644 --- a/frontend/assets/mock.image.js +++ b/frontend/assets/mock.image.js @@ -1,3 +1,3 @@ // loading images gives back a path. This is what we replace // that with for tests: -module.exports = 'test-image-stub'; \ No newline at end of file +module.exports = 'test-image-stub'; diff --git a/frontend/assets/mock.style.js b/frontend/assets/mock.style.js index 44feea96e..110f10ba1 100644 --- a/frontend/assets/mock.style.js +++ b/frontend/assets/mock.style.js @@ -1,2 +1,2 @@ // For loading styles, give back an empty object in tests: -module.exports = {}; \ No newline at end of file +module.exports = {}; diff --git a/frontend/images.d.ts b/frontend/images.d.ts index fd9ba477f..aa6feaf0d 100644 --- a/frontend/images.d.ts +++ b/frontend/images.d.ts @@ -14,6 +14,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -declare module '*.svg' -declare module '*.png' -declare module '*.jpg' +declare module '*.svg'; +declare module '*.png'; +declare module '*.jpg'; diff --git a/frontend/jest.config.js b/frontend/jest.config.js index e35734749..e69f909b3 100644 --- a/frontend/jest.config.js +++ b/frontend/jest.config.js @@ -20,7 +20,8 @@ module.exports = { testEnvironment: 'jsdom', setupFiles: ['/setupJest.js'], moduleNameMapper: { - "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/assets/mock.image.js", - "\\.(css|less|scss|sass)$": "/assets/mock.style.js" + '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': + '/assets/mock.image.js', + '\\.(css|less|scss|sass)$': '/assets/mock.style.js', }, -}; \ No newline at end of file +}; diff --git a/frontend/setupJest.js b/frontend/setupJest.js index a78eb3b42..ddacb44d8 100644 --- a/frontend/setupJest.js +++ b/frontend/setupJest.js @@ -22,4 +22,4 @@ global.TextEncoder = TextEncoder; global.TextDecoder = TextDecoder; // polyfill fetch since it's not in jsdom: -require('whatwg-fetch'); \ No newline at end of file +require('whatwg-fetch'); diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 961448272..17656be73 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -72,9 +72,9 @@ export default class App extends React.Component { blockpropagation: true, blocklasttime: false, uptime: false, - version: true, + version: true, target_os: true, - target_arch: true, + target_arch: true, core_count: true, memory: true, is_virtual_machine: true, @@ -85,7 +85,6 @@ export default class App extends React.Component { disk_sequential_write_score: true, disk_random_write_score: true, cpu_vendor: true, - }, (settings) => { const selectedColumns = this.selectedColumns(settings); diff --git a/frontend/src/Connection.ts b/frontend/src/Connection.ts index dc82061f7..327756a16 100644 --- a/frontend/src/Connection.ts +++ b/frontend/src/Connection.ts @@ -133,7 +133,7 @@ export class Connection { this.bindSocket(); } - public subscribe(chain: Types.GenesisHash) { + public subscribe(chain: Types.GenesisHash) { if ( this.appState.subscribed != null && this.appState.subscribed !== chain @@ -210,7 +210,7 @@ export class Connection { nodeHardware, blockDetails, location, - startupTime, + startupTime ); nodes.add(node); diff --git a/frontend/src/common/feed.ts b/frontend/src/common/feed.ts index 2ddc206b5..d7f967717 100644 --- a/frontend/src/common/feed.ts +++ b/frontend/src/common/feed.ts @@ -98,7 +98,7 @@ interface AddedNodeMessage extends MessageBase { NodeHardware, BlockDetails, Maybe, - Maybe, + Maybe ]; } diff --git a/frontend/src/common/types.ts b/frontend/src/common/types.ts index 78d2c1875..b6eb1f878 100644 --- a/frontend/src/common/types.ts +++ b/frontend/src/common/types.ts @@ -25,15 +25,15 @@ export type NodeId = Id<'Node'>; export type NodeName = Opaque; export type NodeImplementation = Opaque; export type NodeVersion = Opaque; -export type OperatingSystem = Opaque; -export type CpuArchitecture = Opaque; -export type Cpu = string; -export type CpuCores = number; -export type TargetEnv = string; -export type Memory = number; -export type VirtualMachine = boolean; -export type LinuxKernel = string; -export type LinuxDistro = string; +export type OperatingSystem = Opaque; +export type CpuArchitecture = Opaque; +export type Cpu = string; +export type CpuCores = number; +export type TargetEnv = string; +export type Memory = number; +export type VirtualMachine = boolean; +export type LinuxKernel = string; +export type LinuxDistro = string; export type BlockNumber = Opaque; export type BlockHash = Opaque; export type Address = Opaque; @@ -52,8 +52,6 @@ export type Bytes = Opaque; export type BytesPerSecond = Opaque; export type NetworkId = Opaque; - - export type NodeSysInfo = { cpu: string | null; memory: number | null; diff --git a/frontend/src/components/List/Column/Column.tsx b/frontend/src/components/List/Column/Column.tsx index 0e0ae6bab..f1aab9df9 100644 --- a/frontend/src/components/List/Column/Column.tsx +++ b/frontend/src/components/List/Column/Column.tsx @@ -38,7 +38,7 @@ import { BlockPropagationColumn, LastBlockColumn, UptimeColumn, - CpuArchitectureColumn, //extra columns added + CpuArchitectureColumn, //extra columns added CpuColumn, CpuCoresColumn, LinuxKernelColumn, diff --git a/frontend/src/components/List/Column/CpuArchitectureColumn.tsx b/frontend/src/components/List/Column/CpuArchitectureColumn.tsx index 658aaf877..4d5c17ac9 100644 --- a/frontend/src/components/List/Column/CpuArchitectureColumn.tsx +++ b/frontend/src/components/List/Column/CpuArchitectureColumn.tsx @@ -21,30 +21,23 @@ import { Node } from '../../../state'; import icon from '../../../icons/file-binary.svg'; export class CpuArchitectureColumn extends React.Component { - public static readonly label = 'CPU Architecture'; - public static readonly icon = icon; - public static readonly width = 154; - public static readonly setting = 'target_arch'; - public static readonly sortBy = ({ target_arch }: Node) => target_arch || ''; - - private data: string; - - - public shouldComponentUpdate(nextProps: ColumnProps) { - return this.data !== nextProps.node.hash; - } - - render() { - const { target_arch } = this.props.node; - - this.data = target_arch; - - return ( - - {target_arch} - - ); - } + public static readonly label = 'CPU Architecture'; + public static readonly icon = icon; + public static readonly width = 154; + public static readonly setting = 'target_arch'; + public static readonly sortBy = ({ target_arch }: Node) => target_arch || ''; + + private data: string; + + public shouldComponentUpdate(nextProps: ColumnProps) { + return this.data !== nextProps.node.hash; } - \ No newline at end of file + render() { + const { target_arch } = this.props.node; + + this.data = target_arch; + + return {target_arch}; + } +} diff --git a/frontend/src/components/List/Column/CpuColumn.tsx b/frontend/src/components/List/Column/CpuColumn.tsx index ac263640f..5d4dabdbc 100644 --- a/frontend/src/components/List/Column/CpuColumn.tsx +++ b/frontend/src/components/List/Column/CpuColumn.tsx @@ -22,31 +22,23 @@ import { Node } from '../../../state'; import icon from '../../../icons/file-binary.svg'; export class CpuColumn extends React.Component { - public static readonly label = 'CPU Column'; - public static readonly icon = icon; - public static readonly width = 154; - public static readonly setting = 'cpu'; - public static readonly sortBy = ({ cpu }: Node) => cpu || 0; - - private data: string; - - public shouldComponentUpdate(nextProps: ColumnProps) { - return this.data !== nextProps.node.cpu; - } - - render() { - const { cpu } = this.props.node; - - this.data = cpu; - - return ( - - {cpu} - - ); - - } - - + public static readonly label = 'CPU Column'; + public static readonly icon = icon; + public static readonly width = 154; + public static readonly setting = 'cpu'; + public static readonly sortBy = ({ cpu }: Node) => cpu || 0; + + private data: string; + + public shouldComponentUpdate(nextProps: ColumnProps) { + return this.data !== nextProps.node.cpu; + } + + render() { + const { cpu } = this.props.node; + + this.data = cpu; + + return {cpu}; } - \ No newline at end of file +} diff --git a/frontend/src/components/List/Column/CpuCoresColumn.tsx b/frontend/src/components/List/Column/CpuCoresColumn.tsx index eb3f033a7..ab1ba530c 100644 --- a/frontend/src/components/List/Column/CpuCoresColumn.tsx +++ b/frontend/src/components/List/Column/CpuCoresColumn.tsx @@ -19,28 +19,23 @@ import { Node } from '../../../state'; import icon from '../../../icons/file-binary.svg'; export class CpuCoresColumn extends React.Component { - public static readonly label = 'CPU Cores'; - public static readonly icon = icon; - public static readonly width = 154; - public static readonly setting = 'core_count'; - public static readonly sortBy = ({ core_count }: Node) => core_count || 0; - - private data: number; - - public shouldComponentUpdate(nextProps: ColumnProps) { - return this.data !== nextProps.node.core_count; - } - - render() { - const { core_count } = this.props.node; - - this.data = core_count; - - return ( - - {core_count} - - ); - } + public static readonly label = 'CPU Cores'; + public static readonly icon = icon; + public static readonly width = 154; + public static readonly setting = 'core_count'; + public static readonly sortBy = ({ core_count }: Node) => core_count || 0; + + private data: number; + + public shouldComponentUpdate(nextProps: ColumnProps) { + return this.data !== nextProps.node.core_count; + } + + render() { + const { core_count } = this.props.node; + + this.data = core_count; + + return {core_count}; } - \ No newline at end of file +} diff --git a/frontend/src/components/List/Column/IsVirtualMachineColumn.tsx b/frontend/src/components/List/Column/IsVirtualMachineColumn.tsx index ae3917bcc..9f257f695 100644 --- a/frontend/src/components/List/Column/IsVirtualMachineColumn.tsx +++ b/frontend/src/components/List/Column/IsVirtualMachineColumn.tsx @@ -21,28 +21,24 @@ import { Node } from '../../../state'; import icon from '../../../icons/file-binary.svg'; export class IsVirtualMachineColumn extends React.Component { - public static readonly label = 'Virtual Machine'; - public static readonly icon = icon; - public static readonly width = 154; - public static readonly setting = 'is_virtual_machine'; - public static readonly sortBy = ({ is_virtual_machine }: Node) => is_virtual_machine || false; - - private data: boolean; + public static readonly label = 'Virtual Machine'; + public static readonly icon = icon; + public static readonly width = 154; + public static readonly setting = 'is_virtual_machine'; + public static readonly sortBy = ({ is_virtual_machine }: Node) => + is_virtual_machine || false; - - public shouldComponentUpdate(nextProps: ColumnProps) { - return this.data !== nextProps.node.is_virtual_machine; - } - - render() { - const { is_virtual_machine } = this.props.node; - - this.data = is_virtual_machine; - - return ( - - {is_virtual_machine ? "True" : "False"} - - ); - } - } \ No newline at end of file + private data: boolean; + + public shouldComponentUpdate(nextProps: ColumnProps) { + return this.data !== nextProps.node.is_virtual_machine; + } + + render() { + const { is_virtual_machine } = this.props.node; + + this.data = is_virtual_machine; + + return {is_virtual_machine ? 'True' : 'False'}; + } +} diff --git a/frontend/src/components/List/Column/LinuxDistroColumn.tsx b/frontend/src/components/List/Column/LinuxDistroColumn.tsx index 17779acac..b1eb7ec6d 100644 --- a/frontend/src/components/List/Column/LinuxDistroColumn.tsx +++ b/frontend/src/components/List/Column/LinuxDistroColumn.tsx @@ -16,34 +16,30 @@ //Column for specifying type of distro each node is running (Linux Distribution) - import * as React from 'react'; import { ColumnProps } from './'; import { Node } from '../../../state'; import icon from '../../../icons/file-binary.svg'; export class LinuxDistroColumn extends React.Component { - public static readonly label = 'Linux Distro'; - public static readonly icon = icon; - public static readonly width = 154; - public static readonly setting = 'linux_distro'; - public static readonly sortBy = ({ linux_distro }: Node) => linux_distro || ''; - - private data: string; - - public shouldComponentUpdate(nextProps: ColumnProps) { - return this.data !== nextProps.node.linux_distro; - } - - render() { - const { linux_distro } = this.props.node; - - this.data = linux_distro; - - return ( - - {linux_distro} - - ); - } + public static readonly label = 'Linux Distro'; + public static readonly icon = icon; + public static readonly width = 154; + public static readonly setting = 'linux_distro'; + public static readonly sortBy = ({ linux_distro }: Node) => + linux_distro || ''; + + private data: string; + + public shouldComponentUpdate(nextProps: ColumnProps) { + return this.data !== nextProps.node.linux_distro; + } + + render() { + const { linux_distro } = this.props.node; + + this.data = linux_distro; + + return {linux_distro}; } +} diff --git a/frontend/src/components/List/Column/LinuxKernelColumn.tsx b/frontend/src/components/List/Column/LinuxKernelColumn.tsx index fa7de70fd..945c66963 100644 --- a/frontend/src/components/List/Column/LinuxKernelColumn.tsx +++ b/frontend/src/components/List/Column/LinuxKernelColumn.tsx @@ -21,27 +21,23 @@ import { Node } from '../../../state'; import icon from '../../../icons/file-binary.svg'; export class LinuxKernelColumn extends React.Component { - public static readonly label = 'Linux Kernel'; - public static readonly icon = icon; - public static readonly width = 154; - public static readonly setting = 'linux_kernel'; - public static readonly sortBy = ({ linux_kernel }: Node) => linux_kernel || 0; - - private data: string; - - public shouldComponentUpdate(nextProps: ColumnProps) { - return this.data !== nextProps.node.linux_kernel; - } - - render() { - const { linux_kernel } = this.props.node; - - this.data = linux_kernel; - - return ( - - {linux_kernel} - - ); - } + public static readonly label = 'Linux Kernel'; + public static readonly icon = icon; + public static readonly width = 154; + public static readonly setting = 'linux_kernel'; + public static readonly sortBy = ({ linux_kernel }: Node) => linux_kernel || 0; + + private data: string; + + public shouldComponentUpdate(nextProps: ColumnProps) { + return this.data !== nextProps.node.linux_kernel; + } + + render() { + const { linux_kernel } = this.props.node; + + this.data = linux_kernel; + + return {linux_kernel}; } +} diff --git a/frontend/src/components/List/Column/MemoryColumn.tsx b/frontend/src/components/List/Column/MemoryColumn.tsx index 4e91f1e0d..6ca17f8de 100644 --- a/frontend/src/components/List/Column/MemoryColumn.tsx +++ b/frontend/src/components/List/Column/MemoryColumn.tsx @@ -21,28 +21,23 @@ import { Node } from '../../../state'; import icon from '../../../icons/file-binary.svg'; export class MemoryColumn extends React.Component { - public static readonly label = 'memory'; - public static readonly icon = icon; - public static readonly width = 154; - public static readonly setting = 'memory'; - public static readonly sortBy = ({ memory }: Node) => memory|| ''; - - private data: number; + public static readonly label = 'memory'; + public static readonly icon = icon; + public static readonly width = 154; + public static readonly setting = 'memory'; + public static readonly sortBy = ({ memory }: Node) => memory || ''; - - public shouldComponentUpdate(nextProps: ColumnProps) { - return this.data !== nextProps.node.memory; - } - - render() { - const { memory} = this.props.node; - - this.data = memory; - - return ( - - {memory} - - ); - } - } \ No newline at end of file + private data: number; + + public shouldComponentUpdate(nextProps: ColumnProps) { + return this.data !== nextProps.node.memory; + } + + render() { + const { memory } = this.props.node; + + this.data = memory; + + return {memory}; + } +} diff --git a/frontend/src/components/List/Column/OperatingSystemColumn.tsx b/frontend/src/components/List/Column/OperatingSystemColumn.tsx index c1ddab360..0d8de8190 100644 --- a/frontend/src/components/List/Column/OperatingSystemColumn.tsx +++ b/frontend/src/components/List/Column/OperatingSystemColumn.tsx @@ -22,28 +22,23 @@ import { Node } from '../../../state'; import icon from '../../../icons/file-binary.svg'; export class OperatingSystemColumn extends React.Component { - public static readonly label = 'OS'; - public static readonly icon = icon; - public static readonly width = 154; - public static readonly setting = 'target_os'; - public static readonly sortBy = ({ target_os }: Node) => target_os || ''; - - private data: string; - - - public shouldComponentUpdate(nextProps: ColumnProps) { - return this.data !== nextProps.node.hash; - } - - render() { - const { target_os } = this.props.node; - - this.data = target_os; - - return ( - - {target_os} - - ); - } - } \ No newline at end of file + public static readonly label = 'OS'; + public static readonly icon = icon; + public static readonly width = 154; + public static readonly setting = 'target_os'; + public static readonly sortBy = ({ target_os }: Node) => target_os || ''; + + private data: string; + + public shouldComponentUpdate(nextProps: ColumnProps) { + return this.data !== nextProps.node.hash; + } + + render() { + const { target_os } = this.props.node; + + this.data = target_os; + + return {target_os}; + } +} diff --git a/frontend/src/components/List/Column/VersionColumn.tsx b/frontend/src/components/List/Column/VersionColumn.tsx index 1a1b91f72..cc4f169b4 100644 --- a/frontend/src/components/List/Column/VersionColumn.tsx +++ b/frontend/src/components/List/Column/VersionColumn.tsx @@ -22,28 +22,23 @@ import { Node } from '../../../state'; import icon from '../../../icons/file-binary.svg'; export class VersionColumn extends React.Component { - public static readonly label = 'version'; - public static readonly icon = icon; - public static readonly width = 154; - public static readonly setting = 'version'; - public static readonly sortBy = ({ version}: Node) => version || ''; - - private data: string; - - - public shouldComponentUpdate(nextProps: ColumnProps) { - return this.data !== nextProps.node.version; - } - - render() { - const { version } = this.props.node; - - this.data = version; - - return ( - - {version} - - ); - } - } \ No newline at end of file + public static readonly label = 'version'; + public static readonly icon = icon; + public static readonly width = 154; + public static readonly setting = 'version'; + public static readonly sortBy = ({ version }: Node) => version || ''; + + private data: string; + + public shouldComponentUpdate(nextProps: ColumnProps) { + return this.data !== nextProps.node.version; + } + + render() { + const { version } = this.props.node; + + this.data = version; + + return {version}; + } +} diff --git a/frontend/src/components/List/Column/index.ts b/frontend/src/components/List/Column/index.ts index 33a63ba43..e8f2c61f3 100644 --- a/frontend/src/components/List/Column/index.ts +++ b/frontend/src/components/List/Column/index.ts @@ -33,7 +33,7 @@ export * from './BlockTimeColumn'; export * from './BlockPropagationColumn'; export * from './LastBlockColumn'; export * from './UptimeColumn'; -export * from './CpuArchitectureColumn'; //extra columns added +export * from './CpuArchitectureColumn'; //extra columns added export * from './CpuCoresColumn'; export * from './LinuxDistroColumn'; export * from './IsVirtualMachineColumn'; @@ -42,4 +42,3 @@ export * from './CpuColumn'; export * from './OperatingSystemColumn'; export * from './VersionColumn'; export * from './LinuxKernelColumn'; - diff --git a/frontend/src/components/List/Row.tsx b/frontend/src/components/List/Row.tsx index 09cded62c..d37e866e9 100644 --- a/frontend/src/components/List/Row.tsx +++ b/frontend/src/components/List/Row.tsx @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -// Each Row in the List Page +// Each Row in the List Page import * as React from 'react'; import { Types } from '../../common'; import { Node } from '../../state'; @@ -47,7 +47,7 @@ import { VersionColumn, IsVirtualMachineColumn, LinuxDistroColumn, - LinuxKernelColumn + LinuxKernelColumn, } from './'; import './Row.css'; @@ -90,7 +90,7 @@ export class Row extends React.Component { MemoryColumn, OperatingSystemColumn, VersionColumn, - IsVirtualMachineColumn + IsVirtualMachineColumn, ]; private renderedChangeRef = 0; @@ -104,7 +104,6 @@ export class Row extends React.Component { public render() { const { node, columns } = this.props; - this.renderedChangeRef = node.changeRef; let className = 'Row'; diff --git a/frontend/src/state.ts b/frontend/src/state.ts index 6521bef88..f6302f302 100644 --- a/frontend/src/state.ts +++ b/frontend/src/state.ts @@ -58,25 +58,22 @@ export class Node { public readonly id: Types.NodeId; public readonly name: Types.NodeName; public readonly implementation: Types.NodeImplementation; - public readonly version: Types.NodeVersion; + public readonly version: Types.NodeVersion; public readonly validator: Maybe; public readonly networkId: Maybe; public readonly startupTime: Maybe; - public readonly target_os: Types.OperatingSystem; - public readonly target_arch: Types.CpuArchitecture; - public readonly target_env: Types.TargetEnv; + public readonly target_os: Types.OperatingSystem; + public readonly target_arch: Types.CpuArchitecture; + public readonly target_env: Types.TargetEnv; public readonly sysInfo: Types.NodeSysInfo; - public readonly cpu: Types.Cpu; public readonly memory: Types.Memory; public readonly core_count: Types.CpuCores; public readonly linux_kernel: Types.LinuxKernel; public readonly linux_distro: Types.LinuxDistro; public readonly is_virtual_machine: Types.VirtualMachine; - - - + public readonly sortableName: string; public readonly sortableVersion: number; @@ -114,10 +111,20 @@ export class Node { nodeHardware: Types.NodeHardware, blockDetails: Types.BlockDetails, location: Maybe, - startupTime: Maybe, - + startupTime: Maybe ) { - const [name, implementation, version, validator, networkId, target_os, target_arch, target_env, customNullField, sysInfo] = nodeDetails; //step 4 + const [ + name, + implementation, + version, + validator, + networkId, + target_os, + target_arch, + target_env, + customNullField, + sysInfo, + ] = nodeDetails; //step 4 this.pinned = pinned; @@ -140,15 +147,18 @@ export class Node { is_virtual_machine: sysInfo?.is_virtual_machine ?? false, }; - this.cpu = sysInfo && sysInfo.cpu ? sysInfo.cpu : ''; + this.cpu = sysInfo && sysInfo.cpu ? sysInfo.cpu : ''; this.memory = sysInfo && sysInfo.memory ? Number(sysInfo.memory) : 0; - this.core_count = sysInfo && sysInfo.core_count ? Number(sysInfo.core_count) : 0; - this.linux_kernel = sysInfo && sysInfo.linux_kernel ? sysInfo.linux_kernel : ''; - this.linux_distro = sysInfo && sysInfo.linux_distro ? sysInfo.linux_distro : ''; - this.is_virtual_machine = sysInfo && sysInfo.is_virtual_machine ? Boolean(sysInfo.is_virtual_machine) : false; - - - + this.core_count = + sysInfo && sysInfo.core_count ? Number(sysInfo.core_count) : 0; + this.linux_kernel = + sysInfo && sysInfo.linux_kernel ? sysInfo.linux_kernel : ''; + this.linux_distro = + sysInfo && sysInfo.linux_distro ? sysInfo.linux_distro : ''; + this.is_virtual_machine = + sysInfo && sysInfo.is_virtual_machine + ? Boolean(sysInfo.is_virtual_machine) + : false; const [major = 0, minor = 0, patch = 0] = (version || '0.0.0') .split('.') @@ -291,7 +301,7 @@ export interface StateSettings { blockpropagation: boolean; blocklasttime: boolean; uptime: boolean; - version: boolean; + version: boolean; target_os: boolean; target_arch: boolean; cpu: boolean; @@ -305,7 +315,6 @@ export interface StateSettings { disk_sequential_write_score: boolean; disk_random_write_score: boolean; cpu_vendor: boolean; - } export interface State { diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index a8cfd0782..057f86f50 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -4,11 +4,7 @@ "outDir": "./build/", "module": "es2020", "target": "es2015", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "sourceMap": true, "allowJs": false, "jsx": "react", diff --git a/frontend/webpack.config.js b/frontend/webpack.config.js index 35d524854..7860c4458 100644 --- a/frontend/webpack.config.js +++ b/frontend/webpack.config.js @@ -16,19 +16,19 @@ module.exports = { // allow 'import "foo.css"' and '@import "foo.css" in css files test: /\.css$/i, use: ['style-loader', 'css-loader'], - generator: { filename: 'styles/[name].[contenthash][ext]' } + generator: { filename: 'styles/[name].[contenthash][ext]' }, }, { // allow 'import Icon from "./icon.png"' test: /\.(png|svg|jpg|jpeg|gif)$/i, type: 'asset/resource', - generator: { filename: 'images/[name].[contenthash][ext]' } + generator: { filename: 'images/[name].[contenthash][ext]' }, }, { // allow CSS @url('./my-font.woff2')" style font loading test: /\.(woff|woff2|eot|ttf|otf)$/i, type: 'asset/resource', - generator: { filename: 'fonts/[name].[contenthash][ext]' } + generator: { filename: 'fonts/[name].[contenthash][ext]' }, }, ], }, @@ -36,8 +36,8 @@ module.exports = { // Use our index.html as a starting point (to add script links etc to) // and make sure to use/copy over the favicon too. new HtmlWebpackPlugin({ - favicon: "./assets/favicon.svg", - template: "./assets/index.html" + favicon: './assets/favicon.svg', + template: './assets/index.html', }), ], resolve: { @@ -46,6 +46,6 @@ module.exports = { output: { filename: 'main.[contenthash].js', path: path.resolve(__dirname, 'build'), - clean: true + clean: true, }, -}; \ No newline at end of file +};