Phase 9: Admin completion, reconcile, notifications, integrity, backups
Admin: Departments (name and stations; add shows the three groups IT must create), Profiles (welder stamp, station limits, active) with a CSV import that previews and applies only when clean, Checklists (weld and plain), Security (session, lockout and rate-limit settings with bounds, alerts for the last 24 hours, the integrity result), Access log with filters and a guarded CSV, Who is in, Stamp check, Notifications, and the employeeID flags. Every Admin change is audited. Worker: ad-reconcile (nightly and on "refresh from AD now"), session-refresh (15 minutes), integrity (seals, asset hashes, missing and orphan files, the audit chain), backup-check, notify-send and notify-digest. Notifications route per event type to AD groups, users, mailboxes or the department Supervisor group, immediately or in a daily digest, over STARTTLS verified against the PESCO CA, with dry run on the test stack. Backups: scripts/backup/ps-backup.sh and ps-restore.sh with a systemd timer at 02:00 America/Denver. Restore rehearsed on the test stack 2026-10-21. CI: pip-audit and npm audit. pypdf 6.21.1 and certifi 2026.10.19. Migration 0010. Closes the app part of I6, M3, O1, O2 and S3. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
// Small pieces the phase 9 Admin tabs share.
|
||||
import { useEffect, useState } from "react";
|
||||
import { admin9Api, type ProfileUser } from "../../api/admin";
|
||||
import { errorText } from "../../lib/format";
|
||||
import type { Load } from "../../lib/useLoad";
|
||||
|
||||
export function Problem({ load }: { load: Load<unknown> }) {
|
||||
if (load.state === "loading") return <div className="empty slim">Loading</div>;
|
||||
if (load.state === "error") return <div className="callout warn">{load.message}</div>;
|
||||
return null;
|
||||
}
|
||||
|
||||
export type Msg = { ok: boolean; text: string } | null;
|
||||
|
||||
export function Notice({ msg }: { msg: Msg }) {
|
||||
if (!msg) return null;
|
||||
return (
|
||||
<div className={msg.ok ? "callout flush" : "callout warn flush"} role={msg.ok ? "status" : "alert"}>
|
||||
{msg.text}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Search the users Packet Station knows and pick one. `label` names the search box. */
|
||||
export function UserPicker({ label, onPick, exclude = [] }: { label: string; onPick: (u: ProfileUser) => void; exclude?: readonly string[] }) {
|
||||
const [q, setQ] = useState("");
|
||||
const [rows, setRows] = useState<ProfileUser[]>([]);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const term = q.trim();
|
||||
if (term.length < 2) {
|
||||
setRows([]);
|
||||
return;
|
||||
}
|
||||
const ctl = new AbortController();
|
||||
const t = window.setTimeout(() => {
|
||||
admin9Api
|
||||
.users(term, ctl.signal)
|
||||
.then((r) => {
|
||||
setRows(r.slice(0, 10));
|
||||
setError(null);
|
||||
})
|
||||
.catch((err: unknown) => {
|
||||
if (!ctl.signal.aborted) setError(errorText(err));
|
||||
});
|
||||
}, 250);
|
||||
return () => {
|
||||
window.clearTimeout(t);
|
||||
ctl.abort();
|
||||
};
|
||||
}, [q]);
|
||||
|
||||
const shown = rows.filter((u) => !exclude.includes(u.id));
|
||||
return (
|
||||
<div className="stack tight">
|
||||
<label className="f">
|
||||
{label}
|
||||
<input className="in" type="search" placeholder="Name or account, 2 letters or more" value={q} onChange={(e) => setQ(e.target.value)} />
|
||||
</label>
|
||||
{error ? <div className="callout warn flush">{error}</div> : null}
|
||||
{shown.length ? (
|
||||
<ul className="chips plain">
|
||||
{shown.map((u) => (
|
||||
<li key={u.id}>
|
||||
<button
|
||||
type="button"
|
||||
className="chip sm"
|
||||
aria-label={`Pick ${u.display_name}`}
|
||||
onClick={() => {
|
||||
onPick(u);
|
||||
setQ("");
|
||||
}}
|
||||
>
|
||||
{u.display_name} <span className="mono small muted">{u.sam_account}</span>
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user