feat: add TypeScript types for network diagrams
Adds all interfaces for network diagrams and device types including DiagramNode, DiagramEdge, DeviceProperties, NetworkDiagramResponse, AI generate request/response, import/export shapes, and list item types. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -98,3 +98,4 @@ export * from './script-builder'
|
||||
export * from './integrations'
|
||||
export * from './notification'
|
||||
export type * from './public-templates'
|
||||
export * from './network-diagram'
|
||||
|
||||
130
frontend/src/types/network-diagram.ts
Normal file
130
frontend/src/types/network-diagram.ts
Normal file
@@ -0,0 +1,130 @@
|
||||
export interface DeviceProperties {
|
||||
hostname: string | null
|
||||
ip: string | null
|
||||
subnet: string | null
|
||||
vendor: string | null
|
||||
model: string | null
|
||||
role: string | null
|
||||
vlan: string | null
|
||||
notes: string | null
|
||||
status: 'unknown' | 'online' | 'offline' | 'degraded'
|
||||
}
|
||||
|
||||
export interface DiagramNode {
|
||||
id: string
|
||||
type: string
|
||||
label: string
|
||||
position: { x: number; y: number }
|
||||
properties: DeviceProperties
|
||||
}
|
||||
|
||||
export interface DiagramEdge {
|
||||
id: string
|
||||
source: string
|
||||
target: string
|
||||
label: string | null
|
||||
connectionType: string
|
||||
speed: string | null
|
||||
notes: string | null
|
||||
}
|
||||
|
||||
export interface DeviceTypeResponse {
|
||||
id: string
|
||||
slug: string
|
||||
label: string
|
||||
category: string
|
||||
is_system: boolean
|
||||
team_id: string | null
|
||||
sort_order: number
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface DeviceTypeCreate {
|
||||
slug: string
|
||||
label: string
|
||||
category: string
|
||||
sort_order?: number
|
||||
}
|
||||
|
||||
export interface NetworkDiagramResponse {
|
||||
id: string
|
||||
team_id: string
|
||||
name: string
|
||||
client_name: string | null
|
||||
asset_name: string | null
|
||||
description: string | null
|
||||
nodes: DiagramNode[]
|
||||
edges: DiagramEdge[]
|
||||
thumbnail_url: string | null
|
||||
is_archived: boolean
|
||||
created_by: string | null
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export interface NetworkDiagramListItem {
|
||||
id: string
|
||||
name: string
|
||||
client_name: string | null
|
||||
description: string | null
|
||||
node_count: number
|
||||
created_by: string | null
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export interface NetworkDiagramCreate {
|
||||
name: string
|
||||
client_name?: string | null
|
||||
asset_name?: string | null
|
||||
description?: string | null
|
||||
nodes?: DiagramNode[]
|
||||
edges?: DiagramEdge[]
|
||||
}
|
||||
|
||||
export interface NetworkDiagramUpdate {
|
||||
name?: string
|
||||
client_name?: string | null
|
||||
asset_name?: string | null
|
||||
description?: string | null
|
||||
nodes?: DiagramNode[]
|
||||
edges?: DiagramEdge[]
|
||||
}
|
||||
|
||||
export interface AIGenerateRequest {
|
||||
description: string
|
||||
client_name?: string | null
|
||||
mode: 'replace' | 'merge'
|
||||
existingBounds?: { minX: number; maxX: number; minY: number; maxY: number } | null
|
||||
}
|
||||
|
||||
export interface AIGenerateResponse {
|
||||
nodes: DiagramNode[]
|
||||
edges: DiagramEdge[]
|
||||
suggestedName: string | null
|
||||
notes: string | null
|
||||
}
|
||||
|
||||
export interface DiagramImportData {
|
||||
schemaVersion: number
|
||||
name: string
|
||||
client_name?: string | null
|
||||
description?: string | null
|
||||
nodes: DiagramNode[]
|
||||
edges: DiagramEdge[]
|
||||
}
|
||||
|
||||
export interface DiagramImportResponse {
|
||||
diagram: NetworkDiagramResponse
|
||||
warnings: string[]
|
||||
}
|
||||
|
||||
export interface DiagramExportResponse {
|
||||
schemaVersion: number
|
||||
name: string
|
||||
client_name: string | null
|
||||
description: string | null
|
||||
nodes: DiagramNode[]
|
||||
edges: DiagramEdge[]
|
||||
exportedAt: string
|
||||
}
|
||||
Reference in New Issue
Block a user