add saving cpu and memory resource values on exit
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
17f243a006
commit
8dbc9d5552
@ -28,7 +28,7 @@
|
||||
</fieldset>
|
||||
<fieldset class="fieldset-no-border">
|
||||
<div class="btn-group" id="form-actions">
|
||||
<button id="cancel" type="button">EXIT</button>
|
||||
<button id="exit" type="button">EXIT</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
@ -26,14 +26,12 @@ async function init () {
|
||||
populateResources();
|
||||
populateDisk();
|
||||
|
||||
let cancelButton = document.querySelector("#cancel");
|
||||
cancelButton.addEventListener("click", () => {
|
||||
goToPage("index.html");
|
||||
});
|
||||
document.querySelector("#exit").addEventListener("click", handleFormExit);
|
||||
}
|
||||
|
||||
async function getConfig () {
|
||||
config = await requestPVE(`/nodes/${node}/${type}/${vmid}/config`, "GET");
|
||||
console.log(config);
|
||||
}
|
||||
|
||||
function populateResources () {
|
||||
@ -467,3 +465,22 @@ async function handleCDAdd () {
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
async function handleFormExit () {
|
||||
let body = {
|
||||
node: node,
|
||||
type: type,
|
||||
vmid: vmid,
|
||||
cores: document.querySelector("#Cores").value,
|
||||
memory: document.querySelector("#Memory").value
|
||||
}
|
||||
let result = await requestAPI("/resources", "POST", body);
|
||||
if (result.status === 200) {
|
||||
await getConfig();
|
||||
populateDisk();
|
||||
}
|
||||
else {
|
||||
console.error(result);
|
||||
}
|
||||
goToPage("index.html");
|
||||
}
|
Loading…
Reference in New Issue
Block a user