- Background scheduler checks every 30s for bookings that need setup or teardown - Per-lab Semaphore template IDs stored on the labs table - Booking flags track which jobs have been triggered and their Semaphore job IDs - Immediate teardown triggered when an active booking is cancelled - Settings UI section for Semaphore API URL, token, and project ID - Lab template form fields for setup/teardown template IDs - BookingDetailsModal shows live Ansible job status with manual trigger buttons
83 lines
1.8 KiB
TypeScript
83 lines
1.8 KiB
TypeScript
/**
|
|
* @license
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
// Known presets plus any custom class the user defines.
|
|
// The `(string & {})` keeps literal autocomplete while allowing arbitrary values.
|
|
export type DeviceType = 'Switch' | 'Access-Point' | 'Firewall' | 'Controller' | (string & {});
|
|
|
|
export interface Device {
|
|
id: string;
|
|
hostname: string;
|
|
ip: string;
|
|
location: string;
|
|
notes: string;
|
|
type: DeviceType;
|
|
status: 'online' | 'offline' | 'unknown';
|
|
emergencySheet: string; // Markdown text
|
|
cmkHostname?: string;
|
|
lastCheckedAt?: string;
|
|
}
|
|
|
|
export interface TopologyLink {
|
|
fromDevice: string;
|
|
toDevice: string;
|
|
type: string; // e.g. "LACP-Trunk", "Uplink", "OOB-Management", "VLAN-Core"
|
|
}
|
|
|
|
export interface LabTemplate {
|
|
id: string;
|
|
name: string;
|
|
description: string;
|
|
contactPerson: string;
|
|
location: string;
|
|
deviceIds: string[];
|
|
topology: TopologyLink[];
|
|
semaphoreSetupTemplateId?: string;
|
|
semaphoreTeardownTemplateId?: string;
|
|
}
|
|
|
|
export interface Booking {
|
|
id: string;
|
|
labId: string;
|
|
userId: string;
|
|
startDateTime: string;
|
|
endDateTime: string;
|
|
notes: string;
|
|
status: 'active' | 'upcoming' | 'completed' | 'cancelled';
|
|
notified: boolean;
|
|
emailSent?: boolean;
|
|
ansibleSetupTriggered?: boolean;
|
|
ansibleTeardownTriggered?: boolean;
|
|
ansibleSetupJobId?: string;
|
|
ansibleTeardownJobId?: string;
|
|
}
|
|
|
|
export interface LogEntry {
|
|
id: string;
|
|
timestamp: string;
|
|
type: 'maintenance' | 'booking' | 'status' | 'system';
|
|
message: string;
|
|
deviceId?: string;
|
|
userId?: string;
|
|
}
|
|
|
|
export interface User {
|
|
id: string;
|
|
name: string;
|
|
role: string;
|
|
email: string;
|
|
}
|
|
|
|
export interface QuickLink {
|
|
id: string;
|
|
title: string;
|
|
url: string;
|
|
description: string;
|
|
category: string;
|
|
color: string; // accent key, e.g. 'emerald' | 'cyan' | 'amber' | ...
|
|
createdBy?: string;
|
|
createdAt: string;
|
|
}
|