procon aggregate
This commit is contained in:
1 parent
3bea468d23
commit
734aa81710
16 files changed
+656
-12
No files matched your search
@@ -36,6 +36,8 @@ export default function AnlageLayout({ children }: Props) {
|
||||
<h2 className="mb-4 font-semibold">Anlage</h2>
|
||||
|
||||
<ul className="space-y-2">
|
||||
<li><a href="/rk2/visu-aggregate">VisuAggregate</a></li>
|
||||
<li><a href="/rk2/visu-aggregate/grafiken">Grafikübersicht</a></li>
|
||||
<li>
|
||||
<a href="/rk2/groups">Groups</a>
|
||||
</li>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import Link from 'next/link';
|
||||
import { api_viewAggregate } from '@/actions/rk2/api-procon-view-aggregate';
|
||||
import ViewAggregateForm from '@/components/rk2/visu-aggregate/viewAggregateForm';
|
||||
|
||||
export default async function Page({ params }: { params: Promise<{ componentId: string }> }) {
|
||||
const { componentId } = await params;
|
||||
try {
|
||||
const data = await api_viewAggregate(componentId);
|
||||
return <div><Link href="/rk2/visu-aggregate" className="underline">Zurück zu VisuAggregate</Link>
|
||||
<h1 className="my-4 text-xl font-semibold">Grafiken – {data.name}</h1>
|
||||
<ViewAggregateForm componentId={componentId} initial={data} />
|
||||
</div>;
|
||||
} catch (error) {
|
||||
return <div><Link href="/rk2/visu-aggregate" className="underline">Zurück zur Tabelle</Link>
|
||||
<p role="alert" className="mt-4 text-red-600">{error instanceof Error ? error.message : 'Laden fehlgeschlagen'}</p></div>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
export async function GET() {
|
||||
try {
|
||||
const response = await fetch('http://localhost:3000/rk2/visu-aggregate/export', { cache: 'no-store' });
|
||||
if (!response.ok) return new Response('Excel-Export fehlgeschlagen.', { status: 502 });
|
||||
return new Response(response.body, {
|
||||
headers: {
|
||||
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'Content-Disposition': 'attachment; filename="VisuAggregate.xlsx"',
|
||||
'Cache-Control': 'no-store',
|
||||
},
|
||||
});
|
||||
} catch {
|
||||
return new Response('Keine Verbindung zum Backend.', { status: 502 });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import Link from 'next/link';
|
||||
import { api_viewAggregate_overview } from '@/actions/rk2/api-procon-view-aggregate';
|
||||
|
||||
export default async function GraphicsOverviewPage() {
|
||||
let aggregates;
|
||||
try { aggregates = await api_viewAggregate_overview(); }
|
||||
catch { return <p role="alert">Die Grafikübersicht konnte nicht geladen werden. Bitte Backend-Verbindung und ausgewählte Anlage prüfen.</p>; }
|
||||
const count = aggregates.reduce((sum, item) => sum + item.elemente.length, 0);
|
||||
return <div>
|
||||
<Link href="/rk2/visu-aggregate" className="text-sm underline">Zur VisuAggregate-Tabelle</Link>
|
||||
<h1 className="my-3 text-xl font-semibold">Grafikübersicht</h1>
|
||||
<p className="mb-4 text-sm text-gray-600">{count} Elemente in {aggregates.length} gespeicherten Aggregaten der ausgewählten Anlage. Angezeigt wird der gespeicherte Stand.</p>
|
||||
{!aggregates.length && <p>Noch keine VisuAggregate gespeichert.</p>}
|
||||
<div className="space-y-3">{aggregates.map(aggregate => <section key={aggregate.componentId} className="rounded border bg-white">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 bg-gray-50 p-2">
|
||||
<div><h2 className="text-sm font-semibold">{aggregate.antriebId} · {aggregate.name}</h2><p className="text-xs text-gray-500">{aggregate.viewName || 'Kein View-Name'}</p></div>
|
||||
<Link className="text-sm underline" href={`/rk2/visu-aggregate/${aggregate.componentId}/grafiken`}>Grafiken bearbeiten</Link>
|
||||
</div>
|
||||
{!aggregate.elemente.length ? <p className="p-2 text-xs text-gray-500">Noch keine Grafikelemente.</p> : <div className="overflow-x-auto">
|
||||
<table className="w-full border-collapse text-left text-xs">
|
||||
<thead><tr>{['Element', 'Typ', 'Breite', 'Höhe', 'X', 'Y', 'Z', 'Sichtbar', 'Zustände / Dateien'].map(label =>
|
||||
<th key={label} className="border-b p-2" scope="col">{label}</th>)}</tr></thead>
|
||||
<tbody>{aggregate.elemente.map(element => <tr key={element._id ?? element.key} className="align-top">
|
||||
<th scope="row" className="border-b p-2 font-medium">{element.key}{element.name && <span className="block font-normal text-gray-500">{element.name}</span>}</th>
|
||||
<td className="border-b p-2">{element.typ}</td>
|
||||
{[element.width, element.height, element.posX, element.posY, element.zIndex].map((value, index) => <td key={index} className="border-b p-2">{value}</td>)}
|
||||
<td className="border-b p-2">{element.show ? 'Ja' : 'Nein'}</td>
|
||||
<td className="border-b p-2">{element.darstellung === 'standard' ? <span className="text-gray-500">Standardanzeige · keine XAML</span>
|
||||
: !element.varianten.length ? <span className="text-gray-500">Keine Zustände</span>
|
||||
: <ul className="space-y-1">{element.varianten.map(variant => <li key={variant.zustand}>
|
||||
<span className={variant.xamlBase64 ? 'text-green-700' : 'text-gray-500'}>{variant.zustand} · {variant.xamlBase64 ? 'XAML vorhanden' : 'ohne XAML'}</span>
|
||||
<span className="block break-all text-gray-500">{aggregate.viewName}_{element.key}_{variant.zustand}.xaml</span>
|
||||
</li>)}</ul>}</td>
|
||||
</tr>)}</tbody>
|
||||
</table>
|
||||
</div>}
|
||||
</section>)}</div>
|
||||
</div>;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { api_visuAggregate } from '@/actions/rk2/api-visu-aggregate';
|
||||
import VisuAggregateTable from '@/components/rk2/visu-aggregate/visuAggregateTable';
|
||||
import Breadcrumbs from '@/components/ui/navigation/breadcrumbs';
|
||||
|
||||
export default async function VisuAggregatePage() {
|
||||
let rows;
|
||||
try { rows = await api_visuAggregate(); }
|
||||
catch {
|
||||
return <div><h1 className="mb-4 text-xl font-semibold">VisuAggregate</h1>
|
||||
<p role="alert">Die Tabelle konnte nicht geladen werden. Bitte die Backend-Verbindung und die ausgewählte Anlage prüfen und die Seite neu laden.</p></div>;
|
||||
}
|
||||
return <div>
|
||||
<Breadcrumbs items={[{ label: 'Anlage', href: '/rk2' }, { label: 'VisuAggregate' }]} />
|
||||
<h1 className="my-4 text-xl font-semibold">VisuAggregate</h1>
|
||||
<p className="mb-4">Werte direkt in der Tabelle bearbeiten und je Zeile speichern. Weitere Spalten sind durch horizontales Scrollen erreichbar.</p>
|
||||
<VisuAggregateTable rows={rows} />
|
||||
</div>;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export default async function PageShowDraw() {
|
||||
height="100%"
|
||||
viewBox={`${0} ${0} ${1820} ${1120}`}
|
||||
>
|
||||
<rect x1={1} y1={0} width={1750} height={1500} fill="#fee0fe" stroke="#000" strokeWidth={1} />
|
||||
<rect x1={1} y1={0} width={1750} height={1500} fill="#fee0fe" stroke="#000" strokeWidth={1} />
|
||||
|
||||
<SvgShow svg={data.svg} />
|
||||
|
||||
@@ -29,8 +29,11 @@ export default async function PageShowDraw() {
|
||||
<Card positons={"start"}>
|
||||
<CardHeader variant={"danger"} >Debug</CardHeader>
|
||||
<CardContent className="ps-8">
|
||||
<pre>{JSON.stringify(data, null, 2)}</pre>
|
||||
|
||||
|
||||
<pre className="overflow-auto whitespace-pre rounded bg-gray-100 p-4 text-sm">
|
||||
<code>{data.xamlBase64}</code>
|
||||
<code>{"data.svg"}</code>
|
||||
</pre>
|
||||
</CardContent>
|
||||
</Card>
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user