feat(frontend): add Helm chart browser, monitoring, chart-references and values templates pages

Add new frontend pages for the multi-tenant OCDP platform:

- Charts page (/charts): Browse Harbor OCI registries to list Helm chart repositories
  and versions, with deploy modal to launch charts on selected clusters
- Monitoring page (/monitoring): Display cluster metrics (CPU/Memory/GPU usage)
  and per-node details with resource utilization bars
- Chart References page (/chart-references): CRUD for chart metadata references
- Values Templates page (/templates): CRUD for Helm values templates with version
  history and rollback support
- Sidebar: Add Charts navigation, update Storage and Templates links
- api.ts: Add all API client functions (clusterApi, registryApi, instanceApi,
  monitoringApi, storageApi, chartReferenceApi, valuesTemplateApi,
  workspaceApi, userApi) with full TypeScript types

Note: deploy flow and values template rollback not yet end-to-end tested.
This commit is contained in:
Ivan087
2026-04-15 16:59:31 +08:00
parent c5e51ed069
commit 29d0310f03
283 changed files with 24658 additions and 36038 deletions

View File

@ -10,43 +10,35 @@
# - 本文件只负责前端构建和 Nginx。
# - Backend / PostgreSQL / pgAdmin 由 backend/docker-compose.yml 提供。
# - Nginx 统一监听 80/443默认映射 WEB_HTTP_PORT=80、WEB_HTTPS_PORT=443
# 根据路径转发:/api/* → backend其他路径 → 前端静态文件
# 根据路径转发:/api/* → backend其他路径 → 前端服务
# ==================================================
services:
# --------------------------------------------------
# 构建前端静态资源 (一次性 Job)
# Next.js 前端服务
# --------------------------------------------------
frontend-build:
frontend:
image: node:20-alpine
container_name: ocdp-frontend-build
container_name: ocdp-frontend
init: true
working_dir: /app
restart: "no"
restart: unless-stopped
environment:
NODE_ENV: production
NPM_CONFIG_PRODUCTION: "false" # ensure devDependencies (tsc, vite) are installed for build
# 默认通过 Nginx 代理到 backend -> /api/v1
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-/api/v1}
FILE_OWNER_UID: ${FILE_OWNER_UID:-1000}
FILE_OWNER_GID: ${FILE_OWNER_GID:-1000}
command: >
sh -c "
set -eux;
npm ci;
npm run build;
mkdir -p /build;
rm -rf /build/*;
cp -R dist/. /build/;
if [ -d dist ]; then chown -R "$$FILE_OWNER_UID:$$FILE_OWNER_GID" dist; fi;
if [ -d /build ]; then chown -R "$$FILE_OWNER_UID:$$FILE_OWNER_GID" /build; fi
"
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-/api/v1}
command: sh -c "npm install --include=dev && npm run build && npm run start"
expose:
- "3000"
volumes:
- ./frontend:/app
- frontend_node_modules:/app/node_modules
- frontend_dist:/build
networks:
- ocdp-network
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:3000 || exit 1"]
interval: 30s
timeout: 10s
retries: 3
# --------------------------------------------------
# Nginx - 静态文件 + /api 反向代理统一入口
@ -55,13 +47,12 @@ services:
image: nginx:1.27-alpine
container_name: ocdp-nginx
depends_on:
frontend-build:
condition: service_completed_successfully
frontend:
condition: service_started
ports:
- "${WEB_HTTP_PORT:-80}:80"
- "${WEB_HTTPS_PORT:-443}:443"
volumes:
- frontend_dist:/usr/share/nginx/html:ro
- ./infra/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
- ./infra/nginx/certs:/etc/nginx/certs:ro
healthcheck:
@ -84,7 +75,5 @@ networks:
# Volumes
# ==================================================
volumes:
frontend_dist:
driver: local
frontend_node_modules:
driver: local