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:
ayurishchevandClaude Sonnet 5.5 committed 2026-10-04 20:56:36 +03:00
1 parent 3836049230
commit d251ec73d0
24 files changed
+722 -39

No files matched your search

+33 -9
View File
@@ -88,9 +88,12 @@
<tr v-if="activeCerts.length > 0" class="section-divider">
<td colspan="6">Active Certificates ({{ activeCerts.length }})</td>
</tr>
<tr v-for="cert in activeCerts" :key="cert.id + '_active'">
<td>
<div class="fw-semibold" style="color: var(--text-heading);">{{ cert.username }}</div>
<tr v-for="cert in activeCerts" :key="cert.id + '_active'" style="cursor: pointer;" @click="showDetails(cert)">
<td v-note-tooltip="cert.note">
<div class="fw-semibold" style="color: var(--text-heading);">
{{ cert.username }}
<i v-if="cert.note" class="fas fa-note-sticky text-muted ms-1 small"></i>
</div>
<div class="certificate-file text-muted small">{{ cert.file_path || 'N/A' }}</div>
</td>
<td><span class="status-badge status-client">Client</span></td>
@@ -100,10 +103,10 @@
</td>
<td v-html="getStatusBadgeHTML(cert)"></td>
<td>
<button class="btn btn-sm btn-link text-warning p-0 me-2" title="Download Config" @click="downloadConfig(cert)">
<button class="btn btn-sm btn-link text-warning p-0 me-2" title="Download Config" @click.stop="downloadConfig(cert)">
<i class="fas fa-download"></i>
</button>
<button class="btn btn-sm btn-link text-danger p-0" title="Revoke" @click="revokeClient(cert)">
<button class="btn btn-sm btn-link text-danger p-0" title="Revoke" @click.stop="revokeClient(cert)">
<i class="fas fa-ban"></i>
</button>
</td>
@@ -114,9 +117,12 @@
<tr class="section-divider">
<td colspan="6">Expired / Revoked ({{ expiredCerts.length }})</td>
</tr>
<tr v-for="cert in expiredCerts" :key="cert.id + '_expired'">
<td>
<div class="fw-semibold" style="color: var(--text-heading);">{{ cert.username }}</div>
<tr v-for="cert in expiredCerts" :key="cert.id + '_expired'" style="cursor: pointer;" @click="showDetails(cert)">
<td v-note-tooltip="cert.note">
<div class="fw-semibold" style="color: var(--text-heading);">
{{ cert.username }}
<i v-if="cert.note" class="fas fa-note-sticky text-muted ms-1 small"></i>
</div>
<div class="certificate-file text-muted small">{{ cert.file_path || 'N/A' }}</div>
</td>
<td><span class="status-badge status-client">Client</span></td>
@@ -126,7 +132,7 @@
</td>
<td v-html="getStatusBadgeHTML(cert)"></td>
<td>
<button class="btn btn-sm btn-link text-danger p-0" title="Revoke" @click="revokeClient(cert)" :disabled="cert.is_revoked">
<button class="btn btn-sm btn-link text-danger p-0" title="Revoke" @click.stop="revokeClient(cert)" :disabled="cert.is_revoked">
<i class="fas fa-ban"></i>
</button>
</td>
@@ -140,6 +146,7 @@
<NewClientModal ref="newClientModal" @create="createClient" />
<ConfirmModal ref="confirmModal" @confirm="confirmRevoke" />
<ProfileDetailsModal ref="detailsModal" @save="saveNote" />
<div v-if="toastMessage" class="toast-message show" :class="'toast-' + toastType" style="position: fixed; bottom: 20px; right: 20px; z-index: 9999;">
<i class="fas" :class="toastType === 'success' ? 'fa-check-circle' : 'fa-exclamation-circle'"></i>
@@ -152,6 +159,8 @@ import { ref, computed, onMounted } from 'vue';
import { useApi } from '../composables/useApi';
import NewClientModal from '../components/NewClientModal.vue';
import ConfirmModal from '../components/ConfirmModal.vue';
import ProfileDetailsModal from '../components/ProfileDetailsModal.vue';
import vNoteTooltip from '../directives/noteTooltip';
const { profilesApiClient } = useApi();
@@ -162,6 +171,7 @@ const hideExpired = ref(false);
const newClientModal = ref(null);
const confirmModal = ref(null);
const detailsModal = ref(null);
const toastMessage = ref('');
const toastType = ref('success');
@@ -276,6 +286,20 @@ const createClient = async (username) => {
}
};
const showDetails = (cert) => {
detailsModal.value.open(cert);
};
const saveNote = async ({ id, note }) => {
try {
await profilesApiClient.put(`/profiles/${id}/note`, { note });
showToast('Note saved.', 'success');
loadCerts();
} catch(e) {
showToast(e.response?.data?.detail || e.message, 'error');
}
};
const downloadConfig = async (cert) => {
if (!cert.id) return;
try {