Can view from web UI XML definition of domains

This commit is contained in:
2023-12-08 18:14:01 +01:00
parent 74b77be013
commit 82447a0018
13 changed files with 632 additions and 135 deletions

View File

@ -106,7 +106,14 @@ export class APIClient {
// JSON response
if (res.headers.get("content-type") === "application/json")
data = await res.json();
// Binary file
// Text / XML response
else if (
["application/xml", "text/plain"].includes(
res.headers.get("content-type") ?? ""
)
)
data = await res.text();
// Binary file, tracking download progress
else if (res.body !== null && args.downProgress) {
// Track download progress
const contentEncoding = res.headers.get("content-encoding");

View File

@ -113,6 +113,10 @@ export class VMInfo implements VMInfoInterface {
get VNCURL(): string {
return `/vm/${this.uuid}/vnc`;
}
get XMLURL(): string {
return `/vm/${this.uuid}/xml`;
}
}
export class VMApi {
@ -154,6 +158,18 @@ export class VMApi {
return new VMInfo(data);
}
/**
* Get the source XML configuration of a domain for debugging purposes
*/
static async GetSingleXML(uuid: string): Promise<string> {
return (
await APIClient.exec({
uri: `/vm/${uuid}/src`,
method: "GET",
})
).data;
}
/**
* Update the information about a single VM
*/