Prepare UI for disks backups

This commit is contained in:
2025-05-30 10:28:54 +02:00
parent a18310e04a
commit 83df7e1b20
7 changed files with 145 additions and 43 deletions

View File

@ -5,6 +5,7 @@
*/
import { APIClient } from "./ApiClient";
import { DiskImageFormat } from "./DiskImageApi";
export type VMState =
| "NoState"
@ -24,7 +25,7 @@ export interface BaseFileVMDisk {
name: string;
delete: boolean;
// application attribute
// application attributes
new?: boolean;
deleteType?: "keepfile" | "deletefile";
}
@ -384,4 +385,20 @@ export class VMApi {
encodeURIComponent(token)
);
}
/**
* Backup VM disk
*/
static async BackupDisk(
vm: VMInfo,
disk: VMFileDisk,
file_name: string,
format: DiskImageFormat
): Promise<void> {
await APIClient.exec({
uri: `/vm/${vm.uuid}/disk/${disk.name}/backup`,
method: "POST",
jsonData: { ...format, file_name },
});
}
}