added better clear buttons

This commit is contained in:
DeSqBlocki committed 2025-12-06 19:06:06 +01:00
1 parent 81f8bc26e3
commit a951e6321d
4 files changed
+36 -40

No files matched your search

-11
View File
@@ -96,17 +96,6 @@ header h1 {
/* ===============================
BUTTONS
=============================== */
.btn-danger {
background-color: #8A190B; /* deeper red accent */
border: none;
color: white;
transition: background 0.3s ease;
}
.btn-danger:hover {
background-color: #A32012;
}
button,
.btn {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
+10
View File
@@ -47,4 +47,14 @@ router.post("/clear-failed", async (req, res) => {
res.redirect("/status");
});
router.post("/clear-done", async (req, res) => {
const db = await getDb();
await db
.collection("done")
.deleteMany({}) //delete all
// Redirect to status, controller fetches everything
res.redirect("/status");
});
module.exports = router;
-5
View File
@@ -17,8 +17,6 @@
<button class="btn btn-danger btn-sm">⚠ Clear CAPTCHA</button>
</form>
</div>
<div class="container-fluid py-4" style="max-width: 2000px;">
<!-- HEADER -->
<header class="d-flex justify-content-between align-items-center mb-4">
@@ -26,9 +24,6 @@
<nav class="d-flex gap-2">
<a class="btn btn-outline-light" href="/">Home</a>
<a class="btn btn-outline-light" href="/status">Status</a>
<form id="clear-failed-form" action="/clear-failed" method="POST" class="d-inline ms-2">
<button class="btn btn-warning">🗑 Clear Failed</button>
</form>
</nav>
</header>
+26 -24
View File
@@ -5,8 +5,10 @@
<!-- ======================= -->
<!-- QUEUED -->
<!-- ======================= -->
<div class="col-md-3">
<h3>Queued</h3>
<div class="col-md-3 text-center">
<div class="d-flex justify-content-center align-items-center mb-2">
<h3 class="mb-0">Queued</h3>
</div>
<ul class="list-group" id="queuedList">
<% queued.forEach(job => { %>
<li class="list-group-item">
@@ -24,21 +26,20 @@
<!-- ======================= -->
<!-- PROCESSING -->
<!-- ======================= -->
<div class="col-md-3">
<h3 style="color:#58a6ff">Processing</h3>
<div class="col-md-3 text-center">
<div class="d-flex justify-content-center align-items-center mb-2">
<h3 class="mb-0" style="color:#58a6ff">Processing</h3>
</div>
<ul class="list-group" id="processingList">
<% processing.forEach(job => { %>
<li class="list-group-item">
<strong style="color:#58a6ff"><%= job.filename %></strong>
<span class="spinner-border spinner-border-sm ms-2" style="color:#58a6ff"></span><br>
<small><%= job.url %></small><br>
<small>Started: <%= new Date(job.created_at).toLocaleString() %></small>
<% if (job.fileSize) { %>
<br><small>Downloaded: <%= job.fileSize %></small>
<% } %>
<% if (job.output_log) { %>
<details class="mt-2">
<summary class="text-light">Live Log</summary>
@@ -49,30 +50,32 @@
<% } %>
</li>
<% }) %>
<% if (processing.length === 0) { %>
<li class="list-group-item">Nothing processing</li>
<% } %>
</ul>
</div>
<!-- ======================= -->
<!-- DONE -->
<!-- ======================= -->
<div class="col-md-3">
<h3 class="text-success">Done</h3>
<div class="col-md-3 text-center">
<div class="d-flex justify-content-center align-items-center mb-2">
<h3 class="text-success mb-0">Done</h3>
<form id="clear-done-form" action="/clear-done" method="POST" class="ms-2">
<button class="btn btn-success btn-sm shadow-sm rounded-pill">
🗑️
</button>
</form>
</div>
<ul class="list-group" id="doneList">
<% finished.forEach(job => { %>
<li class="list-group-item">
<strong class="text-success"><%= job.filename %></strong><br />
<small><%= new Date(job.finished_at).toLocaleString() %></small><br>
<% if (job.fileSize) { %>
<small>Size: <%= job.fileSize %></small><br>
<% } %>
<% if (job.output_log) { %>
<details class="mt-2">
<summary class="text-light">Show Log</summary>
@@ -81,29 +84,31 @@
</pre>
</details>
<% } %>
</li>
<% }) %>
<% if (finished.length === 0) { %>
<li class="list-group-item">No completed jobs</li>
<% } %>
</ul>
</div>
<!-- ======================= -->
<!-- FAILED -->
<!-- ======================= -->
<div class="col-md-3">
<h3 class="text-danger">Failed</h3>
<div class="col-md-3 text-center">
<div class="d-flex justify-content-center align-items-center mb-2">
<h3 class="text-danger mb-0">Failed</h3>
<form id="clear-failed-form" action="/clear-failed" method="POST" class="ms-2">
<button class="btn btn-danger btn-sm shadow-sm rounded-pill">
🗑️
</button>
</form>
</div>
<ul class="list-group" id="failedList">
<% failed.forEach(job => { %>
<li class="list-group-item">
<strong class="text-danger"><%= job.filename %></strong><br />
<small><%= new Date(job.failed_at).toLocaleString() %></small><br>
<% if (job.output_log) { %>
<details class="mt-2">
<summary class="text-danger">Show Error Log</summary>
@@ -112,14 +117,11 @@
</pre>
</details>
<% } %>
</li>
<% }) %>
<% if (failed.length === 0) { %>
<li class="list-group-item">No failed jobs</li>
<% } %>
</ul>
</div>