Files
OpenVPN-Monitoring-Simple/DOCS/Changes/2026-10-04_Profile_Notes_PLAN.md
ayurishchevandClaude Sonnet 5.5 d251ec73d0 Certificates: profile modal with notes, note tooltip; async PKI init
- Profiler: UserProfile.note (nullable, startup migration), PUT
  /profiles/{id}/note (max 1000 chars); add missing `requests`
  dependency (client creation failed without Public IP set).
- UI: clickable rows on Certificates open a compact profile details
  modal with an editable note; tooltip with the note on the client
  name (v-note-tooltip) and a note icon.
- PKI init runs in a background thread: POST /system/init returns 202,
  GET /system/init/status, 409 for a second start, Clear PKI and client
  creation are blocked while it runs. A marker file identifies an
  interrupted run (only such a PKI is wiped on the next Init).
- PKI Configuration page: state from the server, progress spinner and
  step text, polling, Init/Clear/Save locked while running, Init locked
  once initialized.
- Tests: one pytest each for notes and async init (requirements-dev.txt).
- Docs: plans and summaries in DOCS/Changes, API reference, README, Index.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-04 20:56:36 +03:00

2.0 KiB

Profile details modal and notes: implementation plan (2026-10-04)

Goal: on the Certificates page, rows become clickable. A click opens a modal with the main profile details and a free-text note that can be saved. Profiles have no note field today, so a minimal Profiler change is required to store it.

Steps

1. Profiler backend (APP_PROFILER/)

  • models.py: UserProfile.note = Column(Text, nullable=True).
  • schemas.py: note: Optional[str] in the response schema; new UserProfileNoteUpdate (max 1000 chars, empty string becomes None).
  • Startup migration: idempotent "add column if missing" step (pattern from APP_CORE/db.py), so existing databases do not fail with no such column.
  • routers/profiles.py: PUT /profiles/{profile_id}/note returns the updated profile; 404 if not found; JWT required (router-level verify_token). PUT is used because CORS does not allow PATCH.

2. UI (APP_UI/)

  • New src/components/ProfileDetailsModal.vue built on BaseModal.vue (pattern: NewClientModal.vue): username, status badge, created, expiration, days remaining, revoked date, file path, note textarea, Save / Close.
  • src/views/Certificates.vue: clickable rows (active and expired/revoked), @click.stop on the download/revoke buttons, saveNote() via profilesApiClient.put, reload and toast.

3. Tests (minimal)

  • One pytest test in APP_PROFILER: PUT /profiles/{id}/note stores the note and GET /profiles returns it (temporary DB, auth dependency overridden).
  • No UI tests (no test infrastructure in APP_UI).

4. Build and verification (containers)

  • Tests and build run in containers; the result is deployed with docker-compose on this host for manual checks.

5. Documentation

  • DOCS/Profiler_Management/API_Reference.md, DOCS/General/Index.md, README.md (Changes table).
  • Summary of the work: DOCS/Changes/2026-10-04_Profile_Notes.md (written at the end).

Out of scope

Note history, per-user permissions, search by note, other pages.