Skip to content

Commit ea39127

Browse files
kalvinnchaunpub1ntr8jjcqq6gt06q5avvqttfjgpwshmra22pcmcagdnukw4ja4nqqsa9g54npub1dccv64krpcpse5cmkzfeh998cftungyatw3djt8jwdw6g43f7fyqzzmrf7
authored
feat: add read-only deployment moderation dashboard (#1999)
Signed-off-by: npub1dccv64krpcpse5cmkzfeh998cftungyatw3djt8jwdw6g43f7fyqzzmrf7 <6e30cd56c30e030cd31bb0939b94a7c257c9a09d5ba2d92cf2735da45629f248@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1ntr8jjcqq6gt06q5avvqttfjgpwshmra22pcmcagdnukw4ja4nqqsa9g54 <9ac6794b000690b7e814eb1805ad32405d0bec7d52838de3a86cf967565dacc0@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1dccv64krpcpse5cmkzfeh998cftungyatw3djt8jwdw6g43f7fyqzzmrf7 <6e30cd56c30e030cd31bb0939b94a7c257c9a09d5ba2d92cf2735da45629f248@sprout-oss.stage.blox.sqprod.co>
1 parent 4f6eea0 commit ea39127

30 files changed

Lines changed: 3859 additions & 21 deletions

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Build artifacts
22
/target/
33
/dist/
4+
/admin-web/dist/
45

56
# lefthook-generated hook scripts (machine-specific)
67
.hooks/

‎Dockerfile‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,11 @@ RUN corepack enable
105105
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
106106
COPY patches/ patches/
107107
COPY web/package.json web/
108-
RUN pnpm install --frozen-lockfile --filter buzz-web
108+
COPY admin-web/package.json admin-web/
109+
RUN pnpm install --frozen-lockfile --filter buzz-web --filter buzz-admin-web
109110
COPY web/ web/
110-
RUN pnpm -C web build
111+
COPY admin-web/ admin-web/
112+
RUN pnpm -C web build && pnpm -C admin-web build
111113

112114
# ─── Stage 5: runtime ───────────────────────────────────────────────────────
113115
FROM debian:${DEBIAN_VERSION}-slim AS runtime
@@ -137,10 +139,13 @@ COPY --from=builder /build/target/release/buzz-relay /usr/local/bin/buzz-rela
137139
COPY --from=builder /build/target/release/buzz-admin /usr/local/bin/buzz-admin
138140
COPY --from=builder /build/target/release/buzz-pair-relay /usr/local/bin/buzz-pair-relay
139141
COPY --from=web-builder /build/web/dist /srv/buzz/web
142+
COPY --from=web-builder /build/admin-web/dist /srv/buzz/admin-web
140143

141144
# The invite landing page is always served from the bundled web UI. Repository
142-
# browser routes require the separate BUZZ_SERVE_GIT_WEB_GUI=true opt-in.
143-
ENV BUZZ_WEB_DIR=/srv/buzz/web
145+
# browser routes require the separate BUZZ_SERVE_GIT_WEB_GUI=true opt-in. The
146+
# admin bundle is inert until BUZZ_ADMIN_HOST is configured.
147+
ENV BUZZ_WEB_DIR=/srv/buzz/web \
148+
BUZZ_ADMIN_WEB_DIR=/srv/buzz/admin-web
144149

145150
# 3000: app (WS + REST) · 8080: /_liveness, /_readiness · 9102: /metrics
146151
EXPOSE 3000 8080 9102

‎Justfile‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,30 @@ relay-web: bootstrap _ensure-migrations
363363
pnpm -C web build
364364
BUZZ_WEB_DIR=./web/dist cargo run -p buzz-relay
365365
366+
# Build and run the private read-only admin dashboard
367+
admin: bootstrap _ensure-migrations
368+
#!/usr/bin/env bash
369+
set -euo pipefail
370+
export PATH="{{justfile_directory()}}/bin:$PATH"
371+
[[ -d node_modules ]] || pnpm install
372+
pnpm -C admin-web build
373+
export BUZZ_ADMIN_HOST="${BUZZ_ADMIN_HOST:-admin.localhost:3000}"
374+
export BUZZ_ADMIN_WEB_DIR="${BUZZ_ADMIN_WEB_DIR:-{{justfile_directory()}}/admin-web/dist}"
375+
echo "Admin dashboard: http://${BUZZ_ADMIN_HOST}/reports"
376+
cargo run -p buzz-relay
377+
378+
# Seed deterministic reports and product feedback for local admin dashboard review
379+
admin-seed: _ensure-migrations
380+
./scripts/seed-admin-dashboard.sh
381+
382+
# Run focused relay and browser checks for the read-only admin dashboard
383+
admin-check: fmt-check
384+
cargo check -p buzz-relay --all-targets
385+
cargo test -p buzz-relay api::admin
386+
cargo test -p buzz-relay router::tests
387+
pnpm -C admin-web check
388+
pnpm -C admin-web exec playwright test
389+
366390
# Start the relay server in release mode
367391
relay-release: _ensure-migrations
368392
cargo run -p buzz-relay --release

‎admin-web/index.html‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta name="referrer" content="no-referrer" />
7+
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
8+
<title>Buzz admin</title>
9+
</head>
10+
<body>
11+
<div id="root"></div>
12+
<script type="module" src="/src/main.tsx"></script>
13+
</body>
14+
</html>

‎admin-web/package.json‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "buzz-admin-web",
3+
"private": true,
4+
"version": "0.1.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc && vite build",
9+
"typecheck": "tsc --noEmit",
10+
"lint": "biome lint .",
11+
"check": "biome check . && pnpm typecheck && pnpm test",
12+
"format": "biome format --write .",
13+
"test": "vitest run src --passWithNoTests",
14+
"test:e2e": "pnpm build && playwright test"
15+
},
16+
"dependencies": {
17+
"@vitejs/plugin-react": "^6.0.0",
18+
"vite": "^8.0.0",
19+
"react": "^19.1.0",
20+
"react-dom": "^19.1.0"
21+
},
22+
"devDependencies": {
23+
"@playwright/test": "^1.58.2",
24+
"@testing-library/jest-dom": "^6.9.1",
25+
"@testing-library/react": "^16.3.2",
26+
"@types/react": "^19.1.8",
27+
"@types/react-dom": "^19.1.6",
28+
"jsdom": "^27.3.0",
29+
"typescript": "~6.0.0",
30+
"vitest": "^4.1.1"
31+
}
32+
}

‎admin-web/playwright.config.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defineConfig } from "@playwright/test";
2+
3+
export default defineConfig({
4+
testDir: "./tests",
5+
webServer: {
6+
command: "pnpm exec vite preview --host 127.0.0.1 --port 4174",
7+
url: "http://127.0.0.1:4174",
8+
reuseExistingServer: true,
9+
},
10+
use: { baseURL: "http://127.0.0.1:4174" },
11+
});

‎admin-web/public/favicon.svg‎

Lines changed: 20 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)