diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 05b57fe..c3c13c1 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -140,7 +140,7 @@ function Shell({ me, reloadMe }: { me: Me; reloadMe: () => Promise }) { const scans = Object.values(s.scans); if (!s.enabled) return "off"; if (scans.some((x) => x.error)) return "err"; - if (scans.some((x) => x.stacks.some((st) => st.status === "error"))) return "err"; + if (scans.some((x) => x.stacks.some((st) => st.status === "error" || (!!st.applied && !st.applied.ok && !st.excluded)))) return "err"; if (scans.some((x) => x.stacks.some((st) => st.status === "updates"))) return "upd"; if (scans.length === 0) return "off"; return "ok"; diff --git a/frontend/src/FleetView.tsx b/frontend/src/FleetView.tsx index 9c92599..41e4be0 100644 --- a/frontend/src/FleetView.tsx +++ b/frontend/src/FleetView.tsx @@ -26,6 +26,9 @@ const statusLabel: Record = { error: "Erreur", }; +/** Derniere mise a jour (manuelle, programmee ou globale) en echec. */ +export const failedApply = (st: Stack) => !!st.applied && !st.applied.ok && !st.excluded; + export function FleetView({ me, fleet, current, run, onEdit, onAdd, onKey }: Props) { const [filter, setFilter] = useState("all"); const [search, setSearch] = useState(""); @@ -73,11 +76,12 @@ export function FleetView({ me, fleet, current, run, onEdit, onAdd, onKey }: Pro 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 autoCount = all.filter((x) => x.auto).length; + const failCount = all.filter(failedApply).length; const q = search.trim().toLowerCase(); const keep = (st: Stack) => { if (filter === "updates" && (st.status !== "updates" || st.excluded)) return false; - if (filter === "problems" && st.status !== "error") return false; + if (filter === "problems" && st.status !== "error" && !failedApply(st)) return false; return !q || st.name.toLowerCase().includes(q) || st.dir.toLowerCase().includes(q) || (st.services ?? []).some((s) => s.image.toLowerCase().includes(q)); }; @@ -101,6 +105,7 @@ export function FleetView({ me, fleet, current, run, onEdit, onAdd, onKey }: Pro {plural(all.length, "stack")} {plural(count("updates"), "mise")} à jour à faire {count("error") > 0 && {plural(count("error"), "erreur")}} + {failCount > 0 && {plural(failCount, "mise")} à jour en échec} {unreachable > 0 && {plural(unreachable, "connexion")} en échec} {count("stopped") > 0 && {plural(count("stopped"), "arrêtée")}} {autoCount > 0 && {plural(autoCount, "stack")} en auto} @@ -352,7 +357,7 @@ function TargetBlock({ server, target, scan, me, keep, filtering, onCheck, onApp {st.dir} - {applying ? "pull, down puis up -d…" : st.status === "error" ? {st.error} : total > 0 ? (late > 0 ? `${late}/${plural(total, "image")} à mettre à jour` : plural(total, "image")) : ""} + {applying ? "pull, down puis up -d…" : st.status === "error" ? {st.error} : failedApply(st) ? Échec de la mise à jour : {st.applied?.message} : total > 0 ? (late > 0 ? `${late}/${plural(total, "image")} à mettre à jour` : plural(total, "image")) : ""} {me.admin && st.status === "updates" && !applying && !st.excluded && (