From 8257715a072d0dcec97e3338028b390263318bb8 Mon Sep 17 00:00:00 2001 From: Teofil Jolte Date: Mon, 16 Sep 2024 19:16:54 +0300 Subject: [PATCH] Dynamic Environments --- .../assets/environments/block_producers.js | 26 +++++++++++++++++++ frontend/src/assets/environments/compose.js | 20 ++++++++++++++ frontend/src/assets/environments/env.js | 8 ++++++ frontend/src/assets/environments/producer.js | 23 ++++++++++++++++ .../{env.js => environments/staging.js} | 9 +++---- .../src/environments/environment.local.ts | 3 ++- frontend/src/environments/environment.prod.ts | 2 +- 7 files changed, 83 insertions(+), 8 deletions(-) create mode 100644 frontend/src/assets/environments/block_producers.js create mode 100644 frontend/src/assets/environments/compose.js create mode 100644 frontend/src/assets/environments/env.js create mode 100644 frontend/src/assets/environments/producer.js rename frontend/src/assets/{env.js => environments/staging.js} (76%) diff --git a/frontend/src/assets/environments/block_producers.js b/frontend/src/assets/environments/block_producers.js new file mode 100644 index 0000000000..fa5e5b493a --- /dev/null +++ b/frontend/src/assets/environments/block_producers.js @@ -0,0 +1,26 @@ +export default { + production: true, + globalConfig: { + features: { + 'block-production': ['won-slots'], + 'mempool': [], + 'benchmarks': ['wallets'], + 'snarks': ['scan-state', 'work-pool'], + }, + canAddNodes: true, + }, + configs: [ + { + name: 'Producer 11010', + url: 'http://localhost:11010', + }, + { + name: 'Producer 11012', + url: 'http://localhost:11012', + }, + { + name: 'Producer 11014', + url: 'http://localhost:11014', + }, + ], +} diff --git a/frontend/src/assets/environments/compose.js b/frontend/src/assets/environments/compose.js new file mode 100644 index 0000000000..520821fdaa --- /dev/null +++ b/frontend/src/assets/environments/compose.js @@ -0,0 +1,20 @@ +export default { + production: true, + identifier: 'Running in Docker', + globalConfig: { + features: { + dashboard: [], + nodes: ['overview', 'live', 'bootstrap'], + state: ['actions'], + network: ['node-dht', 'graph-overview', 'bootstrap-stats'], + snarks: ['scan-state'], + }, + canAddNodes: true, + }, + configs: [ + { + name: 'Compose rust node', + url: '/openmina-node', + }, + ], +}; diff --git a/frontend/src/assets/environments/env.js b/frontend/src/assets/environments/env.js new file mode 100644 index 0000000000..f8b0f4a2ee --- /dev/null +++ b/frontend/src/assets/environments/env.js @@ -0,0 +1,8 @@ +/** + * This file is imported in the environment.prod.ts file + * The content of this file is replaced from a docker command + * => 1 Docker image = multiple environments + */ +export default { + production: true, +}; diff --git a/frontend/src/assets/environments/producer.js b/frontend/src/assets/environments/producer.js new file mode 100644 index 0000000000..03ea87447c --- /dev/null +++ b/frontend/src/assets/environments/producer.js @@ -0,0 +1,23 @@ +export default { + production: true, + hideNodeStats: true, + globalConfig: { + features: { + 'block-production': ['overview'], + }, + }, + configs: [ + { + name: 'Producer-0', + url: 'https://staging-devnet-openmina-bp-0-dashboard.minaprotocol.network', + }, + { + name: 'Producer-1', + url: 'https://staging-devnet-openmina-bp-1-dashboard.minaprotocol.network', + }, + { + name: 'Producer-2', + url: 'https://staging-devnet-openmina-bp-2-dashboard.minaprotocol.network', + }, + ], +} diff --git a/frontend/src/assets/env.js b/frontend/src/assets/environments/staging.js similarity index 76% rename from frontend/src/assets/env.js rename to frontend/src/assets/environments/staging.js index 8ad1b2103e..f8b6070557 100644 --- a/frontend/src/assets/env.js +++ b/frontend/src/assets/environments/staging.js @@ -1,16 +1,13 @@ export default { - production: false, + production: true, globalConfig: { features: { 'dashboard': [], + 'block-production': ['won-slots'], 'nodes': ['overview', 'live', 'bootstrap'], + 'mempool': [], 'state': ['actions'], - 'network': ['messages', 'connections', 'blocks', 'topology', 'node-dht', 'graph-overview', 'bootstrap-stats'], 'snarks': ['scan-state', 'work-pool'], - 'testing-tool': ['scenarios'], - 'resources': ['memory'], - 'block-production': ['overview', 'won-slots'], - 'mempool': [], 'benchmarks': ['wallets'], }, canAddNodes: false, diff --git a/frontend/src/environments/environment.local.ts b/frontend/src/environments/environment.local.ts index 7fd24bf173..f90f0edc62 100644 --- a/frontend/src/environments/environment.local.ts +++ b/frontend/src/environments/environment.local.ts @@ -8,7 +8,8 @@ export const environment: Readonly = { dashboard: [], nodes: ['overview', 'live', 'bootstrap'], state: ['actions'], - snarks: ['scan-state'], + snarks: ['scan-state', 'work-pool'], + mempool: [], 'block-production': ['won-slots'], }, canAddNodes: true, diff --git a/frontend/src/environments/environment.prod.ts b/frontend/src/environments/environment.prod.ts index c8d3422203..4c7297422c 100644 --- a/frontend/src/environments/environment.prod.ts +++ b/frontend/src/environments/environment.prod.ts @@ -1,4 +1,4 @@ import { MinaEnv } from '@shared/types/core/environment/mina-env.type'; -import env from '../assets/env'; +import env from '../assets/environments/env'; export const environment: Readonly = env as MinaEnv;