app/: the web app in its own folder, with the Images and Labeling pages (D-138)

- app/serveur/ (FastAPI) and app/web/ (React, Mantine) moved out of API/, which keeps
  only the agents; the Support page drives them
- Images page: view.py in React (slider, zoom, sensor names, displacement arrows on a range)
- Labeling page: labeling.py in React (two aligned plots, label bar, add, edit, delete);
  labels are written to labeling/{auto,manual}/ of the repo (AIMSIGHT_LABELS)
- shared station and date selector kept in the address; buttons from a support session
- app/serveur/station.py: the data of both pages, copied computations listed in app/README.md
- app/serveur/check.py: server and station checks (labels in a temporary folder)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-05 14:25:57 +01:00
1 parent 374d91eb15
commit bd93e708d2
26 files changed
+1263 -206

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
import { useEffect, useState } from "react";
import { Button, Card, Group, Select, Text, TextInput } from "@mantine/core";
import { notifications } from "@mantine/notifications";
// Une requête à l'API ; un refus du serveur s'affiche en notification -> le JSON rendu, ou null
export async function appel(chemin, methode = "GET", corps) {
try {
const r = await fetch(chemin, corps === undefined ? { method: methode }
: { method: methode, headers: { "Content-Type": "application/json" }, body: JSON.stringify(corps) });
const json = await r.json().catch(() => ({ erreur: r.statusText }));
if (r.ok) return json;
notifications.show({ color: "red", title: "Refusé", message: json.erreur || r.statusText });
} catch (e) {
notifications.show({ color: "red", title: "Serveur injoignable", message: e.message });
}
return null;
}
export const poster = async (chemin, corps) => (await appel(chemin, "POST", corps)) !== null;
export function Carte({ surtitre, titre, action, children, ...reste }) {
return (
<Card shadow="sm" padding={0} withBorder {...reste}>
<Group px="lg" py="md" justify="space-between" wrap="nowrap" style={{ borderBottom: "1px solid var(--mantine-color-default-border)" }}>
<div>
<Text size="xs" fw={700} tt="uppercase" c="dimmed">{surtitre}</Text>
<Text fw={500}>{titre}</Text>
</div>
{action}
</Group>
{children}
</Card>
);
}
// La station et la plage (UTC, Au exclue ; vides : toute la période), partagées par Images et Étiquetage via l'adresse
export function Selecteur({ selection, choisir }) {
const [stations, setStations] = useState([]), [s, setS] = useState(selection);
useEffect(() => { appel("/api/stations").then(l => l && setStations(l)); }, []);
useEffect(() => setS(selection), [selection.station, selection.du, selection.au]);
return (
<Card shadow="sm" withBorder>
<Group align="flex-end" gap="md">
<Select label="Station" placeholder="Choisir" data={stations} value={s.station || null} searchable w={200}
onChange={v => setS({ ...s, station: v || "" })} />
<TextInput label="Du (UTC)" type="date" value={s.du} onChange={e => setS({ ...s, du: e.currentTarget.value })} />
<TextInput label="Au (exclu)" type="date" value={s.au} onChange={e => setS({ ...s, au: e.currentTarget.value })} />
<Button onClick={() => choisir(s)} disabled={!s.station}>Charger</Button>
</Group>
</Card>
);
}