bootstrap frontend
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Has been cancelled
This commit is contained in:
1 parent
43888e5796
commit
ec54166f8f
24 files changed
+414
-890
No files matched your search
+29
-29
@@ -7,12 +7,10 @@ const upload_image_button = document.querySelector("#upload_image_button");
|
||||
const upload_image_input = document.querySelector("#upload_image_input");
|
||||
const update_block = document.querySelector("#update_block");
|
||||
const uploadprogress_block = document.querySelector("#uploadprogress");
|
||||
const upload_progress_bar = document.querySelector("#uploadbar");
|
||||
const upload_percents = document.querySelector("#uploadpercent");
|
||||
|
||||
const update_image_button = document.querySelector("#update_image_button");
|
||||
const updateprogress = document.querySelector("#updateprogress");
|
||||
const updatebar = document.querySelector("#updatebar");
|
||||
const updatepercent = document.querySelector("#updatepercent");
|
||||
|
||||
let progress = 0;
|
||||
@@ -36,33 +34,35 @@ upload_image_button.addEventListener("click", () => {
|
||||
});
|
||||
|
||||
update_image_button.addEventListener("click", () => {
|
||||
updatebar.style.width = "0%";
|
||||
updatepercent.innerHTML = "Updated: 0 %";
|
||||
updateprogress.classList.remove("hidden");
|
||||
start_progress();
|
||||
fetch(routes.update_image(), {
|
||||
method: "Post",
|
||||
body: `{"token":"${localStorage.getItem("token")}", "needAutoReboot": ${auto_reboot_flag.checked}}`,
|
||||
})
|
||||
.then((data) => data.json())
|
||||
.then((jsondata) => {
|
||||
if (jsondata.success === true) {
|
||||
stop_progress();
|
||||
notification("Updated successful", "success");
|
||||
updatebar.style.width = "100%";
|
||||
updatepercent.innerHTML = "Updated: 100 %";
|
||||
} else {
|
||||
stop_progress();
|
||||
updatebar.style.width = "100%";
|
||||
updatepercent.innerHTML = "Updated: 100 %";
|
||||
notification("Unexpected error", "error");
|
||||
}
|
||||
});
|
||||
if (confirm("Start Update Firmware?")) {
|
||||
updatepercent.style.width = "0%";
|
||||
updatepercent.innerHTML = "Updated: 0 %";
|
||||
updateprogress.classList.remove("hidden");
|
||||
start_progress();
|
||||
fetch(routes.update_image(), {
|
||||
method: "Post",
|
||||
body: `{"token":"${localStorage.getItem("token")}", "needAutoReboot": ${auto_reboot_flag.checked}}`,
|
||||
})
|
||||
.then((data) => data.json())
|
||||
.then((jsondata) => {
|
||||
if (jsondata.success === true) {
|
||||
stop_progress();
|
||||
notification("Updated successful", "success");
|
||||
updatepercent.style.width = "100%";
|
||||
updatepercent.innerHTML = "Updated: 100 %";
|
||||
} else {
|
||||
stop_progress();
|
||||
updatepercent.style.width = "100%";
|
||||
updatepercent.innerHTML = "Updated: 100 %";
|
||||
notification("Unexpected error", "error");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const upload_firmware_image = async () => {
|
||||
upload_percents.innerHTML = "Upload progress 0 %";
|
||||
upload_progress_bar.style.width = "0%";
|
||||
upload_percents.style.width = "0%";
|
||||
uploadprogress_block.classList.remove("hidden");
|
||||
let image = upload_image_input.files[0];
|
||||
let formData = new FormData();
|
||||
@@ -73,12 +73,12 @@ const upload_firmware_image = async () => {
|
||||
var file1Size = image.size;
|
||||
if (e.loaded <= file1Size) {
|
||||
var percent = Math.round((e.loaded / file1Size) * 100);
|
||||
upload_progress_bar.style.width = `${percent}%`;
|
||||
upload_percents.style.width = `${percent}%`;
|
||||
upload_percents.innerHTML = `Upload progress ${percent} %`;
|
||||
}
|
||||
|
||||
if (e.loaded == e.total) {
|
||||
upload_progress_bar.style.width = "100%";
|
||||
upload_percents.style.width = "100%";
|
||||
upload_percents.innerHTML = "Upload progress 100 %";
|
||||
}
|
||||
});
|
||||
@@ -106,7 +106,7 @@ upload_image_input.addEventListener("change", (event) => {
|
||||
});
|
||||
|
||||
const start_progress = () => {
|
||||
updatebar.style.width = "0%";
|
||||
updatepercent.style.width = "0%";
|
||||
progress = 0;
|
||||
updatepercent.innerHTML = "Updated: 0 %";
|
||||
updateprogress.classList.remove("hidden");
|
||||
@@ -115,7 +115,7 @@ const start_progress = () => {
|
||||
.then((data) => data.json())
|
||||
.then((jsondata) => {
|
||||
progress = jsondata.progress;
|
||||
updatebar.style.width = `${progress}%`;
|
||||
updatepercent.style.width = `${progress}%`;
|
||||
updatepercent.innerHTML = `Updated: ${progress} %`;
|
||||
if (progress === 100) {
|
||||
stop_progress();
|
||||
|
||||
Reference in new issue
Block a user