visualisierung

This commit is contained in:
marco committed 2026-10-26 07:34:27 +01:00
1 parent 734aa81710
commit 6baea55216
47 files changed
+1892 -124

No files matched your search

@@ -0,0 +1,41 @@
import Link from 'next/link';
import { api_ProconAggregate_Visualisierungen } from '@/actions/procon/api-procon-aggregate';
export default async function Page({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
const back = <Link href="/procon/aggregate" className="text-sm underline">Zurück zu den Aggregaten</Link>;
if (!/^\d+$/.test(id) || !Number.isSafeInteger(Number(id))) return <div>{back}<p role="alert">Ungültige Aggregat-ID.</p></div>;
try {
const { aggregat: aggregate, visualisierungen } = await api_ProconAggregate_Visualisierungen(Number(id));
return <div>{back}
<h2 className="my-3 text-xl font-semibold">{aggregate.SPSAntriebId} · {aggregate.Bezeichnung}</h2>
<dl className="mb-4 grid grid-cols-2 gap-3 rounded border bg-gray-50 p-3 md:grid-cols-4">
{[['Datenbank-ID', aggregate.Id], ['BMK', aggregate.BMK], ['View', aggregate.ViewName], ['Motoren', aggregate.AnzahlMotor]].map(([label, value]) =>
<div key={label}><dt className="text-xs text-gray-500">{label}</dt><dd className="break-all text-sm">{value ?? '—'}</dd></div>)}
</dl>
<h3 className="mb-2 font-semibold">Visualisierungen ({visualisierungen.length})</h3>
<Link className="mb-3 inline-block rounded border bg-blue-600 px-3 py-2 text-sm text-white" href={`/procon/aggregate/${id}/arbeitsflaeche`}>Gemeinsame Arbeitsfläche öffnen</Link>
{!visualisierungen.length ? <p>Für dieses Aggregat sind keine Visualisierungen vorhanden.</p> : <div className="overflow-auto rounded border">
<table className="w-full border-collapse text-left text-sm">
<thead className="bg-gray-100"><tr>{['ID', 'Art', 'XAML-Dateien', 'Nummer', 'Breite', 'Höhe', 'X', 'Y', 'Z', 'Sichtbar', 'Hauptansicht', 'Text', 'Abgleich'].map(label => <th key={label} scope="col" className="whitespace-nowrap border p-2">{label}</th>)}</tr></thead>
<tbody>{visualisierungen.map(item => <tr key={item.Id} className="hover:bg-blue-50">
{[item.Id, item.Discriminator,
item.Discriminator === 'XamlVisualisierung'
? item.xamlNames?.length ? <ul className="space-y-1">{item.xamlNames.map(name => <li className="break-all text-xs" key={name}>{name}</li>)}</ul> : 'Keine XAML-Zuordnung'
: '',
item.Number, item.Width, item.Height, item.PositionX, item.PositionY, item.PositionZ,
item.Show ? 'Ja' : 'Nein', item.MainView ? 'Ja' : 'Nein', item.Text].map((value, index) =>
<td key={index} className="border p-2">{value ?? ''}</td>)}
<td className="border p-2"><Link className="whitespace-nowrap underline" href={`/procon/aggregate/${id}/arbeitsflaeche`}>Arbeitsfläche</Link></td>
</tr>)}</tbody>
</table>
</div>}
<details className="mt-4"><summary className="cursor-pointer text-sm">Alle Aggregateigenschaften</summary>
<dl className="mt-2 grid gap-2 rounded border p-3 sm:grid-cols-2">{Object.entries(aggregate).map(([key, value]) =>
<div key={key}><dt className="text-xs text-gray-500">{key}</dt><dd className="break-all text-sm">{value === null || value === undefined ? '—' : String(value)}</dd></div>)}</dl>
</details>
</div>;
} catch (error) {
return <div>{back}<p role="alert" className="mt-3 text-red-600">{error instanceof Error ? error.message : 'Laden fehlgeschlagen.'}</p></div>;
}
}