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,86 @@
|
||||
<template>
|
||||
<BaseModal id="profileDetailsModal" title="Profile Details" ref="modal">
|
||||
<template #header>
|
||||
<div class="d-flex align-items-center gap-2 flex-wrap">
|
||||
<h5 class="modal-title fw-bold mb-0" style="color: var(--text-heading);">{{ profile?.username }}</h5>
|
||||
<span v-if="profile" class="status-badge" :class="status.cls">{{ status.label }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body>
|
||||
<div v-if="profile">
|
||||
<dl class="profile-meta">
|
||||
<dt>Created</dt>
|
||||
<dd>{{ formatDate(profile.created_at) }}</dd>
|
||||
<dt>Expires</dt>
|
||||
<dd>{{ formatDate(profile.expiration_date) }}<span v-if="daysLabel" class="text-muted"> ({{ daysLabel }})</span></dd>
|
||||
<template v-if="profile.revoked_at">
|
||||
<dt>Revoked</dt>
|
||||
<dd>{{ formatDate(profile.revoked_at) }}</dd>
|
||||
</template>
|
||||
<dt>File</dt>
|
||||
<dd class="certificate-file text-muted small text-break mt-0">{{ profile.file_path || 'N/A' }}</dd>
|
||||
</dl>
|
||||
|
||||
<label for="profileNote" class="form-label small text-muted text-uppercase fw-bold">Note</label>
|
||||
<textarea class="form-control" id="profileNote" rows="3" maxlength="1000" v-model="note" placeholder="Add a note about this profile..."></textarea>
|
||||
<div class="form-text text-end">{{ note.length }} / 1000</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<button type="button" class="btn-action btn-action-secondary" @click="close">Close</button>
|
||||
<button type="button" class="btn-action btn-action-save" @click="save" :disabled="!dirty">Save</button>
|
||||
</template>
|
||||
</BaseModal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import BaseModal from './BaseModal.vue';
|
||||
|
||||
const emit = defineEmits(['save']);
|
||||
const modal = ref(null);
|
||||
const profile = ref(null);
|
||||
const note = ref('');
|
||||
|
||||
const dirty = computed(() => note.value !== (profile.value?.note || ''));
|
||||
|
||||
const status = computed(() => {
|
||||
const p = profile.value;
|
||||
if (p?.is_revoked) return { label: 'Revoked', cls: 'status-expired' };
|
||||
if (p?.is_expired) return { label: 'Expired', cls: 'status-expired' };
|
||||
if (p?.days_remaining != null && p.days_remaining <= 30) return { label: 'Expiring Soon', cls: 'status-warning' };
|
||||
return { label: 'Active', cls: 'status-valid' };
|
||||
});
|
||||
|
||||
const daysLabel = computed(() => {
|
||||
const days = profile.value?.days_remaining;
|
||||
if (days == null) return '';
|
||||
return days > 0 ? `${days} d` : 'expired';
|
||||
});
|
||||
|
||||
// YYYY-MM-DD HH:mm (local time)
|
||||
const formatDate = (dateStr) => {
|
||||
if (!dateStr) return 'N/A';
|
||||
const d = new Date(dateStr);
|
||||
if (isNaN(d)) return dateStr;
|
||||
const pad = (n) => String(n).padStart(2, '0');
|
||||
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`;
|
||||
};
|
||||
|
||||
const open = (p) => {
|
||||
profile.value = p;
|
||||
note.value = p.note || '';
|
||||
modal.value.show();
|
||||
};
|
||||
|
||||
const close = () => {
|
||||
modal.value.hide();
|
||||
};
|
||||
|
||||
const save = () => {
|
||||
emit('save', { id: profile.value.id, note: note.value });
|
||||
close();
|
||||
};
|
||||
|
||||
defineExpose({ open, close });
|
||||
</script>
|
||||
Reference in new issue
Block a user