diff --git a/web/pqueue.js b/web/pqueue.js
index 5a8a4ea..10b6e65 100644
--- a/web/pqueue.js
+++ b/web/pqueue.js
@@ -20,6 +20,7 @@
history: [],
container: null,
listPending: null,
+ selectedPending: new Set(),
};
function el(tag, attrs={}, children=[]) {
@@ -54,8 +55,15 @@
pauseBtn.innerHTML = `${state.paused ? 'Resume' : 'Pause'}`;
const refreshBtn = el('button', { id: 'pqueue-refresh', class: 'p-button p-component p-button-text' });
refreshBtn.innerHTML = `Refresh`;
+ const runningCount = el('span', { class: 'p-tag p-tag-rounded p-tag-info', text: `Running ${state.queue_running.length}` });
+ const pendingCount = el('span', { class: 'p-tag p-tag-rounded p-tag-secondary', text: `Pending ${state.queue_pending.length}` });
+ const clearBtn = el('button', { id: 'pqueue-clear', class: 'p-button p-component p-button-text p-button-danger' });
+ clearBtn.innerHTML = `Clear Pending`;
toolbar.appendChild(pauseBtn);
toolbar.appendChild(refreshBtn);
+ toolbar.appendChild(runningCount);
+ toolbar.appendChild(pendingCount);
+ toolbar.appendChild(clearBtn);
const sections = el('div', { class: 'pqueue-sections' });
@@ -140,6 +148,16 @@
await refresh();
};
document.getElementById('pqueue-refresh').onclick = refresh;
+ const clearBtn = document.getElementById('pqueue-clear');
+ if (clearBtn) {
+ clearBtn.onclick = async () => {
+ const ids = Array.from(document.querySelectorAll('#pqueue-pending li[data-id]')).map(li => li.dataset.id);
+ if (ids.length) {
+ await API.del(ids);
+ await refresh();
+ }
+ };
+ }
const list = document.getElementById('pqueue-pending');
let dragged;