Can create VM from UI

This commit is contained in:
2023-10-16 19:00:15 +02:00
parent 7ef5afb978
commit fbfe4f00c5
12 changed files with 420 additions and 10 deletions

View File

@ -5,7 +5,19 @@ export interface ServerConfig {
local_auth_enabled: boolean;
oidc_auth_enabled: boolean;
iso_mimetypes: string[];
constraints: ServerConstraints;
}
export interface ServerConstraints {
iso_max_size: number;
name_size: LenConstraint;
title_size: LenConstraint;
memory_size: LenConstraint;
}
export interface LenConstraint {
min: number;
max: number;
}
let config: ServerConfig | null = null;

View File

@ -52,12 +52,35 @@ export class VMInfo implements VMInfoInterface {
this.vnc_access = int.vnc_access;
}
static NewEmpty(): VMInfo {
return new VMInfo({
name: "",
boot_type: "UEFI",
architecture: "x86_64",
memory: 1024,
vnc_access: true,
});
}
get ViewURL(): string {
return `/api/vm/${this.uuid}`;
}
}
export class VMApi {
/**
* Create a new virtual machine
*/
static async Create(v: VMInfo): Promise<{ uuid: string }> {
return (
await APIClient.exec({
uri: `/vm/create`,
method: "POST",
jsonData: v,
})
).data;
}
/**
* Get the list of defined virtual machines
*/