Skip to content

New home dashboard - #128

Merged
lucasdillmann merged 13 commits into
mainfrom
new-home-dashboard
May 31, 2026
Merged

New home dashboard#128
lucasdillmann merged 13 commits into
mainfrom
new-home-dashboard

Conversation

@lucasdillmann

Copy link
Copy Markdown
Owner

No description provided.

@lucasdillmann lucasdillmann self-assigned this May 31, 2026
@lucasdillmann
lucasdillmann marked this pull request as ready for review May 31, 2026 16:12
@greptile-apps

greptile-apps Bot commented May 31, 2026

Copy link
Copy Markdown

Greptile Summary

This PR replaces the old home page (which contained embedded video tutorials) with a rich dashboard showing nginx status with uptime, host/stream/certificate counts, traffic statistics, expiring certificates, and recent error logs. The backend gains a Status struct with an UptimeSeconds field populated via ps -o lstart= on Unix and Win32 GetProcessTimes on Windows, with procps added to the Alpine Dockerfile to provide the ps binary.

  • New home dashboard (HomePage.tsx, NginxStatusCard.tsx, HomeHeader.tsx, CountCard.tsx): permission-aware sections for nginx control, resource counts, traffic stats, expiring certificates, and error log preview; the help page absorbs the video content previously on the home page.
  • Backend uptime API (model.go, service.go, process_manager_unix.go, process_manager_windows.go, status_handler.go): GetStatus now returns Status{Running, UptimeSeconds} instead of a plain bool; uptime resolution errors are logged and gracefully omitted from the response.
  • CertificateService.listAll(): replaces the previous single-page 100-certificate fetch with a full paginator, addressing the prior "expiring certs capped at 100" concern.

Confidence Score: 5/5

Safe to merge; backend changes are well-tested and fail gracefully, and the frontend rework is self-contained with no broken contracts.

The backend uptime logic handles all error paths (missing PID, dead process, ps parse failure) with a log-and-ignore strategy so the API never breaks. The new listAll() paginator correctly terminates on empty pages. Frontend changes are additive and permission-gated. No data mutation or auth boundary changes are present.

No files require special attention; the two observations on HomePage.tsx are minor efficiency notes.

Important Files Changed

Filename Overview
core/nginx/process_manager_unix.go Adds Unix uptime calculation via ps -o lstart=; depends on procps being available (added to Dockerfile) and locale-consistent date output.
core/nginx/process_manager_windows.go Adds Windows uptime calculation via Win32 GetProcessTimes; handles boundary case where seconds < 0.
core/nginx/service.go Extends GetStatus to return a Status struct with running flag and optional uptime; gracefully degrades when uptime resolution fails.
frontend/src/domain/home/HomePage.tsx Complete rewrite of the home page into a rich dashboard; fetches counts, certificates, logs, and traffic stats with permission-aware conditional loading.
frontend/src/domain/home/components/NginxStatusCard.tsx New self-contained nginx status card; subscribes to nginx events, fetches its own status, and renders running/offline/unknown state with uptime display.
frontend/src/domain/certificate/CertificateService.ts Adds listAll() paginator that fetches all certificate pages sequentially; break condition guards against empty pages and totalItems convergence.
api/nginx/status_handler.go Status handler now returns running and uptimeSeconds fields from the new Status struct.
Dockerfile Adds procps to the Alpine runtime image so that ps -o lstart= is available for the Unix uptime calculation.

Sequence Diagram

sequenceDiagram
    participant UI as HomePage
    participant NSC as NginxStatusCard
    participant BE as Backend API

    UI->>+BE: Promise.all [getMetadata, isRunning, getSettings, list(hosts,1), list(streams,1), listAll(certs)]
    NSC->>+BE: getStatus() (independent call)
    BE-->>-NSC: "{running, uptimeSeconds}"
    BE-->>-UI: [metadata, nginxRunning, settings, hostsPage, streamsPage, certificates]

    alt serverLogsEnabled
        UI->>+BE: logs(15, 0)
        BE-->>-UI: errorLogs
    end

    alt "statsSupported && statsEnabled && nginxRunning"
        UI->>+BE: getStats()
        BE-->>-UI: TrafficStatsResponse
    end

    UI->>UI: setState (render dashboard)
    NSC->>NSC: setState (render status card)
Loading

Reviews (2): Last reviewed commit: "New home dashboard" | Re-trigger Greptile

Comment thread frontend/src/domain/home/components/NginxStatusCard.tsx
Comment thread frontend/src/domain/home/HomePage.tsx
Comment thread frontend/src/domain/home/HomePage.tsx
@sonarqubecloud

Copy link
Copy Markdown

@lucasdillmann
lucasdillmann merged commit 2537a57 into main May 31, 2026
4 checks passed
@lucasdillmann
lucasdillmann deleted the new-home-dashboard branch May 31, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant