Files
DCM/src/types.ts
2026-08-09 17:04:38 -05:00

123 lines
2.3 KiB
TypeScript

export type ThemeMode = 'light' | 'dark';
export type ComponentType =
| 'rack'
| 'cabinet'
| 'switch'
| 'router'
| 'firewall'
| 'server-rack'
| 'blade-chassis'
| 'storage-array'
| 'storage-switch'
| 'patch-panel'
| 'pdu'
| 'cable-management'
| 'kvm'
| 'kvm-console';
export type LibraryCategory = 'container' | 'equipment';
export type PatchPanelMedium = '' | 'copper' | 'fiberoptic';
export interface PatchPanelPort {
id: string;
portId: string;
cableId: string;
}
export interface NetworkPort {
id: string;
portId: string;
cableId: string;
vlan: number;
}
export type PduMount = 'horizontal' | 'vertical';
export type PduSide = 'left' | 'right';
export interface PduOutputPort {
id: string;
label: string;
voltage: number;
amps: number;
}
export interface LibraryItem {
type: ComponentType;
category: LibraryCategory;
label: string;
defaultU: number;
minU: number;
maxU: number;
color: string;
}
export interface Equipment {
id: string;
type: ComponentType;
name: string;
sizeU: number;
uStart: number;
manufacturer: string;
model: string;
serialNumber: string;
assetTag: string;
powerWatts: number;
patchPanelMedium: PatchPanelMedium;
patchPanelPorts: number;
patchPanelPortMap: PatchPanelPort[];
networkPorts: NetworkPort[];
managed: boolean;
managedHostname: string;
managedUrl: string;
managedUser: string;
pduMount: PduMount;
pduSide: PduSide;
pduInputVoltage: string;
pduOutputPorts: PduOutputPort[];
pduManaged: boolean;
pduHostname: string;
pduUrl: string;
pduUser: string;
notes: string;
color: string;
}
export interface RackContainer {
id: string;
type: 'rack' | 'cabinet';
name: string;
sizeU: number;
manufacturer: string;
model: string;
location: string;
locationArea: string;
locationRow: string;
locationColumn: string;
notes: string;
equipment: Equipment[];
}
export interface DiagramData {
appName: 'Datacenter Modeler';
schemaVersion: 1;
name: string;
createdAt: string;
updatedAt: string;
racks: RackContainer[];
}
export type Selection =
| { kind: 'rack'; rackId: string }
| { kind: 'equipment'; rackId: string; equipmentId: string }
| null;
export interface DragPayload {
source: 'library' | 'equipment';
type?: ComponentType;
rackId?: string;
equipmentId?: string;
}