mirror of
https://github.com/0ceanSlim/grain.git
synced 2024-10-30 01:26:32 +00:00
import spinner working
This commit is contained in:
parent
a2f7f0a5b4
commit
41c7998831
@ -63,7 +63,7 @@ func ImportEvents(w http.ResponseWriter, r *http.Request) {
|
|||||||
renderResult(w, true, "Events imported successfully", totalEvents)
|
renderResult(w, true, "Events imported successfully", totalEvents)
|
||||||
case err := <-errorChan:
|
case err := <-errorChan:
|
||||||
renderResult(w, false, err.Error(), 0)
|
renderResult(w, false, err.Error(), 0)
|
||||||
case <-time.After(5 * time.Minute):
|
case <-time.After(10 * time.Minute): // Increase timeout for large imports
|
||||||
renderResult(w, false, "Timeout importing events", 0)
|
renderResult(w, false, "Timeout importing events", 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div id="spinner" class="spinner"></div>
|
<div id="spinner" class="spinner" style="display: none"></div>
|
||||||
<div id="result" class="p-2 m-2 text-xl font-bold"></div>
|
<div id="result" class="p-2 m-2 text-xl font-bold"></div>
|
||||||
<button
|
<button
|
||||||
hx-get="/"
|
hx-get="/"
|
||||||
@ -56,9 +56,11 @@
|
|||||||
document.getElementById("spinner").style.display = "block";
|
document.getElementById("spinner").style.display = "block";
|
||||||
});
|
});
|
||||||
|
|
||||||
document
|
document.addEventListener("htmx:afterRequest", function () {
|
||||||
.getElementById("result")
|
document.getElementById("spinner").style.display = "none";
|
||||||
.addEventListener("htmx:afterRequest", function () {
|
});
|
||||||
|
|
||||||
|
document.addEventListener("htmx:requestError", function () {
|
||||||
document.getElementById("spinner").style.display = "none";
|
document.getElementById("spinner").style.display = "none";
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user