Can remove disks files from UI

This commit is contained in:
2023-10-26 12:04:55 +02:00
parent bdb2f6427d
commit 9371d709a5
2 changed files with 94 additions and 20 deletions

View File

@ -27,6 +27,7 @@ export interface VMDisk {
// application attribute
new?: boolean;
deleteType?: "keepfile" | "deletefile";
}
interface VMInfoInterface {
@ -137,6 +138,12 @@ export class VMApi {
* Update the information about a single VM
*/
static async UpdateSingle(vm: VMInfo): Promise<VMInfo> {
// Process disks list, looking for removal
vm.disks = vm.disks.filter((d) => d.deleteType !== "keepfile");
vm.disks.forEach((d) => {
if (d.deleteType === "deletefile") d.delete = true;
});
const data = (
await APIClient.exec({
uri: `/vm/${vm.uuid!}`,