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>
This commit is contained in:
1 parent
3836049230
commit
d251ec73d0
24 files changed
+722
-39
No files matched your search
@@ -0,0 +1,55 @@
|
||||
# Profile details modal and notes (2026-10-04)
|
||||
|
||||
Goal: make rows on the **Certificates** page clickable; a click opens a modal with the main profile details and a note that can be saved. Plan: [Profile_Notes_PLAN](2026-10-04_Profile_Notes_PLAN.md).
|
||||
|
||||
## Changes
|
||||
|
||||
| Area | Change |
|
||||
|---|---|
|
||||
| Model (`APP_PROFILER/models.py`) | `UserProfile.note` (nullable `Text`) |
|
||||
| Schemas (`APP_PROFILER/schemas.py`) | `note` in the profile response; `UserProfileNoteUpdate` (max 1000 chars, empty or whitespace-only becomes `null`) |
|
||||
| Migration (`APP_PROFILER/database.py`, `main.py`) | `ensure_columns()` runs after `create_all` and adds `note` to an existing `user_profiles` table if missing (idempotent) |
|
||||
| API (`APP_PROFILER/routers/profiles.py`) | `PUT /profiles/{id}/note` returns the updated profile; `404` if missing; JWT required. PUT is used because CORS does not allow PATCH |
|
||||
| UI (`APP_UI/src/components/ProfileDetailsModal.vue`) | New modal on `BaseModal`: name, status, created, expiration, days remaining, revoked date, file path, note textarea with counter; Save is enabled only after a change |
|
||||
| UI (`APP_UI/src/views/Certificates.vue`) | Rows (active and expired/revoked) open the modal; download/revoke buttons use `@click.stop`; `saveNote()` calls the API, shows a toast and reloads the list |
|
||||
| Fix (`APP_PROFILER/requirements.txt`) | Added `requests`: `services/utils.py` imports it to detect the public IP, and creating a client failed with `No module named 'requests'` (HTTP 500, "Config Generation failed") when Public IP was not set in server settings. The failed attempts had already issued the certificate in PKI |
|
||||
| Docs | `DOCS/Profiler_Management/API_Reference.md`: new endpoint and `note` field |
|
||||
| Tests | `APP_PROFILER/test_profile_note.py` (one test), `APP_PROFILER/requirements-dev.txt` |
|
||||
|
||||
## Verification (in containers)
|
||||
|
||||
| Check | Result |
|
||||
|---|---|
|
||||
| `pytest test_profile_note.py` in `python:3.12-alpine` | 1 passed |
|
||||
| `docker compose` build of all four images | OK |
|
||||
| New DB: `note` column present | OK |
|
||||
| Old-schema DB (no `note`): column added on start, data kept, second start is a no-op | OK |
|
||||
| `PUT /profiles/{id}/note` with JWT | 200, note returned by `GET /profiles` |
|
||||
| Without token / note over 1000 chars / unknown id | 401 / 422 / 404 |
|
||||
| Whitespace-only note | stored as `null` |
|
||||
| Browser check of the UI | manual (see below) |
|
||||
|
||||
## Notes
|
||||
|
||||
- Run the new test on its own (`cd APP_PROFILER && pip install -r requirements-dev.txt && pytest test_profile_note.py`): the older `test_server_process.py` also imports `main` with the default DB path.
|
||||
- On a revoked row the Revoke button is disabled; some browsers do not pass a click on a disabled button to the row, so the modal may not open from that spot. Click elsewhere in the row.
|
||||
- The modal closes right after Save; if the request fails the text is not kept.
|
||||
|
||||
## Existing installations
|
||||
|
||||
Rebuild the Profiler image so that `requests` is installed. A client name whose certificate was already issued by a failed attempt cannot be created again (Easy-RSA: certificate exists, HTTP 500); use another name or revoke/clear it in PKI.
|
||||
|
||||
No manual steps: the `note` column is added on the next Profiler start (native: restart `ovpmon-profiler`; Docker: rebuild `app-profiler` and `app-ui`). Back up `ovpn_profiler.db` first.
|
||||
|
||||
## Follow-up: compact modal and note tooltip (2026-10-04)
|
||||
|
||||
Plan: [Profile_Modal_Polish_PLAN](2026-10-04_Profile_Modal_Polish_PLAN.md). UI only.
|
||||
|
||||
| Area | Change |
|
||||
|---|---|
|
||||
| `ProfileDetailsModal.vue` | Default modal width (no `modal-lg`); name and status badge in the header; compact label : value list (Created, Expires with days remaining, Revoked, File); dates as `YYYY-MM-DD HH:mm`; 3-row note field |
|
||||
| `directives/noteTooltip.js` | `v-note-tooltip`: Bootstrap Tooltip with the note text (plain text, hover, hidden on click); recreated when the note changes, disposed on unmount |
|
||||
| `Certificates.vue` | Tooltip on the client cell in active and expired/revoked rows; muted note icon next to the name when a note exists |
|
||||
| `main.css` | `.note-tooltip` (max width 320 px, line breaks kept, light/dark theme variables), `.profile-meta` grid |
|
||||
|
||||
Verification: `app-ui` image builds, the note icon and tooltip styles are in the bundle; layout and tooltip behaviour are checked manually.
|
||||
Reference in new issue
Block a user