Can create VM from UI
This commit is contained in:
@ -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;
|
||||
|
@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user