+
+ {on && (
+
+
+ setExpr(e.target.value)} placeholder="min heure jour mois jour-semaine" aria-label="Planification crontab" spellCheck={false} />
+
+
+ )}
+ {on && (
+
+ {preview.error
+ ? preview.error
+ : preview.next?.length
+ ? `Prochaines executions : ${preview.next.map(fmtDate).join(", ")}${tz ? ` (heure ${tz})` : ""}`
+ : " "}
+
+ )}
+ {stack.auto && (
+
+ Derniere execution programmee :
+
+ )}
+
+ );
+}
+
+interface Row {
+ server: Server;
+ target: Target;
+ scan: Scan;
+ stack: Stack;
+ auto: AutoInfo;
+}
+
+interface PanelProps {
+ me: Me;
+ servers: Server[];
+ query: string;
+ tz?: string;
+ onDisable: (server: Server, target: Target, stack: Stack) => void;
+}
+
+/** Espace de suivi : toutes les stacks programmees, triees par prochaine execution. */
+export function AutoPanel({ me, servers, query, tz, onDisable }: PanelProps) {
+ const rows: Row[] = servers.flatMap((server) =>
+ server.targets.flatMap((target) => {
+ const scan = server.scans[target.id];
+ return (scan?.stacks ?? []).flatMap((stack) => (stack.auto ? [{ server, target, scan, stack, auto: stack.auto }] : []));
+ }),
+ );
+ const q = query.trim().toLowerCase();
+ const shown = rows
+ .filter((r) => !q || r.stack.name.toLowerCase().includes(q) || r.stack.dir.toLowerCase().includes(q) || r.server.name.toLowerCase().includes(q))
+ .sort((a, b) => (a.auto.next ?? "9").localeCompare(b.auto.next ?? "9"));
+
+ if (!rows.length) {
+ return (
+
+ Aucune stack en mise a jour automatique. Pour en programmer une, ouvrir son detail et cocher « Mise a jour automatique programmee ».
+
+ );
+ }
+ return (
+
+
+ {rows.length} stack{rows.length > 1 ? "s" : ""} programmee{rows.length > 1 ? "s" : ""}. Heures exprimees dans le fuseau du serveur stackwatch{tz ? ` (${tz})` : ""}.
+
+
+
+
+ | Stack |
+ Serveur |
+ Planification |
+ Prochaine |
+ Derniere execution |
+ {me.admin && | }
+
+
+
+ {shown.map(({ server, target, scan, stack, auto }) => {
+ const running = scan.running && scan.task === "apply" && scan.current === stack.dir;
+ return (
+
+
+ {stack.name}
+
+ {stack.dir}
+ |
+
+ {server.name}
+ {!server.enabled && (desactive)}
+
+ {target.user}
+ |
+
+ {auto.schedule}
+ |
+ {auto.next ? fmtDate(auto.next) : jamais} |
+
+ {running ? (
+
+ Mise a jour en cours
+
+ ) : (
+
+ )}
+ |
+ {me.admin && (
+
+
+ |
+ )}
+
+ );
+ })}
+
+
+ {shown.length === 0 &&
Aucune programmation ne correspond a la recherche.
}
+
+ );
+}
diff --git a/frontend/src/FleetView.tsx b/frontend/src/FleetView.tsx
index 1b07da6..e85634b 100644
--- a/frontend/src/FleetView.tsx
+++ b/frontend/src/FleetView.tsx
@@ -1,10 +1,11 @@
import { useMemo, useState } from "react";
import { api, type Me, type Fleet, type Scan, type Server, type Stack, type StackStatus, type Target } from "./api";
+import { AutoBadge, AutoEditor, AutoPanel } from "./AutoUpdate";
import { ConfirmDialog } from "./Dialogs";
import { fmtRelative, plural } from "./format";
import { ArrowUpIcon, BanIcon, CheckIcon, ChevronDownIcon, ChevronRightIcon, ClockIcon, EditIcon, KeyIcon, PlusIcon, RefreshIcon, SearchIcon, ServerIcon, WarningIcon } from "./icons";
-type Filter = "all" | "updates" | "problems";
+type Filter = "all" | "updates" | "problems" | "auto";
interface Props {
me: Me;
@@ -70,6 +71,7 @@ export function FleetView({ me, fleet, current, run, onEdit, onAdd, onKey }: Pro
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 autoCount = all.filter((x) => x.auto).length;
const q = search.trim().toLowerCase();
const keep = (st: Stack) => {
@@ -97,6 +99,7 @@ export function FleetView({ me, fleet, current, run, onEdit, onAdd, onKey }: Pro
{count("error") > 0 &&