Stackwatch : suivi des mises à jour de stacks docker compose via SSH

Base Up And Down (auth, thème, dialogues) + moteur fleet (script distant POSIX,
analyse pull + comparaison d'images, mise à jour d'une stack), interface de suivi.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
claude BotandClaude Sonnet 5.5 committed 2026-11-23 08:37:40 +01:00
commit 56e1bbe842
54 files changed
+10954

No files matched your search

+92
View File
@@ -0,0 +1,92 @@
import { useEffect, useLayoutEffect, useRef, useState } from "react";
import type { ReactNode } from "react";
import { createPortal } from "react-dom";
interface Props {
/** Bouton « … » qui a ouvert le menu : le menu s'aligne sur lui. */
anchor: HTMLElement;
onClose: () => void;
children: ReactNode;
}
const MARGIN = 8; // écart minimal avec les bords de la fenêtre
/**
* Menu déroulant des actions d'un élément, ouvert sous le bouton « … » et aligné
* sur son bord droit (au-dessus s'il manque de place en bas). Rendu dans <body>
* pour ne pas être rogné par le défilement de la liste ; refermé par un clic
* ailleurs, Échap, un défilement, un redimensionnement ou le choix d'une action.
*/
export function ActionMenu({ anchor, onClose, children }: Props) {
const ref = useRef<HTMLDivElement>(null);
const [pos, setPos] = useState<{ top: number; left: number } | null>(null);
useLayoutEffect(() => {
const menu = ref.current;
if (!menu) return;
const a = anchor.getBoundingClientRect();
const { offsetWidth: w, offsetHeight: h } = menu;
let top = a.bottom + 4;
if (top + h > innerHeight - MARGIN) top = Math.max(MARGIN, a.top - 4 - h);
const left = Math.min(Math.max(MARGIN, a.right - w), innerWidth - w - MARGIN);
setPos({ top, left });
}, [anchor]);
// Focus sur la première action une fois le menu placé (masqué, il ne le prend pas).
useEffect(() => {
if (pos) ref.current?.querySelector<HTMLElement>("button, a")?.focus({ preventScroll: true });
}, [pos]);
useEffect(() => {
const inside = (t: EventTarget | null) => t instanceof Node && (ref.current?.contains(t) || anchor.contains(t));
const onDown = (ev: PointerEvent) => {
if (!inside(ev.target)) onClose();
};
const onKey = (ev: KeyboardEvent) => {
if (ev.key === "Escape") {
// Ni désélection, ni fermeture du panneau flottant : seulement le menu.
ev.preventDefault();
ev.stopPropagation();
onClose();
anchor.focus();
} else if (ev.key === "ArrowDown" || ev.key === "ArrowUp") {
const items = [...(ref.current?.querySelectorAll<HTMLElement>("button, a") ?? [])];
if (!items.length) return;
ev.preventDefault();
const i = items.indexOf(document.activeElement as HTMLElement);
const next = ev.key === "ArrowDown" ? (i + 1) % items.length : (i - 1 + items.length) % items.length;
items[next].focus();
}
};
const onScroll = (ev: Event) => {
if (!(ev.target instanceof Node && ref.current?.contains(ev.target))) onClose();
};
document.addEventListener("pointerdown", onDown, true);
document.addEventListener("keydown", onKey, true);
document.addEventListener("scroll", onScroll, true);
window.addEventListener("resize", onClose);
return () => {
document.removeEventListener("pointerdown", onDown, true);
document.removeEventListener("keydown", onKey, true);
document.removeEventListener("scroll", onScroll, true);
window.removeEventListener("resize", onClose);
};
}, [anchor, onClose]);
return createPortal(
<div
ref={ref}
className="actions menu-popup"
role="menu"
style={pos ?? { top: 0, left: 0, visibility: "hidden" }}
// Une action choisie referme le menu (après coup, pour laisser un lien de
// téléchargement aboutir).
onClick={(ev) => {
if ((ev.target as HTMLElement).closest("button, a")) setTimeout(onClose);
}}
>
{children}
</div>,
document.body,
);
}
+293
View File
@@ -0,0 +1,293 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { api, type Fleet, type Me } from "./api";
import { ActionMenu } from "./ActionMenu";
import { FleetView } from "./FleetView";
import { KeyDialog, ServerDialog } from "./ServerDialog";
import { Login } from "./Login";
import { SettingsDialog } from "./SettingsDialog";
import { initials } from "./format";
import { LogoutIcon, MenuIcon, MoonIcon, PlusIcon, RefreshIcon, ServerIcon, SettingsIcon, ShieldIcon, StackIcon, SunIcon, UserIcon, UsersIcon, KeyIcon } from "./icons";
type Theme = "light" | "dark";
const initialTheme = (): Theme => (document.documentElement.dataset.theme === "dark" ? "dark" : "light");
const hashServer = () => decodeURIComponent(location.hash.replace(/^#\/?/, ""));
export default function App() {
const [me, setMe] = useState<Me | null>(null);
const [loadError, setLoadError] = useState<string | null>(null);
const loadMe = useCallback(
() =>
api
.me()
.then((m) => {
setMe(m);
setLoadError(null);
document.title = m.title || "Stackwatch";
})
.catch((e) => setLoadError(e instanceof Error ? e.message : String(e))),
[],
);
useEffect(() => {
loadMe();
}, [loadMe]);
// OIDC seul : pas de page de connexion locale, direction le fournisseur.
const redirecting = !!me && !me.user && me.oidc && !me.local;
useEffect(() => {
if (redirecting) location.replace(`/auth/login?next=${encodeURIComponent(location.pathname + location.search + location.hash)}`);
}, [redirecting]);
if (loadError) {
return (
<main className="login">
<div className="login-card center">
<p className="error">{loadError}</p>
<button className="primary" onClick={loadMe}>
Réessayer
</button>
</div>
</main>
);
}
if (!me || redirecting) return <div className="splash muted">Chargement…</div>;
if (!me.user) return <Login me={me} onLoggedIn={loadMe} />;
return <Shell me={me} reloadMe={loadMe} />;
}
function Shell({ me, reloadMe }: { me: Me; reloadMe: () => Promise<unknown> }) {
const [theme, setTheme] = useState<Theme>(initialTheme);
const [fleet, setFleet] = useState<Fleet | null>(null);
const [error, setError] = useState<string | null>(null);
const [sel, setSel] = useState(hashServer());
const [drawer, setDrawer] = useState(false);
const [settings, setSettings] = useState<"account" | "users" | null>(null);
const [userMenu, setUserMenu] = useState<HTMLElement | null>(null);
const [serverDialog, setServerDialog] = useState<{ id?: string } | null>(null);
const [keyDialog, setKeyDialog] = useState(false);
const title = me.title || "Stackwatch";
const user = me.user!;
useEffect(() => {
document.documentElement.dataset.theme = theme;
try {
localStorage.setItem("swTheme", theme);
} catch {
/* stockage indisponible */
}
}, [theme]);
const load = useCallback(
() =>
api
.fleet()
.then((f) => {
setFleet(f);
setError(null);
return f;
})
.catch((e) => {
setError(e instanceof Error ? e.message : String(e));
return null;
}),
[],
);
// Rafraîchissement : rapide pendant une analyse, lent sinon.
const busy = !!fleet && fleet.summary.scanning > 0;
const loadRef = useRef(load);
loadRef.current = load;
useEffect(() => {
loadRef.current();
const t = setInterval(() => loadRef.current(), busy ? 2000 : 30000);
return () => clearInterval(t);
}, [busy]);
useEffect(() => {
const onHash = () => setSel(hashServer());
window.addEventListener("hashchange", onHash);
return () => window.removeEventListener("hashchange", onHash);
}, []);
const go = (id: string) => {
setSel(id);
setDrawer(false);
if (id) location.hash = `#/${encodeURIComponent(id)}`;
else history.pushState(null, "", location.pathname + location.search);
};
const run = async (fn: () => Promise<unknown>) => {
setError(null);
try {
await fn();
await load();
} catch (e) {
setError(e instanceof Error ? e.message : String(e));
}
};
const servers = fleet?.servers ?? [];
const current = servers.find((s) => s.id === sel);
const sum = fleet?.summary;
const dot = (s: (typeof servers)[number]) => {
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 === "updates"))) return "upd";
if (scans.length === 0) return "off";
return "ok";
};
const updatesOf = (s: (typeof servers)[number]) => Object.values(s.scans).reduce((n, x) => n + x.stacks.filter((st) => st.status === "updates").length, 0);
return (
<div className="app">
<header className="topbar">
<button className="icon-btn menu-btn-inline" onClick={() => setDrawer(!drawer)} aria-label="Menu" title="Menu">
<MenuIcon />
</button>
<a className="brand" href="/" onClick={(e) => (e.preventDefault(), go(""))} title={title}>
<StackIcon size={26} />
<span>{title}</span>
</a>
<div className="topbar-tools">
<button className="ex-btn" onClick={() => run(api.checkAll)} disabled={!servers.length || busy} title="Analyser tous les serveurs">
<RefreshIcon className={busy ? "spin" : ""} />
<span className="hide-sm">{busy ? "Analyse…" : "Tout vérifier"}</span>
</button>
<button className="icon-btn" onClick={() => setTheme(theme === "dark" ? "light" : "dark")} aria-label={theme === "dark" ? "Thème clair" : "Thème sombre"} title={theme === "dark" ? "Thème clair" : "Thème sombre"}>
{theme === "dark" ? <SunIcon /> : <MoonIcon />}
</button>
<button className="user-btn" onClick={(e) => setUserMenu(userMenu ? null : e.currentTarget)} aria-haspopup="menu" aria-expanded={!!userMenu} title={`${user.name} (${user.id})`}>
<span className="avatar">{initials(user.name)}</span>
<span className="user-name">{user.name}</span>
{me.admin && me.mode !== "none" && <ShieldIcon size={14} />}
{!!me.pending && <small className="badge">{me.pending}</small>}
</button>
</div>
</header>
<div className="layout">
{drawer && <div className="scrim" onClick={() => setDrawer(false)} />}
<aside className={`sidebar ${drawer ? "open" : ""}`}>
<nav>
<button className={`nav-item ${sel === "" ? "on" : ""}`} onClick={() => go("")} aria-current={sel === "" ? "page" : undefined}>
<ServerIcon />
<span>Tous les serveurs</span>
{!!sum?.updates && <small className="badge warn">{sum.updates}</small>}
</button>
{servers.map((s) => (
<button key={s.id} className={`nav-item ${sel === s.id ? "on" : ""}`} onClick={() => go(s.id)} aria-current={sel === s.id ? "page" : undefined} title={`${s.host}:${s.port}`}>
<i className={`dot ${dot(s)}`} aria-hidden />
<span>{s.name}</span>
{updatesOf(s) > 0 && <small className="badge warn">{updatesOf(s)}</small>}
</button>
))}
</nav>
<div className="sidebar-foot">
{me.admin && (
<>
<button onClick={() => (setServerDialog({}), setDrawer(false))}>
<PlusIcon />
Ajouter un serveur
</button>
<button onClick={() => (setKeyDialog(true), setDrawer(false))}>
<KeyIcon />
Clé SSH
</button>
</>
)}
{fleet && <small className="muted">{fleet.interval > 0 ? `Analyse automatique toutes les ${fmtInterval(fleet.interval)}` : "Analyse automatique désactivée"}</small>}
{me.version && me.version !== "dev" && <small className="muted">v{me.version}</small>}
</div>
</aside>
<div className="splitter-line" />
<main className="main">
{error && (
<div className="error floating" onClick={() => setError(null)}>
{error}
</div>
)}
<FleetView
me={me}
fleet={fleet}
current={current}
reload={load}
run={run}
onEdit={(id) => setServerDialog({ id })}
onAdd={() => setServerDialog({})}
onKey={() => setKeyDialog(true)}
/>
</main>
</div>
{userMenu && (
<ActionMenu anchor={userMenu} onClose={() => setUserMenu(null)}>
<div className="menu-head">
<strong>{user.name}</strong>
<small className="muted">{user.email || user.id}</small>
<small className="muted">{me.admin && me.mode !== "none" ? "Administrateur" : ""}</small>
</div>
<hr />
{me.mode !== "none" && (
<button role="menuitem" onClick={() => setSettings("account")}>
<UserIcon />
Mon compte
</button>
)}
{me.admin && me.mode !== "none" && (
<button role="menuitem" onClick={() => setSettings("users")}>
<UsersIcon />
Utilisateurs{!!me.pending && ` (${me.pending} en attente)`}
</button>
)}
{me.admin && (
<button role="menuitem" onClick={() => setKeyDialog(true)}>
<SettingsIcon />
Clé SSH
</button>
)}
{me.logout && (
<>
<hr />
<a role="menuitem" href={me.logout}>
<LogoutIcon />
Se déconnecter
</a>
</>
)}
</ActionMenu>
)}
{settings && <SettingsDialog me={me} initialTab={settings} onClose={() => setSettings(null)} onChanged={reloadMe} />}
{keyDialog && fleet && <KeyDialog publicKey={fleet.publicKey ?? ""} onClose={() => setKeyDialog(false)} />}
{serverDialog && (
<ServerDialog
server={servers.find((s) => s.id === serverDialog.id)}
publicKey={fleet?.publicKey ?? ""}
onClose={() => setServerDialog(null)}
onSaved={(id) => {
setServerDialog(null);
load();
if (id) go(id);
}}
onDeleted={() => {
setServerDialog(null);
go("");
load();
}}
/>
)}
</div>
);
}
export function fmtInterval(seconds: number) {
if (seconds % 86400 === 0) return `${seconds / 86400} j`;
if (seconds % 3600 === 0) return `${seconds / 3600} h`;
return `${Math.round(seconds / 60)} min`;
}
+98
View File
@@ -0,0 +1,98 @@
import { useEffect, useRef, useState } from "react";
import type { ReactNode } from "react";
function useEscape(onClose: () => void) {
useEffect(() => {
const onKey = (e: KeyboardEvent) => e.key === "Escape" && onClose();
window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
}, [onClose]);
}
interface PromptProps {
title: string;
label?: string;
initial?: string;
placeholder?: string;
submit?: string;
/** Sélectionne seulement le nom, sans l'extension (renommage d'un fichier). */
stem?: boolean;
onSubmit: (value: string) => void;
onClose: () => void;
}
/** Saisie d'un nom (nouveau dossier, renommage), à la place de prompt(). */
export function PromptDialog({ title, label, initial = "", placeholder, submit = "Valider", stem, onSubmit, onClose }: PromptProps) {
const [value, setValue] = useState(initial);
const ref = useRef<HTMLInputElement>(null);
useEscape(onClose);
useEffect(() => {
const el = ref.current;
if (!el) return;
el.focus();
const dot = initial.lastIndexOf(".");
el.setSelectionRange(0, stem && dot > 0 ? dot : initial.length);
}, [initial, stem]);
const trimmed = value.trim();
return (
<div className="modal-backdrop" onClick={onClose}>
<form
className="modal small"
role="dialog"
aria-modal="true"
aria-label={title}
onClick={(e) => e.stopPropagation()}
onSubmit={(e) => {
e.preventDefault();
if (trimmed) onSubmit(trimmed);
}}
>
<h3>{title}</h3>
<label className="field">
{label && <span>{label}</span>}
<input ref={ref} value={value} placeholder={placeholder} maxLength={255} onChange={(e) => setValue(e.target.value)} />
</label>
<div className="modal-actions">
<span className="spacer" />
<button type="button" onClick={onClose}>
Annuler
</button>
<button type="submit" className="primary" disabled={!trimmed || trimmed === initial}>
{submit}
</button>
</div>
</form>
</div>
);
}
interface ConfirmProps {
title: string;
children: ReactNode;
confirm: string;
danger?: boolean;
onConfirm: () => void;
onClose: () => void;
}
/** Confirmation d'une action destructrice, à la place de confirm(). */
export function ConfirmDialog({ title, children, confirm, danger, onConfirm, onClose }: ConfirmProps) {
useEscape(onClose);
return (
<div className="modal-backdrop" onClick={onClose}>
<div className="modal small" role="alertdialog" aria-modal="true" aria-label={title} onClick={(e) => e.stopPropagation()}>
<h3>{title}</h3>
<div className="modal-text">{children}</div>
<div className="modal-actions">
<span className="spacer" />
<button onClick={onClose}>Annuler</button>
<button autoFocus className={danger ? "primary danger-fill" : "primary"} onClick={onConfirm}>
{confirm}
</button>
</div>
</div>
</div>
);
}
+356
View File
@@ -0,0 +1,356 @@
import { useMemo, useState } from "react";
import { api, type Me, type Fleet, type Scan, type Server, type Stack, type StackStatus, type Target } from "./api";
import { ConfirmDialog } from "./Dialogs";
import { fmtRelative, plural } from "./format";
import { ArrowUpIcon, CheckIcon, ChevronDownIcon, ChevronRightIcon, ClockIcon, EditIcon, KeyIcon, PlusIcon, RefreshIcon, SearchIcon, ServerIcon, WarningIcon } from "./icons";
type Filter = "all" | "updates" | "problems";
interface Props {
me: Me;
fleet: Fleet | null;
/** Serveur affiché ; absent : tous. */
current?: Server;
reload: () => Promise<unknown>;
run: (fn: () => Promise<unknown>) => Promise<void>;
onEdit: (id: string) => void;
onAdd: () => void;
onKey: () => void;
}
const statusLabel: Record<StackStatus, string> = {
uptodate: "À jour",
updates: "Mise à jour",
stopped: "Arrêtée",
error: "Erreur",
};
export function FleetView({ me, fleet, current, run, onEdit, onAdd, onKey }: Props) {
const [filter, setFilter] = useState<Filter>("all");
const [search, setSearch] = useState("");
const [applying, setApplying] = useState<{ server: Server; target: Target; stack: Stack } | null>(null);
const servers = useMemo(() => (current ? [current] : (fleet?.servers ?? [])), [current, fleet]);
if (!fleet) return <div className="splash muted">Chargement…</div>;
if (!fleet.servers.length) {
return (
<div className="empty-state">
<ServerIcon size={44} />
<h2>Aucun serveur</h2>
<p className="muted">
Ajoutez un serveur joignable en SSH : stackwatch y retrouve les stacks docker compose (dans <code>/home</code> par défaut) et vous dit lesquelles ont une nouvelle image.
</p>
{me.admin ? (
<div className="row-actions">
<button className="primary big" onClick={onAdd}>
<PlusIcon />
Ajouter un serveur
</button>
<button className="big" onClick={onKey}>
<KeyIcon />
Clé SSH à autoriser
</button>
</div>
) : (
<p className="muted">Un administrateur doit d'abord en déclarer.</p>
)}
</div>
);
}
if (!current && location.hash.replace(/^#\/?/, "")) {
return <div className="empty-state"><p className="muted">Serveur introuvable.</p></div>;
}
// 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;
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 === "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));
};
return (
<div className="fleet">
<div className="head">
<div className="head-title">
<h2>{current ? current.name : "Tous les serveurs"}</h2>
{current && (
<span className="muted">
{current.host}
{current.port !== 22 ? `:${current.port}` : ""}
{current.note ? ` · ${current.note}` : ""}
</span>
)}
</div>
<div className="stats">
<span className="stat">{plural(all.length, "stack")}</span>
<span className={`stat ${count("updates") ? "warn" : ""}`}>{plural(count("updates"), "mise")} à jour à faire</span>
{count("error") > 0 && <span className="stat err">{plural(count("error"), "erreur")}</span>}
{unreachable > 0 && <span className="stat err">{plural(unreachable, "connexion")} en échec</span>}
{count("stopped") > 0 && <span className="stat">{plural(count("stopped"), "arrêtée")}</span>}
</div>
</div>
<div className="toolbar">
<div className="segmented" role="group" aria-label="Filtre">
{(
[
["all", "Toutes"],
["updates", "Mises à jour"],
["problems", "Erreurs"],
] as [Filter, string][]
).map(([k, label]) => (
<button key={k} className={filter === k ? "on" : ""} onClick={() => setFilter(k)} aria-pressed={filter === k}>
{label}
</button>
))}
</div>
<label className="searchbox">
<SearchIcon />
<input type="search" placeholder="Stack, répertoire, image…" value={search} onChange={(e) => setSearch(e.target.value)} />
</label>
<span className="spacer" />
{current && (
<>
<button onClick={() => run(() => api.check(current.id))} disabled={scanning}>
<RefreshIcon className={scanning ? "spin" : ""} />
Vérifier
</button>
{me.admin && (
<button onClick={() => onEdit(current.id)}>
<EditIcon />
Modifier
</button>
)}
</>
)}
</div>
<div className="scroll">
{servers.map((s) => (
<ServerBlock
key={s.id}
server={s}
single={!!current}
me={me}
keep={keep}
filtering={filter !== "all" || !!q}
onEdit={() => onEdit(s.id)}
onCheck={(t) => run(() => api.check(s.id, t))}
onApply={(target, stack) => setApplying({ server: s, target, stack })}
/>
))}
</div>
{applying && (
<ConfirmDialog
title="Mettre à jour la stack"
confirm="Mettre à jour"
onClose={() => setApplying(null)}
onConfirm={() => {
const a = applying;
setApplying(null);
run(() => api.applyStack(a.server.id, a.target.id, a.stack.dir));
}}
>
<p>
Sur <strong>{applying.server.name}</strong>, <code>{applying.stack.dir}</code> : téléchargement des images, arrêt (<code>down</code>) puis redémarrage (<code>up -d</code>) de toute la stack, sous l'utilisateur{" "}
<code>{applying.target.user}</code>. Les services sont interrompus quelques instants.
</p>
</ConfirmDialog>
)}
</div>
);
}
interface BlockProps {
server: Server;
single: boolean;
me: Me;
keep: (s: Stack) => boolean;
filtering: boolean;
onEdit: () => void;
onCheck: (targetId?: string) => void;
onApply: (t: Target, s: Stack) => void;
}
function ServerBlock({ server, single, me, keep, filtering, onEdit, onCheck, onApply }: 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);
return (
<section className="server-block">
{!single && (
<header className="server-head">
<ServerIcon size={18} />
<h3>{server.name}</h3>
<span className="muted">{server.host}</span>
{!server.enabled && <span className="pill">désactivé</span>}
{updates > 0 && <span className="pill warn">{plural(updates, "mise")} à jour</span>}
<span className="spacer" />
{last && (
<span className="muted small-text" title={new Date(last).toLocaleString()}>
<ClockIcon size={13} /> {fmtRelative(last)}
</span>
)}
<button className="icon-btn" onClick={() => onCheck()} disabled={running} aria-label={`Vérifier ${server.name}`} title="Vérifier ce serveur">
<RefreshIcon className={running ? "spin" : ""} />
</button>
{me.admin && (
<button className="icon-btn" onClick={onEdit} aria-label={`Modifier ${server.name}`} title="Modifier">
<EditIcon />
</button>
)}
</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)} />
))}
</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 }) {
const [open, setOpen] = useState<Record<string, boolean>>({});
const stacks = (scan?.stacks ?? []).filter(keep);
const hidden = (scan?.stacks.length ?? 0) - stacks.length;
return (
<div className="target">
<div className="target-head">
<code>
{target.user}@{server.host}
</code>
<span className="muted roots">{target.roots.join(" · ")}{target.depth > 1 ? ` (profondeur ${target.depth})` : ""}</span>
<span className="spacer" />
{scan?.running && (
<span className="muted small-text running">
<RefreshIcon size={13} className="spin" /> {scan.task === "apply" ? "Mise à jour" : "Analyse"}
{scan.current ? ` : ${scan.current.split("/").pop()}` : "…"}
</span>
)}
{!scan?.running && scan?.finished && (
<span className="muted small-text" title={new Date(scan.finished).toLocaleString()}>
vérifié {fmtRelative(scan.finished)}
</span>
)}
{scan?.compose && (
<span className="muted small-text" title={`docker ${scan.docker ?? "?"}, compose ${scan.compose}`}>
compose {scan.compose}
</span>
)}
<button className="icon-btn" onClick={onCheck} disabled={scan?.running} aria-label={`Vérifier ${target.user}`} title="Vérifier cette connexion">
<RefreshIcon className={scan?.running ? "spin" : ""} />
</button>
</div>
{scan?.error && (
<div className="error static">
<WarningIcon /> {scan.error}
{scan.stacks.length > 0 && <span className="muted"> (dernier résultat conservé)</span>}
</div>
)}
{scan?.warnings?.map((w) => (
<div key={w} className="notice warn-notice">
<WarningIcon /> {w}
</div>
))}
{!scan && <p className="muted pad">Pas encore analysé.</p>}
{scan && !scan.error && !scan.running && scan.stacks.length === 0 && <p className="muted pad">Aucune stack compose trouvée sous ces racines.</p>}
{scan && scan.stacks.length > 0 && stacks.length === 0 && filtering && <p className="muted pad">Aucune stack ne correspond au filtre ({hidden} masquées).</p>}
{stacks.length > 0 && (
<ul className="stacks">
{stacks.map((st) => {
const isOpen = !!open[st.dir];
const [late, total] = [st.services?.filter((s) => s.state === "update").length ?? 0, st.services?.length ?? 0];
return (
<li key={st.dir} className={`stack st-${st.status} ${isOpen ? "open" : ""}`}>
<div className="stack-row" onClick={() => setOpen({ ...open, [st.dir]: !isOpen })}>
<button className="icon-btn" aria-expanded={isOpen} aria-label="Détails" onClick={(e) => (e.stopPropagation(), setOpen({ ...open, [st.dir]: !isOpen }))}>
{isOpen ? <ChevronDownIcon /> : <ChevronRightIcon />}
</button>
<span className={`status-pill st-${st.status}`}>
{st.status === "uptodate" && <CheckIcon size={13} />}
{st.status === "updates" && <ArrowUpIcon size={13} />}
{st.status === "error" && <WarningIcon size={13} />}
{statusLabel[st.status]}
</span>
<span className="stack-name">
<strong>{st.name}</strong>
<small className="muted">{st.dir}</small>
</span>
<span className="stack-meta muted">
{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" && (
<button className="primary" disabled={scan?.running} onClick={(e) => (e.stopPropagation(), onApply(st))} title="pull, down puis up -d">
<ArrowUpIcon />
Mettre à jour
</button>
)}
</div>
{isOpen && (
<div className="stack-detail">
<div className="muted small-text">
<code>{st.file}</code>
</div>
{st.error && <div className="error static">{st.error}</div>}
{total > 0 && (
<table className="services">
<thead>
<tr>
<th>Service</th>
<th>Image</th>
<th>En cours</th>
<th>Disponible</th>
<th />
</tr>
</thead>
<tbody>
{st.services!.map((s) => (
<tr key={s.name}>
<td>{s.name}</td>
<td>
<code>{s.image}</code>
</td>
<td>
<code>{s.running}</code>
</td>
<td>
<code>{s.latest || "?"}</code>
</td>
<td>
<span className={`svc ${s.state}`}>{s.state === "ok" ? "à jour" : s.state === "update" ? "nouvelle image" : "inconnu"}</span>
</td>
</tr>
))}
</tbody>
</table>
)}
{st.applied && (
<div className={`notice ${st.applied.ok ? "" : "warn-notice"}`}>
{st.applied.ok ? "Mise à jour effectuée" : "Mise à jour en échec"} le {new Date(st.applied.at).toLocaleString()} par {st.applied.by} : {st.applied.message}
</div>
)}
</div>
)}
</li>
);
})}
</ul>
)}
</div>
);
}
+126
View File
@@ -0,0 +1,126 @@
import { useState } from "react";
import { api, ApiError, type Me } from "./api";
import { StackIcon } from "./icons";
interface Props {
me: Me;
/** Connexion ou inscription réussie (session ouverte) : recharge l'application. */
onLoggedIn: () => void;
}
/** Page de connexion : compte local, inscription (selon le mode choisi par l'administrateur) et bouton OIDC. */
export function Login({ me, onLoggedIn }: Props) {
const canRegister = me.local && (me.registration !== "closed" || !!me.setup);
const [mode, setMode] = useState<"login" | "register">(me.setup ? "register" : "login");
const [f, setF] = useState({ username: "", name: "", email: "", password: "", confirm: "" });
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
const [info, setInfo] = useState<string | null>(null);
const title = me.title || "Stackwatch";
const next = encodeURIComponent(location.pathname + location.search + location.hash);
const set = (k: keyof typeof f) => (e: React.ChangeEvent<HTMLInputElement>) => setF({ ...f, [k]: e.target.value });
const submit = async (e: React.FormEvent) => {
e.preventDefault();
setError(null);
setInfo(null);
if (mode === "register" && f.password !== f.confirm) {
setError("Les deux mots de passe sont différents.");
return;
}
setBusy(true);
try {
if (mode === "login") {
await api.login(f.username, f.password);
onLoggedIn();
} else {
const status = await api.register({ username: f.username, name: f.name, email: f.email, password: f.password });
if (status === "pending") {
setInfo("Compte créé. Un administrateur doit le valider avant votre première connexion.");
setMode("login");
setF({ ...f, password: "", confirm: "" });
} else onLoggedIn();
}
} catch (err) {
if (err instanceof ApiError && err.code === "pending") setInfo("Votre compte est en attente de validation par un administrateur.");
else setError(err instanceof Error ? err.message : String(err));
} finally {
setBusy(false);
}
};
return (
<main className="login">
<div className="login-card">
<div className="login-brand">
<StackIcon size={36} />
<h1>{title}</h1>
<p className="muted">Suivez les mises à jour de vos stacks docker compose.</p>
</div>
{me.setup && (
<div className="notice">
<strong>Première utilisation.</strong> Le compte créé ici devient l'administrateur.
</div>
)}
{info && <div className="notice">{info}</div>}
{error && <div className="error">{error}</div>}
{me.local && (
<form onSubmit={submit} className="form">
{canRegister && !me.setup && (
<div className="tabs" role="tablist">
<button type="button" role="tab" aria-selected={mode === "login"} className={mode === "login" ? "on" : ""} onClick={() => setMode("login")}>
Connexion
</button>
<button type="button" role="tab" aria-selected={mode === "register"} className={mode === "register" ? "on" : ""} onClick={() => setMode("register")}>
Créer un compte
</button>
</div>
)}
<label className="field">
<span>Identifiant</span>
<input autoFocus autoComplete="username" autoCapitalize="none" spellCheck={false} required value={f.username} onChange={set("username")} />
</label>
{mode === "register" && (
<>
<label className="field">
<span>Nom affiché (facultatif)</span>
<input autoComplete="name" maxLength={80} value={f.name} onChange={set("name")} />
</label>
<label className="field">
<span>Adresse e-mail (facultatif)</span>
<input type="email" autoComplete="email" maxLength={120} value={f.email} onChange={set("email")} />
</label>
</>
)}
<label className="field">
<span>{mode === "register" ? "Mot de passe (10 caractères minimum)" : "Mot de passe"}</span>
<input type="password" required minLength={mode === "register" ? 10 : undefined} autoComplete={mode === "login" ? "current-password" : "new-password"} value={f.password} onChange={set("password")} />
</label>
{mode === "register" && (
<label className="field">
<span>Confirmer le mot de passe</span>
<input type="password" required autoComplete="new-password" value={f.confirm} onChange={set("confirm")} />
</label>
)}
<button className="primary big" type="submit" disabled={busy}>
{mode === "login" ? "Se connecter" : me.setup ? "Créer l'administrateur" : "Créer mon compte"}
</button>
{mode === "register" && me.registration === "approval" && !me.setup && <p className="muted small-text">Votre compte devra être validé par un administrateur.</p>}
</form>
)}
{me.oidc && (
<>
{me.local && <div className="or">ou</div>}
<a className="ex-btn big" href={`/auth/login?next=${next}`}>
Se connecter avec {me.oidcName || "SSO"}
</a>
</>
)}
</div>
</main>
);
}
+284
View File
@@ -0,0 +1,284 @@
import { useEffect, useState } from "react";
import { api, type PingResult, type Server, type ServerInput } from "./api";
import { ConfirmDialog } from "./Dialogs";
import { CheckIcon, CloseIcon, CopyIcon, PlusIcon, TrashIcon, WarningIcon } from "./icons";
const msg = (e: unknown) => (e instanceof Error ? e.message : String(e));
function useEscape(onClose: () => void) {
useEffect(() => {
const onKey = (e: KeyboardEvent) => e.key === "Escape" && onClose();
window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
}, [onClose]);
}
async function copy(text: string): Promise<boolean> {
try {
await navigator.clipboard.writeText(text);
return true;
} catch {
return false;
}
}
interface TargetForm {
id?: string;
user: string;
roots: string;
depth: number;
}
const emptyTarget = (): TargetForm => ({ user: "", roots: "/home", depth: 1 });
const toInput = (f: { name: string; host: string; port: string; note: string; enabled: boolean }, targets: TargetForm[]): ServerInput => ({
name: f.name,
host: f.host,
port: Number(f.port) || 22,
note: f.note,
enabled: f.enabled,
targets: targets.map((t) => ({ id: t.id, user: t.user.trim(), depth: t.depth, roots: t.roots.split(/[\n,]+/).map((r) => r.trim()).filter(Boolean) })),
});
/** Ajout ou modification d'un serveur : hôte SSH et connexions (utilisateur + racines à parcourir). */
export function ServerDialog({
server,
publicKey,
onClose,
onSaved,
onDeleted,
}: {
server?: Server;
publicKey: string;
onClose: () => void;
onSaved: (id?: string) => void;
onDeleted: () => void;
}) {
const [f, setF] = useState({
name: server?.name ?? "",
host: server?.host ?? "",
port: String(server?.port ?? 22),
note: server?.note ?? "",
enabled: server?.enabled ?? true,
});
const [targets, setTargets] = useState<TargetForm[]>(
server ? server.targets.map((t) => ({ id: t.id, user: t.user, roots: t.roots.join("\n"), depth: t.depth })) : [emptyTarget()],
);
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
const [ping, setPing] = useState<PingResult[] | null>(null);
const [removing, setRemoving] = useState(false);
const [copied, setCopied] = useState(false);
useEscape(onClose);
const set = (k: keyof typeof f) => (e: React.ChangeEvent<HTMLInputElement>) => setF({ ...f, [k]: k === "enabled" ? e.target.checked : e.target.value });
const setT = (i: number, v: Partial<TargetForm>) => setTargets(targets.map((t, j) => (j === i ? { ...t, ...v } : t)));
const test = async () => {
setBusy(true);
setError(null);
setPing(null);
try {
setPing(await api.testServer("-", toInput(f, targets)));
} catch (e) {
setError(msg(e));
} finally {
setBusy(false);
}
};
const save = async (e: React.FormEvent) => {
e.preventDefault();
setBusy(true);
setError(null);
try {
const res = server ? await api.updateServer(server.id, toInput(f, targets)) : await api.addServer(toInput(f, targets));
onSaved(res.id);
} catch (e) {
setError(msg(e));
setBusy(false);
}
};
const remove = async () => {
setRemoving(false);
setBusy(true);
try {
await api.deleteServer(server!.id);
onDeleted();
} catch (e) {
setError(msg(e));
setBusy(false);
}
};
return (
<div className="modal-backdrop" onClick={onClose}>
<form className="modal wide" role="dialog" aria-modal="true" aria-label={server ? "Modifier le serveur" : "Ajouter un serveur"} onClick={(e) => e.stopPropagation()} onSubmit={save}>
<header className="settings-head flat">
<h3>{server ? `Serveur ${server.name}` : "Ajouter un serveur"}</h3>
<button type="button" className="icon-btn" onClick={onClose} aria-label="Fermer" title="Fermer (Échap)">
<CloseIcon />
</button>
</header>
{error && (
<div className="error" onClick={() => setError(null)}>
{error}
</div>
)}
<div className="form">
<div className="grid2">
<label className="field">
<span>Nom</span>
<input autoFocus required maxLength={80} value={f.name} onChange={set("name")} placeholder="lancelot" />
</label>
<div className="grid-host">
<label className="field">
<span>Hôte SSH</span>
<input required spellCheck={false} autoCapitalize="none" value={f.host} onChange={set("host")} placeholder="lancelot.home.naoned.net" />
</label>
<label className="field port">
<span>Port</span>
<input type="number" min={1} max={65535} value={f.port} onChange={set("port")} />
</label>
</div>
</div>
<label className="field">
<span>Note (facultative)</span>
<input maxLength={300} value={f.note} onChange={set("note")} placeholder="Hôte des stacks de prod" />
</label>
<label className="check-row">
<input type="checkbox" checked={f.enabled} onChange={set("enabled")} />
<span>Analyse automatique activée (désactivé : seulement à la demande)</span>
</label>
<h4>Connexions</h4>
<p className="muted small-text">
Une connexion = un utilisateur SSH et les répertoires où chercher des stacks (<code>compose.yaml</code>, <code>docker-compose.yml</code>…). Pour des stacks qui n'appartiennent qu'à un utilisateur, ajoutez une connexion sous cet utilisateur, avec son répertoire (ex. <code>/home/alice</code>) :
elles ne tournent alors qu'avec ses droits. L'utilisateur doit pouvoir utiliser docker.
</p>
{targets.map((t, i) => (
<div key={t.id ?? i} className="card target-form">
<div className="grid-target">
<label className="field">
<span>Utilisateur SSH</span>
<input required spellCheck={false} autoCapitalize="none" value={t.user} onChange={(e) => setT(i, { user: e.target.value })} placeholder="root" />
</label>
<label className="field">
<span>Profondeur</span>
<select value={t.depth} onChange={(e) => setT(i, { depth: Number(e.target.value) })} title="Niveaux de sous-répertoires parcourus sous chaque racine">
<option value={1}>1 : racine/stack</option>
<option value={2}>2 : racine/x/stack</option>
<option value={3}>3</option>
<option value={4}>4</option>
</select>
</label>
{targets.length > 1 && (
<button type="button" className="icon-btn danger" onClick={() => setTargets(targets.filter((_, j) => j !== i))} aria-label="Retirer cette connexion" title="Retirer cette connexion">
<TrashIcon />
</button>
)}
</div>
<label className="field">
<span>Racines (une par ligne)</span>
<textarea rows={Math.min(5, Math.max(2, t.roots.split("\n").length))} spellCheck={false} value={t.roots} onChange={(e) => setT(i, { roots: e.target.value })} placeholder="/home" />
</label>
{ping && ping[i] && (
<div className={`ping ${ping[i].ok ? "ok" : "ko"}`}>
{ping[i].ok ? <CheckIcon size={14} /> : <WarningIcon size={14} />} {ping[i].message || (ping[i].ok ? "OK" : "échec")}
</div>
)}
</div>
))}
<div>
<button type="button" onClick={() => setTargets([...targets, emptyTarget()])} disabled={targets.length >= 20}>
<PlusIcon />
Ajouter une connexion
</button>
</div>
{publicKey && (
<details className="keyhelp">
<summary>Clé publique à autoriser sur le serveur</summary>
<p className="muted small-text">
À ajouter dans <code>~/.ssh/authorized_keys</code> de chaque utilisateur ci-dessus :
</p>
<pre className="example">{publicKey}</pre>
<button type="button" onClick={async () => setCopied(await copy(publicKey.trim()))}>
<CopyIcon />
{copied ? "Copiée" : "Copier"}
</button>
</details>
)}
</div>
<div className="modal-actions">
{server && (
<button type="button" className="danger-outline" onClick={() => setRemoving(true)} disabled={busy}>
<TrashIcon />
Supprimer
</button>
)}
<span className="spacer" />
<button type="button" onClick={test} disabled={busy || !f.host}>
Tester la connexion
</button>
<button type="button" onClick={onClose}>
Annuler
</button>
<button type="submit" className="primary" disabled={busy}>
{server ? "Enregistrer" : "Ajouter"}
</button>
</div>
</form>
{removing && server && (
<ConfirmDialog title="Supprimer le serveur" confirm="Supprimer" danger onClose={() => setRemoving(false)} onConfirm={remove}>
<p>
Retirer <strong>{server.name}</strong> de stackwatch ? Rien n'est modifié sur le serveur.
</p>
</ConfirmDialog>
)}
</div>
);
}
/** Clé publique SSH de stackwatch, à autoriser sur chaque serveur. */
export function KeyDialog({ publicKey, onClose }: { publicKey: string; onClose: () => void }) {
const [copied, setCopied] = useState(false);
useEscape(onClose);
const cmd = `echo '${publicKey.trim()}' >> ~/.ssh/authorized_keys`;
return (
<div className="modal-backdrop" onClick={onClose}>
<div className="modal" role="dialog" aria-modal="true" aria-label="Clé SSH" onClick={(e) => e.stopPropagation()}>
<header className="settings-head flat">
<h3>Clé SSH de stackwatch</h3>
<button className="icon-btn" onClick={onClose} aria-label="Fermer" title="Fermer (Échap)">
<CloseIcon />
</button>
</header>
{publicKey ? (
<>
<p>Stackwatch se connecte en SSH avec cette clé (créée au premier démarrage, stockée dans son volume de données). Ajoutez-la à chaque utilisateur déclaré sur vos serveurs :</p>
<pre className="example">{publicKey}</pre>
<p className="muted small-text">Sur le serveur, connecté en tant que cet utilisateur :</p>
<pre className="example">{cmd}</pre>
<p className="muted small-text">
L'utilisateur doit appartenir au groupe <code>docker</code> (ou faire tourner docker en mode rootless). Les clés d'hôte sont enregistrées à la première connexion puis vérifiées.
</p>
<div className="modal-actions">
<span className="spacer" />
<button onClick={async () => setCopied(await copy(publicKey.trim()))}>
<CopyIcon />
{copied ? "Copiée" : "Copier la clé"}
</button>
<button className="primary" onClick={onClose}>
Fermer
</button>
</div>
</>
) : (
<p className="muted">Clé indisponible.</p>
)}
</div>
</div>
);
}
+367
View File
@@ -0,0 +1,367 @@
import { useCallback, useEffect, useState } from "react";
import type { ReactNode } from "react";
import { api, type Account, type Me, type Role, type Status } from "./api";
import { CheckIcon, CloseIcon, KeyIcon, TrashIcon, UserIcon, UsersIcon } from "./icons";
import { ConfirmDialog } from "./Dialogs";
import { fmtDate, plural } from "./format";
type Tab = "account" | "users";
interface Props {
me: Me;
initialTab?: Tab;
onClose: () => void;
/** Comptes modifiés : le parent recharge /api/me. */
onChanged: () => void;
}
const statusLabel: Record<Status, string> = { active: "Actif", pending: "En attente", disabled: "Désactivé" };
const msg = (e: unknown) => (e instanceof Error ? e.message : String(e));
/** Paramètres : compte ; pour les administrateurs, gestion des utilisateurs. */
export function SettingsDialog({ me, initialTab = "account", onClose, onChanged }: Props) {
const [tab, setTab] = useState<Tab>(initialTab);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
const onKey = (e: KeyboardEvent) => e.key === "Escape" && onClose();
window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
}, [onClose]);
const tabs: { id: Tab; label: string; icon: ReactNode; admin?: boolean; badge?: number }[] = [
{ id: "account", label: "Mon compte", icon: <UserIcon /> },
{ id: "users", label: "Utilisateurs", icon: <UsersIcon />, admin: true, badge: me.pending },
];
return (
<div className="modal-backdrop" onClick={onClose}>
<div className="modal settings" role="dialog" aria-modal="true" aria-label="Paramètres" onClick={(e) => e.stopPropagation()}>
<header className="settings-head">
<h3>Paramètres</h3>
<button className="icon-btn" onClick={onClose} aria-label="Fermer" title="Fermer (Échap)">
<CloseIcon />
</button>
</header>
<nav className="tabs" role="tablist">
{tabs
.filter((t) => !t.admin || me.admin)
.map((t) => (
<button
key={t.id}
role="tab"
aria-selected={tab === t.id}
className={tab === t.id ? "on" : ""}
onClick={() => {
setError(null);
setTab(t.id);
}}
>
{t.icon}
<span>{t.label}</span>
{!!t.badge && <small className="badge">{t.badge}</small>}
</button>
))}
</nav>
{error && (
<div className="error" onClick={() => setError(null)}>
{error}
</div>
)}
<div className="settings-body">
{tab === "account" && <AccountTab me={me} onError={setError} onChanged={onChanged} />}
{tab === "users" && me.admin && <UsersTab me={me} onError={setError} onChanged={onChanged} />}
</div>
</div>
</div>
);
}
// --- Mon compte ----------------------------------------------------------------------
function AccountTab({ me, onError, onChanged }: { me: Me; onError: (m: string | null) => void; onChanged: () => void }) {
const u = me.user;
const [name, setName] = useState(u?.name ?? "");
const [email, setEmail] = useState(u?.email ?? "");
const [current, setCurrent] = useState("");
const [next, setNext] = useState("");
const [ok, setOk] = useState<string | null>(null);
const local = me.canChangePassword;
const run = async (fn: () => Promise<unknown>, done: string) => {
onError(null);
setOk(null);
try {
await fn();
setOk(done);
} catch (e) {
onError(msg(e));
}
};
return (
<div className="section">
<dl className="kv">
<dt>Identifiant</dt>
<dd>
<code>{u?.id}</code>
</dd>
<dt>Rôle</dt>
<dd>{u?.role === "admin" ? "Administrateur" : "Utilisateur"}</dd>
<dt>Connexion</dt>
<dd>{u?.provider === "oidc" ? "Fournisseur d'identité (OIDC)" : u?.provider === "local" ? "Compte local" : "Sans authentification intégrée"}</dd>
</dl>
{ok && <div className="notice">{ok}</div>}
{local ? (
<>
<form
className="form"
onSubmit={(e) => {
e.preventDefault();
run(async () => {
await api.patchAccount({ name, email });
onChanged();
}, "Profil enregistré.");
}}
>
<h4>Profil</h4>
<label className="field">
<span>Nom affiché</span>
<input value={name} maxLength={80} onChange={(e) => setName(e.target.value)} />
</label>
<label className="field">
<span>Adresse e-mail</span>
<input type="email" value={email} maxLength={120} onChange={(e) => setEmail(e.target.value)} />
</label>
<div>
<button className="primary" type="submit">
Enregistrer
</button>
</div>
</form>
<form
className="form"
onSubmit={(e) => {
e.preventDefault();
run(async () => {
await api.changePassword(current, next);
setCurrent("");
setNext("");
}, "Mot de passe modifié.");
}}
>
<h4>Mot de passe</h4>
<label className="field">
<span>Mot de passe actuel</span>
<input type="password" autoComplete="current-password" value={current} onChange={(e) => setCurrent(e.target.value)} />
</label>
<label className="field">
<span>Nouveau mot de passe (10 caractères minimum)</span>
<input type="password" autoComplete="new-password" minLength={10} value={next} onChange={(e) => setNext(e.target.value)} />
</label>
<div>
<button className="primary" type="submit" disabled={!current || next.length < 10}>
Changer le mot de passe
</button>
</div>
</form>
</>
) : (
<p className="muted">Le nom, l'adresse et le mot de passe de ce compte sont gérés par votre fournisseur d'identité.</p>
)}
</div>
);
}
function UsersTab({ me, onError, onChanged }: { me: Me; onError: (m: string | null) => void; onChanged: () => void }) {
const [users, setUsers] = useState<Account[] | null>(null);
const [form, setForm] = useState({ username: "", name: "", email: "", password: "", role: "user" as Role });
const [creating, setCreating] = useState(false);
const [removing, setRemoving] = useState<Account | null>(null);
const [resetting, setResetting] = useState<Account | null>(null);
const [newPassword, setNewPassword] = useState("");
const load = useCallback(() => api.users().then(setUsers).catch((e) => onError(msg(e))), [onError]);
useEffect(() => {
load();
}, [load]);
const patch = async (u: Account, v: Parameters<typeof api.patchUser>[1]) => {
onError(null);
try {
await api.patchUser(u.id, v);
await load();
onChanged();
} catch (e) {
onError(msg(e));
}
};
const create = async () => {
onError(null);
try {
await api.createUser(form);
setForm({ username: "", name: "", email: "", password: "", role: "user" });
setCreating(false);
await load();
} catch (e) {
onError(msg(e));
}
};
return (
<div className="section">
<div className="row-between">
<span className="muted">{users ? plural(users.length, "compte") : ""}</span>
<button className="primary" onClick={() => setCreating(!creating)}>
{creating ? "Annuler" : "Créer un compte local"}
</button>
</div>
{creating && (
<form
className="form card"
onSubmit={(e) => {
e.preventDefault();
create();
}}
>
<div className="grid2">
<label className="field">
<span>Identifiant</span>
<input value={form.username} autoComplete="off" onChange={(e) => setForm({ ...form, username: e.target.value })} />
</label>
<label className="field">
<span>Nom affiché</span>
<input value={form.name} onChange={(e) => setForm({ ...form, name: e.target.value })} />
</label>
<label className="field">
<span>Adresse e-mail</span>
<input type="email" value={form.email} onChange={(e) => setForm({ ...form, email: e.target.value })} />
</label>
<label className="field">
<span>Mot de passe (10 caractères minimum)</span>
<input type="password" autoComplete="new-password" value={form.password} onChange={(e) => setForm({ ...form, password: e.target.value })} />
</label>
<label className="field">
<span>Rôle</span>
<select value={form.role} onChange={(e) => setForm({ ...form, role: e.target.value as Role })}>
<option value="user">Utilisateur</option>
<option value="admin">Administrateur</option>
</select>
</label>
</div>
<div>
<button className="primary" type="submit" disabled={form.username.length < 3 || form.password.length < 10}>
Créer
</button>
</div>
</form>
)}
<div className="table-wrap">
<table className="users">
<thead>
<tr>
<th>Compte</th>
<th>Origine</th>
<th>Rôle</th>
<th>État</th>
<th>Dernière connexion</th>
<th />
</tr>
</thead>
<tbody>
{users?.map((u) => (
<tr key={u.id} className={u.status}>
<td>
<strong>{u.name}</strong>
<small className="muted"> {u.id}</small>
{u.email && u.email !== u.id && <small className="muted block">{u.email}</small>}
</td>
<td>{u.provider === "oidc" ? "OIDC" : "Local"}</td>
<td>
<select value={u.role} onChange={(e) => patch(u, { role: e.target.value as Role })} aria-label={`Rôle de ${u.id}`}>
<option value="user">Utilisateur</option>
<option value="admin">Administrateur</option>
</select>
</td>
<td>
<span className={`status ${u.status}`}>{statusLabel[u.status]}</span>
</td>
<td className="muted">{u.lastLogin ? fmtDate(u.lastLogin) : "jamais"}</td>
<td className="actions-cell">
{u.status === "pending" && (
<button className="primary" onClick={() => patch(u, { status: "active" })}>
<CheckIcon />
<span>Valider</span>
</button>
)}
{u.status === "active" && u.id !== me.user?.id && <button onClick={() => patch(u, { status: "disabled" })}>Désactiver</button>}
{u.status === "disabled" && <button onClick={() => patch(u, { status: "active" })}>Réactiver</button>}
{u.provider === "local" && (
<button className="icon-btn" onClick={() => setResetting(u)} title="Nouveau mot de passe" aria-label={`Nouveau mot de passe pour ${u.id}`}>
<KeyIcon />
</button>
)}
{u.id !== me.user?.id && (
<button className="icon-btn danger" onClick={() => setRemoving(u)} title="Supprimer le compte" aria-label={`Supprimer ${u.id}`}>
<TrashIcon />
</button>
)}
</td>
</tr>
))}
</tbody>
</table>
</div>
{resetting && (
<ConfirmDialog
title={`Nouveau mot de passe pour ${resetting.id}`}
confirm="Changer"
onClose={() => {
setResetting(null);
setNewPassword("");
}}
onConfirm={async () => {
const u = resetting;
setResetting(null);
await patch(u, { password: newPassword });
setNewPassword("");
}}
>
<label className="field">
<span>Mot de passe (10 caractères minimum)</span>
<input type="password" autoFocus autoComplete="new-password" value={newPassword} onChange={(e) => setNewPassword(e.target.value)} />
</label>
</ConfirmDialog>
)}
{removing && (
<ConfirmDialog
title="Supprimer le compte"
confirm="Supprimer"
danger
onClose={() => setRemoving(null)}
onConfirm={async () => {
const u = removing;
setRemoving(null);
onError(null);
try {
await api.deleteUser(u.id);
await load();
onChanged();
} catch (e) {
onError(msg(e));
}
}}
>
<p>
Supprimer le compte de <strong>{removing.name}</strong> ({removing.id}) ? Ses sessions sont révoquées.
</p>
</ConfirmDialog>
)}
</div>
);
}
+230
View File
@@ -0,0 +1,230 @@
// Client de l'API Go (voir internal/api/api.go).
export type Role = "admin" | "user";
export type Status = "active" | "pending" | "disabled";
export type Registration = "closed" | "approval" | "open";
/** Session courante et réglages publics (GET /api/me, accessible sans connexion). */
export interface Me {
mode: "none" | "local" | "oidc" | "both";
local: boolean;
oidc: boolean;
oidcName?: string;
registration: Registration;
/** Aucun administrateur : le premier compte créé le devient. */
setup?: boolean;
title: string;
version?: string;
user?: { id: string; name: string; email?: string; role: Role; provider?: "local" | "oidc" };
admin: boolean;
canChangePassword?: boolean;
logout?: string;
/** Administrateur : inscriptions à valider. */
pending?: number;
}
export interface Account {
id: string;
username?: string;
name: string;
email?: string;
provider: "local" | "oidc";
role: Role;
status: Status;
created: string;
lastLogin?: string;
}
// --- Suivi des stacks --------------------------------------------------------------
export type StackStatus = "uptodate" | "updates" | "stopped" | "error";
export interface Target {
id: string;
user: string;
roots: string[];
depth: number;
}
export interface Service {
name: string;
image: string;
running: string;
latest: string;
state: "ok" | "update" | "unknown";
}
export interface Applied {
at: string;
by: string;
ok: boolean;
message: string;
}
export interface Stack {
dir: string;
name: string;
file: string;
status: StackStatus;
error?: string;
services?: Service[];
applied?: Applied;
}
export interface Scan {
running: boolean;
task?: "scan" | "apply";
current?: string;
started?: string;
finished?: string;
error?: string;
warnings?: string[];
stacks: Stack[];
docker?: string;
compose?: string;
}
export interface ServerInput {
id?: string;
name: string;
host: string;
port: number;
note?: string;
enabled: boolean;
targets: { id?: string; user: string; roots: string[]; depth: number }[];
}
export interface Server extends ServerInput {
id: string;
targets: Target[];
/** Résultat de chaque connexion, par identifiant de connexion. */
scans: Record<string, Scan>;
}
export interface Summary {
servers: number;
stacks: number;
updates: number;
errors: number;
stopped: number;
unreachable: number;
scanning: number;
}
export interface Fleet {
servers: Server[];
summary: Summary;
/** Secondes entre deux analyses automatiques (0 : désactivées). */
interval: number;
/** Administrateur : clé publique SSH à autoriser sur les serveurs. */
publicKey?: string;
}
export interface PingResult {
target: string;
user: string;
ok: boolean;
message: string;
}
export class ApiError extends Error {
constructor(
public status: number,
message: string,
public code?: string,
) {
super(message);
}
}
async function request(url: string, init?: RequestInit): Promise<Response> {
const res = await fetch(url, init);
if (!res.ok) {
// Session OIDC expirée : reconnexion, puis retour sur la page courante.
const login = res.status === 401 ? res.headers.get("X-Auth-Login") : null;
if (login) location.assign(`${login}?next=${encodeURIComponent(location.pathname + location.search + location.hash)}`);
let msg = res.statusText;
let code: string | undefined;
try {
const j = await res.json();
msg = j.error ?? msg;
code = j.code;
} catch {
/* corps non JSON */
}
throw new ApiError(res.status, msg, code);
}
return res;
}
const q = (p: string) => encodeURIComponent(p);
const json = (body: unknown, method = "POST"): RequestInit => ({
method,
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
});
export const api = {
me: async (): Promise<Me> => (await request("/api/me")).json(),
// --- Connexion ---------------------------------------------------------------
login: async (username: string, password: string): Promise<void> => {
await request("/auth/local/login", json({ username, password }));
},
/** Renvoie « active » (connecté d'office) ou « pending » (à valider par un administrateur). */
register: async (v: { username: string; name: string; email: string; password: string }): Promise<"active" | "pending"> => {
const res = await request("/auth/local/register", json(v));
return (await res.json()).status;
},
// --- Serveurs et analyses ----------------------------------------------------
fleet: async (): Promise<Fleet> => (await request("/api/fleet")).json(),
checkAll: async (): Promise<void> => {
await request("/api/check", { method: "POST" });
},
check: async (serverId: string, targetId?: string): Promise<void> => {
await request(`/api/servers/${q(serverId)}/check${targetId ? `?target=${q(targetId)}` : ""}`, { method: "POST" });
},
addServer: async (v: ServerInput): Promise<{ id: string }> => (await request("/api/servers", json(v))).json(),
updateServer: async (id: string, v: ServerInput): Promise<{ id: string }> => (await request(`/api/servers/${q(id)}`, json(v, "PUT"))).json(),
deleteServer: async (id: string): Promise<void> => {
await request(`/api/servers/${q(id)}`, { method: "DELETE" });
},
/** Teste la connexion SSH, docker et docker compose (id « - » : serveur pas encore enregistré, décrit par v). */
testServer: async (id: string, v?: ServerInput): Promise<PingResult[]> =>
(await request(`/api/servers/${q(id)}/test`, v ? json(v) : { method: "POST" })).json(),
applyStack: async (serverId: string, targetId: string, dir: string): Promise<void> => {
await request(`/api/servers/${q(serverId)}/targets/${q(targetId)}/apply`, json({ dir }));
},
// --- Compte ------------------------------------------------------------------
changePassword: async (current: string, next: string): Promise<void> => {
await request("/api/account/password", json({ current, new: next }));
},
patchAccount: async (v: { name?: string; email?: string }): Promise<void> => {
await request("/api/account", json(v, "PATCH"));
},
// --- Administration ----------------------------------------------------------
users: async (): Promise<Account[]> => (await request("/api/admin/users")).json(),
createUser: async (v: { username: string; name: string; email: string; password: string; role: Role }): Promise<Account> =>
(await request("/api/admin/users", json(v))).json(),
patchUser: async (id: string, v: Partial<{ name: string; email: string; role: Role; status: Status; password: string }>): Promise<Account> =>
(await request(`/api/admin/users/${q(id)}`, json(v, "PATCH"))).json(),
deleteUser: async (id: string): Promise<void> => {
await request(`/api/admin/users/${q(id)}`, { method: "DELETE" });
},
};
+43
View File
@@ -0,0 +1,43 @@
// Mise en forme des dates, tailles et auteurs (explorateur, panneau Détails).
export const fmtDate = (iso: string) => new Date(iso).toLocaleString(undefined, { dateStyle: "short", timeStyle: "short" });
export const fmtSize = (n: number) => {
if (n < 1024) return `${n} o`;
const units = ["Ko", "Mo", "Go", "To"];
let v = n / 1024;
let i = 0;
while (v >= 1024 && i < units.length - 1) {
v /= 1024;
i++;
}
return `${v >= 100 ? v.toFixed(0) : v.toFixed(1)} ${units[i]}`;
};
export const fmtRate = (bytesPerSecond: number) => `${fmtSize(bytesPerSecond)}/s`;
export const plural = (n: number, word: string) => `${n} ${word}${n > 1 ? "s" : ""}`;
const relative = new Intl.RelativeTimeFormat("fr", { numeric: "auto" });
/** « à l'instant », « il y a 5 minutes », « hier »… puis la date au-delà d'un mois. */
export const fmtRelative = (iso: string) => {
const s = (Date.now() - new Date(iso).getTime()) / 1000;
if (s < 60) return "à l'instant";
if (s < 3600) return relative.format(-Math.round(s / 60), "minute");
if (s < 86400) return relative.format(-Math.round(s / 3600), "hour");
if (s < 30 * 86400) return relative.format(-Math.round(s / 86400), "day");
return new Date(iso).toLocaleDateString(undefined, { dateStyle: "medium" });
};
/** Auteur affichable : rien pour l'utilisateur unique sans authentification. */
export const who = (id?: string) => (id && id !== "local" ? id : "");
/** Initiales d'un nom pour l'avatar. */
export const initials = (name: string) =>
name
.split(/[\s._@-]+/)
.filter(Boolean)
.slice(0, 2)
.map((p) => p[0].toUpperCase())
.join("") || "?";
+414
View File
@@ -0,0 +1,414 @@
// Icônes de l'interface : jeu Papicons (formes pleines, couleur héritée via currentColor),
// identique à celui d'Excalicloud (frontend/src/icons.tsx) pour que les deux outils se ressemblent.
// Les tracés Papicons sont dans papicons.ts ; les quelques icônes absentes du jeu sont
// dessinées ici dans le même esprit (formes pleines arrondies, ou trait épais à bouts ronds).
import { useId, type ReactNode } from "react";
import * as P from "./papicons";
import type { PapPath } from "./papicons";
type IconProps = { size?: number; className?: string };
/** Identifiant de masque SVG unique et sûr dans url(#…). */
function useMaskId() {
return "m" + useId().replace(/[^a-zA-Z0-9_-]/g, "");
}
function Svg({ size = 16, className, children }: IconProps & { children: ReactNode }) {
return (
<svg width={size} height={size} viewBox="0 0 24 24" fill="currentColor" className={className} aria-hidden>
{children}
</svg>
);
}
const paths = (p: PapPath[]) =>
p.map((x, i) => <path key={i} d={x.d} fillRule={x.evenodd ? "evenodd" : undefined} clipRule={x.evenodd ? "evenodd" : undefined} />);
/** Icône Papicons telle quelle. */
export const pap = (p: PapPath[], transform?: string) =>
function Icon({ size, className }: IconProps) {
return (
<Svg size={size} className={className}>
<g transform={transform}>{paths(p)}</g>
</Svg>
);
};
/** Icône au trait, pour les icônes de dossiers sans équivalent Papicons (trait 2, plus appuyé que Tabler). */
export const icon = (children: ReactNode) =>
function Icon({ size = 16, className }: IconProps) {
return (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" className={className} aria-hidden>
{children}
</svg>
);
};
/** Icône pleine dessinée ici. */
const solid = (children: ReactNode) =>
function Icon({ size, className }: IconProps) {
return <Svg size={size} className={className}>{children}</Svg>;
};
/** Icône au trait épais (graisse des flèches Papicons), pour les symboles absents du jeu. */
const line = (children: ReactNode) =>
function Icon({ size = 16, className }: IconProps) {
return (
<svg
className={className}
width={size}
height={size}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth={2.5}
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden
>
{children}
</svg>
);
};
/** Icône Papicons avec une pastille en bas à droite (le fond est évidé autour de la pastille). */
const badged = (base: PapPath[], badge: PapPath[]) =>
function Icon({ size }: IconProps) {
const id = useMaskId();
return (
<Svg size={size}>
<mask id={id}>
<rect width="24" height="24" fill="#fff" />
<circle cx="18" cy="18" r="7" fill="#000" />
</mask>
<g mask={`url(#${id})`}>{paths(base)}</g>
<g transform="translate(18 18) scale(0.5) translate(-12 -12)">{paths(badge)}</g>
</Svg>
);
};
// Thème, barre du haut, panneaux.
/** Soleil dessiné ici : celui de Papicons ressemble trop à la roue dentée des Paramètres. */
export const SunIcon = solid(
<>
<circle cx="12" cy="12" r="4.5" />
<path
d="M12 2.5v1.5M12 20v1.5M2.5 12H4M20 12h1.5M5.3 5.3l1.05 1.05M17.65 17.65l1.05 1.05M5.3 18.7l1.05-1.05M17.65 6.35l1.05-1.05"
stroke="currentColor"
strokeWidth={2.5}
strokeLinecap="round"
/>
</>,
);
export const MoonIcon = pap(P.Moon);
export const SettingsIcon = pap(P.Gears);
export const MenuIcon = pap(P.Menu);
export const CloseIcon = pap(P.Cross);
export const UpdateIcon = pap(P.Sparkles);
export const UserIcon = pap(P.User);
export const LogoutIcon = pap(P.Logout);
export const InfoIcon = pap(P.Info);
export const LinkIcon = pap(P.Link);
export const SearchIcon = pap(P.Search);
// Fichiers et dossiers.
export const FolderIcon = pap(P.Folder);
export const FileIcon = pap(P.Paper);
export const FilePlusIcon = badged(P.Paper, P.Add);
export const FolderPlusIcon = badged(P.Folder, P.Add);
export const FolderUploadIcon = badged(P.Folder, P.ArrowUpBox);
export const MoveIcon = badged(P.Folder, P.ArrowRightBox);
export const UploadIcon = pap(P.ArrowUpBox);
export const DownloadIcon = pap(P.ArrowDownBox);
/** Dossier parent (« .. »). */
export const UpIcon = pap(P.ArrowLeftUp);
export const EditIcon = pap(P.PenAlt);
export const SelectAllIcon = pap(P.Tasks);
export const DeselectIcon = pap(P.Placeholder);
/** Menu d'actions « … » : points à l'horizontale. */
export const DotsIcon = pap(P.Dots, "rotate(90 12 12)");
// Vues de l'explorateur.
export const ListIcon = pap(P.List);
export const GridIcon = pap(P.Grid);
export const GalleryIcon = pap(P.Gallery);
// Poubelle.
export const TrashIcon = pap(P.Trash);
/** Poubelle qui contient des éléments : pastille pleine sur le couvercle. */
export function TrashFullIcon({ size }: IconProps) {
const id = useMaskId();
return (
<Svg size={size}>
<mask id={id}>
<rect width="24" height="24" fill="#fff" />
<circle cx="19.5" cy="4.5" r="4.5" fill="#000" />
</mask>
<g mask={`url(#${id})`}>{paths(P.Trash)}</g>
<circle cx="19.5" cy="4.5" r="3" />
</Svg>
);
}
// Favoris : étoile pleine (favori) ou évidée (pas favori), même silhouette.
export const StarFilledIcon = pap(P.Star);
export function StarIcon({ size }: IconProps) {
const id = useMaskId();
return (
<Svg size={size}>
<mask id={id}>
<rect width="24" height="24" fill="#fff" />
<g fill="#000" transform="translate(12 13) scale(0.45) translate(-12 -13)">
{paths(P.Star)}
</g>
</mask>
<g mask={`url(#${id})`}>{paths(P.Star)}</g>
</Svg>
);
}
// Actions sans équivalent dans Papicons.
export const RefreshIcon = line(
<>
<path d="M19.5 10.5A7.8 7.8 0 0 0 5 8.5M4.5 4.5v4h4" />
<path d="M4.5 13.5A7.8 7.8 0 0 0 19 15.5m.5 4v-4h-4" />
</>,
);
export const RestoreIcon = line(<path d="M9 14.5 4.5 10 9 5.5M4.5 10h11a4.5 4.5 0 1 1 0 9H14" />);
export const HistoryIcon = line(
<>
<path d="M12 8v4l2.5 2" />
<path d="M3.5 11a8.6 8.6 0 1 1 .6 4M3.5 20v-5h5" />
</>,
);
export const SortIcon = line(<path d="M4 6h9M4 12h7M4 18h5M17.5 4.5v15M14.5 16.5l3 3 3-3" />);
export const CopyIcon = function CopyIcon({ size }: IconProps) {
const id = useMaskId();
return (
<Svg size={size}>
<mask id={id}>
<rect width="24" height="24" fill="#fff" />
<rect x="7" y="7" width="16" height="16" rx="5" fill="#000" />
</mask>
<rect x="3" y="3" width="12.5" height="12.5" rx="3.5" mask={`url(#${id})`} />
<rect x="9" y="9" width="12" height="12" rx="3.5" />
</Svg>
);
};
export const SaveIcon = function SaveIcon({ size }: IconProps) {
const id = useMaskId();
return (
<Svg size={size}>
<mask id={id}>
<rect width="24" height="24" fill="#fff" />
<rect x="7.5" y="1" width="7.5" height="6.5" rx="1.5" fill="#000" />
<circle cx="12" cy="15" r="2.75" fill="#000" />
</mask>
<path mask={`url(#${id})`} d="M7 3h8.2c.8 0 1.56.32 2.12.88l2.8 2.8c.56.56.88 1.32.88 2.12V17a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V7a4 4 0 0 1 4-4z" />
</Svg>
);
};
export const TagIcon = solid(
<path
fillRule="evenodd"
clipRule="evenodd"
d="M3 6a3 3 0 0 1 3-3h4.76a3 3 0 0 1 2.12.88l7.9 7.9a3 3 0 0 1 0 4.24l-4.76 4.76a3 3 0 0 1-4.24 0l-7.9-7.9A3 3 0 0 1 3 10.76zm5 .25a1.75 1.75 0 1 0 0 3.5 1.75 1.75 0 0 0 0-3.5z"
/>,
);
export const ShareIcon = solid(
<>
<path d="M6 12 17.5 5.5M6 12l11.5 6.5" fill="none" stroke="currentColor" strokeWidth={2.5} strokeLinecap="round" />
<circle cx="6" cy="12" r="3.25" />
<circle cx="17.5" cy="5.5" r="3.25" />
<circle cx="17.5" cy="18.5" r="3.25" />
</>,
);
export const EyeIcon = solid(
<path
fillRule="evenodd"
clipRule="evenodd"
d="M12 5c4.3 0 7.6 2.7 9.5 6.1.3.56.3 1.24 0 1.8C19.6 16.3 16.3 19 12 19s-7.6-2.7-9.5-6.1a1.9 1.9 0 0 1 0-1.8C4.4 7.7 7.7 5 12 5m0 3.5a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7m0 2a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3"
/>,
);
/** Punaise : panneau épinglé ou flottant. */
export const PinIcon = solid(
<g transform="rotate(35 12 12)">
<path d="M8.5 3h7a1.5 1.5 0 0 1 0 3H15v4l2.6 2.4c.95.88.33 2.6-1 2.6H7.4c-1.33 0-1.95-1.72-1-2.6L9 10V6h-.5a1.5 1.5 0 0 1 0-3z" />
<path d="M12 15v6" stroke="currentColor" strokeWidth={2.5} strokeLinecap="round" />
</g>,
);
// Métadonnées des schémas (vue Galerie, panneau Détails).
export const ClockIcon = pap(P.Clock);
export const TextIcon = pap(P.Font);
export const PhotoIcon = pap(P.Camera);
export const ArrowIcon = pap(P.ArrowRightUp);
/** Taille du fichier. */
export const SizeIcon = pap(P.Archive);
export const ShapesIcon = solid(
<>
<rect x="3" y="3" width="8.5" height="8.5" rx="2.5" />
<circle cx="17" cy="17" r="4.25" />
<path d="M15.7 3.75a1.5 1.5 0 0 1 2.6 0l3.2 5.5A1.5 1.5 0 0 1 20.2 11.5h-6.4a1.5 1.5 0 0 1-1.3-2.25z" />
</>,
);
export const FrameIcon = line(<path d="M4 7.5h16M4 16.5h16M7.5 4v16M16.5 4v16" />);
// --- Propres à Up And Down : types de fichiers, aperçu, comptes ----------------------
// Même esprit : Papicons quand l'équivalent existe, sinon formes pleines ou trait épais.
/** Feuille Papicons dont un motif est évidé (types de fichiers). */
const page = (glyph: ReactNode) =>
function Icon({ size, className }: IconProps) {
const id = useMaskId();
return (
<Svg size={size} className={className}>
<mask id={id}>
<rect width="24" height="24" fill="#fff" />
<g fill="none" stroke="#000" strokeWidth={1.6} strokeLinecap="round" strokeLinejoin="round">
{glyph}
</g>
</mask>
<g mask={`url(#${id})`}>{paths(P.Paper)}</g>
</Svg>
);
};
export const FileTextIcon = page(<path d="M8.5 14.5h7M8.5 17.5h5" />);
export const FileCodeIcon = page(<path d="M10.5 13.5l-2 2.25 2 2.25M13.5 13.5l2 2.25-2 2.25" />);
export const FileZipIcon = page(
<>
<path d="M8.5 7h1.5M8.5 9.5h1.5M8.5 12h1.5" />
<rect x="8" y="14.5" width="3.5" height="4" rx="1" />
</>,
);
export const FileMusicIcon = page(
<>
<circle cx="10.5" cy="17.5" r="1.4" />
<path d="M11.9 17.5V13.5l2.6 1" />
</>,
);
export const FileVideoIcon = page(<path d="M10.5 13.5v5l4-2.5z" fill="#000" />);
export const FilePdfIcon = page(
<path d="M8.5 18.5v-4.5h1.3a1.3 1.3 0 0 1 0 2.6H8.5M12.7 14v4.5M12.7 14h.8a1.6 1.6 0 0 1 1.6 1.6v1.3a1.6 1.6 0 0 1-1.6 1.6h-.8" />,
);
export const FileSheetIcon = page(<path d="M8.5 14h7M8.5 17h7M12 13v6" />);
export const FileSlidesIcon = page(<path d="M9 18.5v-2M12 18.5v-4.5M15 18.5v-3" />);
export const FileImageIcon = page(
<>
<circle cx="9.75" cy="14" r="1" fill="#000" />
<path d="M8.5 18.5l2.75-2.5 1.75 1.5 2.5-2.5" />
</>,
);
export const PlayIcon = solid(<path d="M7 5.1v13.8a1.3 1.3 0 0 0 2 1.1l11-6.9a1.3 1.3 0 0 0 0-2.2L9 4a1.3 1.3 0 0 0-2 1.1z" />);
export const ChevronLeftIcon = line(<path d="M15 5.5 8.5 12l6.5 6.5" />);
export const ChevronRightIcon = line(<path d="M9 5.5 15.5 12 9 18.5" />);
export const ChevronDownIcon = line(<path d="M5.5 9 12 15.5 18.5 9" />);
export const LockIcon = pap(P.Lock);
export const KeyIcon = line(
<>
<circle cx="8" cy="15.5" r="3.75" />
<path d="M10.75 12.75 19 4.5M16.5 7l2.5 2.5M14 9.5l2 2" />
</>,
);
export const UsersIcon = solid(
<>
<circle cx="9" cy="7.75" r="3.75" />
<path d="M2.5 19a5.5 5.5 0 0 1 5.5-5.5h2a5.5 5.5 0 0 1 5.5 5.5v.5a1.5 1.5 0 0 1-1.5 1.5H4a1.5 1.5 0 0 1-1.5-1.5z" />
<circle cx="16.5" cy="7.25" r="3" />
<path d="M17 13.5h.5A4.5 4.5 0 0 1 22 18v1a1.5 1.5 0 0 1-1.5 1.5h-3.2c.13-.33.2-.69.2-1.07V19c0-2.1-.9-4-2.3-5.3.6-.13 1.2-.2 1.8-.2z" />
</>,
);
export const ShieldIcon = solid(
<path d="M11.3 2.7a2 2 0 0 1 1.4 0l6.5 2.4c.8.3 1.3 1 1.3 1.9V12c0 4.6-3.3 8.4-8 9.4a2.4 2.4 0 0 1-1 0c-4.7-1-8-4.8-8-9.4V7c0-.9.5-1.6 1.3-1.9z" />,
);
export const CheckIcon = line(<path d="M5 12.5l4.5 4.5L19 7.5" />);
export const PlusIcon = pap(P.Add);
export const HomeIcon = solid(
<path d="M10.6 3.6a2 2 0 0 1 2.8 0l7 6.6c.4.38.6.9.6 1.45V18a3 3 0 0 1-3 3h-3v-5a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v5H6a3 3 0 0 1-3-3v-6.35c0-.55.22-1.07.6-1.45z" />,
);
export const TableIcon = line(
<>
<rect x="3.5" y="4.5" width="17" height="15" rx="3" />
<path d="M3.5 10h17M10 10v9.5" />
</>,
);
const cloud = "M7 19.5a5 5 0 0 1-.6-9.96 6.5 6.5 0 0 1 12.4 1.56A4.25 4.25 0 0 1 17.5 19.5z";
export const CloudIcon = solid(<path d={cloud} />);
/** Nuage avec une flèche vers le haut évidée : logo par défaut. */
export function CloudUpIcon({ size, className }: IconProps) {
const id = useMaskId();
return (
<Svg size={size} className={className}>
<mask id={id}>
<rect width="24" height="24" fill="#fff" />
<path d="M12 17v-5.5M9.25 14 12 11.25 14.75 14" fill="none" stroke="#000" strokeWidth={2.25} strokeLinecap="round" strokeLinejoin="round" />
</mask>
<path d={cloud} mask={`url(#${id})`} />
</Svg>
);
}
export const ExpandIcon = line(<path d="M4.5 9.5v-5h5M19.5 9.5v-5h-5M4.5 14.5v5h5M19.5 14.5v5h-5" />);
export const CopyLinkIcon = CopyIcon;
export function WarningIcon({ size, className }: IconProps) {
const id = useMaskId();
return (
<Svg size={size} className={className}>
<mask id={id}>
<rect width="24" height="24" fill="#fff" />
<path d="M12 9.5v4" stroke="#000" strokeWidth={2.25} strokeLinecap="round" />
<circle cx="12" cy="17" r="1.25" fill="#000" />
</mask>
<path mask={`url(#${id})`} d="M10.27 3.98a2 2 0 0 1 3.46 0l8.02 13.9A2 2 0 0 1 20.02 21H3.98a2 2 0 0 1-1.73-3.12z" />
</Svg>
);
}
/** Serveur : deux boîtiers empilés, voyants évidés. */
export function ServerIcon({ size, className }: IconProps) {
const id = useMaskId();
return (
<Svg size={size} className={className}>
<mask id={id}>
<rect width="24" height="24" fill="#fff" />
<circle cx="7" cy="7.5" r="1.2" fill="#000" />
<circle cx="7" cy="16.5" r="1.2" fill="#000" />
</mask>
<g mask={`url(#${id})`}>
<rect x="2.5" y="3.5" width="19" height="8" rx="2.4" />
<rect x="2.5" y="12.5" width="19" height="8" rx="2.4" />
</g>
</Svg>
);
}
/** Couches empilées : logo (stacks docker compose). */
export const StackIcon = line(<path d="M12 3.2 3.2 8 12 12.8 20.8 8 12 3.2zM3.2 12 12 16.8 20.8 12M3.2 16 12 20.8 20.8 16" />);
/** Flèche vers le haut dans un cercle : mise à jour disponible. */
export const ArrowUpIcon = line(<path d="M12 19V5.5M6 11.5l6-6 6 6" />);
+10
View File
@@ -0,0 +1,10 @@
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "./styles.css";
import App from "./App";
createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>,
);
+156
View File
@@ -0,0 +1,156 @@
// Tracés extraits de Papicons 0.2.3 (@getpapillon/papicons, https://github.com/PapillonApp/papicons),
// icônes de Tom Things pour Papillon. Licence MIT, (c) 2025 Association Papillon : voir THIRD_PARTY_NOTICES.md.
// Grille 24 x 24, formes pleines. Seules les icônes utilisées par Excalicloud sont reprises.
export type PapPath = { d: string; evenodd?: boolean };
export const Add: PapPath[] = [
{ d: "M20.414 10.515c.375.374.586.916.586 1.485s-.21 1.112-.585 1.486a1.8 1.8 0 0 1-1.415.515l-.35-.025-5.035-.36.36 5.035.026.349c.038.53-.14 1.04-.515 1.415-.374.375-.917.585-1.486.585s-1.111-.211-1.485-.586A1.79 1.79 0 0 1 10 19.001l.026-.35.36-5.036-5.037.36L5 14a1.79 1.79 0 0 1-1.413-.515C3.21 13.111 3 12.57 3 12s.21-1.112.585-1.486A1.8 1.8 0 0 1 5 10l.35.024 5.034.36L10 5c-.039-.53.138-1.04.514-1.415C10.888 3.21 11.431 3 12 3s1.111.211 1.485.586c.376.375.553.883.515 1.413l-.026.35-.359 5.036 5.036-.36L19 10a1.79 1.79 0 0 1 1.413.515" },
];
export const Archive: PapPath[] = [
{ d: "M12.935 9.076c3.192-.1 4.79-.15 5.381.368.066.057.089.08.148.144.536.576.536 1.92.536 4.605 0 2.641 0 3.962-.774 4.819a3 3 0 0 1-.214.214c-.857.774-2.178.774-4.819.774h-2.386c-2.641 0-3.962 0-4.819-.774a3 3 0 0 1-.214-.214C5 18.155 5 16.834 5 14.193c0-2.686 0-4.03.536-4.605.06-.064.082-.087.148-.144.592-.517 2.189-.468 5.381-.368a30 30 0 0 0 1.87 0M12 12c-.713 0-1.275.017-1.695.037C9.668 12.068 9 12.363 9 13s.668.932 1.305.963c.42.02.982.037 1.695.037s1.275-.017 1.695-.037C14.332 13.932 15 13.637 15 13s-.668-.932-1.305-.963A35 35 0 0 0 12 12m6.65-8c.745 0 1.35.605 1.35 1.35 0 .663-.48 1.224-1.138 1.297C17.547 6.795 15.151 7 12 7c-3.15 0-5.546-.205-6.862-.353A1.29 1.29 0 0 1 4 5.351C4 4.605 4.605 4 5.35 4z" },
];
export const ArrowDownBox: PapPath[] = [
{ d: "M21 12c0 1.483-.072 2.748-.178 3.805-.274 2.723-2.293 4.743-5.016 5.016a38 38 0 0 1-3.806.18c-1.483 0-2.748-.073-3.805-.18-2.723-.273-4.742-2.293-5.016-5.016A38 38 0 0 1 3 12c0-1.483.073-2.749.179-3.806.274-2.722 2.294-4.741 5.016-5.015A38 38 0 0 1 12 3c1.483 0 2.75.073 3.806.179 2.723.274 4.742 2.293 5.016 5.015C20.928 9.251 21 10.517 21 12m-4.122.828a1 1 0 1 0-1.414-1.414l-2.366 2.367.268-5.228.017-.322a1.23 1.23 0 0 0-.355-.944c-.25-.25-.606-.39-.978-.39s-.728.14-.978.39-.373.59-.355.944l.017.322.26 5.046-2.185-2.185a1 1 0 0 0-1.414 1.414l4.034 4.035c.39.39 1.024.39 1.415 0z", evenodd: true },
];
export const ArrowLeftUp: PapPath[] = [
{ d: "M4.5 15a1.5 1.5 0 0 0 3 0V9.621l9.44 9.44a1.5 1.5 0 1 0 2.12-2.122L9.622 7.5h5.38a1.5 1.5 0 0 0 0-3H6A1.5 1.5 0 0 0 4.5 6z" },
];
export const ArrowRightBox: PapPath[] = [
{ d: "M12 3c1.483 0 2.748.073 3.805.179 2.723.274 4.743 2.293 5.017 5.015C20.928 9.251 21 10.517 21 12s-.072 2.748-.178 3.805c-.274 2.723-2.294 4.743-5.017 5.016a38 38 0 0 1-3.805.18c-1.483 0-2.749-.073-3.805-.18-2.723-.274-4.742-2.293-5.016-5.016A38 38 0 0 1 3 12c0-1.483.073-2.749.179-3.806.274-2.722 2.293-4.741 5.016-5.015A38 38 0 0 1 12 3m.828 4.122a1 1 0 1 0-1.414 1.414l2.367 2.367-5.228-.27-.322-.016a1.23 1.23 0 0 0-.944.356c-.25.25-.39.606-.39.977 0 .372.14.728.39.978s.59.374.944.355l.322-.016 5.046-.261-2.185 2.185a1 1 0 0 0 1.414 1.415l4.035-4.035c.391-.39.391-1.024 0-1.415z", evenodd: true },
];
export const ArrowRightUp: PapPath[] = [
{ d: "M19.5 15a1.5 1.5 0 0 1-3 0V9.621l-9.44 9.44a1.5 1.5 0 1 1-2.12-2.122L14.378 7.5H9a1.5 1.5 0 1 1 0-3h9A1.5 1.5 0 0 1 19.5 6z" },
];
export const ArrowUpBox: PapPath[] = [
{ d: "M21 12c0-1.483-.072-2.748-.178-3.805-.274-2.722-2.293-4.742-5.016-5.016A38 38 0 0 0 12 3c-1.483 0-2.748.073-3.805.179-2.723.274-4.742 2.293-5.016 5.016A38 38 0 0 0 3 12c0 1.483.073 2.75.179 3.806.274 2.723 2.294 4.742 5.016 5.015 1.057.107 2.322.18 3.805.18a38 38 0 0 0 3.806-.18c2.723-.274 4.742-2.292 5.016-5.015.106-1.057.178-2.323.178-3.806m-4.122-.828a1 1 0 0 1-1.414 1.414l-2.366-2.367.268 5.228.017.323c.018.353-.105.693-.355.943s-.606.39-.978.39-.728-.14-.978-.39-.373-.59-.355-.943l.017-.323.26-5.045-2.185 2.184a1 1 0 0 1-1.414-1.414l4.034-4.035c.39-.39 1.024-.39 1.415 0z", evenodd: true },
];
export const Calendar: PapPath[] = [
{ d: "M3 6.125C3 4.399 4.4 3 6.125 3h11.75C19.601 3 21 4.4 21 6.125 21 7.161 20.16 8 19.125 8H4.875A1.875 1.875 0 0 1 3 6.125M18.174 10.005a3 3 0 0 1 2.821 2.821c.003.048.002.101.002.174H17a4 4 0 0 0-4 4v3.99c-.373.009-.804.01-1.313.01h-2.4c-2.133 0-3.2 0-4.022-.396a4 4 0 0 1-1.869-1.869C3 17.913 3 16.846 3 14.714c0-1.6 0-2.399.297-3.016a3 3 0 0 1 1.401-1.401C5.315 10 6.115 10 7.714 10h10.065c.205 0 .308 0 .395.005" },
{ d: "M17 15h3.64c-.181.397-.426.766-.73 1.089-.04.042-.083.084-.168.169l-2.4 2.4c-1.087 1.087-1.665 1.66-2.342 1.978V17a2 2 0 0 1 1.796-1.99z" },
];
export const Camera: PapPath[] = [
{ d: "M12 11a2 2 0 1 1 0 4 2 2 0 0 1 0-4" },
{ d: "M12 4c1.73 0 3.103.853 3.963 2.153l-.102-.01c2.674.213 4.812 2.038 5.048 4.71A24 24 0 0 1 21 13a24 24 0 0 1-.09 2.148c-.237 2.671-2.375 4.496-5.049 4.708A49 49 0 0 1 12 20c-1.51 0-2.793-.058-3.861-.144-2.674-.213-4.812-2.037-5.048-4.709A24 24 0 0 1 3 13c0-.796.035-1.51.09-2.148.237-2.671 2.375-4.496 5.049-4.708q-.052.003-.103.01C8.896 4.851 10.27 4 12 4m0 5a4 4 0 1 0 0 8 4 4 0 0 0 0-8", evenodd: true },
];
export const Clock: PapPath[] = [
{ d: "M12 3a9 9 0 1 1 0 18 9 9 0 0 1 0-18m0 3a1 1 0 0 0-1 1v3.93c0 .334-.167.647-.445.832l-2.11 1.406a1 1 0 0 0 1.11 1.665l2.11-1.407A3 3 0 0 0 13 10.93V7a1 1 0 0 0-1-1", evenodd: true },
];
export const Code: PapPath[] = [
{ d: "M7.898 4.009c.52-.104 1.088.021 1.56.336s.806.79.91 1.31-.03 1.043-.355 1.463l-.221.286-3.553 4.605 3.553 4.604.22.287c.326.42.46.942.355 1.462-.103.52-.437.996-.909 1.31-.472.316-1.04.441-1.56.337a1.8 1.8 0 0 1-1.213-.89l-.18-.314q-1.612-2.826-3.226-5.65l-.178-.314a1.44 1.44 0 0 1-.182-.615v-.436a1.44 1.44 0 0 1 .182-.613l.178-.314 3.226-5.65.18-.313a1.8 1.8 0 0 1 1.213-.891M13.94 4.345c.472-.315 1.04-.44 1.559-.336.52.104.95.429 1.214.89l.18.314 3.225 5.65.179.314c.141.248.2.54.181.83.02.293-.04.585-.181.834l-.179.313-3.225 5.65-.18.314a1.8 1.8 0 0 1-1.214.89c-.52.105-1.087-.02-1.56-.335-.472-.315-.805-.791-.909-1.31-.104-.52.03-1.043.355-1.463l.22-.287 3.553-4.604-3.553-4.605-.22-.286a1.8 1.8 0 0 1-.355-1.463c.104-.52.437-.995.91-1.31" },
];
export const Cross: PapPath[] = [
{ d: "M17.958 3.958c.53 0 1.059.23 1.456.628.397.397.628.926.628 1.456s-.23 1.02-.628 1.372l-.317.282L14.253 12l4.844 4.304.317.282c.397.353.628.841.628 1.372 0 .53-.23 1.059-.628 1.456-.397.397-.926.628-1.456.628s-1.02-.23-1.372-.628l-.282-.317L12 14.253l-4.304 4.844-.282.317a1.82 1.82 0 0 1-1.372.628c-.53 0-1.059-.23-1.456-.628-.398-.397-.628-.926-.628-1.456s.23-1.02.628-1.372l.317-.282L9.746 12 4.903 7.696l-.317-.282a1.82 1.82 0 0 1-.628-1.372c0-.53.23-1.059.628-1.456.397-.398.926-.628 1.456-.628s1.02.23 1.372.628l.282.317L12 9.746l4.304-4.843.282-.317a1.82 1.82 0 0 1 1.372-.628" },
];
export const Dots: PapPath[] = [
{ d: "M10 12a2 2 0 1 1 4 0 2 2 0 0 1-4 0M10 6a2 2 0 1 1 4 0 2 2 0 0 1-4 0M10 18a2 2 0 1 1 4 0 2 2 0 0 1-4 0" },
];
export const Folder: PapPath[] = [
{ d: "M18.295 12c1.462 0 2.194 0 2.618.373.19.166.334.378.42.614.193.531-.073 1.213-.603 2.575-.71 1.822-1.066 2.733-1.725 3.353a4 4 0 0 1-1.018.695c-.816.39-1.795.39-3.75.39H9.831c-1.945 0-2.917 0-3.727-.382a4 4 0 0 1-1.12-.787c-.634-.633-.964-1.548-1.624-3.378-.468-1.3-.702-1.952-.521-2.459a1.5 1.5 0 0 1 .458-.651C3.714 12 4.405 12 5.788 12zM8.7 4c.484 0 .726 0 .947.05a2 2 0 0 1 1.063.638c.148.171.262.385.49.812s.341.64.49.812a2 2 0 0 0 1.063.637c.22.05.463.051.947.051H17a3 3 0 0 1 3 3H4V8.571c0-1.464 0-2.197.25-2.77A3 3 0 0 1 5.8 4.25C6.374 4 7.106 4 8.57 4z" },
];
export const Font: PapPath[] = [
{ d: "M8.303 5.71c1.362-3.297 6.032-3.297 7.394 0l2.29 5.542 2.817 5.885a2 2 0 1 1-3.608 1.726l-.878-1.834H7.682l-.878 1.834a2 2 0 1 1-3.608-1.726l2.816-5.885zm1.39 7.112-.022.051-.024.049-.051.107h4.808l-.052-.107-.023-.049-.021-.05L12 7.236z" },
];
export const Gallery: PapPath[] = [
{ d: "M12 3c1.483 0 2.748.072 3.805.179 2.723.273 4.743 2.293 5.016 5.016C20.927 9.252 21 10.517 21 12s-.073 2.748-.179 3.805c-.274 2.723-2.293 4.743-5.016 5.016A38 38 0 0 1 12 21c-1.483 0-2.748-.073-3.805-.179-2.723-.274-4.743-2.293-5.016-5.016A38 38 0 0 1 3 12c0-1.483.072-2.748.179-3.805.273-2.723 2.293-4.743 5.016-5.016A38 38 0 0 1 12 3M9.842 13.212a2 2 0 0 0-2.683 0l-1.628 1.47a1.1 1.1 0 0 0-.362.923c.179 1.777 1.45 3.047 3.226 3.226.988.1 2.187.169 3.605.169s2.617-.07 3.605-.169c1.217-.122 2.195-.758 2.747-1.717.357-.617.082-1.366-.447-1.844l-.063-.058a2 2 0 0 0-2.683 0l-.212.191a2 2 0 0 1-2.681 0zM15 7a2 2 0 1 0 0 4 2 2 0 0 0 0-4" },
];
export const Gears: PapPath[] = [
{ d: "M12 3c.593 0 1.309.202 1.892.412.66.238.99.948.822 1.63l-.183.746c-.098.4.114.809.47 1.016.357.207.814.184 1.112-.102l.555-.531c.508-.486 1.287-.557 1.824-.104.473.4 1.006.92 1.302 1.433.297.514.48 1.235.59 1.845.124.69-.328 1.33-1.002 1.527l-.739.215c-.396.115-.643.5-.643.913 0 .412.246.797.642.913l.741.216c.674.197 1.125.835 1 1.526-.11.61-.292 1.331-.589 1.845-.296.514-.829 1.032-1.302 1.433-.537.453-1.316.383-1.824-.103l-.555-.532c-.298-.286-.754-.31-1.112-.103-.356.207-.569.616-.47 1.016l.183.747c.167.682-.161 1.393-.822 1.63-.583.21-1.3.412-1.892.412-.594 0-1.309-.201-1.892-.411-.66-.238-.99-.949-.822-1.631l.182-.748c.098-.4-.114-.809-.47-1.015-.358-.206-.814-.183-1.112.103l-.554.532c-.508.486-1.288.556-1.824.103-.473-.4-1.006-.92-1.302-1.433-.297-.514-.48-1.235-.59-1.845-.125-.69.327-1.33 1-1.526l.74-.216c.396-.115.644-.5.644-.913 0-.412-.248-.798-.644-.913l-.74-.215c-.673-.196-1.124-.836-1-1.527.11-.61.293-1.331.59-1.845.296-.514.829-1.032 1.302-1.433.537-.453 1.316-.382 1.824.104l.554.531c.298.285.754.309 1.112.102.356-.207.568-.615.47-1.016l-.182-.746c-.167-.682.161-1.392.822-1.63.583-.21 1.298-.412 1.891-.412m0 6a3 3 0 1 0 0 6 3 3 0 0 0 0-6", evenodd: true },
];
export const Globe: PapPath[] = [
{ d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2M4.74 9a.24.24 0 0 0-.22.16A8 8 0 0 0 12 20c.509 0 1-.328 1-.837a1.837 1.837 0 0 0-1.837-1.836H8.826a1.044 1.044 0 0 1 0-2.087h.043c.6 0 1.087-.486 1.087-1.087v-.51c0-.881-.714-1.596-1.596-1.596h-.358a1.523 1.523 0 0 1-1.523-1.524C6.479 9.683 5.796 9 4.955 9zm7.778-1.774a1.703 1.703 0 0 0 1.185 2.925h1.873A2.425 2.425 0 0 1 18 12.576v.924c0 .294.084.567.23.798.457.723 1.428.168 1.602-.669q.166-.79.168-1.629a7.99 7.99 0 0 0-3.654-6.717c-.679-.44-1.556-.262-2.136.3z", evenodd: true },
];
export const Grid: PapPath[] = [
{ d: "M7 13c.552 0 1.036.023 1.454.058 1.364.114 2.374 1.124 2.488 2.488.035.418.058.902.058 1.454s-.023 1.036-.058 1.454c-.114 1.363-1.124 2.374-2.488 2.488C8.036 20.977 7.552 21 7 21s-1.036-.023-1.454-.058c-1.364-.114-2.374-1.125-2.488-2.488A17 17 0 0 1 3 17c0-.552.023-1.036.058-1.454.114-1.364 1.124-2.374 2.488-2.488C5.964 13.023 6.448 13 7 13M17 13c.552 0 1.036.023 1.454.058 1.363.114 2.374 1.124 2.488 2.488.035.418.058.902.058 1.454s-.023 1.036-.058 1.454c-.114 1.363-1.125 2.374-2.488 2.488-.418.035-.902.058-1.454.058s-1.036-.023-1.454-.058c-1.364-.114-2.374-1.125-2.488-2.488A18 18 0 0 1 13 17c0-.552.023-1.036.058-1.454.114-1.364 1.124-2.374 2.488-2.488.418-.035.902-.058 1.454-.058M7 3c.552 0 1.036.023 1.454.058 1.364.114 2.374 1.124 2.488 2.488.035.418.058.902.058 1.454s-.023 1.036-.058 1.454c-.114 1.364-1.124 2.374-2.488 2.488C8.036 10.977 7.552 11 7 11s-1.036-.023-1.454-.058c-1.364-.114-2.374-1.124-2.488-2.488A17 17 0 0 1 3 7c0-.552.023-1.036.058-1.454.114-1.364 1.124-2.374 2.488-2.488C5.964 3.023 6.448 3 7 3M17 3c.552 0 1.036.023 1.454.058 1.363.114 2.374 1.124 2.488 2.488.035.418.058.902.058 1.454s-.023 1.036-.058 1.454c-.114 1.364-1.125 2.374-2.488 2.488-.418.035-.902.058-1.454.058s-1.036-.023-1.454-.058c-1.364-.114-2.374-1.124-2.488-2.488A18 18 0 0 1 13 7c0-.552.023-1.036.058-1.454.114-1.364 1.124-2.374 2.488-2.488C15.964 3.023 16.448 3 17 3" },
];
export const Info: PapPath[] = [
{ d: "M12 3c1.483 0 2.748.073 3.805.179 2.723.274 4.743 2.293 5.017 5.015C20.928 9.251 21 10.517 21 12s-.072 2.748-.178 3.805c-.274 2.723-2.294 4.743-5.017 5.016a38 38 0 0 1-3.805.18c-1.483 0-2.749-.073-3.805-.18-2.723-.274-4.742-2.293-5.016-5.016A38 38 0 0 1 3 12c0-1.483.073-2.749.179-3.806.274-2.722 2.293-4.741 5.016-5.015A38 38 0 0 1 12 3m0 8a1 1 0 0 0-1 1v5a1 1 0 1 0 2 0v-5a1 1 0 0 0-1-1m0-4a1 1 0 1 0 0 2 1 1 0 0 0 0-2", evenodd: true },
];
export const Link: PapPath[] = [
{ d: "M9.415 10.429a1.5 1.5 0 0 1 2.12 2.12 10 10 0 0 0-.223.231c-.56.6-.606 1.602.24 2.546q.528.593 1.276 1.344.476.475.888.86c1.203 1.123 2.568 1.096 3.232.432.606-.606.867-1.051.975-1.33.1-.258.075-.384.067-.42a.3.3 0 0 0-.092-.155l-.007-.008.012.01.017.011.012.01q.003.001.006.004l.005.002a1.5 1.5 0 0 1 1.653-2.503l-.58.882c.553-.84.58-.88.582-.881l.002.002.005.003.01.006q.008.007.02.014l.05.037q.057.041.134.105a3.32 3.32 0 0 1 1.09 1.775c.327 1.389-.222 2.94-1.839 4.557-2.274 2.274-5.565 1.352-7.4-.36a39 39 0 0 1-2.354-2.396c-1.571-1.755-2.108-4.55-.194-6.597q.139-.149.293-.301" },
{ d: "M5.981 4.112c2.274-2.274 5.566-1.35 7.4.362a39 39 0 0 1 2.353 2.395c1.572 1.755 2.11 4.55.196 6.596q-.14.15-.293.303a1.5 1.5 0 0 1-2.122-2.122q.119-.117.224-.23c.561-.6.606-1.602-.24-2.546a35.758 35.758 0 0 0-2.165-2.203c-1.203-1.123-2.566-1.097-3.23-.433-.606.606-.867 1.051-.975 1.33-.1.257-.076.383-.068.42a.3.3 0 0 0 .092.156l.007.008q0-.001-.012-.01l-.016-.013-.013-.008-.006-.005-.005-.002a1.5 1.5 0 0 1-1.653 2.502l.58-.881c-.552.837-.58.88-.582.881l-.002-.002-.005-.002-.009-.007-.02-.014-.051-.036a3.263 3.263 0 0 1-.496-.462A3.3 3.3 0 0 1 4.14 8.67c-.325-1.389.223-2.94 1.84-4.558" },
];
export const List: PapPath[] = [
{ d: "M12 3c1.483 0 2.748.073 3.805.179 2.723.273 4.742 2.293 5.016 5.015C20.927 9.251 21 10.517 21 12s-.073 2.748-.179 3.805c-.274 2.723-2.293 4.743-5.016 5.016A38 38 0 0 1 12 21c-1.483 0-2.749-.073-3.806-.179-2.722-.274-4.742-2.293-5.015-5.016A38 38 0 0 1 3 12c0-1.483.072-2.749.179-3.806.274-2.722 2.293-4.741 5.015-5.015A38 38 0 0 1 12 3m-.5 12c-1.31 0-2.281.025-2.937.052C7.86 15.08 7 15.298 7 16s.86.92 1.563.948c.656.027 1.626.052 2.937.052s2.281-.025 2.938-.052C15.139 16.92 16 16.702 16 16s-.86-.92-1.562-.948A74 74 0 0 0 11.5 15m-1-4c-.91 0-1.609.02-2.111.043-.657.03-1.389.3-1.389.957 0 .658.732.927 1.389.957C8.89 12.98 9.59 13 10.5 13s1.609-.02 2.111-.043c.657-.03 1.389-.3 1.389-.957 0-.658-.732-.927-1.389-.957A46 46 0 0 0 10.5 11M12 7a90 90 0 0 0-3.347.055C7.927 7.082 7 7.274 7 8s.927.918 1.653.945C9.383 8.973 10.487 9 12 9s2.617-.027 3.347-.055C16.073 8.918 17 8.726 17 8s-.927-.918-1.653-.945A90 90 0 0 0 12 7" },
];
export const Lock: PapPath[] = [
{ d: "M12.324 3.866c3.316.171 5.504 2.964 5.636 6.349q.029.78.035 1.68c.656.043 1.117.14 1.505.364a3 3 0 0 1 1.098 1.098c.402.696.402 1.63.402 3.5s0 2.804-.402 3.5a3 3 0 0 1-1.098 1.098c-.696.402-1.63.402-3.5.402H8c-1.87 0-2.804 0-3.5-.402a3 3 0 0 1-1.098-1.098C3 19.661 3 18.727 3 16.857s0-2.804.402-3.5A3 3 0 0 1 4.5 12.26c.387-.223.849-.32 1.504-.365q.002-.336.007-.655l.029-1.024C6.176 6.72 8.503 3.857 12 3.857zM12 6.857c-1.497 0-2.872 1.172-2.962 3.474q-.026.707-.033 1.526h5.99a51 51 0 0 0-.033-1.526c-.09-2.302-1.465-3.474-2.962-3.474", evenodd: true },
];
export const Logout: PapPath[] = [
{ d: "M7.5 3c1.272 0 2.281.143 3.045.321 1.234.288 2.004 1.367 2.15 2.626q.069.582.131 1.346c.065.811-.634 1.47-1.443 1.38L11 8.634c-.884-.098-1.732.167-2.357.794-.626.623-.976 1.557-.976 2.539s.35 1.916.976 2.539c.625.626 1.473.891 2.357.794l.382-.041c.81-.089 1.512.568 1.448 1.382a38 38 0 0 1-.136 1.413c-.146 1.259-.916 2.338-2.15 2.626C9.78 20.857 8.772 21 7.5 21s-2.282-.143-3.045-.321c-1.234-.288-2.004-1.367-2.15-2.626C2.152 16.74 2 14.743 2 12s.152-4.74.305-6.053c.146-1.259.916-2.338 2.15-2.626C5.218 3.143 6.228 3 7.5 3m8.396 4.384a1 1 0 0 1 1.414 0l3.773 3.773a1 1 0 0 1 0 1.414l-3.773 3.773a1 1 0 0 1-1.414-1.414L17.824 13l-6.442.281L11 13.3a1.25 1.25 0 0 1-.943-.361c-.25-.25-.39-.603-.39-.972 0-.37.14-.722.39-.972s.59-.377.943-.361l.382.016 6.655.29-2.141-2.141a1 1 0 0 1 0-1.414" },
];
export const Menu: PapPath[] = [
{ d: "M12 17c2.472 0 3.263.043 4.429.085 1.114.04 2.571.3 2.571 1.415s-1.457 1.375-2.571 1.415C15.263 19.957 14.472 20 12 20s-3.263-.043-4.429-.085C6.457 19.875 5 19.615 5 18.5s1.457-1.375 2.571-1.415C8.737 17.043 9.528 17 12 17M12 11c2.472 0 2.263.043 3.429.085 1.114.04 2.571.3 2.571 1.415s-1.457 1.375-2.571 1.415c-1.166.042-.957.085-3.429.085s-2.263-.043-3.429-.085C7.457 13.875 6 13.615 6 12.5s1.457-1.375 2.571-1.415C9.737 11.043 9.528 11 12 11M12 5c2.472 0 4.263.043 5.429.085 1.114.04 2.571.3 2.571 1.415s-1.457 1.375-2.571 1.415A152 152 0 0 1 12 8c-2.472 0-4.263-.043-5.429-.085C5.457 7.875 4 7.615 4 6.5s1.457-1.375 2.571-1.415C7.737 5.043 9.528 5 12 5" },
];
export const Moon: PapPath[] = [
{ d: "M11 3.857c.79 0 1 1.185.464 1.764a5.5 5.5 0 0 0 7.77 7.772c.58-.536 1.766-.325 1.766.464.003 4.97-4.03 8-9 8a9 9 0 0 1-9-9c0-4.97 3.03-9 8-9" },
];
export const Paper: PapPath[] = [
{ d: "M12 7.828a4 4 0 0 0 4 4c.932 0 1.398 0 1.765.152a2 2 0 0 1 1.083 1.082c.152.368.152.834.152 1.766V15c0 2.828 0 4.243-.879 5.122S15.828 21 13 21h-2c-2.828 0-4.242 0-5.121-.878C5 19.242 5 17.828 5 14.999v-4c0-2.808 0-4.212.674-5.221a4 4 0 0 1 1.103-1.104c.39-.26.837-.42 1.402-.518 1.538-.267 2.307-.401 2.99.09.073.053.165.13.23.193C12 5.028 12 5.961 12 7.828" },
{ d: "M14 6.365c0-1.004 0-1.506.304-1.636s.666.219 1.39.915l2.792 2.688c.316.304.501.701.507 1.14.003.186-.147.356-.334.356H16l-.204-.011A2 2 0 0 1 14 7.827z" },
];
export const PenAlt: PapPath[] = [
{ d: "M19.145 14.688a.4.4 0 0 1 .157.054c.229.125.343 1.145.573 3.184l.029.26c.122 1.088.184 1.633-.128 1.966q-.027.029-.057.055c-.337.308-.887.247-1.988.127l-.263-.029c-2.065-.226-3.097-.34-3.223-.566a.4.4 0 0 1-.055-.154c-.044-.254.746-1.036 2.327-2.598s2.371-2.343 2.628-2.299M12.326 8.006a1.19 1.19 0 0 1 1.676-.012c1.7 1.68 2.692 2.933 3.205 3.65.307.43.366.974.111 1.437-.332.602-.958 1.53-2.082 2.64s-2.062 1.729-2.672 2.057c-.468.252-1.018.194-1.454-.11-.725-.507-1.994-1.487-3.694-3.166a1.163 1.163 0 0 1 .012-1.656zM8.494 4.923c.681-.413 1.51-.325 2.151.147.552.406.585 1.207.098 1.688l-4.58 4.526c-.49.484-1.292.451-1.706-.099-.478-.634-.567-1.452-.149-2.126.365-.586.951-1.374 1.873-2.285s1.72-1.49 2.313-1.85" },
];
export const Pie: PapPath[] = [
{ d: "M11 12a1 1 0 0 0 1 1h4.477c2.117 0 3.175 0 3.736 1.074s.1 1.738-.824 3.065A9 9 0 1 1 6.862 4.612c1.326-.924 1.99-1.386 3.064-.825S11 5.407 11 7.523z" },
{ d: "M13 7.247c0-1.777 0-2.665.823-3.264.112-.082.336-.203.466-.252.95-.362 1.507 0 2.62.726a9.05 9.05 0 0 1 2.634 2.634c.726 1.113 1.088 1.67.726 2.62-.049.13-.17.354-.252.466-.599.823-1.487.823-3.264.823-1.647 0-2.47 0-3.024-.455a2 2 0 0 1-.274-.274C13 9.717 13 8.894 13 7.247" },
];
export const Placeholder: PapPath[] = [
{ d: "M4 17.357a1.5 1.5 0 0 1 1.5 1.5v.5H6a1.5 1.5 0 0 1 0 3H5a2.5 2.5 0 0 1-2.5-2.5v-1a1.5 1.5 0 0 1 1.5-1.5M13 19.357a1.5 1.5 0 0 1 0 3h-2a1.5 1.5 0 0 1 0-3zM20 17.357a1.5 1.5 0 0 1 1.5 1.5v1a2.5 2.5 0 0 1-2.5 2.5h-1a1.5 1.5 0 0 1 0-3h.5v-.5a1.5 1.5 0 0 1 1.5-1.5M4 10.357a1.5 1.5 0 0 1 1.5 1.5v2a1.5 1.5 0 0 1-3 0v-2a1.5 1.5 0 0 1 1.5-1.5M20 10.357a1.5 1.5 0 0 1 1.5 1.5v2a1.5 1.5 0 0 1-3 0v-2a1.5 1.5 0 0 1 1.5-1.5M6 3.357a1.5 1.5 0 1 1 0 3h-.5v.5a1.5 1.5 0 0 1-3 0v-1a2.5 2.5 0 0 1 2.5-2.5zM19 3.357a2.5 2.5 0 0 1 2.5 2.5v1a1.5 1.5 0 0 1-3 0v-.5H18a1.5 1.5 0 0 1 0-3zM13 3.357a1.5 1.5 0 0 1 0 3h-2a1.5 1.5 0 0 1 0-3z" },
];
export const Search: PapPath[] = [
{ d: "M10 3a7 7 0 0 1 5.573 11.232l4.078 3.548c1.28 1.114.492 3.22-1.205 3.22a1.84 1.84 0 0 1-1.43-.685l-3.453-4.29A7 7 0 1 1 10 3m0 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8", evenodd: true },
];
export const Sparkles: PapPath[] = [
{ d: "M12.647 16.859c-1.087 2.185-1.63 3.278-2.412 3.543a2 2 0 0 1-1.284 0c-.782-.265-1.325-1.358-2.412-3.543-1.156-.202-1.735-.302-1.876-.35-1.888-.626-1.801-3.326.123-3.831.144-.038.68-.097 1.753-.213 1.064-2.252 1.596-3.378 2.365-3.66a2 2 0 0 1 1.378 0c.77.282 1.301 1.408 2.365 3.66 1.176.114 1.765.172 1.91.208 1.958.49 2.038 3.246.11 3.849-.142.044-.768.142-2.02.337M14.294 9.114l-.25-.14c-.944-.531-1.416-.796-1.549-1.114a1 1 0 0 1 .081-.925c.186-.29.697-.47 1.718-.827.768-1.43 1.152-2.146 1.682-2.343a1.5 1.5 0 0 1 1.047 0c.53.197.915.912 1.683 2.343 1.021.358 1.532.537 1.718.827a1 1 0 0 1 .08.925c-.132.318-.604.583-1.547 1.113l-.251.141c-.79 1.39-1.184 2.085-1.726 2.269a1.5 1.5 0 0 1-.96 0c-.542-.183-.937-.879-1.726-2.269" },
];
export const Star: PapPath[] = [
{ d: "m7.82 8.84-1.563 5.203L12 17.68l5.744-3.637L16.18 8.84z" },
{ d: "M12 17.68c2.723 2.55 4.084 3.826 5.08 3.639a2 2 0 0 0 1.091-.6c.693-.74.347-2.573-.345-6.239l-.082-.437z" },
{ d: "m16.18 8.84 1.564 5.203c2.305-1.066 3.459-1.599 3.76-2a2 2 0 0 0-.651-2.965c-.443-.238-1.713-.238-4.254-.238zM7.82 8.84h8.36l-.564-1.192C14.05 4.335 13.266 2.68 12 2.68s-2.05 1.656-3.616 4.97zM6.174 14.48c-.692 3.666-1.038 5.499-.345 6.24a2 2 0 0 0 1.09.599c.997.187 2.359-1.088 5.081-3.639l-5.743-3.637zM6.257 14.043 7.82 8.84h-.419c-2.54 0-3.81 0-4.254.238a2 2 0 0 0-.652 2.965c.302.401 1.455.934 3.762 2" },
];
export const Tasks: PapPath[] = [
{ d: "M12 3c1.483 0 2.748.073 3.805.179 2.723.274 4.743 2.293 5.017 5.015C20.928 9.251 21 10.517 21 12s-.072 2.748-.178 3.805c-.274 2.723-2.294 4.743-5.017 5.016a38 38 0 0 1-3.805.18c-1.483 0-2.749-.073-3.805-.18-2.723-.274-4.742-2.293-5.016-5.016A38 38 0 0 1 3 12c0-1.483.073-2.749.179-3.806.274-2.722 2.293-4.741 5.016-5.015A38 38 0 0 1 12 3m5.63 4.223a1 1 0 0 0-1.407.148l-5.773 7.136-2.213-2.214-.077-.068a1 1 0 0 0-1.338 1.482l2.214 2.214a2 2 0 0 0 2.97-.156l5.772-7.136a1 1 0 0 0-.149-1.406", evenodd: true },
];
export const Trash: PapPath[] = [
{ d: "M14.876 10.29c2.406-.085 3.608-.127 4.233.586.626.713.433 1.87.047 4.187l-.321 1.923c-.4 2.395-.598 3.592-1.437 4.303S15.344 22 12.917 22h-1.835c-2.427 0-3.641 0-4.48-.71-.84-.712-1.039-1.91-1.438-4.304l-.32-1.924c-.386-2.315-.58-3.473.046-4.186.625-.713 1.828-.67 4.234-.587.934.033 1.917.054 2.876.054s1.942-.021 2.876-.054M8.5 12a1 1 0 0 0-1 1v6a1 1 0 0 0 2 0v-6a1 1 0 0 0-1-1m3.5 0a1 1 0 0 0-1 1v6a1 1 0 1 0 2 0v-6a1 1 0 0 0-1-1m3.5 0a1 1 0 0 0-1 1v6a1 1 0 1 0 2 0v-6a1 1 0 0 0-1-1M12 2c1.275 0 2.271.276 2.97.854.722.597.978 1.388 1.022 2.083.024.376-.013.74-.073 1.063h2.73C19.395 6 20 6.605 20 7.35c0 .663-.48 1.224-1.138 1.297C17.547 8.795 15.151 9 12 9c-3.15 0-5.546-.205-6.862-.353A1.29 1.29 0 0 1 4 7.351C4 6.605 4.605 6 5.35 6h2.731a4.3 4.3 0 0 1-.073-1.063c.044-.695.3-1.486 1.021-2.083C9.73 2.276 10.725 2 12 2m0 2c-1.018 0-1.488.224-1.696.396-.186.153-.28.362-.3.667-.02.302.043.638.133.937h3.726c.09-.3.152-.635.133-.937-.02-.305-.114-.514-.3-.667C13.488 4.224 13.018 4 12 4" },
];
export const User: PapPath[] = [
{ d: "M17 8A5 5 0 1 1 7 8a5 5 0 0 1 10 0M4.345 18.582c.052-.358.077-.537.094-.628.41-2.155 2.06-3.414 4.247-3.24.091.008.35.04.868.105.85.107 1.705.181 2.446.181s1.595-.073 2.446-.18c.518-.066.777-.098.868-.106 2.187-.174 3.837 1.085 4.247 3.24.017.09.042.27.094.628.017.124.026.185.03.236a2 2 0 0 1-1.89 2.18c-.05.002-.113.002-.238.002H6.444c-.125 0-.188 0-.238-.003a2 2 0 0 1-1.89-2.18c.004-.05.013-.111.03-.235" },
];
File diff suppressed because it is too large. Load diff
+1
View File
@@ -0,0 +1 @@
/// <reference types="vite/client" />