From a4ec39e4a26978686d3f319b858d14f4794636c8 Mon Sep 17 00:00:00 2001 From: jude Date: Wed, 5 Nov 2025 18:52:36 +0000 Subject: [PATCH] Fix dashboard rendering --- .gitignore | 4 ++-- Containerfile.run | 12 +++++------- build.rs | 13 +++++++++++++ src/web/mod.rs | 1 + static/assets | 1 - static/index.html | 35 ++++++++++++++++++++++++++++++++++- 6 files changed, 55 insertions(+), 11 deletions(-) delete mode 120000 static/assets mode change 120000 => 100644 static/index.html diff --git a/.gitignore b/.gitignore index 489c7e2..1590c05 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,8 @@ target /venv .cargo .idea -web/static/index.html -web/static/assets +static/index.html +static/assets # Logs logs *.log diff --git a/Containerfile.run b/Containerfile.run index 6b8b7a4..d6616f6 100644 --- a/Containerfile.run +++ b/Containerfile.run @@ -17,13 +17,7 @@ COPY ./conf ./conf COPY ./extract_derive ./extract_derive COPY ./migrations ./migrations COPY ./recordable_derive ./recordable_derive -COPY ./reminder-dashboard/public ./reminder-dashboard/public -COPY ./reminder-dashboard/src ./reminder-dashboard/src -COPY ./reminder-dashboard/index.html ./reminder-dashboard/ -COPY ./reminder-dashboard/package.json ./reminder-dashboard/ -COPY ./reminder-dashboard/package-lock.json ./reminder-dashboard/ -COPY ./reminder-dashboard/tsconfig.json ./reminder-dashboard/ -COPY ./reminder-dashboard/vite.config.ts ./reminder-dashboard/ +COPY ./reminder-dashboard ./reminder-dashboard COPY ./src ./src COPY ./static ./static COPY ./templates ./templates @@ -32,6 +26,10 @@ COPY ./Cargo.lock ./ COPY ./Cargo.toml ./ COPY ./dp.py ./ +# Build dashboard assets explicitly to ensure dist exists +RUN npm ci --prefix reminder-dashboard && npm run build --prefix reminder-dashboard + +# Build and install the Rust binary RUN cargo install --path . EXPOSE 18920 diff --git a/build.rs b/build.rs index 846a649..23b0fab 100644 --- a/build.rs +++ b/build.rs @@ -10,4 +10,17 @@ fn main() { .current_dir(Path::new("reminder-dashboard")) .spawn() .expect("Failed to build NPM"); + + Command::new("cp") + .arg("reminder-dashboard/dist/index.html") + .arg("static/index.html") + .spawn() + .expect("Failed to copy index.html"); + + Command::new("cp") + .arg("-r") + .arg("reminder-dashboard/dist/static/assets") + .arg("static/") + .spawn() + .expect("Failed to copy assets"); } diff --git a/src/web/mod.rs b/src/web/mod.rs index 0183f88..b9bf0be 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -126,6 +126,7 @@ pub async fn initialize( let static_path = if Path::new("static").exists() { "static" } else { "/lib/reminder-rs/static" }; + info!("Using static path: {}", static_path); rocket::build() .attach(MetricProducer) diff --git a/static/assets b/static/assets deleted file mode 120000 index 28d98b0..0000000 --- a/static/assets +++ /dev/null @@ -1 +0,0 @@ -/home/jude/reminder-bot/reminder-dashboard/dist/static/assets \ No newline at end of file diff --git a/static/index.html b/static/index.html deleted file mode 120000 index af9ba7b..0000000 --- a/static/index.html +++ /dev/null @@ -1 +0,0 @@ -/home/jude/reminder-bot/reminder-dashboard/dist/index.html \ No newline at end of file diff --git a/static/index.html b/static/index.html new file mode 100644 index 0000000..656b0b7 --- /dev/null +++ b/static/index.html @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + Reminder Bot | Dashboard + + + + + + + + + +
+ +