From 3a949d83c385964c8aab29cc4cc424510de82842 Mon Sep 17 00:00:00 2001 From: hayzamjs Date: Thu, 26 Mar 2026 15:30:47 +0100 Subject: [PATCH] ui: vm: lifecycle zod fixes --- internal/db/db.go | 1 - web/src/lib/api/vm/vm.ts | 8 +++++--- web/src/lib/types/vm/vm.ts | 7 +++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/internal/db/db.go b/internal/db/db.go index cbec2023..d6910fca 100644 --- a/internal/db/db.go +++ b/internal/db/db.go @@ -123,7 +123,6 @@ func SetupDatabase(cfg *internal.SylveConfig, isTest bool) *gorm.DB { &infoModels.Note{}, &infoModels.ZPoolHistorical{}, - &zfsModels.PeriodicSnapshot{}, &networkModels.ManualSwitch{}, diff --git a/web/src/lib/api/vm/vm.ts b/web/src/lib/api/vm/vm.ts index 3ea3c5b3..3b7087cb 100644 --- a/web/src/lib/api/vm/vm.ts +++ b/web/src/lib/api/vm/vm.ts @@ -16,7 +16,9 @@ import { type VMLogs, type VMTemplate, type VMDomain, - type VMStat + type VMStat, + type OutcomeResponse, + OutcomeResponseSchema } from '$lib/types/vm/vm'; import { apiRequest } from '$lib/utils/http'; import { z } from 'zod/v4'; @@ -113,8 +115,8 @@ export async function actionVm( rid: number | string, action: string, hostname?: string -): Promise { - return await apiRequest(`/vm/${action}/${rid}`, APIResponseSchema, 'POST', undefined, { hostname }); +): Promise { + return await apiRequest(`/vm/${action}/${rid}`, OutcomeResponseSchema, 'POST', undefined, { hostname }); } export interface ConvertVMToTemplateRequest { diff --git a/web/src/lib/types/vm/vm.ts b/web/src/lib/types/vm/vm.ts index 690f0f49..58f94ad7 100644 --- a/web/src/lib/types/vm/vm.ts +++ b/web/src/lib/types/vm/vm.ts @@ -277,6 +277,10 @@ export const QGAInfoSchema = z.object({ interfaces: z.array(QGANetworkInterfaceSchema).nullable() }); +export const OutcomeResponseSchema = z.object({ + outcome: z.string() +}); + export type VM = z.infer; export type VMCPUPinning = z.infer; export type VMStorage = z.infer; @@ -290,10 +294,9 @@ export type VMTemplate = z.infer; export type VMTemplateStorage = z.infer; export type VMTemplateNetwork = z.infer; export type QGAInfo = z.infer; - export type VMLifecycleAction = 'start' | 'stop' | 'shutdown' | 'reboot'; - export type VMLifecycleBadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline'; +export type OutcomeResponse = z.infer; export interface VMLifecycleBadgeStyle { variant: VMLifecycleBadgeVariant;