mirror of
https://github.com/karma-riuk/crab-webapp.git
synced 2025-07-05 14:18:12 +02:00
added some visibility handling
This commit is contained in:
@ -28,6 +28,9 @@ document.getElementById("download-dataset").onclick = () => {
|
|||||||
|
|
||||||
// Upload logic
|
// Upload logic
|
||||||
document.getElementById("upload-btn").onclick = async () => {
|
document.getElementById("upload-btn").onclick = async () => {
|
||||||
|
statusEl.classList.add("hidden");
|
||||||
|
progressContainer.classList.add("hidden");
|
||||||
|
|
||||||
const type = document.getElementById("answer-cype").value;
|
const type = document.getElementById("answer-cype").value;
|
||||||
const fileInput = document.getElementById("file-cnput");
|
const fileInput = document.getElementById("file-cnput");
|
||||||
if (!fileInput.files.length) {
|
if (!fileInput.files.length) {
|
||||||
@ -108,6 +111,7 @@ document.getElementById("upload-btn").onclick = async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function setProgress(percent) {
|
function setProgress(percent) {
|
||||||
|
progressContainer.classList.remove("hidden");
|
||||||
progressBar.value = percent;
|
progressBar.value = percent;
|
||||||
progressText.textContent = `${percent.toFixed(0)}%`;
|
progressText.textContent = `${percent.toFixed(0)}%`;
|
||||||
}
|
}
|
||||||
@ -121,11 +125,11 @@ socket.on("progress", (data) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on("started-processing", () => {
|
socket.on("started-processing", () => {
|
||||||
progressContainer.classList.remove("hidden");
|
|
||||||
setProgress(0);
|
setProgress(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("successful-upload", () => {
|
socket.on("successful-upload", () => {
|
||||||
|
statusEl.classList.remove("hidden");
|
||||||
statusEl.style.color = "green";
|
statusEl.style.color = "green";
|
||||||
statusEl.textContent = "Upload succeeded!";
|
statusEl.textContent = "Upload succeeded!";
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user