feat: types JSON canoniques partagés (snapshot, execution, machine)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
// shared/types.ts
|
||||
export type OsFamily = "debian" | "ubuntu" | "unknown";
|
||||
export type MachineStatus = "unknown" | "ok" | "updates_available" | "error" | "running";
|
||||
export type AptProxyMode = "direct" | "runtime";
|
||||
export type ActionType = "apt_full_upgrade" | "reboot";
|
||||
export type ExecutionStatus = "ok" | "warning" | "error";
|
||||
|
||||
export interface AptPackage {
|
||||
name: string;
|
||||
currentVersion: string | null;
|
||||
targetVersion: string;
|
||||
origin: string | null;
|
||||
}
|
||||
|
||||
export interface UpdateSnapshot {
|
||||
machineId: string;
|
||||
hostname: string;
|
||||
os: { family: OsFamily; version: string };
|
||||
checkedAt: string; // ISO 8601
|
||||
status: MachineStatus;
|
||||
apt: {
|
||||
enabled: boolean;
|
||||
count: number;
|
||||
rebootRequired: boolean;
|
||||
packages: AptPackage[];
|
||||
};
|
||||
rawHints?: { logImportantLines: string[] };
|
||||
}
|
||||
|
||||
export interface ExecutionResult {
|
||||
executionId: string;
|
||||
machineId: string;
|
||||
startedAt: string;
|
||||
finishedAt: string;
|
||||
mode: "manual";
|
||||
action: ActionType;
|
||||
status: ExecutionStatus;
|
||||
rebootRequiredAfterRun: boolean;
|
||||
importantLogLines: string[];
|
||||
rawLogRef: string;
|
||||
reportRef: string;
|
||||
}
|
||||
|
||||
/** Vue machine renvoyée par l'API — NE CONTIENT JAMAIS de secret. */
|
||||
export interface MachineView {
|
||||
id: string;
|
||||
name: string;
|
||||
hostname: string;
|
||||
port: number;
|
||||
osFamily: OsFamily;
|
||||
username: string;
|
||||
aptProxyMode: AptProxyMode;
|
||||
aptProxyUrl: string | null;
|
||||
status: MachineStatus;
|
||||
lastCheckedAt: string | null;
|
||||
}
|
||||
Reference in New Issue
Block a user