Remove ImportDialog and all manual credential management. The browser handles 401 challenges natively for same-origin fetch requests — it shows its own credential prompt, retries, and caches the result for the session. No JS-level auth code is needed. - api.js: remove authHeader() and all credentials parameters - store.js: remove credentials field - ImportDialog.js: deleted - AppShell.js: remove showImport/openImport/onMounted dialog machinery; pass importOnLoad through to PaneCP - PaneCP.js: inline doImport() (was in ImportDialog); auto-triggers on mount when importOnLoad is true; shows inline import error on failure - StatusPoller.js: remove credentials arg from fetchStatus() - style.css: remove .se-import-dialog and .se-overlay blocks
47 lines
1.5 KiB
JavaScript
47 lines
1.5 KiB
JavaScript
import { h, onMounted, onUnmounted, ref } from 'vue';
|
|
import { fetchStatus } from '../api.js';
|
|
|
|
export const StatusPoller = {
|
|
props: ['store'],
|
|
setup(props) {
|
|
const timer = ref(null);
|
|
|
|
async function poll() {
|
|
try {
|
|
const status = await fetchStatus();
|
|
props.store.synthesisStatus = status;
|
|
if (status.frozen) return;
|
|
} catch (_) {
|
|
// transient — keep polling
|
|
}
|
|
timer.value = setTimeout(poll, 2000);
|
|
}
|
|
|
|
onMounted(() => { poll(); });
|
|
onUnmounted(() => { if (timer.value) clearTimeout(timer.value); });
|
|
|
|
return () => {
|
|
const s = props.store.synthesisStatus;
|
|
if (!s) return h('div', { class: 'se-status' }, 'Polling…');
|
|
|
|
const total = s.notes_in_total ?? 0;
|
|
const done = s.currently_rendered_notes ?? 0;
|
|
const pct = total > 0 ? Math.min(100, Math.round(done / total * 100)) : 0;
|
|
|
|
let label;
|
|
if (s.frozen) {
|
|
label = s.errors ? `Error: ${s.errors}` : 'Done';
|
|
} else {
|
|
label = s.remaining_time ?? `Synthesizing… ${pct}%`;
|
|
}
|
|
|
|
return h('div', { class: 'se-status' }, [
|
|
h('span', null, label),
|
|
h('div', { class: 'se-status-progress' }, [
|
|
h('div', { class: 'se-status-bar', style: { width: `${pct}%` } }),
|
|
]),
|
|
]);
|
|
};
|
|
},
|
|
};
|