├── .dockerignore ├── .editorconfig ├── .github ├── dependabot.yml └── workflows │ ├── backend.yml │ ├── docker-build.yml │ ├── frontend.yml │ └── publish-deploy.yml ├── .gitignore ├── CHANGELOG.md ├── CODEOWNERS ├── LICENSE ├── README.md ├── ROADMAP.md ├── backend ├── .dockerignore ├── Cargo.lock ├── Cargo.toml ├── Dockerfile ├── Dockerfile.README.md ├── README.md ├── common │ ├── Cargo.toml │ └── src │ │ ├── assign_id.rs │ │ ├── byte_size.rs │ │ ├── dense_map.rs │ │ ├── either_sink.rs │ │ ├── http_utils.rs │ │ ├── id_type.rs │ │ ├── internal_messages.rs │ │ ├── lib.rs │ │ ├── mean_list.rs │ │ ├── most_seen.rs │ │ ├── multi_map_unique.rs │ │ ├── node_message.rs │ │ ├── node_types.rs │ │ ├── num_stats.rs │ │ ├── ready_chunks_all.rs │ │ ├── rolling_total.rs │ │ ├── time.rs │ │ └── ws_client │ │ ├── connect.rs │ │ ├── mod.rs │ │ ├── on_close.rs │ │ ├── receiver.rs │ │ └── sender.rs ├── docs │ └── architecture.svg ├── telemetry_core │ ├── Cargo.toml │ ├── benches │ │ └── subscribe.rs │ ├── src │ │ ├── GeoLite2-City.mmdb │ │ ├── aggregator │ │ │ ├── aggregator.rs │ │ │ ├── aggregator_set.rs │ │ │ ├── inner_loop.rs │ │ │ └── mod.rs │ │ ├── feed_message.rs │ │ ├── find_location.rs │ │ ├── main.rs │ │ └── state │ │ │ ├── chain.rs │ │ │ ├── chain_stats.rs │ │ │ ├── counter.rs │ │ │ ├── mod.rs │ │ │ ├── node.rs │ │ │ └── state.rs │ └── tests │ │ ├── e2e_tests.rs │ │ └── soak_tests.rs ├── telemetry_shard │ ├── Cargo.toml │ └── src │ │ ├── aggregator.rs │ │ ├── blocked_addrs.rs │ │ ├── connection.rs │ │ ├── json_message │ │ ├── hash.rs │ │ ├── mod.rs │ │ └── node_message.rs │ │ ├── main.rs │ │ └── real_ip.rs └── test_utils │ ├── Cargo.toml │ └── src │ ├── contains_matches.rs │ ├── fake_telemetry.rs │ ├── feed_message_de.rs │ ├── lib.rs │ ├── server │ ├── channels.rs │ ├── mod.rs │ ├── server.rs │ └── utils.rs │ └── workspace │ ├── commands.rs │ ├── mod.rs │ └── start_server.rs ├── doc └── screenshot01.png ├── docker-compose.yml └── frontend ├── .eslintrc.json ├── .gitignore ├── .nvmrc ├── .prettierrc ├── Dockerfile ├── Dockerfile.README.md ├── assets ├── favicon.svg ├── index.html ├── mock.image.js └── mock.style.js ├── images.d.ts ├── jest.config.js ├── nginx └── nginx.conf ├── package-lock.json ├── package.json ├── scripts ├── env.sh └── start.sh ├── setupJest.js ├── src ├── App.css ├── App.test.tsx ├── App.tsx ├── Connection.ts ├── assets │ └── world-map.svg ├── common │ ├── SortedCollection.ts │ ├── common.test.ts │ ├── feed.ts │ ├── helpers.ts │ ├── id.ts │ ├── index.ts │ ├── iterators.ts │ ├── stringify.ts │ └── types.ts ├── components │ ├── Ago.tsx │ ├── AllChains.css │ ├── AllChains.tsx │ ├── Chain │ │ ├── Chain.css │ │ ├── Chain.tsx │ │ ├── Header.css │ │ ├── Header.tsx │ │ ├── Tab.css │ │ ├── Tab.tsx │ │ └── index.ts │ ├── Chains.css │ ├── Chains.tsx │ ├── Filter.css │ ├── Filter.tsx │ ├── Icon.css │ ├── Icon.tsx │ ├── List │ │ ├── Column │ │ │ ├── BlockHashColumn.tsx │ │ │ ├── BlockNumberColumn.tsx │ │ │ ├── BlockPropagationColumn.tsx │ │ │ ├── BlockTimeColumn.tsx │ │ │ ├── Column.css │ │ │ ├── Column.tsx │ │ │ ├── CpuArchitectureColumn.tsx │ │ │ ├── CpuColumn.tsx │ │ │ ├── CpuCoresColumn.tsx │ │ │ ├── DownloadColumn.tsx │ │ │ ├── FinalizedBlockColumn.tsx │ │ │ ├── FinalizedHashColumn.tsx │ │ │ ├── ImplementationColumn.tsx │ │ │ ├── IsVirtualMachineColumn.tsx │ │ │ ├── LastBlockColumn.tsx │ │ │ ├── LinuxDistroColumn.tsx │ │ │ ├── LinuxKernelColumn.tsx │ │ │ ├── LocationColumn.tsx │ │ │ ├── MemoryColumn.tsx │ │ │ ├── NameColumn.tsx │ │ │ ├── NetworkIdColumn.tsx │ │ │ ├── OperatingSystemColumn.tsx │ │ │ ├── PeersColumn.tsx │ │ │ ├── StateCacheColumn.tsx │ │ │ ├── TxsColumn.tsx │ │ │ ├── UploadColumn.tsx │ │ │ ├── UptimeColumn.tsx │ │ │ ├── ValidatorColumn.tsx │ │ │ ├── VersionColumn.tsx │ │ │ └── index.ts │ │ ├── List.css │ │ ├── List.tsx │ │ ├── Row.css │ │ ├── Row.tsx │ │ ├── THead.css │ │ ├── THead.tsx │ │ ├── THeadCell.tsx │ │ └── index.ts │ ├── Map │ │ ├── Location.css │ │ ├── Location.tsx │ │ ├── Map.css │ │ ├── Map.tsx │ │ └── index.ts │ ├── OfflineIndicator.css │ ├── OfflineIndicator.tsx │ ├── PolkadotIcon.tsx │ ├── Settings │ │ ├── Setting.css │ │ ├── Setting.tsx │ │ ├── Settings.css │ │ ├── Settings.tsx │ │ └── index.ts │ ├── Sparkline.css │ ├── Sparkline.tsx │ ├── Stats │ │ ├── Stats.css │ │ ├── Stats.tsx │ │ └── index.ts │ ├── Tile.css │ ├── Tile.tsx │ ├── Tooltip.css │ ├── Tooltip.tsx │ ├── Truncate.tsx │ └── index.ts ├── icons │ ├── alert.svg │ ├── archive.svg │ ├── arrow-down.svg │ ├── arrow-left.svg │ ├── arrow-right.svg │ ├── arrow-small-down.svg │ ├── arrow-small-left.svg │ ├── arrow-small-right.svg │ ├── arrow-small-up.svg │ ├── arrow-up.svg │ ├── assets.d.ts │ ├── beaker.svg │ ├── bell.svg │ ├── bifrost.svg │ ├── bold.svg │ ├── book.svg │ ├── bookmark.svg │ ├── briefcase.svg │ ├── broadcast.svg │ ├── browser.svg │ ├── bug.svg │ ├── calendar.svg │ ├── cennznet.svg │ ├── chainx.svg │ ├── check-square-regular.svg │ ├── check-square-solid.svg │ ├── check.svg │ ├── checklist.svg │ ├── chevron-down.svg │ ├── chevron-left.svg │ ├── chevron-right.svg │ ├── chevron-up.svg │ ├── circle-regular.svg │ ├── circle-slash.svg │ ├── circle-solid.svg │ ├── circuit-board.svg │ ├── clippy.svg │ ├── clock.svg │ ├── cloud-download.svg │ ├── cloud-upload.svg │ ├── code.svg │ ├── comment-discussion.svg │ ├── comment.svg │ ├── crab.svg │ ├── credit-card.svg │ ├── crust.svg │ ├── cube-alt.svg │ ├── cube.svg │ ├── darwinia.svg │ ├── dash.svg │ ├── dashboard.svg │ ├── database.svg │ ├── desktop-download.svg │ ├── device-camera-video.svg │ ├── device-camera.svg │ ├── device-desktop.svg │ ├── device-mobile.svg │ ├── diff-added.svg │ ├── diff-ignored.svg │ ├── diff-modified.svg │ ├── diff-removed.svg │ ├── diff-renamed.svg │ ├── diff.svg │ ├── dot.svg │ ├── dothereum.svg │ ├── edgeware.svg │ ├── ellipsis-v-solid.svg │ ├── ellipsis.svg │ ├── eye.svg │ ├── file-binary.svg │ ├── file-code.svg │ ├── file-directory.svg │ ├── file-media.svg │ ├── file-pdf.svg │ ├── file-submodule.svg │ ├── file-symlink-directory.svg │ ├── file-symlink-file.svg │ ├── file-zip.svg │ ├── file.svg │ ├── finalized.svg │ ├── fingerprint.svg │ ├── flame.svg │ ├── fold.svg │ ├── gear.svg │ ├── gift.svg │ ├── gist-secret.svg │ ├── gist.svg │ ├── git-branch.svg │ ├── git-commit.svg │ ├── git-compare.svg │ ├── git-merge.svg │ ├── git-pull-request.svg │ ├── globe-solid.svg │ ├── globe.svg │ ├── gossamer.svg │ ├── grabber.svg │ ├── graph.svg │ ├── hatching.svg │ ├── heart.svg │ ├── history.svg │ ├── home.svg │ ├── horizontal-rule.svg │ ├── hubot.svg │ ├── inbox.svg │ ├── info.svg │ ├── issue-closed.svg │ ├── issue-opened.svg │ ├── issue-reopened.svg │ ├── italic.svg │ ├── jersey.svg │ ├── joystream.svg │ ├── kagome.svg │ ├── katalchain.svg │ ├── kebab-horizontal.svg │ ├── kebab-vertical.svg │ ├── key.svg │ ├── keyboard.svg │ ├── laddernetwork.svg │ ├── law.svg │ ├── light-bulb.svg │ ├── link-external.svg │ ├── link.svg │ ├── list-alt-regular.svg │ ├── list-ordered.svg │ ├── list-unordered.svg │ ├── location.svg │ ├── lock.svg │ ├── logo-gist.svg │ ├── logo-github.svg │ ├── mail-read.svg │ ├── mail.svg │ ├── map-marked-alt-solid.svg │ ├── map-marker-alt-solid.svg │ ├── map-pin-solid.svg │ ├── mark-github.svg │ ├── markdown.svg │ ├── megaphone.svg │ ├── memory-solid.svg │ ├── mention.svg │ ├── microchip-solid.svg │ ├── milestone.svg │ ├── mirror.svg │ ├── mortar-board.svg │ ├── mute.svg │ ├── network.svg │ ├── no-newline.svg │ ├── nodle.svg │ ├── note.svg │ ├── octoface.svg │ ├── organization.svg │ ├── package.svg │ ├── paintcan.svg │ ├── parity-substrate.svg │ ├── pencil.svg │ ├── person.svg │ ├── pin.svg │ ├── plug.svg │ ├── plus-small.svg │ ├── plus.svg │ ├── polkadot-js.svg │ ├── primitive-dot.svg │ ├── primitive-square.svg │ ├── project.svg │ ├── pulse.svg │ ├── question-solid.svg │ ├── question.svg │ ├── quote.svg │ ├── radio-tower.svg │ ├── reply.svg │ ├── repo-clone.svg │ ├── repo-force-push.svg │ ├── repo-forked.svg │ ├── repo-pull.svg │ ├── repo-push.svg │ ├── repo.svg │ ├── report.svg │ ├── robonomics.svg │ ├── rocket.svg │ ├── rss.svg │ ├── ruby.svg │ ├── screen-full.svg │ ├── screen-normal.svg │ ├── search.svg │ ├── server.svg │ ├── settings.svg │ ├── shield.svg │ ├── sign-in.svg │ ├── sign-out.svg │ ├── smiley.svg │ ├── square-regular.svg │ ├── square-solid.svg │ ├── squirrel.svg │ ├── star.svg │ ├── stop.svg │ ├── substrate.svg │ ├── sync.svg │ ├── tag.svg │ ├── tasklist.svg │ ├── telescope.svg │ ├── terminal.svg │ ├── text-size.svg │ ├── three-bars.svg │ ├── thumbsdown.svg │ ├── thumbsup.svg │ ├── tools.svg │ ├── totem.svg │ ├── trashcan.svg │ ├── triangle-down.svg │ ├── triangle-left.svg │ ├── triangle-right.svg │ ├── triangle-up.svg │ ├── turingnetwork.svg │ ├── unfold.svg │ ├── unmute.svg │ ├── unverified.svg │ ├── verified.svg │ ├── versions.svg │ ├── watch.svg │ ├── x.svg │ ├── zap.svg │ └── zero.svg ├── index.css ├── index.tsx ├── persist │ ├── Persistent.ts │ ├── PersistentObject.ts │ ├── PersistentSet.ts │ └── index.ts ├── state.ts └── utils.ts ├── tsconfig.json └── webpack.config.js /.dockerignore: -------------------------------------------------------------------------------- 1 | target 2 | Dockerfile 3 | build 4 | node_modules 5 | .git 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | [*] 3 | charset = utf-8 4 | trim_trailing_whitespace = true 5 | insert_final_newline = true 6 | indent_style = space 7 | 8 | [frontend/**] 9 | indent_size = 2 10 | 11 | [backend/**] 12 | indent_size = 4 13 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: github-actions 4 | directory: '/' 5 | schedule: 6 | interval: daily 7 | -------------------------------------------------------------------------------- /.github/workflows/frontend.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Frontend CI 5 | 6 | on: 7 | push: 8 | paths: 9 | - '.github/workflows/frontend.yml' 10 | - 'frontend/**' 11 | - '!backend/**' 12 | pull_request: 13 | paths: 14 | - '.github/workflows/frontend.yml' 15 | - 'frontend/**' 16 | - '!backend/**' 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 20 | cancel-in-progress: true 21 | 22 | defaults: 23 | run: 24 | working-directory: ./frontend 25 | 26 | jobs: 27 | build: 28 | runs-on: ubuntu-latest 29 | 30 | strategy: 31 | matrix: 32 | node-version: [14.x] 33 | 34 | steps: 35 | - uses: actions/checkout@v4 36 | 37 | - name: Use Node.js ${{ matrix.node-version }} 38 | uses: actions/setup-node@v4 39 | with: 40 | node-version: ${{ matrix.node-version }} 41 | 42 | - name: Install 43 | run: npm install 44 | 45 | - name: Check 46 | run: npm run pretty:check 47 | 48 | - name: Test 49 | run: npm run test 50 | 51 | - name: Build 52 | run: npm run build 53 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | htdocs 3 | .idea 4 | backend/target 5 | 6 | # dependencies 7 | node_modules 8 | 9 | # testing 10 | coverage 11 | 12 | # production 13 | build 14 | 15 | # misc 16 | .DS_Store 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | env-config.js 22 | 23 | npm-debug.log* 24 | npm-error.log* 25 | .vscode 26 | .nyc 27 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this crate are documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this crate adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [0.3] - 2021-03-25 9 | 10 | ### Added 11 | 12 | - Add `--denylist network1 network2` switch to deny nodes on the given networks to connect [#315](https://github.com/paritytech/substrate-telemetry/pull/314) 13 | - Add `--log` switch to configure log levels [#314](https://github.com/paritytech/substrate-telemetry/pull/314) 14 | 15 | ### Fixed 16 | 17 | - Fix clippy warnings [#314](https://github.com/paritytech/substrate-telemetry/pull/314) 18 | 19 | ### Changed 20 | 21 | - Docker image use alpine (for now) [#326](https://github.com/paritytech/substrate-telemetry/pull/326) 22 | - Mute denied nodes [#322](https://github.com/paritytech/substrate-telemetry/pull/322) 23 | - Build actix-web without compression support [#319](https://github.com/paritytech/substrate-telemetry/pull/319) 24 | - Update to actix v4 beta [#316](https://github.com/paritytech/substrate-telemetry/pull/317) 25 | - Cap third party networks to at most 500 connected nodes. Polkadot, Kusama, Westend and Rococo are not subject to this limit. [#314](https://github.com/paritytech/substrate-telemetry/pull/314) 26 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Lists some code owners. 2 | # 3 | # A codeowner just oversees some part of the codebase. If an owned file is changed then the 4 | # corresponding codeowner receives a review request. An approval of the codeowner might be 5 | # required for merging a PR (depends on repository settings). 6 | # 7 | # For details about syntax, see: 8 | # https://help.github.com/en/articles/about-code-owners 9 | # But here are some important notes: 10 | # 11 | # - Glob syntax is git-like, e.g. `/core` means the core directory in the root, unlike `core` 12 | # which can be everywhere. 13 | # - Multiple owners are supported. 14 | # - Either handle (e.g, @github_user or @github_org/team) or email can be used. Keep in mind, 15 | # that handles might work better because they are more recognizable on GitHub, 16 | # eyou can use them for mentioning unlike an email. 17 | # - The latest matching rule, if multiple, takes precedence. 18 | 19 | # main codeowner @paritytech/tools-team 20 | * @paritytech/tools-team 21 | 22 | # CI 23 | /.github/ @paritytech/ci @paritytech/tools-team 24 | /.gitlab-ci.yml @paritytech/ci @arshamparity 25 | -------------------------------------------------------------------------------- /backend/.dockerignore: -------------------------------------------------------------------------------- 1 | target 2 | *.Dockerfile 3 | .git 4 | .idea -------------------------------------------------------------------------------- /backend/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "common", 4 | "telemetry_core", 5 | "telemetry_shard", 6 | "test_utils" 7 | ] 8 | 9 | [profile.dev] 10 | opt-level = 3 11 | 12 | [profile.release] 13 | lto = true 14 | panic = "abort" 15 | ## Enabling these seems necessary to get 16 | ## good debug info in Instruments: 17 | # debug = true 18 | # codegen-units = 1 -------------------------------------------------------------------------------- /backend/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/paritytech/ci-linux:production as builder 2 | 3 | ARG PROFILE=release 4 | WORKDIR /app 5 | 6 | COPY . . 7 | 8 | RUN cargo build --${PROFILE} --bins 9 | 10 | # MAIN IMAGE FOR PEOPLE TO PULL --- small one# 11 | FROM docker.io/debian:buster-slim 12 | LABEL maintainer="Parity Technologies" 13 | LABEL description="Substrate Telemetry Backend shard/core binaries, static build" 14 | 15 | ARG PROFILE=release 16 | WORKDIR /usr/local/bin 17 | 18 | COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ 19 | COPY --from=builder /app/target/$PROFILE/telemetry_shard /usr/local/bin 20 | COPY --from=builder /app/target/$PROFILE/telemetry_core /usr/local/bin 21 | 22 | RUN useradd -m -u 1000 -U telemetry && \ 23 | apt-get -y update && \ 24 | apt-get -y install openssl && \ 25 | apt-get autoremove -y && \ 26 | apt-get clean && \ 27 | rm -rf /var/lib/apt/lists/ 28 | 29 | USER telemetry 30 | EXPOSE 8000 31 | -------------------------------------------------------------------------------- /backend/Dockerfile.README.md: -------------------------------------------------------------------------------- 1 | # substrate-telemetry-backend 2 | 3 | The backend image contains both the `telemetry_core` and `telemetry_shard` binaries. 4 | 5 | ### [Documentation](https://github.com/paritytech/substrate-telemetry/blob/master/README.md) -------------------------------------------------------------------------------- /backend/README.md: -------------------------------------------------------------------------------- 1 | # Backend Crates 2 | 3 | This folder contains the rust crates and documentation specific to the telemetry backend. A description of the folders: 4 | 5 | - [telemetry_core](./telemetry_core): The Telemetry Core. This aggregates data received from shards and allows UI feeds to connect and receive this information. 6 | - [telemetry_shard](./telemetry_shard): A Shard. It's expected that multiple of these will run. Nodes will connect to Shard instances and send JSON telemetry to them, and Shard instances will each connect to the Telemetry Core and relay on relevant data to it. 7 | - [common](./common): common code shared between the telemetry shard and core 8 | - [test_utils](./test_utils): Test utilities, primarily focused around making it easy to run end-to-end tests. 9 | - [docs](./docs): Material supporting the documentation lives here 10 | 11 | # Architecture 12 | 13 | As we move to a sharded version of this telemetry server, this set of architecture diagrams may be useful in helping to understand the current setup (middle diagram), previous setup (first diagram) and possible future setup if we need to scale further (last diagram): 14 | 15 | ![Architecture Diagram](./docs/architecture.svg) 16 | 17 | # Deployment 18 | 19 | A `Dockerfile` exists which builds the Shard and Telemetry Core binaries into an image. A `docker-compose.yaml` in the root of the repository can serve as an example of these services, along with the UI, running together. -------------------------------------------------------------------------------- /backend/common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "common" 3 | version = "0.1.0" 4 | authors = ["Parity Technologies Ltd. "] 5 | edition = "2021" 6 | license = "GPL-3.0" 7 | 8 | [dependencies] 9 | anyhow = "1.0.42" 10 | base64 = { default-features = false, features = ["alloc"], version = "0.21" } 11 | bimap = "0.6.1" 12 | bytes = "1.0.1" 13 | flume = "0.10.8" 14 | fnv = "1.0.7" 15 | futures = "0.3.15" 16 | hex = "0.4.3" 17 | http = "0.2.4" 18 | hyper = { version = "0.14.11", features = ["full"] } 19 | log = "0.4" 20 | num-traits = "0.2" 21 | pin-project-lite = "0.2.7" 22 | primitive-types = { version = "0.12.1", features = ["serde"] } 23 | rustc-hash = "1.1.0" 24 | serde = { version = "1.0", features = ["derive"] } 25 | serde_json = { version = "1.0", features = ["raw_value"] } 26 | sha-1 = { default-features = false, version = "0.10.1" } 27 | soketto = "0.7.1" 28 | thiserror = "1.0.24" 29 | tokio = { version = "1.8.2", features = ["full"] } 30 | tokio-util = { version = "0.7.4", features = ["compat"] } 31 | arrayvec = { version = "0.7.1", features = ["serde"] } 32 | tokio-rustls = "0.23.4" 33 | webpki-roots = "0.22.4" 34 | 35 | [dev-dependencies] 36 | bincode = "1.3.3" 37 | -------------------------------------------------------------------------------- /backend/common/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2021 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | pub mod byte_size; 18 | pub mod http_utils; 19 | pub mod id_type; 20 | pub mod internal_messages; 21 | pub mod node_message; 22 | pub mod node_types; 23 | pub mod ready_chunks_all; 24 | pub mod rolling_total; 25 | pub mod time; 26 | pub mod ws_client; 27 | 28 | mod assign_id; 29 | mod dense_map; 30 | mod either_sink; 31 | mod mean_list; 32 | mod most_seen; 33 | mod multi_map_unique; 34 | mod num_stats; 35 | 36 | // Export a bunch of common bits at the top level for ease of import: 37 | pub use assign_id::AssignId; 38 | pub use dense_map::DenseMap; 39 | pub use either_sink::EitherSink; 40 | pub use mean_list::MeanList; 41 | pub use most_seen::MostSeen; 42 | pub use multi_map_unique::MultiMapUnique; 43 | pub use num_stats::NumStats; 44 | -------------------------------------------------------------------------------- /backend/common/src/time.rs: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2021 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | /// Returns current unix time in ms (compatible with JS Date.now()) 18 | pub fn now() -> u64 { 19 | use std::time::SystemTime; 20 | 21 | SystemTime::now() 22 | .duration_since(SystemTime::UNIX_EPOCH) 23 | .expect("System time must be configured to be post Unix Epoch start; qed") 24 | .as_millis() as u64 25 | } 26 | -------------------------------------------------------------------------------- /backend/common/src/ws_client/mod.rs: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2021 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | /// Functionality to establish a connection 18 | mod connect; 19 | /// A close helper that we use in sender/receiver. 20 | mod on_close; 21 | /// The channel based receive interface 22 | mod receiver; 23 | /// The channel based send interface 24 | mod sender; 25 | 26 | pub use connect::{connect, ConnectError, Connection, RawReceiver, RawSender}; 27 | pub use receiver::{Receiver, RecvError, RecvMessage}; 28 | pub use sender::{SendError, Sender, SentMessage}; 29 | -------------------------------------------------------------------------------- /backend/common/src/ws_client/on_close.rs: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2021 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | use tokio::sync::broadcast; 18 | 19 | /// A small helper to fire the "close" channel when it's dropped. 20 | pub struct OnClose(pub broadcast::Sender<()>); 21 | 22 | impl Drop for OnClose { 23 | fn drop(&mut self) { 24 | let _ = self.0.send(()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /backend/telemetry_core/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "telemetry_core" 3 | version = "0.1.0" 4 | authors = ["Parity Technologies Ltd. "] 5 | edition = "2021" 6 | license = "GPL-3.0" 7 | 8 | [dependencies] 9 | anyhow = "1.0.41" 10 | bimap = "0.6.1" 11 | bincode = "1.3.3" 12 | bytes = "1.0.1" 13 | common = { path = "../common" } 14 | flume = "0.10.8" 15 | futures = "0.3.15" 16 | hex = "0.4.3" 17 | http = "0.2.4" 18 | hyper = "0.14.11" 19 | log = "0.4.14" 20 | maxminddb = "0.23.0" 21 | num_cpus = "1.13.0" 22 | once_cell = "1.8.0" 23 | parking_lot = "0.12.1" 24 | primitive-types = { version = "0.12.1", features = ["serde"] } 25 | rayon = "1.5.1" 26 | reqwest = { version = "0.11.4", features = ["json"] } 27 | rustc-hash = "1.1.0" 28 | serde = { version = "1.0.126", features = ["derive"] } 29 | serde_json = "1.0.64" 30 | simple_logger = "4.0.0" 31 | smallvec = "1.6.1" 32 | soketto = "0.7.1" 33 | structopt = "0.3.21" 34 | thiserror = "1.0.25" 35 | tokio = { version = "1.10.1", features = ["full"] } 36 | tokio-util = { version = "0.7.4", features = ["compat"] } 37 | 38 | [target.'cfg(not(target_env = "msvc"))'.dependencies] 39 | jemallocator = "0.5.0" 40 | 41 | [dev-dependencies] 42 | shellwords = "1.1.0" 43 | test_utils = { path = "../test_utils" } 44 | criterion = { version = "0.4.0", features = ["async", "async_tokio"] } 45 | 46 | [[bench]] 47 | name = "subscribe" 48 | harness = false 49 | -------------------------------------------------------------------------------- /backend/telemetry_core/src/GeoLite2-City.mmdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paritytech/substrate-telemetry/635776328da241dad7301775726525466cde93d4/backend/telemetry_core/src/GeoLite2-City.mmdb -------------------------------------------------------------------------------- /backend/telemetry_core/src/aggregator/mod.rs: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2021 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | mod aggregator; 18 | mod aggregator_set; 19 | mod inner_loop; 20 | 21 | // Expose the various message types that can be worked with externally: 22 | pub use aggregator::AggregatorOpts; 23 | pub use inner_loop::{FromFeedWebsocket, FromShardWebsocket, ToFeedWebsocket, ToShardWebsocket}; 24 | 25 | pub use aggregator_set::*; 26 | -------------------------------------------------------------------------------- /backend/telemetry_core/src/state/mod.rs: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2021 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | mod chain; 18 | mod chain_stats; 19 | mod counter; 20 | mod node; 21 | 22 | mod state; 23 | 24 | pub use node::Node; 25 | pub use state::*; 26 | -------------------------------------------------------------------------------- /backend/telemetry_shard/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "telemetry_shard" 3 | version = "0.1.0" 4 | authors = ["Parity Technologies Ltd. "] 5 | edition = "2021" 6 | license = "GPL-3.0" 7 | 8 | [dependencies] 9 | anyhow = "1.0.41" 10 | bincode = "1.3.3" 11 | common = { path = "../common" } 12 | flume = "0.10.8" 13 | futures = "0.3.15" 14 | hex = "0.4.3" 15 | http = "0.2.4" 16 | hyper = "0.14.11" 17 | log = "0.4.14" 18 | num_cpus = "1.13.0" 19 | primitive-types = { version = "0.12.1", features = ["serde"] } 20 | serde = { version = "1.0.126", features = ["derive"] } 21 | serde_json = "1.0.64" 22 | simple_logger = "4.0.0" 23 | soketto = "0.7.1" 24 | structopt = "0.3.21" 25 | thiserror = "1.0.25" 26 | tokio = { version = "1.10.1", features = ["full"] } 27 | tokio-util = { version = "0.7.4", features = ["compat"] } 28 | 29 | [target.'cfg(not(target_env = "msvc"))'.dependencies] 30 | jemallocator = "0.5.0" 31 | -------------------------------------------------------------------------------- /backend/telemetry_shard/src/json_message/mod.rs: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2021 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | //! This module contains the types we need to deserialize JSON messages from nodes 18 | 19 | mod hash; 20 | mod node_message; 21 | 22 | pub use node_message::*; 23 | -------------------------------------------------------------------------------- /backend/test_utils/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_utils" 3 | version = "0.1.0" 4 | authors = ["James Wilson "] 5 | edition = "2021" 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | anyhow = "1.0.41" 11 | futures = "0.3.15" 12 | http = "0.2.4" 13 | log = "0.4.14" 14 | serde_json = "1.0.64" 15 | soketto = "0.7.1" 16 | thiserror = "1.0.25" 17 | tokio = { version = "1.10.1", features = ["full"] } 18 | tokio-util = { version = "0.7.4", features = ["full"] } 19 | common = { path = "../common" } 20 | time = { version = "0.3.0", features = ["formatting"] } 21 | flume = "0.10.8" 22 | -------------------------------------------------------------------------------- /backend/test_utils/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2021 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | /// Create/connect to a server consisting of shards and a core process that we can interact with. 18 | pub mod server; 19 | 20 | /// Test support for deserializing feed messages from the feed processes. This basically 21 | /// is the slightly-lossy inverse of the custom serialization we do to feed messages. 22 | pub mod feed_message_de; 23 | 24 | /// A couple of macros to make it easier to test for the presence of things (mainly, feed messages) 25 | /// in an iterable container. 26 | #[macro_use] 27 | pub mod contains_matches; 28 | 29 | /// Utilities to help with running tests from within this current workspace. 30 | pub mod workspace; 31 | 32 | /// A utility to generate fake telemetry messages at realistic intervals. 33 | pub mod fake_telemetry; 34 | -------------------------------------------------------------------------------- /backend/test_utils/src/server/mod.rs: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2021 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | mod server; 18 | mod utils; 19 | 20 | pub mod channels; 21 | pub use server::*; 22 | -------------------------------------------------------------------------------- /backend/test_utils/src/workspace/mod.rs: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2021 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | mod commands; 18 | mod start_server; 19 | 20 | pub use start_server::*; 21 | -------------------------------------------------------------------------------- /doc/screenshot01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paritytech/substrate-telemetry/635776328da241dad7301775726525466cde93d4/doc/screenshot01.png -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | telemetry-frontend: 5 | build: 6 | dockerfile: Dockerfile 7 | context: ./frontend/ 8 | read_only: true 9 | tmpfs: 10 | - /var/cache/nginx:uid=101,gid=101 11 | - /var/run:uid=101,gid=101 12 | - /app/tmp:uid=101,gid=101 13 | environment: 14 | SUBSTRATE_TELEMETRY_URL: ws://localhost:8000/feed 15 | ports: 16 | - 3000:8000 17 | expose: 18 | - 3000 19 | restart: unless-stopped 20 | 21 | telemetry-backend-shard: 22 | build: 23 | dockerfile: Dockerfile 24 | context: ./backend/ 25 | read_only: true 26 | command: [ 27 | 'telemetry_shard', 28 | '--listen', '0.0.0.0:8001', 29 | '--core', 'http://telemetry-backend-core:8000/shard_submit' 30 | ] 31 | ports: 32 | - 8001:8001 33 | expose: 34 | - 8001 35 | restart: unless-stopped 36 | 37 | telemetry-backend-core: 38 | build: 39 | dockerfile: Dockerfile 40 | context: ./backend/ 41 | read_only: true 42 | command: [ 43 | 'telemetry_core', 44 | '--listen', '0.0.0.0:8000' 45 | ] 46 | ports: 47 | - 8000:8000 48 | expose: 49 | - 8000 50 | restart: unless-stopped 51 | 52 | -------------------------------------------------------------------------------- /frontend/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2021": true 5 | }, 6 | "extends": [ 7 | "eslint:recommended", 8 | "plugin:@typescript-eslint/recommended", 9 | "plugin:react/jsx-runtime", 10 | "plugin:react/recommended" 11 | ], 12 | "parser": "@typescript-eslint/parser", 13 | "parserOptions": { 14 | "ecmaFeatures": { 15 | "jsx": true 16 | }, 17 | "ecmaVersion": 12, 18 | "sourceType": "module" 19 | }, 20 | "plugins": ["react", "react-hooks", "@typescript-eslint"], 21 | "rules": { 22 | "no-console": 0, 23 | "no-empty": 0, 24 | "no-bitwise": 0, 25 | "quotes": [1, "single"], 26 | "jsx-quotes": [1, "prefer-double"], 27 | "semi": [1, "always"], 28 | "@typescript-eslint/prefer-as-const": 1, 29 | "@typescript-eslint/no-namespace": 1, 30 | "no-unused-vars": "off", 31 | "@typescript-eslint/no-unused-vars": [ 32 | "warn", 33 | { 34 | "argsIgnorePattern": "^_", 35 | "varsIgnorePattern": "^_", 36 | "caughtErrorsIgnorePattern": "^_" 37 | } 38 | ] 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /frontend/.gitignore: -------------------------------------------------------------------------------- 1 | .nyc 2 | .nyc_output 3 | report.20200422.181728.7118.0.001.json 4 | -------------------------------------------------------------------------------- /frontend/.nvmrc: -------------------------------------------------------------------------------- 1 | 14 2 | -------------------------------------------------------------------------------- /frontend/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "semi": true 4 | } 5 | -------------------------------------------------------------------------------- /frontend/Dockerfile: -------------------------------------------------------------------------------- 1 | #### BUILDER IMAGE #### 2 | FROM docker.io/node:18 as builder 3 | LABEL maintainer="Chevdor " 4 | LABEL description="Substrate Telemetry Frontend builder image" 5 | 6 | WORKDIR /opt/builder 7 | 8 | COPY . . 9 | 10 | RUN npm install && npm run build 11 | 12 | #### OUTPUT IMAGE #### 13 | FROM docker.io/nginx:stable-alpine 14 | LABEL maintainer="Chevdor " 15 | LABEL description="Substrate Telemetry Frontend" 16 | 17 | # Each time this container is ran, the value that's provided for this env var 18 | # determines where the frontend will try to request feed information from: 19 | ENV SUBSTRATE_TELEMETRY_URL= 20 | 21 | WORKDIR /app 22 | 23 | COPY --from=builder /opt/builder/scripts/*.sh /usr/local/bin/ 24 | COPY --from=builder /opt/builder/build /app 25 | COPY --from=builder /opt/builder/nginx/nginx.conf /etc/nginx/nginx.conf 26 | 27 | RUN apk add --no-cache bash && \ 28 | chown -R nginx:nginx /app && \ 29 | chown -R nginx:nginx /var/cache/nginx && \ 30 | chown -R nginx:nginx /var/log/nginx && \ 31 | chown -R nginx:nginx /etc/nginx/conf.d && \ 32 | touch /var/run/nginx.pid && \ 33 | chown -R nginx:nginx /var/run/nginx.pid && \ 34 | rm /etc/nginx/conf.d/default.conf 35 | 36 | # UID= 101 37 | USER nginx 38 | EXPOSE 8000 39 | 40 | CMD ["/usr/local/bin/start.sh"] 41 | -------------------------------------------------------------------------------- /frontend/Dockerfile.README.md: -------------------------------------------------------------------------------- 1 | # substrate-telemetry-frontend 2 | 3 | ### [Documentation](https://github.com/paritytech/substrate-telemetry/blob/master/README.md) 4 | -------------------------------------------------------------------------------- /frontend/assets/favicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /frontend/assets/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | Polkadot Telemetry 11 | 12 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /frontend/assets/mock.image.js: -------------------------------------------------------------------------------- 1 | // loading images gives back a path. This is what we replace 2 | // that with for tests: 3 | module.exports = 'test-image-stub'; 4 | -------------------------------------------------------------------------------- /frontend/assets/mock.style.js: -------------------------------------------------------------------------------- 1 | // For loading styles, give back an empty object in tests: 2 | module.exports = {}; 3 | -------------------------------------------------------------------------------- /frontend/images.d.ts: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | declare module '*.svg'; 18 | declare module '*.png'; 19 | declare module '*.jpg'; 20 | -------------------------------------------------------------------------------- /frontend/jest.config.js: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | /** @type {import('ts-jest').JestConfigWithTsJest} */ 18 | module.exports = { 19 | preset: 'ts-jest', 20 | testEnvironment: 'jsdom', 21 | setupFiles: ['/setupJest.js'], 22 | moduleNameMapper: { 23 | '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': 24 | '/assets/mock.image.js', 25 | '\\.(css|less|scss|sass)$': '/assets/mock.style.js', 26 | }, 27 | }; 28 | -------------------------------------------------------------------------------- /frontend/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | worker_processes auto; 2 | worker_rlimit_nofile 30000; 3 | 4 | error_log /var/log/nginx/error.log warn; 5 | pid /var/run/nginx.pid; 6 | 7 | events { 8 | worker_connections 8000; 9 | } 10 | 11 | http { 12 | default_type application/octet-stream; 13 | include /etc/nginx/mime.types; 14 | 15 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 16 | '$status $body_bytes_sent "$http_referer" ' 17 | '"$http_user_agent" "$http_x_forwarded_for"'; 18 | 19 | access_log /var/log/nginx/access.log main; 20 | sendfile on; 21 | 22 | keepalive_timeout 65; 23 | gzip on; 24 | include /etc/nginx/conf.d/*.conf; 25 | 26 | server { 27 | root /app; 28 | index index.html; 29 | listen 8000; 30 | listen [::]:8000; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /frontend/scripts/env.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script is used when the docker container starts and does the magic to 4 | # bring the ENV variables to the generated static UI. 5 | 6 | ENV_DIR=./tmp 7 | mkdir -p "$ENV_DIR" 8 | TARGET="$ENV_DIR/env-config.js" 9 | 10 | # Recreate config file 11 | echo -n > $TARGET 12 | 13 | declare -a vars=( 14 | "SUBSTRATE_TELEMETRY_URL" 15 | ) 16 | 17 | echo "window.process_env = {" >> $TARGET 18 | for VAR in ${vars[@]}; do 19 | echo " $VAR: \"${!VAR}\"," >> $TARGET 20 | done 21 | echo "}" >> $TARGET 22 | 23 | chmod 440 $TARGET 24 | -------------------------------------------------------------------------------- /frontend/scripts/start.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ENV_CONFIG=/app/tmp/env-config.js 4 | 5 | if test -f $ENV_CONFIG; then 6 | echo Config is locked 7 | else 8 | echo Generate env-config script... 9 | /usr/local/bin/env.sh 10 | echo done 11 | chmod 444 $ENV_CONFIG 12 | fi 13 | 14 | echo Starting nginx... 15 | nginx -g "daemon off;" 16 | -------------------------------------------------------------------------------- /frontend/setupJest.js: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | // This file runs some code before a jest test. 18 | 19 | // polyfill TextEncoder/TextDecoder since they aren't in jsdom: 20 | const { TextEncoder, TextDecoder } = require('util'); 21 | global.TextEncoder = TextEncoder; 22 | global.TextDecoder = TextDecoder; 23 | 24 | // polyfill fetch since it's not in jsdom: 25 | require('whatwg-fetch'); 26 | -------------------------------------------------------------------------------- /frontend/src/App.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .App { 20 | text-align: left; 21 | font-family: Roboto, Helvetica, Arial, sans-serif; 22 | font-size: 16px; 23 | min-width: 1318px; 24 | } 25 | 26 | .App-no-telemetry { 27 | width: 100vw; 28 | height: 100vh; 29 | line-height: 80vh; 30 | font-size: 56px; 31 | font-weight: 100; 32 | text-align: center; 33 | color: #888; 34 | } 35 | -------------------------------------------------------------------------------- /frontend/src/App.test.tsx: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | import * as React from 'react'; 18 | import { createRoot } from 'react-dom/client'; 19 | import App from './App'; 20 | 21 | describe('App.tsx', () => { 22 | it('renders without crashing', () => { 23 | const div = document.createElement('div'); 24 | const root = createRoot(div); 25 | root.render(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /frontend/src/common/id.ts: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | import { Opaque } from './helpers'; 18 | 19 | /** 20 | * Unique type-constrained Id number. 21 | */ 22 | export type Id = Opaque; 23 | 24 | /** 25 | * Higher order function producing new auto-incremented `Id`s. 26 | */ 27 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 28 | export function idGenerator>(): () => I { 29 | let current = 0; 30 | 31 | return () => current++ as I; 32 | } 33 | -------------------------------------------------------------------------------- /frontend/src/common/index.ts: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | export * from './helpers'; 18 | export * from './id'; 19 | export * from './stringify'; 20 | export * from './SortedCollection'; 21 | 22 | import * as Types from './types'; 23 | import * as FeedMessage from './feed'; 24 | 25 | export { Types, FeedMessage }; 26 | 27 | // Increment this if breaking changes were made to types in `feed.ts` 28 | export const VERSION: Types.FeedVersion = 32 as Types.FeedVersion; 29 | -------------------------------------------------------------------------------- /frontend/src/common/stringify.ts: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | export abstract class Stringified { 18 | public __PHANTOM__: T; 19 | } 20 | 21 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 22 | export const parse = JSON.parse as any as (val: Stringified) => T; 23 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 24 | export const stringify = JSON.stringify as any as (val: T) => Stringified; 25 | -------------------------------------------------------------------------------- /frontend/src/components/Chain/Chain.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .Chain-content-container { 20 | position: absolute; 21 | left: 0; 22 | right: 0; 23 | bottom: 0; 24 | top: 148px; 25 | } 26 | 27 | .Chain-content { 28 | width: 100%; 29 | min-width: 1350px; 30 | min-height: 100%; 31 | background: #2c2b2b; 32 | color: #fff; 33 | } 34 | -------------------------------------------------------------------------------- /frontend/src/components/Chain/Header.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .Header { 20 | width: 100%; 21 | height: 108px; 22 | overflow: hidden; 23 | background: #fff; 24 | color: #000; 25 | min-width: 1350px; 26 | position: relative; 27 | background: linear-gradient(0deg, rgba(0,0,0,0.2) 0%, rgb(255, 255, 255) 17%), white; 28 | } 29 | 30 | .Header-tabs { 31 | position: absolute; 32 | right: 5px; 33 | bottom: 10px; 34 | width: 200px; 35 | text-align: right; 36 | } 37 | -------------------------------------------------------------------------------- /frontend/src/components/Chain/Tab.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .Chain-Tab { 20 | display: inline-flex; 21 | align-items: center; 22 | justify-content: center; 23 | margin-right: 5px; 24 | font-size: 18px; 25 | line-height: 20px; 26 | height: 32px; 27 | width: 32px; 28 | color: #555; 29 | cursor: pointer; 30 | border-radius: 40px; 31 | box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.2); 32 | } 33 | 34 | .Chain-Tab:hover { 35 | background: #ccc; 36 | } 37 | 38 | .Chain-Tab-on, 39 | .Chain-Tab-on:hover { 40 | background: #e6007a; 41 | color: #fff; 42 | } 43 | -------------------------------------------------------------------------------- /frontend/src/components/Chain/index.ts: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | export * from './Chain'; 18 | export * from './Tab'; 19 | export * from './Header'; 20 | -------------------------------------------------------------------------------- /frontend/src/components/Filter.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .Filter { 20 | position: fixed; 21 | z-index: 100; 22 | bottom: 20px; 23 | left: 50%; 24 | width: 400px; 25 | font-size: 30px; 26 | margin-left: -210px; 27 | padding: 10px 10px 10px 60px; 28 | border-radius: 4px; 29 | background: #111; 30 | color: #fff; 31 | box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); 32 | } 33 | 34 | .Filter-hidden { 35 | bottom: -300px; 36 | } 37 | 38 | .Filter input { 39 | padding: 0; 40 | margin: 0; 41 | border: none; 42 | outline: none; 43 | width: 350px; 44 | font-size: 30px; 45 | background: #111; 46 | color: #fff; 47 | font-family: Roboto, Helvetica, Arial, sans-serif; 48 | font-weight: 300; 49 | } 50 | 51 | .Filter .Icon { 52 | position: absolute; 53 | left: 13px; 54 | top: 17px; 55 | font-size: 30px; 56 | } 57 | -------------------------------------------------------------------------------- /frontend/src/components/Icon.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .Icon { 20 | fill: currentColor; 21 | height: 1em; 22 | width: 1em; 23 | text-align: center; 24 | line-height: 1em; 25 | vertical-align: middle; 26 | display: inline-block; 27 | } 28 | 29 | .Icon svg, 30 | .Icon-symbol-root symbol { 31 | width: 1em; 32 | height: 1em; 33 | } 34 | -------------------------------------------------------------------------------- /frontend/src/components/List/Column/BlockNumberColumn.tsx: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | import * as React from 'react'; 18 | import { ColumnProps } from './'; 19 | import { Node } from '../../../state'; 20 | import { formatNumber } from '../../../utils'; 21 | import icon from '../../../icons/cube.svg'; 22 | 23 | export class BlockNumberColumn extends React.Component { 24 | public static readonly label = 'Block'; 25 | public static readonly icon = icon; 26 | public static readonly width = 88; 27 | public static readonly setting = 'blocknumber'; 28 | public static readonly sortBy = ({ height }: Node) => height; 29 | 30 | private data = 0; 31 | 32 | public shouldComponentUpdate(nextProps: ColumnProps) { 33 | return this.data !== nextProps.node.height; 34 | } 35 | 36 | render() { 37 | const { height } = this.props.node; 38 | 39 | this.data = height; 40 | 41 | return {`#${formatNumber(height)}`}; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /frontend/src/components/List/Column/Column.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .Column { 20 | text-align: left; 21 | padding: 6px 13px; 22 | height: 19px; 23 | position: relative; 24 | white-space: nowrap; 25 | } 26 | 27 | .Column-truncate { 28 | position: absolute; 29 | left: 0; 30 | right: 0; 31 | top: 0; 32 | padding: 6px 13px; 33 | overflow: hidden; 34 | text-overflow: ellipsis; 35 | } 36 | 37 | .Column-Tooltip { 38 | position: initial !important; 39 | padding: inherit !important; 40 | } 41 | 42 | .Column-validator { 43 | display: block; 44 | width: 16px; 45 | height: 16px; 46 | cursor: pointer; 47 | } 48 | 49 | .Column-validator:hover { 50 | transform: scale(2); 51 | } 52 | 53 | .Column--a { 54 | color: inherit; 55 | text-decoration: none; 56 | } 57 | 58 | .Column--a:hover { 59 | text-decoration: underline; 60 | } 61 | -------------------------------------------------------------------------------- /frontend/src/components/List/Column/CpuColumn.tsx: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | //Column for specifying which CPU type the node is running on 18 | 19 | import * as React from 'react'; 20 | import { ColumnProps } from './'; 21 | import { Node } from '../../../state'; 22 | import icon from '../../../icons/file-binary.svg'; 23 | 24 | export class CpuColumn extends React.Component { 25 | public static readonly label = 'CPU Column'; 26 | public static readonly icon = icon; 27 | public static readonly width = 154; 28 | public static readonly setting = 'cpu'; 29 | public static readonly sortBy = ({ cpu }: Node) => cpu || 0; 30 | 31 | private data: string; 32 | 33 | public shouldComponentUpdate(nextProps: ColumnProps) { 34 | return this.data !== nextProps.node.cpu; 35 | } 36 | 37 | render() { 38 | const { cpu } = this.props.node; 39 | 40 | this.data = cpu; 41 | 42 | return {cpu || '-'}; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /frontend/src/components/List/Column/CpuCoresColumn.tsx: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | import * as React from 'react'; 17 | import { ColumnProps } from './'; 18 | import { Node } from '../../../state'; 19 | import icon from '../../../icons/file-binary.svg'; 20 | 21 | export class CpuCoresColumn extends React.Component { 22 | public static readonly label = 'CPU Cores'; 23 | public static readonly icon = icon; 24 | public static readonly width = 154; 25 | public static readonly setting = 'core_count'; 26 | public static readonly sortBy = ({ core_count }: Node) => core_count || 0; 27 | 28 | private data: number; 29 | 30 | public shouldComponentUpdate(nextProps: ColumnProps) { 31 | return this.data !== nextProps.node.core_count; 32 | } 33 | 34 | render() { 35 | const { core_count } = this.props.node; 36 | 37 | this.data = core_count; 38 | 39 | return {core_count || '-'}; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /frontend/src/components/List/Column/FinalizedBlockColumn.tsx: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | import * as React from 'react'; 18 | import { ColumnProps } from './'; 19 | import { Node } from '../../../state'; 20 | import { formatNumber } from '../../../utils'; 21 | import icon from '../../../icons/cube-alt.svg'; 22 | 23 | export class FinalizedBlockColumn extends React.Component { 24 | public static readonly label = 'Finalized Block'; 25 | public static readonly icon = icon; 26 | public static readonly width = 88; 27 | public static readonly setting = 'finalized'; 28 | public static readonly sortBy = ({ finalized }: Node) => finalized || 0; 29 | 30 | private data = 0; 31 | 32 | public shouldComponentUpdate(nextProps: ColumnProps) { 33 | return this.data !== nextProps.node.finalized; 34 | } 35 | 36 | render() { 37 | const { finalized } = this.props.node; 38 | 39 | this.data = finalized; 40 | 41 | return {`#${formatNumber(finalized)}`}; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /frontend/src/components/List/Column/MemoryColumn.tsx: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | //Column specifying type of memory each node has 18 | import * as React from 'react'; 19 | import { ColumnProps } from './'; 20 | import { Node } from '../../../state'; 21 | import icon from '../../../icons/file-binary.svg'; 22 | 23 | export class MemoryColumn extends React.Component { 24 | public static readonly label = 'memory'; 25 | public static readonly icon = icon; 26 | public static readonly width = 154; 27 | public static readonly setting = 'memory'; 28 | public static readonly sortBy = ({ memory }: Node) => memory || ''; 29 | 30 | private data: number; 31 | 32 | public shouldComponentUpdate(nextProps: ColumnProps) { 33 | return this.data !== nextProps.node.memory; 34 | } 35 | 36 | render() { 37 | const { memory } = this.props.node; 38 | 39 | this.data = memory; 40 | 41 | return {memory || '-'}; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /frontend/src/components/List/Column/OperatingSystemColumn.tsx: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | //Column for specifying which OS the node is running on 18 | 19 | import * as React from 'react'; 20 | import { ColumnProps } from './'; 21 | import { Node } from '../../../state'; 22 | import icon from '../../../icons/file-binary.svg'; 23 | 24 | export class OperatingSystemColumn extends React.Component { 25 | public static readonly label = 'OS'; 26 | public static readonly icon = icon; 27 | public static readonly width = 154; 28 | public static readonly setting = 'target_os'; 29 | public static readonly sortBy = ({ target_os }: Node) => target_os || ''; 30 | 31 | private data: string; 32 | 33 | public shouldComponentUpdate(nextProps: ColumnProps) { 34 | return this.data !== nextProps.node.hash; 35 | } 36 | 37 | render() { 38 | const { target_os } = this.props.node; 39 | 40 | this.data = target_os; 41 | 42 | return {target_os || '-'}; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /frontend/src/components/List/Column/PeersColumn.tsx: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | import * as React from 'react'; 18 | import { ColumnProps } from './'; 19 | import { Node } from '../../../state'; 20 | import icon from '../../../icons/broadcast.svg'; 21 | 22 | export class PeersColumn extends React.Component { 23 | public static readonly label = 'Peer Count'; 24 | public static readonly icon = icon; 25 | public static readonly width = 26; 26 | public static readonly setting = 'peers'; 27 | public static readonly sortBy = ({ peers }: Node) => peers; 28 | 29 | private data = 0; 30 | 31 | public shouldComponentUpdate(nextProps: ColumnProps) { 32 | return this.data !== nextProps.node.peers; 33 | } 34 | 35 | render() { 36 | const { peers } = this.props.node; 37 | 38 | this.data = peers; 39 | 40 | return {peers}; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /frontend/src/components/List/Column/TxsColumn.tsx: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | import * as React from 'react'; 18 | import { ColumnProps } from './'; 19 | import { Node } from '../../../state'; 20 | import icon from '../../../icons/inbox.svg'; 21 | 22 | export class TxsColumn extends React.Component { 23 | public static readonly label = 'Transactions in Queue'; 24 | public static readonly icon = icon; 25 | public static readonly width = 26; 26 | public static readonly setting = 'txs'; 27 | public static readonly sortBy = ({ txs }: Node) => txs; 28 | 29 | private data = 0; 30 | 31 | public shouldComponentUpdate(nextProps: ColumnProps) { 32 | return this.data !== nextProps.node.txs; 33 | } 34 | 35 | render() { 36 | const { txs } = this.props.node; 37 | 38 | this.data = txs; 39 | 40 | return {txs}; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /frontend/src/components/List/Column/VersionColumn.tsx: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | //Column for specifying which polkadot version node is running on 18 | 19 | import * as React from 'react'; 20 | import { ColumnProps } from './'; 21 | import { Node } from '../../../state'; 22 | import icon from '../../../icons/file-binary.svg'; 23 | 24 | export class VersionColumn extends React.Component { 25 | public static readonly label = 'version'; 26 | public static readonly icon = icon; 27 | public static readonly width = 154; 28 | public static readonly setting = 'version'; 29 | public static readonly sortBy = ({ version }: Node) => version || ''; 30 | 31 | private data: string; 32 | 33 | public shouldComponentUpdate(nextProps: ColumnProps) { 34 | return this.data !== nextProps.node.version; 35 | } 36 | 37 | render() { 38 | const { version } = this.props.node; 39 | 40 | this.data = version; 41 | 42 | return {version || '-'}; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /frontend/src/components/List/List.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .List { 20 | /* Prevents the list from auto-scrolling while cascading node 21 | * updates on new block, which helps with performance. */ 22 | overflow-anchor: none; 23 | } 24 | 25 | .List-no-nodes { 26 | font-size: 30px; 27 | padding-top: 20vh; 28 | text-align: center; 29 | font-weight: 300; 30 | } 31 | 32 | .List-padding { 33 | padding: 0; 34 | margin: 0; 35 | } 36 | 37 | .List--table { 38 | width: 100%; 39 | border-spacing: 0; 40 | font-family: monospace, sans-serif; 41 | } 42 | -------------------------------------------------------------------------------- /frontend/src/components/List/Row.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .Row { 20 | color: #b5aeae; 21 | cursor: pointer; 22 | } 23 | 24 | .Row-synced { 25 | color: #fff; 26 | } 27 | 28 | .Row-pinned td:first-child { 29 | border-left: 3px solid #e6007a; 30 | padding-left: 10px; 31 | } 32 | 33 | .Row-pinned td:last-child { 34 | border-right: 3px solid #e6007a; 35 | padding-right: 10px; 36 | } 37 | 38 | .Row-pinned.Row-synced { 39 | color: #e6007a; 40 | } 41 | 42 | .Row-stale { 43 | color: #555; 44 | } 45 | 46 | .Row:hover { 47 | background-color: #1e1e1e; 48 | } 49 | -------------------------------------------------------------------------------- /frontend/src/components/List/THead.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .THead { 20 | background: #393838; 21 | } 22 | 23 | .THeadCell { 24 | text-align: left; 25 | padding: 8px 13px; 26 | height: 23px; 27 | } 28 | 29 | .THeadCell-sortable { 30 | cursor: pointer; 31 | } 32 | 33 | .THeadCell-sorted { 34 | cursor: pointer; 35 | background: #e6007a; 36 | color: #fff; 37 | } 38 | 39 | .THeadCell-container { 40 | position: relative; 41 | display: inline-block; 42 | } 43 | -------------------------------------------------------------------------------- /frontend/src/components/List/index.ts: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | export * from './Column'; 18 | export * from './List'; 19 | export * from './Row'; 20 | export * from './THeadCell'; 21 | export * from './THead'; 22 | -------------------------------------------------------------------------------- /frontend/src/components/Map/Map.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .Map { 20 | min-width: 1350px; 21 | background: url('../../assets/world-map.svg') no-repeat; 22 | background-size: contain; 23 | background-position: center; 24 | position: absolute; 25 | left: 0; 26 | right: 0; 27 | top: 0; 28 | bottom: 0; 29 | } 30 | -------------------------------------------------------------------------------- /frontend/src/components/Map/index.ts: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | export * from './Map'; 18 | export * from './Location'; 19 | -------------------------------------------------------------------------------- /frontend/src/components/OfflineIndicator.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .OfflineIndicator { 20 | position: absolute; 21 | top: 30px; 22 | right: 30px; 23 | z-index: 10; 24 | background: #c00; 25 | line-height: 16px; 26 | color: #fff; 27 | font-size: 30px; 28 | padding: 16px; 29 | border-radius: 50px; 30 | box-shadow: rgba(0, 0, 0, 0.5) 0 3px 20px; 31 | } 32 | 33 | .OfflineIndicator-upgrade { 34 | background: #282; 35 | } 36 | -------------------------------------------------------------------------------- /frontend/src/components/Settings/Setting.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .Setting { 20 | color: #635f5f; 21 | padding: 0; 22 | margin: 0 0 8px 0; 23 | cursor: pointer; 24 | } 25 | 26 | .Setting-on { 27 | color: #fff; 28 | } 29 | 30 | .Setting .Icon { 31 | margin-right: 10px; 32 | } 33 | 34 | .Setting-switch { 35 | width: 40px; 36 | height: 18px; 37 | border-radius: 18px; 38 | display: block; 39 | float: right; 40 | position: relative; 41 | background: #444; 42 | transition: background-color 0.15s linear, border-color 0.15s linear; 43 | } 44 | 45 | .Setting-on .Setting-switch { 46 | background: #e6007a; 47 | border-color: #e6007a; 48 | } 49 | 50 | .Setting-knob { 51 | width: 18px; 52 | height: 18px; 53 | border-radius: 19px; 54 | display: block; 55 | position: absolute; 56 | left: 0; 57 | top: 0; 58 | background: #fff; 59 | transition: left 0.15s ease-in-out; 60 | } 61 | 62 | .Setting-on .Setting-knob { 63 | left: 22px; 64 | } 65 | -------------------------------------------------------------------------------- /frontend/src/components/Settings/Settings.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .Settings { 20 | text-align: center; 21 | } 22 | 23 | .Settings-category { 24 | text-align: left; 25 | width: 500px; 26 | margin: 0 auto; 27 | padding: 2em 0; 28 | } 29 | 30 | .Settings-category h2 { 31 | padding: 0; 32 | margin: 0 0 0.5em 0; 33 | font-size: 20px; 34 | font-weight: 100; 35 | } 36 | -------------------------------------------------------------------------------- /frontend/src/components/Settings/index.ts: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | export * from './Settings'; 18 | export * from './Setting'; 19 | -------------------------------------------------------------------------------- /frontend/src/components/Sparkline.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .Sparkline { 20 | fill: currentcolor; 21 | fill-opacity: 0.35; 22 | stroke: currentcolor; 23 | margin: 0 -1px -3px -1px; 24 | } 25 | 26 | .Sparkline path { 27 | pointer-events: none; 28 | } 29 | 30 | .Sparkline .Sparkline-cursor { 31 | display: none; 32 | } 33 | 34 | .Sparkline:hover .Sparkline-cursor { 35 | display: initial; 36 | } 37 | -------------------------------------------------------------------------------- /frontend/src/components/Stats/index.ts: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2022 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | export * from './Stats'; 18 | -------------------------------------------------------------------------------- /frontend/src/components/Tile.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | .Tile { 20 | font-size: 2.5em; 21 | text-align: left; 22 | width: 260px; 23 | height: 100px; 24 | display: inline-block; 25 | position: relative; 26 | } 27 | 28 | .Tile-label { 29 | position: absolute; 30 | top: 24px; 31 | left: 70px; 32 | right: 0; 33 | font-size: 0.4em; 34 | text-transform: uppercase; 35 | } 36 | 37 | .Tile-content { 38 | position: absolute; 39 | bottom: 16px; 40 | left: 70px; 41 | right: 0; 42 | font-weight: 300; 43 | font-size: 0.75em; 44 | } 45 | 46 | .Tile .Icon { 47 | position: absolute; 48 | left: 20px; 49 | top: 15px; 50 | font-size: 0.8em; 51 | padding: 0.1em; 52 | border-radius: 1.25em; 53 | border: 2px solid #e6007a; 54 | color: #e6007a; 55 | } 56 | -------------------------------------------------------------------------------- /frontend/src/components/Tile.tsx: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | import * as React from 'react'; 18 | import './Tile.css'; 19 | import { Icon } from './Icon'; 20 | 21 | interface TileProps { 22 | title: string; 23 | icon: string; 24 | children?: React.ReactNode; 25 | } 26 | 27 | export function Tile(props: TileProps) { 28 | return ( 29 |
30 | 31 | {props.title} 32 | {props.children} 33 |
34 | ); 35 | } 36 | -------------------------------------------------------------------------------- /frontend/src/components/Truncate.tsx: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | import * as React from 'react'; 18 | 19 | interface TruncateProps { 20 | text: string; 21 | chars?: number; 22 | } 23 | 24 | export class Truncate extends React.Component { 25 | public shouldComponentUpdate(nextProps: TruncateProps): boolean { 26 | return this.props.text !== nextProps.text; 27 | } 28 | 29 | public render() { 30 | const { text, chars } = this.props; 31 | 32 | if (!text) { 33 | return '-'; 34 | } 35 | 36 | if (chars != null && text.length <= chars) { 37 | return text; 38 | } 39 | 40 | return chars ? ( 41 | `${text.substr(0, chars - 1)}…` 42 | ) : ( 43 |
{text}
44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /frontend/src/components/index.ts: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | export * from './AllChains'; 18 | export * from './Chains'; 19 | export * from './Chain'; 20 | export * from './List'; 21 | export * from './Map'; 22 | export * from './Settings'; 23 | export * from './Stats'; 24 | export * from './Icon'; 25 | export * from './Tile'; 26 | export * from './Ago'; 27 | export * from './OfflineIndicator'; 28 | export * from './Sparkline'; 29 | export * from './Truncate'; 30 | export * from './Tooltip'; 31 | export * from './Filter'; 32 | export * from './PolkadotIcon'; 33 | -------------------------------------------------------------------------------- /frontend/src/icons/alert.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/archive.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/arrow-down.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/arrow-left.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/arrow-right.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/arrow-small-down.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/arrow-small-left.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/arrow-small-right.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/arrow-small-up.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/arrow-up.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/assets.d.ts: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | declare module '*.svg'; 18 | -------------------------------------------------------------------------------- /frontend/src/icons/beaker.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/bell.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/bifrost.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/bold.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/book.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/bookmark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/briefcase.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/broadcast.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/browser.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/bug.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/calendar.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/cennznet.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/check-square-regular.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/check-square-solid.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/check.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/checklist.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/chevron-down.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/chevron-left.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/chevron-right.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/chevron-up.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/circle-regular.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/circle-slash.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/circle-solid.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/circuit-board.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/clippy.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/clock.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/cloud-download.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/cloud-upload.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/code.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/comment-discussion.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/comment.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/credit-card.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/crust.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /frontend/src/icons/cube-alt.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /frontend/src/icons/cube.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /frontend/src/icons/dash.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/dashboard.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/database.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/desktop-download.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/device-camera-video.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/device-camera.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/device-desktop.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/device-mobile.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/diff-added.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/diff-ignored.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/diff-modified.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/diff-removed.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/diff-renamed.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/diff.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/dot.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /frontend/src/icons/dothereum.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /frontend/src/icons/edgeware.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /frontend/src/icons/ellipsis-v-solid.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/ellipsis.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/eye.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/file-binary.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/file-code.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/file-directory.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/file-media.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/file-pdf.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/file-submodule.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/file-symlink-directory.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/file-symlink-file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/file-zip.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/finalized.svg: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /frontend/src/icons/fingerprint.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /frontend/src/icons/flame.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/fold.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/gear.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/gift.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/gist-secret.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/gist.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/git-branch.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/git-commit.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/git-compare.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/git-merge.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/git-pull-request.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/globe-solid.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/grabber.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/graph.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/heart.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/history.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/home.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/horizontal-rule.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/hubot.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/inbox.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/info.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/issue-closed.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/issue-opened.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/issue-reopened.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/italic.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/jersey.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/joystream.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /frontend/src/icons/katalchain.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /frontend/src/icons/kebab-horizontal.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/kebab-vertical.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/key.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/keyboard.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/law.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/light-bulb.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/link-external.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/link.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/list-alt-regular.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/list-ordered.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/list-unordered.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/location.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/lock.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/logo-gist.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/mail-read.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/mail.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/map-marked-alt-solid.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/map-marker-alt-solid.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/map-pin-solid.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/mark-github.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/markdown.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/megaphone.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/memory-solid.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/mention.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/microchip-solid.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/milestone.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/mirror.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/mortar-board.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/mute.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/network.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /frontend/src/icons/no-newline.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/note.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/octoface.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/organization.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/package.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/paintcan.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/pencil.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/person.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/pin.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/plug.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/plus-small.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/plus.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/polkadot-js.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /frontend/src/icons/primitive-dot.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/primitive-square.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/project.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/pulse.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/question-solid.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/question.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/quote.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/radio-tower.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/reply.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/repo-clone.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/repo-force-push.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/repo-forked.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/repo-pull.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/repo-push.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/repo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/report.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/robonomics.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /frontend/src/icons/rocket.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/rss.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/ruby.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/screen-full.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/screen-normal.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/search.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/server.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/settings.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/shield.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/sign-in.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/sign-out.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/smiley.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/square-regular.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/square-solid.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/squirrel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/star.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/stop.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/substrate.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /frontend/src/icons/sync.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/tag.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/tasklist.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/telescope.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/terminal.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/text-size.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/three-bars.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/thumbsdown.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/thumbsup.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/tools.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/totem.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /frontend/src/icons/trashcan.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/triangle-down.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/triangle-left.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/triangle-right.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/triangle-up.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/unfold.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/unmute.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/unverified.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/verified.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/versions.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/watch.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/x.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/zap.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/zero.svg: -------------------------------------------------------------------------------- 1 | z-ctrl-blk 2 | -------------------------------------------------------------------------------- /frontend/src/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | Source code for the Substrate Telemetry Server. 3 | Copyright (C) 2023 Parity Technologies (UK) Ltd. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | * { 20 | /* Use "standard"/common sense heights/widths (ie they include padding+border) */ 21 | box-sizing: border-box; 22 | } 23 | 24 | html, body { 25 | background-color: #2c2b2b; 26 | } 27 | 28 | body { 29 | margin: 0; 30 | padding: 0; 31 | font-family: sans-serif; 32 | } 33 | -------------------------------------------------------------------------------- /frontend/src/index.tsx: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | import * as React from 'react'; 18 | import { createRoot } from 'react-dom/client'; 19 | import App from './App'; 20 | import './index.css'; 21 | 22 | const container = document.getElementById('root') as HTMLElement; 23 | const root = createRoot(container); 24 | root.render(); 25 | -------------------------------------------------------------------------------- /frontend/src/persist/PersistentObject.ts: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | import { Persistent } from './'; 18 | 19 | export class PersistentObject { 20 | private readonly inner: Persistent; 21 | 22 | constructor(key: string, initial: Data, onChange: (value: Data) => void) { 23 | this.inner = new Persistent(key, initial, onChange); 24 | } 25 | 26 | public raw(): Readonly { 27 | return this.inner.get(); 28 | } 29 | 30 | public get(key: K): Data[K] { 31 | return this.inner.get()[key]; 32 | } 33 | 34 | public set(key: K, value: Data[K]) { 35 | const data: Data = Object.assign({}, this.raw()); 36 | data[key] = value; 37 | this.inner.set(data); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /frontend/src/persist/PersistentSet.ts: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | import { Persistent } from './'; 18 | 19 | export class PersistentSet { 20 | private readonly inner: Persistent; 21 | private value: Set; 22 | 23 | constructor(key: string, onChange: (value: Set) => void) { 24 | this.inner = new Persistent(key, [], (raw: Readonly) => 25 | onChange((this.value = new Set(raw as Item[]))) 26 | ); 27 | this.value = new Set(this.inner.get() as Item[]); 28 | } 29 | 30 | public get(): Set { 31 | return this.value; 32 | } 33 | 34 | public add(item: Item) { 35 | this.value.add(item); 36 | this.inner.set(Array.from(this.value)); 37 | } 38 | 39 | public delete(item: Item) { 40 | this.value.delete(item); 41 | this.inner.set(Array.from(this.value)); 42 | } 43 | 44 | public clear() { 45 | this.inner.set([]); 46 | } 47 | 48 | public has(item: Item): boolean { 49 | return this.value.has(item); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /frontend/src/persist/index.ts: -------------------------------------------------------------------------------- 1 | // Source code for the Substrate Telemetry Server. 2 | // Copyright (C) 2023 Parity Technologies (UK) Ltd. 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | export * from './Persistent'; 18 | export * from './PersistentObject'; 19 | export * from './PersistentSet'; 20 | -------------------------------------------------------------------------------- /frontend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "outDir": "./build/", 5 | "module": "es2020", 6 | "target": "es2015", 7 | "lib": ["dom", "dom.iterable", "esnext"], 8 | "sourceMap": true, 9 | "allowJs": false, 10 | "jsx": "react", 11 | "rootDir": "src", 12 | "moduleResolution": "node", 13 | "allowSyntheticDefaultImports": true, 14 | "noEmitOnError": false, 15 | "pretty": true, 16 | "forceConsistentCasingInFileNames": true, 17 | "noErrorTruncation": true, 18 | "noImplicitReturns": true, 19 | "noImplicitAny": true, 20 | "noImplicitThis": true, 21 | "strictNullChecks": true, 22 | "suppressImplicitAnyIndexErrors": true, 23 | "resolveJsonModule": true, 24 | "noUnusedParameters": true, 25 | "skipLibCheck": true 26 | }, 27 | "exclude": ["node_modules", "build"], 28 | "include": ["src", "declarations/**/*.d.ts"] 29 | } 30 | -------------------------------------------------------------------------------- /frontend/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const HtmlWebpackPlugin = require('html-webpack-plugin'); 3 | 4 | module.exports = { 5 | entry: './src/index.tsx', 6 | devtool: 'inline-source-map', 7 | module: { 8 | rules: [ 9 | { 10 | // Allow 'import * from "./foo.tsx"' 11 | test: /\.tsx?$/, 12 | use: 'ts-loader', 13 | exclude: /node_modules/, 14 | }, 15 | { 16 | // allow 'import "foo.css"' and '@import "foo.css" in css files 17 | test: /\.css$/i, 18 | use: ['style-loader', 'css-loader'], 19 | generator: { filename: 'styles/[name].[contenthash][ext]' }, 20 | }, 21 | { 22 | // allow 'import Icon from "./icon.png"' 23 | test: /\.(png|svg|jpg|jpeg|gif)$/i, 24 | type: 'asset/resource', 25 | generator: { filename: 'images/[name].[contenthash][ext]' }, 26 | }, 27 | { 28 | // allow CSS @url('./my-font.woff2')" style font loading 29 | test: /\.(woff|woff2|eot|ttf|otf)$/i, 30 | type: 'asset/resource', 31 | generator: { filename: 'fonts/[name].[contenthash][ext]' }, 32 | }, 33 | ], 34 | }, 35 | plugins: [ 36 | // Use our index.html as a starting point (to add script links etc to) 37 | // and make sure to use/copy over the favicon too. 38 | new HtmlWebpackPlugin({ 39 | favicon: './assets/favicon.svg', 40 | template: './assets/index.html', 41 | }), 42 | ], 43 | resolve: { 44 | extensions: ['.tsx', '.ts', '.js'], 45 | }, 46 | output: { 47 | filename: 'main.[contenthash].js', 48 | path: path.resolve(__dirname, 'build'), 49 | clean: true, 50 | }, 51 | }; 52 | --------------------------------------------------------------------------------