added more clears
This commit is contained in:
1 parent
163df8b343
commit
c1675a19a4
2 files changed
+31
-19
No files matched your search
@@ -57,4 +57,24 @@ router.post("/clear-done", async (req, res) => {
|
|||||||
res.redirect("/status");
|
res.redirect("/status");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.post("/clear-processing", async (req, res) => {
|
||||||
|
const db = await getDb();
|
||||||
|
await db
|
||||||
|
.collection("queue")
|
||||||
|
.updateMany({}, { $unset: { "processing": ""}})
|
||||||
|
|
||||||
|
// Redirect to status, controller fetches everything
|
||||||
|
res.redirect("/status");
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post("/clear-queued", async (req, res) => {
|
||||||
|
const db = await getDb();
|
||||||
|
await db
|
||||||
|
.collection("queue")
|
||||||
|
.deleteMany({}) //delete all
|
||||||
|
|
||||||
|
// Redirect to status, controller fetches everything
|
||||||
|
res.redirect("/status");
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
+11
-19
@@ -8,6 +8,11 @@
|
|||||||
<div class="col-md-3 text-center">
|
<div class="col-md-3 text-center">
|
||||||
<div class="d-flex justify-content-center align-items-center mb-2">
|
<div class="d-flex justify-content-center align-items-center mb-2">
|
||||||
<h3 class="mb-0">Queued</h3>
|
<h3 class="mb-0">Queued</h3>
|
||||||
|
<form id="clear-queued-form" action="/clear-queued" method="POST" class="ms-2">
|
||||||
|
<button class="btn btn-success btn-sm shadow-sm rounded-pill">
|
||||||
|
🗑️
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<ul class="list-group" id="queuedList">
|
<ul class="list-group" id="queuedList">
|
||||||
<% queued.forEach(job => { %>
|
<% queued.forEach(job => { %>
|
||||||
@@ -29,6 +34,11 @@
|
|||||||
<div class="col-md-3 text-center">
|
<div class="col-md-3 text-center">
|
||||||
<div class="d-flex justify-content-center align-items-center mb-2">
|
<div class="d-flex justify-content-center align-items-center mb-2">
|
||||||
<h3 class="mb-0" style="color:#58a6ff">Processing</h3>
|
<h3 class="mb-0" style="color:#58a6ff">Processing</h3>
|
||||||
|
<form id="clear-processing-form" action="/clear-processing" method="POST" class="ms-2">
|
||||||
|
<button class="btn btn-success btn-sm shadow-sm rounded-pill">
|
||||||
|
🗑️
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<ul class="list-group" id="processingList">
|
<ul class="list-group" id="processingList">
|
||||||
<% processing.forEach(job => { %>
|
<% processing.forEach(job => { %>
|
||||||
@@ -135,26 +145,8 @@
|
|||||||
<pre id="pm2Logs" style="background:#383838; padding:10px; border-radius:5px; height:300px; overflow-y:auto; white-space:pre-wrap; color: #330000;"></pre>
|
<pre id="pm2Logs" style="background:#383838; padding:10px; border-radius:5px; height:300px; overflow-y:auto; white-space:pre-wrap; color: #330000;"></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- SCRIPT TO BE IMPLEMENTED! -->
|
||||||
|
|
||||||
<script>
|
|
||||||
async function fetchLogs() {
|
|
||||||
try {
|
|
||||||
const res = await fetch('../../../.pm2/logs/proxerdl-worker1-out.log');
|
|
||||||
const text = await res.text();
|
|
||||||
document.getElementById('pm2Logs').textContent = text;
|
|
||||||
// auto-scroll to bottom
|
|
||||||
const logDiv = document.getElementById('pm2Logs');
|
|
||||||
logDiv.scrollTop = logDiv.scrollHeight;
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching logs:', err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// fetch logs every 2 seconds
|
|
||||||
setInterval(fetchLogs, 2000);
|
|
||||||
// initial fetch
|
|
||||||
fetchLogs();
|
|
||||||
</script>
|
|
||||||
<!-- ======================= -->
|
<!-- ======================= -->
|
||||||
<!-- AUTO-REFRESH SCRIPT -->
|
<!-- AUTO-REFRESH SCRIPT -->
|
||||||
<!-- ======================= -->
|
<!-- ======================= -->
|
||||||
|
|||||||
Reference in new issue
Block a user