Exclusion de stacks des mises a jour (case a cocher, reactivable)
- back : une stack peut etre exclue des mises a jour par un administrateur
(PUT /api/servers/{id}/targets/{t}/exclude {"dir","excluded"}) ; etat
persiste dans excluded.json. La stack reste analysee et affichee, mais
Apply la refuse (409), elle n'est plus comptee dans les mises a jour du
resume (nouveau compteur "excluded"). Exclusions oubliees a la
suppression du serveur ou de la connexion.
- front : case "Exclure cette stack des mises a jour" dans le detail de la
stack (administrateur), decochable pour la reactiver ; pastille "exclue"
sur la ligne, statut neutre "Exclue" au lieu de "Mise a jour", plus de
bouton "Mettre a jour" ; exclue du filtre et des compteurs de mises a jour.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LNfwm4C4dXa9nz3NDoyEot
This commit is contained in:
1 parent
dfe110fdee
commit
adf58d5021
7 files changed
+252
-15
No files matched your search
+32
-11
@@ -66,13 +66,14 @@ export function FleetView({ me, fleet, current, run, onEdit, onAdd, onKey }: Pro
|
||||
|
||||
// Compteurs du périmètre affiché.
|
||||
const all = servers.flatMap((s) => Object.values(s.scans).flatMap((sc) => sc.stacks));
|
||||
const count = (st: StackStatus) => all.filter((x) => x.status === st).length;
|
||||
// Les stacks exclues ne comptent pas comme mises à jour à faire.
|
||||
const count = (st: StackStatus) => all.filter((x) => x.status === st && !(st === "updates" && x.excluded)).length;
|
||||
const unreachable = servers.reduce((n, s) => n + Object.values(s.scans).filter((sc) => sc.error).length, 0);
|
||||
const scanning = servers.some((s) => Object.values(s.scans).some((sc) => sc.running));
|
||||
const q = search.trim().toLowerCase();
|
||||
|
||||
const keep = (st: Stack) => {
|
||||
if (filter === "updates" && st.status !== "updates") return false;
|
||||
if (filter === "updates" && (st.status !== "updates" || st.excluded)) return false;
|
||||
if (filter === "problems" && st.status !== "error") return false;
|
||||
return !q || st.name.toLowerCase().includes(q) || st.dir.toLowerCase().includes(q) || (st.services ?? []).some((s) => s.image.toLowerCase().includes(q));
|
||||
};
|
||||
@@ -146,6 +147,7 @@ export function FleetView({ me, fleet, current, run, onEdit, onAdd, onKey }: Pro
|
||||
onEdit={() => onEdit(s.id)}
|
||||
onCheck={(t) => run(() => api.check(s.id, t))}
|
||||
onApply={(target, stack) => setApplying({ server: s, target, stack })}
|
||||
onExclude={(target, stack, on) => run(() => api.excludeStack(s.id, target.id, stack.dir, on))}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
@@ -180,13 +182,14 @@ interface BlockProps {
|
||||
onEdit: () => void;
|
||||
onCheck: (targetId?: string) => void;
|
||||
onApply: (t: Target, s: Stack) => void;
|
||||
onExclude: (t: Target, s: Stack, on: boolean) => void;
|
||||
}
|
||||
|
||||
function ServerBlock({ server, single, me, keep, filtering, onEdit, onCheck, onApply }: BlockProps) {
|
||||
function ServerBlock({ server, single, me, keep, filtering, onEdit, onCheck, onApply, onExclude }: BlockProps) {
|
||||
const scans = Object.values(server.scans);
|
||||
const running = scans.some((s) => s.running);
|
||||
const last = scans.map((s) => s.finished).filter(Boolean).sort().pop();
|
||||
const updates = scans.reduce((n, s) => n + s.stacks.filter((x) => x.status === "updates").length, 0);
|
||||
const updates = scans.reduce((n, s) => n + s.stacks.filter((x) => x.status === "updates" && !x.excluded).length, 0);
|
||||
|
||||
return (
|
||||
<section className="server-block">
|
||||
@@ -214,13 +217,13 @@ function ServerBlock({ server, single, me, keep, filtering, onEdit, onCheck, onA
|
||||
</header>
|
||||
)}
|
||||
{server.targets.map((t) => (
|
||||
<TargetBlock key={t.id} server={server} target={t} scan={server.scans[t.id]} me={me} keep={keep} filtering={filtering} onCheck={() => onCheck(t.id)} onApply={(s) => onApply(t, s)} />
|
||||
<TargetBlock key={t.id} server={server} target={t} scan={server.scans[t.id]} me={me} keep={keep} filtering={filtering} onCheck={() => onCheck(t.id)} onApply={(s) => onApply(t, s)} onExclude={(s, on) => onExclude(t, s, on)} />
|
||||
))}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function TargetBlock({ server, target, scan, me, keep, filtering, onCheck, onApply }: { server: Server; target: Target; scan?: Scan; me: Me; keep: (s: Stack) => boolean; filtering: boolean; onCheck: () => void; onApply: (s: Stack) => void }) {
|
||||
function TargetBlock({ server, target, scan, me, keep, filtering, onCheck, onApply, onExclude }: { server: Server; target: Target; scan?: Scan; me: Me; keep: (s: Stack) => boolean; filtering: boolean; onCheck: () => void; onApply: (s: Stack) => void; onExclude: (s: Stack, on: boolean) => void }) {
|
||||
const [open, setOpen] = useState<Record<string, boolean>>({});
|
||||
const stacks = (scan?.stacks ?? []).filter(keep);
|
||||
const hidden = (scan?.stacks.length ?? 0) - stacks.length;
|
||||
@@ -278,7 +281,9 @@ function TargetBlock({ server, target, scan, me, keep, filtering, onCheck, onApp
|
||||
const isOpen = !!open[st.dir];
|
||||
const [late, total] = [st.services?.filter((s) => s.state === "update").length ?? 0, st.services?.length ?? 0];
|
||||
const applying = !!applyingDir && applyingDir === st.dir;
|
||||
const status = applying ? "applying" : st.status;
|
||||
// Stack exclue avec une mise à jour disponible : statut neutre, sans bouton.
|
||||
const ignored = !applying && !!st.excluded && st.status === "updates";
|
||||
const status = applying ? "applying" : ignored ? "stopped" : st.status;
|
||||
return (
|
||||
<li key={st.dir} className={`stack st-${status} ${isOpen ? "open" : ""}`}>
|
||||
<div className="stack-row" onClick={() => setOpen({ ...open, [st.dir]: !isOpen })}>
|
||||
@@ -288,18 +293,28 @@ function TargetBlock({ server, target, scan, me, keep, filtering, onCheck, onApp
|
||||
<span className={`status-pill st-${status}`} aria-live="polite">
|
||||
{applying && <RefreshIcon size={13} className="spin" />}
|
||||
{!applying && st.status === "uptodate" && <CheckIcon size={13} />}
|
||||
{!applying && st.status === "updates" && <ArrowUpIcon size={13} />}
|
||||
{!applying && !ignored && st.status === "updates" && <ArrowUpIcon size={13} />}
|
||||
{!applying && st.status === "error" && <WarningIcon size={13} />}
|
||||
{applying ? "Mise à jour en cours" : statusLabel[st.status]}
|
||||
{applying ? "Mise à jour en cours" : ignored ? "Exclue" : statusLabel[st.status]}
|
||||
</span>
|
||||
<span className="stack-name">
|
||||
<strong>{st.name}</strong>
|
||||
<strong>
|
||||
{st.name}
|
||||
{st.excluded && (
|
||||
<>
|
||||
{" "}
|
||||
<span className="pill" title="Exclue des mises à jour (réactivable dans le détail de la stack)">
|
||||
exclue
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
</strong>
|
||||
<small className="muted">{st.dir}</small>
|
||||
</span>
|
||||
<span className="stack-meta muted">
|
||||
{applying ? "pull, down puis up -d…" : st.status === "error" ? <span className="error-text clip" title={st.error}>{st.error}</span> : total > 0 ? (late > 0 ? `${late}/${plural(total, "image")} à mettre à jour` : plural(total, "image")) : ""}
|
||||
</span>
|
||||
{me.admin && st.status === "updates" && !applying && (
|
||||
{me.admin && st.status === "updates" && !applying && !st.excluded && (
|
||||
<button className="primary" disabled={scan?.running} onClick={(e) => (e.stopPropagation(), onApply(st))} title="pull, down puis up -d">
|
||||
<ArrowUpIcon />
|
||||
Mettre à jour
|
||||
@@ -311,6 +326,12 @@ function TargetBlock({ server, target, scan, me, keep, filtering, onCheck, onApp
|
||||
<div className="muted small-text">
|
||||
<code>{st.file}</code>
|
||||
</div>
|
||||
{me.admin && (
|
||||
<label className="check-row">
|
||||
<input type="checkbox" checked={!!st.excluded} disabled={applying} onChange={(e) => onExclude(st, e.target.checked)} />
|
||||
<span>Exclure cette stack des mises à jour (elle reste analysée et affichée, sans bouton « Mettre à jour »)</span>
|
||||
</label>
|
||||
)}
|
||||
{st.error && <div className="error static">{st.error}</div>}
|
||||
{total > 0 && (
|
||||
<table className="services">
|
||||
|
||||
@@ -69,6 +69,8 @@ export interface Stack {
|
||||
error?: string;
|
||||
services?: Service[];
|
||||
applied?: Applied;
|
||||
/** Exclue des mises à jour par un administrateur (reste analysée et affichée). */
|
||||
excluded?: boolean;
|
||||
}
|
||||
|
||||
export interface Scan {
|
||||
@@ -105,6 +107,7 @@ export interface Summary {
|
||||
servers: number;
|
||||
stacks: number;
|
||||
updates: number;
|
||||
excluded: number;
|
||||
errors: number;
|
||||
stopped: number;
|
||||
unreachable: number;
|
||||
@@ -206,6 +209,11 @@ export const api = {
|
||||
await request(`/api/servers/${q(serverId)}/targets/${q(targetId)}/apply`, json({ dir }));
|
||||
},
|
||||
|
||||
/** Exclut une stack des mises à jour (on) ou la réactive. */
|
||||
excludeStack: async (serverId: string, targetId: string, dir: string, on: boolean): Promise<void> => {
|
||||
await request(`/api/servers/${q(serverId)}/targets/${q(targetId)}/exclude`, json({ dir, excluded: on }, "PUT"));
|
||||
},
|
||||
|
||||
// --- Compte ------------------------------------------------------------------
|
||||
changePassword: async (current: string, next: string): Promise<void> => {
|
||||
await request("/api/account/password", json({ current, new: next }));
|
||||
|
||||
Reference in new issue
Block a user