From c4be93b3b70a2f4d20935d18c4e947e88f873059 Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Wed, 4 Sep 2024 13:46:33 +0300 Subject: [PATCH 1/3] Making the dashboard available at both /dashboard and /controlpanel --- src/index.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/index.ts b/src/index.ts index 3b001ff9c..16edecb65 100644 --- a/src/index.ts +++ b/src/index.ts @@ -134,19 +134,26 @@ if (config.hasHttp) { // Serve static files expected at the root, under the '/_next' path app.use('/_next', express.static(path.join(__dirname, '/dashboard/_next'))) - // Serve static files for Next.js under '/dashboard' + // Serve static files for Next.js under both '/dashboard' and '/controlpanel' const dashboardPath = path.join(__dirname, '/dashboard') app.use('/dashboard', express.static(dashboardPath)) - - // Custom middleware for SPA routing: Serve index.html for non-static asset requests under '/dashboard' - app.use('/dashboard', (req, res, next) => { + app.use('/controlpanel', express.static(dashboardPath)) + + // Custom middleware for SPA routing: Serve index.html for non-static asset requests + const serveIndexHtml = ( + req: express.Request, + res: express.Response, + next: express.NextFunction + ) => { if (/(.ico|.js|.css|.jpg|.png|.svg|.map)$/i.test(req.path)) { return next() // Skip this middleware if the request is for a static asset } - - // For any other requests under '/dashboard', serve index.html + // For any other requests, serve index.html res.sendFile(path.join(dashboardPath, 'index.html')) - }) + } + + app.use('/dashboard', serveIndexHtml) + app.use('/controlpanel', serveIndexHtml) } app.use(requestValidator, (req, res, next) => { From 41a8b5f95292bc71b9cf2c14891b74a2bb1e9a3e Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Wed, 4 Sep 2024 13:52:03 +0300 Subject: [PATCH 2/3] Updating both readme files --- README.md | 4 ++-- dashboard/README.md | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index eb6a12072..3ead88628 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ The `PRIVATE_KEY` is the only mandatory environmental variable, you must include npm run start ``` -Your node is now running, the dashboard will be available at `http://localhost:8000/dashboard/`. To start additional nodes, repeat these steps in a new terminal. +Your node is now running, the control panel will be available at `http://localhost:8000/controlpanel/`. To start additional nodes, repeat these steps in a new terminal. ## Additional Resources @@ -136,5 +136,5 @@ Your node is now running, the dashboard will be available at `http://localhost:8 - [Testing Guide](docs/testing.md) - [Network Configuration](docs/networking.md) - [Logging & accessing logs](docs/networking.md) -- [Dashboard: Local development](dashboard/README.md) +- [Control Panel: Local development](dashboard/README.md) - [Docker Deployment Guide](docs/dockerDeployment.md) diff --git a/dashboard/README.md b/dashboard/README.md index 355583f91..7491d63b0 100644 --- a/dashboard/README.md +++ b/dashboard/README.md @@ -1,8 +1,8 @@ -# Dashboard +# Control Panel -The static dashbaord files are included in ocean nodes so the dashboard doesn't have to be rebuilt every time the node is built. If there are changes to the dashboard it will be built by default with the Ocean Node. There is a [script](scripts/dashboardChanges.js) running to check for changes in this directory. +The static dashbaord files are included in ocean nodes so the control panel doesn't have to be rebuilt every time the node is built. If there are changes to the control panel it will be built by default with the Ocean Node. There is a [script](scripts/dashboardChanges.js) running to check for changes in this directory. -When you start your node the dashboard will be made available at: `http://localhost:8000/dashboard/` +When you start your node the control panel will be made available at: `http://localhost:8000/controlpanel/` ## Local development @@ -30,11 +30,11 @@ This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-opti ## Build & run -The dashboard is built by default with the Ocean Node. Set the environmental variables and then run the following commands from the root of the project: +The control panel is built by default with the Ocean Node. Set the environmental variables and then run the following commands from the root of the project: ``` npm run build npm run start ``` -The dashboard will be made available at: `http://localhost:8000/dashboard/` +The control panel will be made available at: `http://localhost:8000/controlpanel/` From 04074ec407b2971dda95c071e816b5d657b8ffd2 Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Wed, 4 Sep 2024 13:55:16 +0300 Subject: [PATCH 3/3] Updating static files --- dist/dashboard/404.html | 2 +- .../_buildManifest.js | 0 .../_ssgManifest.js | 0 dist/dashboard/index.html | 2 +- scripts/dashboard.hash | 2 +- 5 files changed, 3 insertions(+), 3 deletions(-) rename dist/dashboard/_next/static/{5CK9tqhe3L89gz1Gxu3HR => Qvkg1l9fWL_9lruiamNvM}/_buildManifest.js (100%) rename dist/dashboard/_next/static/{5CK9tqhe3L89gz1Gxu3HR => Qvkg1l9fWL_9lruiamNvM}/_ssgManifest.js (100%) diff --git a/dist/dashboard/404.html b/dist/dashboard/404.html index 2cfb64865..bbf8dbedd 100644 --- a/dist/dashboard/404.html +++ b/dist/dashboard/404.html @@ -1 +1 @@ -404: This page could not be found

404

This page could not be found.

\ No newline at end of file +404: This page could not be found

404

This page could not be found.

\ No newline at end of file diff --git a/dist/dashboard/_next/static/5CK9tqhe3L89gz1Gxu3HR/_buildManifest.js b/dist/dashboard/_next/static/Qvkg1l9fWL_9lruiamNvM/_buildManifest.js similarity index 100% rename from dist/dashboard/_next/static/5CK9tqhe3L89gz1Gxu3HR/_buildManifest.js rename to dist/dashboard/_next/static/Qvkg1l9fWL_9lruiamNvM/_buildManifest.js diff --git a/dist/dashboard/_next/static/5CK9tqhe3L89gz1Gxu3HR/_ssgManifest.js b/dist/dashboard/_next/static/Qvkg1l9fWL_9lruiamNvM/_ssgManifest.js similarity index 100% rename from dist/dashboard/_next/static/5CK9tqhe3L89gz1Gxu3HR/_ssgManifest.js rename to dist/dashboard/_next/static/Qvkg1l9fWL_9lruiamNvM/_ssgManifest.js diff --git a/dist/dashboard/index.html b/dist/dashboard/index.html index 59b537da0..9a5872781 100644 --- a/dist/dashboard/index.html +++ b/dist/dashboard/index.html @@ -1 +1 @@ -Ocean nodes
Ocean Node Logo
ADMIN ACTIONS
\ No newline at end of file +Ocean nodes
Ocean Node Logo
ADMIN ACTIONS
\ No newline at end of file diff --git a/scripts/dashboard.hash b/scripts/dashboard.hash index 14643dc93..51e3dcc28 100644 --- a/scripts/dashboard.hash +++ b/scripts/dashboard.hash @@ -1 +1 @@ -0becf9b2c1cdce97904c6113aa63632ce436c7824aa98c84461fad7f63dafd3f \ No newline at end of file +2f1167e408269d2ca854d7a412cfb1ea7a2260402f9ab746e8a1f4714711931f \ No newline at end of file