update client for api changes
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
1be6566527
commit
83a310095f
@ -16,10 +16,9 @@ async function init () {
|
|||||||
goToPage("login.html");
|
goToPage("login.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
let resources = await requestAPI("/user/resources");
|
let user = await requestAPI("/user");
|
||||||
resources = resources.resources;
|
let resources = user.resources;
|
||||||
let instances = await requestAPI("/user/instances");
|
let instances = user.instances;
|
||||||
instances = instances.instances;
|
|
||||||
document.querySelector("#username").innerHTML += getCookie("username");
|
document.querySelector("#username").innerHTML += getCookie("username");
|
||||||
document.querySelector("#pool").innerHTML += instances.pool;
|
document.querySelector("#pool").innerHTML += instances.pool;
|
||||||
document.querySelector("#vmid").innerHTML += `[${instances.vmid.min},${instances.vmid.max}]`;
|
document.querySelector("#vmid").innerHTML += `[${instances.vmid.min},${instances.vmid.max}]`;
|
||||||
|
@ -189,7 +189,7 @@ async function handleDiskDetach () {
|
|||||||
vmid: vmid,
|
vmid: vmid,
|
||||||
disk: this.dataset.disk
|
disk: this.dataset.disk
|
||||||
};
|
};
|
||||||
let result = await requestAPI("/disk/detach", "POST", body);
|
let result = await requestAPI("/instance/disk/detach", "POST", body);
|
||||||
if (result.status === 200) {
|
if (result.status === 200) {
|
||||||
await getConfig();
|
await getConfig();
|
||||||
populateDisk();
|
populateDisk();
|
||||||
@ -225,7 +225,7 @@ async function handleDiskAttach () {
|
|||||||
disk: `${type === "qemu" ? "sata" : "mp"}${device}`,
|
disk: `${type === "qemu" ? "sata" : "mp"}${device}`,
|
||||||
data: type === "lxc" ? diskImage + `,mp=/mp${device}/` : diskImage
|
data: type === "lxc" ? diskImage + `,mp=/mp${device}/` : diskImage
|
||||||
}
|
}
|
||||||
let result = await requestAPI("/disk/attach", "POST", body);
|
let result = await requestAPI("/instance/disk/attach", "POST", body);
|
||||||
if (result.status === 200) {
|
if (result.status === 200) {
|
||||||
await getConfig();
|
await getConfig();
|
||||||
populateDisk();
|
populateDisk();
|
||||||
@ -258,7 +258,7 @@ async function handleDiskResize () {
|
|||||||
disk: this.dataset.disk,
|
disk: this.dataset.disk,
|
||||||
size: form.get("size-increment")
|
size: form.get("size-increment")
|
||||||
}
|
}
|
||||||
let result = await requestAPI("/disk/resize", "POST", body);
|
let result = await requestAPI("/instance/disk/resize", "POST", body);
|
||||||
if (result.status === 200) {
|
if (result.status === 200) {
|
||||||
await getConfig();
|
await getConfig();
|
||||||
populateDisk();
|
populateDisk();
|
||||||
@ -308,7 +308,7 @@ async function handleDiskMove () {
|
|||||||
storage: form.get("storage-select"),
|
storage: form.get("storage-select"),
|
||||||
delete: form.get("delete-check") === "on" ? "1": "0"
|
delete: form.get("delete-check") === "on" ? "1": "0"
|
||||||
}
|
}
|
||||||
let result = await requestAPI("/disk/move", "POST", body);
|
let result = await requestAPI("/instance/disk/move", "POST", body);
|
||||||
if (result.status === 200) {
|
if (result.status === 200) {
|
||||||
await getConfig();
|
await getConfig();
|
||||||
populateDisk();
|
populateDisk();
|
||||||
@ -340,7 +340,7 @@ async function handleDiskDelete () {
|
|||||||
vmid: vmid,
|
vmid: vmid,
|
||||||
disk: this.dataset.disk
|
disk: this.dataset.disk
|
||||||
};
|
};
|
||||||
let result = await requestAPI("/disk/delete", "POST", body);
|
let result = await requestAPI("/instance/disk/delete", "POST", body);
|
||||||
if (result.status === 200) {
|
if (result.status === 200) {
|
||||||
await getConfig();
|
await getConfig();
|
||||||
populateDisk();
|
populateDisk();
|
||||||
@ -390,7 +390,7 @@ async function handleDiskAdd () {
|
|||||||
storage: form.get("storage-select"),
|
storage: form.get("storage-select"),
|
||||||
size: form.get("size")
|
size: form.get("size")
|
||||||
};
|
};
|
||||||
let result = await requestAPI("/disk/create", "POST", body);
|
let result = await requestAPI("/instance/disk/create", "POST", body);
|
||||||
if (result.status === 200) {
|
if (result.status === 200) {
|
||||||
await getConfig();
|
await getConfig();
|
||||||
populateDisk();
|
populateDisk();
|
||||||
@ -451,7 +451,7 @@ async function handleCDAdd () {
|
|||||||
disk: `ide${form.get("device")}`,
|
disk: `ide${form.get("device")}`,
|
||||||
iso: form.get("iso-select")
|
iso: form.get("iso-select")
|
||||||
};
|
};
|
||||||
let result = await requestAPI("/disk/create", "POST", body);
|
let result = await requestAPI("/instance/disk/create", "POST", body);
|
||||||
if (result.status === 200) {
|
if (result.status === 200) {
|
||||||
await getConfig();
|
await getConfig();
|
||||||
populateDisk();
|
populateDisk();
|
||||||
|
Loading…
Reference in New Issue
Block a user