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

@ -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
*/