io zuordnung; signal liste mit eas; links; csv ausgabe
This commit is contained in:
1 parent
13bbd26ce5
commit
f769ff7cc0
20 files changed
+594
-115
No files matched your search
@@ -1,4 +1,5 @@
|
||||
"use client"
|
||||
import Link from "next/link";
|
||||
|
||||
import { PropertyField } from "./propertyFields"
|
||||
import { ComponentDefaults, ComponentResponse, ComponentType, ComponentTypeDefinition } from "@/types/anlagen/components"
|
||||
@@ -112,6 +113,7 @@ export function ComponentForm({ component, componentTypes, componentDefaults, on
|
||||
|
||||
|
||||
{/* --- Signal IDs ----*/}
|
||||
<Link href={`/rk2/signals/${encodeURIComponent(component.id)}`} className="inline-block my-3 underline">Signale verwalten</Link>
|
||||
{signalByComp && signalByComp.map((s) => <div key={s.id}>
|
||||
{s.name}
|
||||
</div>)}
|
||||
@@ -129,4 +131,4 @@ export function ComponentForm({ component, componentTypes, componentDefaults, on
|
||||
}
|
||||
/*
|
||||
|
||||
*/
|
||||
*/
|
||||
@@ -15,6 +15,7 @@ import { ComponentDefaults, ComponentTypeDefinition } from "@/types/anlagen/comp
|
||||
|
||||
|
||||
interface Params {
|
||||
initialComponentId?: string;
|
||||
anlage: Anlage,
|
||||
groups: GroupResponse[],
|
||||
selectedUnit?: UnitResponse,
|
||||
@@ -22,7 +23,7 @@ interface Params {
|
||||
componentDefaults: ComponentDefaults[]
|
||||
}
|
||||
|
||||
export const UnitEdit = ({ anlage, groups, selectedUnit, componentTypes,componentDefaults }: Params) => {
|
||||
export const UnitEdit = ({ anlage, groups, selectedUnit, componentTypes,componentDefaults, initialComponentId }: Params) => {
|
||||
|
||||
|
||||
const { getGroupById } = useGroups({ groups });
|
||||
@@ -55,7 +56,7 @@ export const UnitEdit = ({ anlage, groups, selectedUnit, componentTypes,componen
|
||||
return (
|
||||
<div className="" >
|
||||
|
||||
<UnitCreateForm anlage={anlage} selectedGroup={selectedGroup} onDisplaySelectGroup={() => setShowSelectGroup(true)} unitIntial={selectedUnit} componentTypes={componentTypes} componentDefaults={componentDefaults}/>
|
||||
<UnitCreateForm anlage={anlage} selectedGroup={selectedGroup} onDisplaySelectGroup={() => setShowSelectGroup(true)} unitIntial={selectedUnit} componentTypes={componentTypes} componentDefaults={componentDefaults} initialComponentId={initialComponentId}/>
|
||||
|
||||
{showSelectGroup &&
|
||||
<Modal onClose={() => setShowSelectGroup(false)} >
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
"use client";
|
||||
import { formatComponentName } from "@/lib/componentName";
|
||||
|
||||
import { useEffect, useState } from "react"
|
||||
import { Anlage } from "@/types/rk";
|
||||
@@ -21,6 +22,7 @@ import { Select } from "@/components/ui/select";
|
||||
|
||||
|
||||
interface Params {
|
||||
initialComponentId?: string;
|
||||
anlage: Anlage,
|
||||
unitIntial?: UnitResponse
|
||||
selectedGroup?: GroupResponse
|
||||
@@ -30,9 +32,9 @@ interface Params {
|
||||
debug?: boolean
|
||||
}
|
||||
|
||||
export const UnitCreateForm = ({ anlage, unitIntial, onDisplaySelectGroup, selectedGroup, componentTypes, componentDefaults, debug }: Params) => {
|
||||
export const UnitCreateForm = ({ anlage, unitIntial, onDisplaySelectGroup, selectedGroup, componentTypes, componentDefaults, debug, initialComponentId }: Params) => {
|
||||
const [id, setId] = useState<string>();
|
||||
const [selectedComponent, setSelectedComponent] = useState<ComponentResponse>();
|
||||
const [selectedComponent, setSelectedComponent] = useState<ComponentResponse | undefined>(() => unitIntial?.components.find((component) => component.id === initialComponentId));
|
||||
|
||||
|
||||
const { emptyUnit, unitType, setValue, unitData, string_to_UnitType } = useUnit({ unit: unitIntial });
|
||||
@@ -163,7 +165,7 @@ export const UnitCreateForm = ({ anlage, unitIntial, onDisplaySelectGroup, selec
|
||||
<List variant="transparent" border={"none"} divide={false} size={"sm"}>
|
||||
{componentNames.map((comp) => (
|
||||
<ListItem className="" key={comp.id}>
|
||||
<Button onClick={() => handlerAppendComponent(comp.id)} type="button" key={comp.id} variant={"select"} size={"xs"} >{comp.name}</Button>
|
||||
<Button onClick={() => handlerAppendComponent(comp.id)} type="button" key={comp.id} variant={"select"} size={"xs"} >{formatComponentName(comp)}</Button>
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
@@ -189,10 +191,7 @@ export const UnitCreateForm = ({ anlage, unitIntial, onDisplaySelectGroup, selec
|
||||
</ListItemTitle>
|
||||
|
||||
<ListItemDescription>
|
||||
{c.prefix && c.prefix}
|
||||
{c.name}
|
||||
{c.postfix && c.postfix}
|
||||
{c.index && c.index > 0 ? c.index: ""}
|
||||
{formatComponentName(c)}
|
||||
</ListItemDescription>
|
||||
</ListItemContent>
|
||||
|
||||
@@ -277,4 +276,4 @@ export const UnitCreateForm = ({ anlage, unitIntial, onDisplaySelectGroup, selec
|
||||
)}
|
||||
|
||||
|
||||
*/
|
||||
*/
|
||||
Reference in new issue
Block a user