visualisierung
This commit is contained in:
1 parent
734aa81710
commit
6baea55216
47 files changed
+1892
-124
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import Link from 'next/link';
|
||||
import { api_groupCompare } from '@/actions/procon/api-group-sync';
|
||||
import AggregateWorkspace from '@/components/procon/aggregateWorkspace';
|
||||
export default async function Page({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
if (!/^\d+$/.test(id) || !Number.isSafeInteger(Number(id))) return <p>Ungültige ID</p>;
|
||||
|
||||
const back = <Link className="text-sm underline" href={`/procon/aggregate/${id}/visualisierungen`}>Zurück zu Visualisierungen</Link>;
|
||||
try {
|
||||
return <div>
|
||||
{back}
|
||||
<AggregateWorkspace
|
||||
aggregateId={Number(id)}
|
||||
initial={await api_groupCompare(Number(id))} />
|
||||
</div>;
|
||||
}
|
||||
catch (error) {
|
||||
return <div>
|
||||
{back}
|
||||
<p role="alert" className="mt-3">{error instanceof Error ? error.message : 'Laden fehlgeschlagen'}
|
||||
</p>
|
||||
<Link className="underline" href="/procon/zuordnung">Zuordnung prüfen</Link>
|
||||
</div>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import Link from 'next/link';
|
||||
import { api_syncCompare } from '@/actions/procon/api-sync';
|
||||
import VisualizationSync from '@/components/procon/visualizationSync';
|
||||
export default async function Page({ params }: { params: Promise<{ id: string; visuId: string }> }) {
|
||||
const { id, visuId } = await params;
|
||||
const back = <Link className="underline" href={`/procon/aggregate/${id}/arbeitsflaeche`}>Zurück zur Arbeitsfläche</Link>;
|
||||
if (!/^\d+$/.test(id) || !/^\d+$/.test(visuId)) return <p>Ungültige ID</p>;
|
||||
try {
|
||||
return <div>{back}<VisualizationSync xamlOnly aggregateId={Number(id)} visualizationId={Number(visuId)} initial={await api_syncCompare(Number(id), Number(visuId))} /></div>;
|
||||
} catch (error) {
|
||||
return <div>{back}<p role="alert" className="mt-3">{error instanceof Error ? error.message : 'Vergleich fehlgeschlagen'}</p><Link href="/procon/zuordnung" className="underline">Zuordnung prüfen</Link></div>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>;
|
||||
}
|
||||
}
|
||||
@@ -1,40 +1,16 @@
|
||||
import { Sites } from "@/_config/sites";
|
||||
import { api_ProconAggregate_GetAll } from "@/actions/procon/api-procon-aggregate";
|
||||
|
||||
import Link from "next/link";
|
||||
|
||||
import Link from 'next/link';
|
||||
import { api_ProconAggregate_GetAll } from '@/actions/procon/api-procon-aggregate';
|
||||
import AggregateTable from '@/components/procon/aggregateTable';
|
||||
|
||||
export default async function PageAggregate() {
|
||||
const aggregate = await api_ProconAggregate_GetAll();
|
||||
return (
|
||||
<div className="">
|
||||
<Link href={Sites.main.url}>{Sites.main.name}</Link>
|
||||
<Link href={Sites.procon.url}>{Sites.procon.name}</Link>
|
||||
<div className="flex flex-col m-4 w-300 ">
|
||||
{aggregate.map((anlage) => (
|
||||
<div key={anlage.Id}
|
||||
className="grid grid-cols-[50px_100px_200px_200px_200px_200px] gap-4 p-2 border-b-1 border-l-1 border-r-1 first:border-t-1">
|
||||
<div>
|
||||
{anlage.Id}
|
||||
</div>
|
||||
<div>
|
||||
{anlage.SPSAntriebId}
|
||||
</div>
|
||||
<div>
|
||||
{anlage.Bezeichnung}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{anlage.BMK}
|
||||
</div>
|
||||
<div>
|
||||
{anlage.ViewName}
|
||||
</div>
|
||||
<div>
|
||||
<Link href={Sites.procon.aggregate.url+"/"+anlage.SPSAntriebId}>Auswahl</Link>
|
||||
</div>
|
||||
</div>))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
try {
|
||||
const rows = await api_ProconAggregate_GetAll();
|
||||
return <div><h2 className="mb-3 text-lg font-semibold">Aggregate</h2>
|
||||
<Link className="mb-3 inline-block text-sm underline" href="/procon/positionen">Positionstabelle öffnen</Link>
|
||||
<AggregateTable rows={rows} /></div>;
|
||||
} catch (error) {
|
||||
return <div><h2 className="mb-3 text-lg font-semibold">Aggregate</h2>
|
||||
<p role="alert" className="mb-3 text-red-600">{error instanceof Error ? error.message : 'Aggregate konnten nicht geladen werden.'}</p>
|
||||
<Link href="/rk2/verbindungen" className="underline">ProCon-Verbindung prüfen</Link></div>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { ReactNode } from 'react';
|
||||
import Link from 'next/link';
|
||||
import { api_anlage_getSelected } from '@/actions/rk/api-anlage';
|
||||
import { api_connections } from '@/actions/rk/api-procon-verbindungen';
|
||||
|
||||
export default async function ProConLayout({ children }: { children: ReactNode }) {
|
||||
let source = 'Keine aktive Verbindung';
|
||||
let location = '';
|
||||
try {
|
||||
const anlage = await api_anlage_getSelected();
|
||||
const data = await api_connections(anlage.id);
|
||||
const active = data.verbindungen.find(item => item.id === data.aktiveVerbindungId);
|
||||
location = data.anlageNr + ' · ' + data.name;
|
||||
if (active) source = active.name + ' (' + active.umgebung + ') · ' + active.server + ' / ' + active.datenbank;
|
||||
} catch { source = 'Anlage oder Verbindung konnte nicht geladen werden'; }
|
||||
return <div className="flex min-h-screen flex-col">
|
||||
<header className="border-b bg-slate-800 px-5 py-3 text-white"><h1 className="text-xl font-semibold">ProCon</h1>
|
||||
<p className="text-sm">{location}</p><p className="text-xs text-slate-200">{source}</p></header>
|
||||
<div className="flex min-h-0 flex-1">
|
||||
<aside className="w-48 shrink-0 border-r bg-gray-50 p-4"><nav className="flex flex-col gap-3 text-sm">
|
||||
<Link href="/">Home</Link><Link href="/procon">ProCon-Start</Link>
|
||||
<Link href="/procon/aggregate">Aggregate</Link><Link href="/procon/zuordnung">Zuordnung</Link><Link href="/rk2/verbindungen">Verbindungen verwalten</Link>
|
||||
<Link href="/rk/anlagen">Anlage auswählen</Link>
|
||||
<Link href="/visualisierung">Visualisierung</Link>
|
||||
</nav></aside>
|
||||
<main className="min-w-0 flex-1 p-4">{children}</main>
|
||||
</div>
|
||||
</div>;
|
||||
}
|
||||
@@ -1,30 +1,7 @@
|
||||
import { Sites } from "@/_config/sites";
|
||||
import { api_ProconAggregate_GetAll } from "@/actions/procon/api-procon-aggregate";
|
||||
|
||||
import Link from "next/link";
|
||||
|
||||
|
||||
export default async function PageAggregate() {
|
||||
|
||||
const topics = [
|
||||
{ name: Sites.procon.aggregate.name, url: Sites.procon.aggregate.url },
|
||||
{ name: Sites.procon.texteVisu.name, url: Sites.procon.texteVisu.url },
|
||||
{ name: "Visu Texte",url: Sites.procon.texteVisu.url },
|
||||
{ name: "SVG Test",url: Sites.procon.svgTest.url }
|
||||
]
|
||||
|
||||
|
||||
return (
|
||||
<div className="">
|
||||
<Link href={Sites.main.url}>{Sites.main.name}</Link>
|
||||
<div className="flex flex-col m-4 w-300 ">
|
||||
{topics.map((top) => (
|
||||
|
||||
<Link href={top.url} key={top.name+top.url}>
|
||||
{top.name}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div >
|
||||
);
|
||||
import Link from 'next/link';
|
||||
export default function ProConPage() {
|
||||
return <div><h2 className="mb-3 text-lg font-semibold">ProCon-Datenbank</h2>
|
||||
<p className="mb-4 text-sm text-gray-600">Daten aus der aktiven Verbindung der ausgewählten Anlage.</p>
|
||||
<Link className="inline-block rounded border bg-white p-4 underline" href="/procon/aggregate">Aggregate-Tabelle anzeigen</Link>
|
||||
</div>;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import Link from 'next/link';
|
||||
import { api_positionTable } from '@/actions/procon/api-position-table';
|
||||
import PositionTable from '@/components/procon/positionTable';
|
||||
|
||||
export default async function Page() {
|
||||
try { return <PositionTable initial={await api_positionTable()} />; }
|
||||
catch (error) {
|
||||
return <div><p role="alert">{error instanceof Error ? error.message : 'Positionen konnten nicht geladen werden.'}</p>
|
||||
<Link className="underline" href="/procon/zuordnung">Zuordnung prüfen</Link></div>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import MappingOverview from '@/components/procon/mappingOverview';
|
||||
import { api_mappingPreview } from '@/actions/procon/api-zuordnung';
|
||||
|
||||
export default async function Page() {
|
||||
try {
|
||||
return <MappingOverview initial={await api_mappingPreview()} />; }
|
||||
catch (error) {
|
||||
return <p role="alert">{error instanceof Error ? error.message : 'Laden fehlgeschlagen'}</p>; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import { api_connections } from '@/actions/rk/api-procon-verbindungen';
|
||||
import ProConConnectionsForm from '@/components/rk/anlage/proconConnections';
|
||||
export default async function Page({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
try { return <div className="p-4"><ProConConnectionsForm initial={await api_connections(id)} /></div>; }
|
||||
catch { return <p role="alert">Verbindungen konnten nicht geladen werden.</p>; }
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ export default function AnlageLayout({ children }: Props) {
|
||||
|
||||
<ul className="space-y-2">
|
||||
<li><a href="/rk2/visu-aggregate">VisuAggregate</a></li>
|
||||
<li><a href="/rk2/verbindungen">ProCon-Verbindungen</a></li>
|
||||
<li><a href="/procon">ProCon</a></li>
|
||||
<li><a href="/rk2/visu-aggregate/grafiken">Grafikübersicht</a></li>
|
||||
<li>
|
||||
<a href="/rk2/groups">Groups</a>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { api_connections } from '@/actions/rk/api-procon-verbindungen';
|
||||
import { api_anlage_getSelected } from '@/actions/rk/api-anlage';
|
||||
import ProConConnectionsForm from '@/components/rk/anlage/proconConnections';
|
||||
export default async function Page() {
|
||||
try {
|
||||
const anlage = await api_anlage_getSelected();
|
||||
return <ProConConnectionsForm initial={await api_connections(anlage.id)} />;
|
||||
} catch { return <p role="alert">Verbindungen konnten nicht geladen werden. Bitte eine Anlage auswählen.</p>; }
|
||||
}
|
||||
|
||||
@@ -1,39 +1,12 @@
|
||||
import Link from 'next/link';
|
||||
import { api_viewAggregate_overview } from '@/actions/rk2/api-procon-view-aggregate';
|
||||
import { api_viewAggregate_overview } from '@/actions/rk2/api-procon-view-aggregate';
|
||||
import { api_anlage_getSelected } from '@/actions/rk/api-anlage';
|
||||
import GraphicsOverview from '@/components/rk2/visu-aggregate/graphicsOverview';
|
||||
|
||||
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>;
|
||||
try {
|
||||
const [aggregates, anlage] = await Promise.all([api_viewAggregate_overview(), api_anlage_getSelected()]);
|
||||
return <GraphicsOverview aggregates={aggregates} anlageId={anlage.id} />;
|
||||
} catch {
|
||||
return <p role="alert">Die Grafikübersicht konnte nicht geladen werden. Bitte Backend-Verbindung und ausgewählte Anlage prüfen.</p>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import DrawTest from '@/components/visu/draw/drawTest';
|
||||
|
||||
export default function DrawTestPage() {
|
||||
return <div className="p-4">
|
||||
<h1 className="mb-2 text-xl font-semibold">Grafik-Test: Motor und BandOben</h1>
|
||||
<p className="mb-4 text-sm text-gray-600">Parameter eingeben und die Grafik über die POST-Schnittstelle erzeugen.</p>
|
||||
<DrawTest />
|
||||
</div>;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import Link from 'next/link';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
export default function Layout({ children }: { children: ReactNode }) {
|
||||
return <div className="min-h-screen bg-slate-50">
|
||||
<header className="border-b bg-slate-800 px-5 py-3 text-white">
|
||||
<h1 className="text-xl font-semibold">Visualisierung</h1>
|
||||
<nav className="mt-2 flex flex-wrap gap-4 text-sm">
|
||||
<Link href="/">Home</Link><Link href="/visualisierung">Anlagenübersicht</Link>
|
||||
<Link href="/procon/positionen">Positionstabelle</Link><Link href="/procon/zuordnung">Zuordnung</Link>
|
||||
<Link href="/rk/anlagen">Anlage auswählen</Link>
|
||||
</nav>
|
||||
</header>
|
||||
<main className="p-4">{children}</main>
|
||||
</div>;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import Link from 'next/link';
|
||||
import { api_visualizationOverview } from '@/actions/visualisierung/api-overview';
|
||||
import AnlageOverview from '@/components/visualisierung/anlageOverview';
|
||||
|
||||
export default async function Page() {
|
||||
try { return <AnlageOverview initial={await api_visualizationOverview()} />; }
|
||||
catch (error) {
|
||||
return <div><p role="alert">{error instanceof Error ? error.message : 'Anlagenübersicht konnte nicht geladen werden.'}</p>
|
||||
<Link href="/procon/zuordnung" className="underline">Anlage, Verbindung und Zuordnung prüfen</Link></div>;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user