Files
mission-control-v2/frontend/dist/assets/ChronikView-Cl1i2WVT.js
T
HitonabiandClaude Opus 5 3249c8e942 build(react): P6 — Sprung auf React 19, und das Budget bewusst angehoben
React 18.3.1 -> 19.2.8, dazu @types/react(-dom) 19.

## Nichts brach

  tsc --noEmit sauber, 54/54 Tests gruen, ESLint 0 Fehler
  Im Browser gegen die ECHTE Box: Cockpit mit 2 Diagrammen und 4 Flaechen,
    Statusleiste live (40,8/122,7 GB, 38 °C, 532 748 115 Token), 8 Karten
  NULL Konsolen-Warnungen — keine veralteten Muster im Bestand

Das eigentliche Risiko war `react-force-graph-2d` (peer: react "*", also ungeprueft,
und es umhuellt eine Nicht-React-Bibliothek). Gegen den echten Vault der Box getestet:
Canvas 500x560, 4498 gezeichnete Pixel, keine Fehlerflaeche. Es laeuft.

## Das Budget hat angeschlagen — und ich habe es trotzdem angehoben

Gemessen kostet der Sprung 14 645 B gzip (118 762 -> 133 407) und riss damit das
in P0 gesetzte Budget von 125 000. Das Gate hat also getan, was es soll.

Beim Router (P2) habe ich in derselben Lage NICHT das Budget angefasst, sondern den
Platz zurueckgeholt (Schublade und Palette hinter lazy()). Hier geht das nicht: Der
Zuwachs IST die Plattform, es gibt nichts wegzulassen.

Also angehoben — einmalig, auf 140 000, mit der Begruendung IM Ampel-Skript, damit ein
spaeterer Leser sieht, dass es ein ueberlegter Schritt war und kein Nachgeben:
MC2 ist eine LAN-Appliance; 14 kB sind ueber Gigabit-Ethernet keine messbare Wartezeit.
Das Budget existiert gegen DRIFT — einen 24-MB-Avatar, eine 95-kB-Diagramm-Bibliothek
auf der Startseite — nicht gegen einen bewussten Plattform-Schritt. Der relative
Abstand zum Deckel bleibt derselbe wie vorher (~5 %).

## Ehrlich zum Nutzen

React 19 bringt diesem Projekt HEUTE wenig Konkretes: use(), Actions und
Server-Komponenten sind hier nicht im Spiel. Der Grund ist die Zukunft — 18 altert,
und der React Compiler ist der Pfad, auf dem die 18 offenen Warnungen aus
eslint-plugin-react-hooks (setState im Effekt, Ref-Zugriff im Render) irgendwann
nicht mehr nur Warnungen sind.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 09:59:58 +02:00

32 lines
11 KiB
JavaScript

import{c as h,ai as S,r as u,z as C,A as M,j as e,aj as z,L as k,a1 as A,R as v,a5 as D,ak as B,al as L,b as Z,am as q,u as E,k as R,n as y,q as T}from"./index-Dd1yR_F_.js";import{S as $}from"./search-304843k8.js";/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const U=h("AlarmClock",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M12 9v4l2 2",key:"1c63tq"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const j=h("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const V=h("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const H=h("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const O=h("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const P=h("Radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]),W={sentry:{icon:L,label:"Health-Wächter",cls:"text-red-300 bg-red-500/10 border-red-500/25"},alarm:{icon:B,label:"Alarm",cls:"text-red-200 bg-red-500/15 border-red-500/40"},notify:{icon:V,label:"Meldung",cls:"text-sky-300 bg-sky-500/10 border-sky-500/25"},"chef-gutachter":{icon:O,label:"Morgenlage",cls:"text-violet-300 bg-violet-500/10 border-violet-500/25"},radar:{icon:P,label:"Radar",cls:"text-teal-300 bg-teal-500/10 border-teal-500/25"},auftragsbuch:{icon:D,label:"Auftragsbuch",cls:"text-primary bg-primary/10 border-primary/25"},zeitmaschine:{icon:v,label:"Zeitmaschine",cls:"text-amber-300 bg-amber-500/10 border-amber-500/25"},reminder:{icon:U,label:"Erinnerung",cls:"text-amber-300 bg-amber-500/10 border-amber-500/25"},traum:{icon:A,label:"Traum",cls:"text-violet-300 bg-violet-500/10 border-violet-500/25"}},F={icon:H,label:"Box",cls:"text-muted-foreground bg-background/40 border-border/50"};function J(s){return new Date(s*1e3).toLocaleDateString("de-DE",{weekday:"long",day:"2-digit",month:"long"})}function I(){const{data:s=[],isLoading:x}=S(),[c,g]=u.useState(!0),f=C(),{q:i=""}=M({from:"/chronik"}),m=r=>f({to:"/chronik",search:r?{q:r}:{},replace:!0}),d=u.useMemo(()=>{const r=i.trim().toLowerCase();return r?s.filter(n=>n.subject.toLowerCase().includes(r)||n.text.toLowerCase().includes(r)||n.source.toLowerCase().includes(r)):s},[s,i]),p=u.useMemo(()=>{const r=[];for(const n of d){const a=J(n.ts),l=r[r.length-1];l&&l.day===a?l.items.push(n):r.push({day:a,items:[n]})}return r},[d]);return e.jsxs("div",{className:"space-y-7",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Chronik"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Was deine Box von allein getan und gemeldet hat — und die Zeitmaschine, falls du zu einem früheren Stand zurück willst."})]}),e.jsx(_,{}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:[e.jsx(z,{className:"h-3.5 w-3.5"})," Verlauf",i&&e.jsxs("span",{className:"normal-case text-primary",children:["· ",d.length," von ",s.length]})]}),e.jsxs("div",{className:"relative ml-auto w-full sm:w-64",children:[e.jsx($,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground","aria-hidden":"true"}),e.jsx("input",{type:"search",value:i,onChange:r=>m(r.target.value),placeholder:"Verlauf durchsuchen …","aria-label":"Chronik durchsuchen",className:"h-8 w-full rounded-lg border border-border/60 bg-background/40 pl-8 pr-3 text-xs text-foreground outline-none transition-colors focus:border-primary"})]})]}),x&&e.jsxs("div",{className:"flex items-center gap-2 rounded-2xl border border-border/60 bg-card/30 p-6 text-xs text-muted-foreground",children:[e.jsx(k,{className:"h-4 w-4 animate-spin"})," Chronik wird geladen …"]}),!x&&d.length===0&&e.jsx("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 text-center text-xs text-muted-foreground",children:i?e.jsxs(e.Fragment,{children:["Nichts zu „",i,'" im Verlauf. ',e.jsx("button",{onClick:()=>m(""),className:"cursor-pointer text-primary underline underline-offset-2",children:"Filter aufheben"})]}):"Noch keine Einträge. Sobald die Box etwas von allein tut oder meldet (Updates, Wächter, Träume), steht es hier."}),p.map(({day:r,items:n})=>e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 text-xs font-bold text-foreground/70",children:r}),e.jsxs("div",{className:"space-y-2 border-l-2 border-border/40 pl-4",children:[(c?n.slice(0,8):n).map(a=>{const l=W[a.source]??F,b=l.icon;return e.jsxs("div",{className:"relative rounded-xl border border-border/50 bg-card/40 p-3 backdrop-blur-sm",children:[e.jsx("span",{className:"absolute -left-[23px] top-4 h-2.5 w-2.5 rounded-full bg-border ring-4 ring-background/60"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:Z("flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[10px] font-bold",l.cls),children:[e.jsx(b,{className:"h-3 w-3"})," ",l.label]}),a.subject&&e.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:a.subject}),e.jsx("span",{className:"ml-auto font-mono text-[10px] text-muted-foreground/60",children:new Date(a.ts*1e3).toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"})})]}),e.jsx("p",{className:"mt-1.5 whitespace-pre-wrap text-xs leading-relaxed text-foreground/85",children:a.text})]},a.id)}),c&&n.length>8&&e.jsxs("button",{onClick:()=>g(!1),className:"text-[11px] text-muted-foreground underline hover:text-foreground",children:[n.length-8," weitere anzeigen"]})]})]},r))]})]})}function _(){const{data:s}=q(),x=E(),{showAlert:c,showConfirm:g,dialogElement:f}=R(),[i,m]=u.useState(null),[d,p]=u.useState(!1),[r,n]=u.useState(!1),a=(s==null?void 0:s.backups)??[],l=r?a:a.slice(0,4);function b(t){const o=t.snapshot.match(/^(\d{4})-?(\d{2})-?(\d{2})[T_-](\d{2})[-:]?(\d{2})/);return o?`${o[3]}.${o[2]}.${o[1]}, ${o[4]}:${o[5]} Uhr`:t.snapshot}async function w(t){m(t.file);try{await y("/api/zeitmaschine/restore",{method:"POST",body:JSON.stringify({file:t.file})}),c("Zeitmaschine läuft","Die Wiederherstellung wurde gestartet. Die Dienste starten gleich neu — die Zentrale ist kurz weg und meldet sich von selbst zurück. Vorher wurde automatisch ein Sicherheits-Backup des jetzigen Zustands gemacht.")}catch(o){c("Start fehlgeschlagen",String((o==null?void 0:o.message)||o))}finally{m(null)}}async function N(){p(!0);try{const t=await y("/api/system/backup",{method:"POST"});t.ok?c("Gesichert",`Snapshot ${t.snapshot} wurde angelegt.`):c("Backup fehlgeschlagen",t.error||"Unbekannter Fehler"),x.invalidateQueries({queryKey:T.zeitmaschine})}catch(t){c("Backup fehlgeschlagen",String((t==null?void 0:t.message)||t))}finally{p(!1)}}return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:[e.jsx(j,{className:"h-3.5 w-3.5"})," Zeitmaschine — gesicherte Stände"]}),e.jsxs("button",{onClick:N,disabled:d||!(s!=null&&s.available),className:"flex h-8 items-center gap-1.5 rounded-lg border border-border/60 bg-card/45 px-2.5 text-[11px] font-semibold text-muted-foreground hover:text-foreground hover:border-primary/40 transition-all cursor-pointer disabled:opacity-50",children:[d?e.jsx(k,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(j,{className:"h-3.5 w-3.5"})," Jetzt sichern"]})]}),s&&!s.available&&e.jsx("div",{className:"rounded-2xl border border-amber-500/30 bg-amber-500/5 p-4 text-xs text-amber-300",children:"Die Snapshots liegen auf der Box — im lokalen Dev-Modus nicht verfügbar."}),(s==null?void 0:s.available)&&a.length===0&&e.jsx("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-5 text-center text-xs text-muted-foreground",children:'Noch keine Snapshots. Das nächtliche Backup (03:30) legt sie automatisch an — oder „Jetzt sichern".'}),l.length>0&&e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:l.map((t,o)=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl border border-border/50 bg-card/40 p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"text-xs font-semibold text-foreground",children:[b(t)," ",o===0&&e.jsx("span",{className:"ml-1 rounded bg-emerald-500/10 px-1.5 py-0.5 text-[9px] font-bold text-emerald-300",children:"neuester"})]}),e.jsxs("p",{className:"font-mono text-[10px] text-muted-foreground/70 truncate",title:t.file,children:[t.size_mb.toLocaleString("de-DE")," MB · ",t.file]})]}),e.jsxs("button",{disabled:i!==null,onClick:()=>g("Wirklich zu diesem Stand zurück?",`Die Box wird auf den Snapshot vom ${b(t)} zurückgesetzt (Gedächtnis, Hermes-Config, Modell-Router). Der JETZIGE Zustand wird vorher automatisch gesichert — der Schritt ist also umkehrbar. Die Dienste starten neu, die Zentrale ist kurz weg.`,()=>w(t)),className:"flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-amber-500/40 bg-amber-500/10 px-2.5 text-[10px] font-bold uppercase tracking-wide text-amber-300 transition-all hover:bg-amber-500/20 cursor-pointer disabled:opacity-50",children:[i===t.file?e.jsx(k,{className:"h-3 w-3 animate-spin"}):e.jsx(v,{className:"h-3 w-3"})," Zurück"]})]},t.file))}),a.length>4&&!r&&e.jsxs("button",{onClick:()=>n(!0),className:"text-[11px] text-muted-foreground underline hover:text-foreground",children:["Alle ",a.length," Snapshots anzeigen"]}),f]})}export{I as ChronikView};