Support tab (agents:support on a range with a question, instructions/support.md, its answer in labeling/auto/support/); the weather read from data/<STATION>/weather/ (pumped), no call to MeteoSwiss from the app; plots in mm (corr_x_mm, corr_y_mm); analyst instructions: the weather pumped, the targets in mm and their distance
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
60d10a282c
commit
161fb0212f
12 files changed
+414
-104
No files matched your search
+17
-12
@@ -50,7 +50,8 @@ function Header({ mobile, desktop, toggle }) {
|
||||
|
||||
// The analyses of the Data page (labeling/auto/analyses/), read again every 3 s: one folder per station, open by default if
|
||||
// it has one running, and inside one analysis per range (a green tick: its labels validated); a click opens Data on its
|
||||
// station and its days, and shows its report there
|
||||
// station and its days, and shows its report there. kind "support": the requests of the Support tab (labeling/auto/support/),
|
||||
// the same without labels to validate
|
||||
// The range of an analysis on two lines, too wide for the sidebar on one: the days "04.11 – 07.11" ("01.11" within the day),
|
||||
// under them the hours "21:12 – 14:12" (UTC)
|
||||
const dayMonth = t => `${t.slice(8, 10)}.${t.slice(5, 7)}`, hour = t => t.slice(11, 16);
|
||||
@@ -60,10 +61,10 @@ const STATE_COLOR = { done: "teal", error: "red", interrupted: "gray" };
|
||||
// The state: a spinning wheel while running, otherwise a coloured dot (its name in the tooltip)
|
||||
const Dot = ({ state }) => (state === "running" ? <Loader size={10} color="orange" />
|
||||
: <Tooltip label={state}><ColorSwatch size={8} color={`var(--mantine-color-${STATE_COLOR[state] || "gray"}-6)`} withShadow={false} /></Tooltip>);
|
||||
function Analyses({ open }) {
|
||||
const [list, setList] = useState([]);
|
||||
function Analyses({ kind = "analyses", open }) {
|
||||
const [list, setList] = useState([]), labels = kind === "analyses";
|
||||
useEffect(() => {
|
||||
const read = () => fetch("/api/analyses").then(r => r.ok && r.json()).then(l => l && setList(l)).catch(() => {}); // silently: every 3 s
|
||||
const read = () => fetch(`/api/${kind}`).then(r => r.ok && r.json()).then(l => l && setList(l)).catch(() => {}); // silently: every 3 s
|
||||
read();
|
||||
const timer = setInterval(read, 3000);
|
||||
return () => clearInterval(timer);
|
||||
@@ -71,19 +72,19 @@ function Analyses({ open }) {
|
||||
if (!list.length) return null;
|
||||
const stations = [...new Set(list.map(a => a.station))].sort();
|
||||
return <>
|
||||
<Text size="xs" fw={700} tt="uppercase" c="dimmed" px="sm" pt="lg" pb="xs">Analyses (UTC)</Text>
|
||||
<Text size="xs" fw={700} tt="uppercase" c="dimmed" px="sm" pt="lg" pb="xs">{labels ? "Analyses" : "Support"} (UTC)</Text>
|
||||
{stations.map(st => {
|
||||
const its = list.filter(a => a.station === st), busy = its.some(a => a.state === "running");
|
||||
const validated = its.filter(a => a.validated).length;
|
||||
// the chevron of the folder stays Mantine's: a rightSection would take its place, and rotate with it
|
||||
return (
|
||||
<NavLink key={st} defaultOpened={busy} childrenOffset={22} leftSection={<IconFolder size={16} />}
|
||||
label={<Group gap={6} wrap="nowrap">{st}<Tooltip label={`${validated} of ${its.length} validated`}><Text span size="xs" c="dimmed">{validated}/{its.length}</Text></Tooltip>{busy && <Loader size={10} color="orange" />}</Group>}>
|
||||
label={<Group gap={6} wrap="nowrap">{st}{labels && <Tooltip label={`${validated} of ${its.length} validated`}><Text span size="xs" c="dimmed">{validated}/{its.length}</Text></Tooltip>}{busy && <Loader size={10} color="orange" />}</Group>}>
|
||||
{its.map(a => (
|
||||
<NavLink key={a.name} py={4} onClick={() => open(a)} leftSection={<Dot state={a.state} />}
|
||||
rightSection={a.validated ? <Tooltip label={`labels validated ${a.validated}`}>
|
||||
rightSection={labels && (a.validated ? <Tooltip label={`labels validated ${a.validated}`}>
|
||||
<IconCircleCheck size={14} color="var(--mantine-color-green-6)" /></Tooltip>
|
||||
: a.state === "done" && <Tooltip label="labels to validate"><IconCircleDashed size={14} color="var(--mantine-color-dimmed)" /></Tooltip>}
|
||||
: a.state === "done" && <Tooltip label="labels to validate"><IconCircleDashed size={14} color="var(--mantine-color-dimmed)" /></Tooltip>)}
|
||||
label={<Text size="xs" ff="monospace" style={{ whiteSpace: "nowrap" }}>{days(a)}</Text>}
|
||||
description={<Text span size="xs" ff="monospace" c="dimmed" style={{ whiteSpace: "nowrap" }}>{hours(a)}</Text>} />
|
||||
))}
|
||||
@@ -104,6 +105,7 @@ function Sidebar({ page, selection, close, open }) {
|
||||
href={address(n, selection)} />
|
||||
))}
|
||||
<Analyses open={a => { close(); open(a); }} />
|
||||
<Analyses kind="support" open={a => { close(); open(a, "support"); }} />
|
||||
</ScrollArea>
|
||||
</AppShell.Navbar>
|
||||
);
|
||||
@@ -114,6 +116,7 @@ export default function App() {
|
||||
const [mobile, { toggle: toggleMobile, close: closeMobile }] = useDisclosure(false);
|
||||
const [desktop, { toggle: toggleDesktop }] = useDisclosure(true);
|
||||
const [analysis, setAnalysis] = useState(null); // the analysis whose report Data shows
|
||||
const [support, setSupport] = useState(null); // the support request whose answer Data shows
|
||||
|
||||
useEffect(() => {
|
||||
const follow = () => setPlace(readAddress());
|
||||
@@ -123,11 +126,12 @@ export default function App() {
|
||||
|
||||
// the same address again (Load): read again, a new selection loads the data again
|
||||
const choose = s => { const a = address(page, s); if (location.hash === a) setPlace(readAddress()); else location.hash = a; };
|
||||
// An analysis of the sidebar: Data on its station, days that cover its range (unless the range shown already covers them)
|
||||
function openAnalysis(a) {
|
||||
// An analysis (or a support request) of the sidebar: Data on its station, days that cover its range (unless the range
|
||||
// shown already covers them)
|
||||
function openAnalysis(a, kind) {
|
||||
const s = selection, covers = s.station === a.station && s.start <= a.start.slice(0, 10) && a.end < s.end;
|
||||
const end = new Date(Date.parse(a.end.slice(0, 10)) + 864e5).toISOString().slice(0, 10);
|
||||
setAnalysis(a.name);
|
||||
(kind === "support" ? setSupport : setAnalysis)(a.name);
|
||||
location.hash = address("data", covers ? s : { station: a.station, start: a.start.slice(0, 10), end });
|
||||
}
|
||||
return (
|
||||
@@ -138,7 +142,8 @@ export default function App() {
|
||||
<AppShell.Main bg="var(--mantine-color-default-hover)">
|
||||
<Suspense fallback={<Loader m="xl" />}>
|
||||
{page === "stations" ? <Stations selection={selection} />
|
||||
: <Data selection={selection} choose={choose} analysis={analysis} setAnalysis={setAnalysis} />}
|
||||
: <Data selection={selection} choose={choose} analysis={analysis} setAnalysis={setAnalysis}
|
||||
support={support} setSupport={setSupport} />}
|
||||
</Suspense>
|
||||
</AppShell.Main>
|
||||
</AppShell>
|
||||
|
||||
Reference in new issue
Block a user