diff --git a/webui/app.js b/webui/app.js
index 98192bd..37a11ed 100644
--- a/webui/app.js
+++ b/webui/app.js
@@ -68,7 +68,34 @@ function setBusy(button, busy) {
}
function confirmAction(message) {
- return window.confirm(message);
+ return new Promise((resolve) => {
+ let settled = false;
+ const done = (value) => {
+ if (settled) return;
+ settled = true;
+ if (dialog.open) dialog.close();
+ resolve(value);
+ };
+ let dialog = document.getElementById('confirm-dialog');
+ if (!dialog) {
+ dialog = document.createElement('dialog');
+ dialog.id = 'confirm-dialog';
+ dialog.className = 'confirm-dialog';
+ dialog.innerHTML =
+ '
Confirm
' +
+ '
' +
+ '
' +
+ '' +
+ '' +
+ '
';
+ document.body.appendChild(dialog);
+ }
+ dialog.querySelector('.confirm-dialog-message').textContent = message;
+ dialog.querySelector('[data-confirm-ok]').onclick = () => done(true);
+ dialog.querySelector('[data-confirm-cancel]').onclick = () => done(false);
+ dialog.onclose = () => done(false);
+ if (!dialog.open) dialog.showModal();
+ });
}
function showToast(message, type = 'info') {
@@ -202,7 +229,7 @@ function renderAccountPanel(accountId) {
(item) => item.value,
);
if (!runAllTracked && channels.length === 0 && enabled) {
- if (!confirmAction('Continuous scraping enabled with no selected channels. Save anyway?')) return;
+ if (!(await confirmAction('Continuous scraping enabled with no selected channels. Save anyway?'))) return;
}
const resp = await api(`/api/accounts/${accountId}/continuous`, {
method: 'POST',
@@ -289,15 +316,17 @@ function updateSidebarAccount() {
const acc = state.accounts.find((a) => a.id === state.activeAccount);
const nameEl = document.getElementById('active-account-name');
const statusEl = document.getElementById('active-account-status');
+ if (!nameEl || !statusEl) return;
+ statusEl.classList.remove('is-ok', 'is-error', 'is-dim');
if (acc) {
nameEl.textContent = acc.label || acc.id;
const authOk = isAccountAuthorized(acc.auth);
statusEl.textContent = authOk ? 'Authorized session' : 'Needs login';
- statusEl.style.color = authOk ? 'var(--ok)' : 'var(--danger)';
+ statusEl.classList.add(authOk ? 'is-ok' : 'is-error');
} else {
nameEl.textContent = 'None';
statusEl.textContent = 'Add an account in Settings';
- statusEl.style.color = 'var(--dim)';
+ statusEl.classList.add('is-dim');
}
}
@@ -313,7 +342,7 @@ function renderChannels(accountId, channels) {
if (!channels.length) {
const row = document.createElement('tr');
row.innerHTML =
- 'No jobs yet. Start a scrape or export to see progress here.
';
+ root.innerHTML = 'Per-account channel list.