feat(import-ui): deep scan button, sticky settings tabs, tasks-above-filters, fix Scanning-undefined source_path — Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

This commit is contained in:
2026-05-25 17:37:10 -04:00
parent 111b952535
commit f657582f30
4 changed files with 63 additions and 26 deletions
+13 -7
View File
@@ -52,25 +52,31 @@ export const useImportStore = defineStore('import', () => {
}
}
async function triggerScan() {
async function triggerScan(mode = 'quick') {
if (!['quick', 'deep', 'verify'].includes(mode)) {
throw new Error(`unsupported scan mode: ${mode}`)
}
triggerError.value = null
try {
await api.post('/api/import/trigger', { body: { mode: 'quick' } })
await api.post('/api/import/trigger', { body: { mode } })
// Acknowledge immediately so the click isn't invisible. scan_directory
// can finalize the batch synchronously when every file in /import is
// already on a non-failed ImportTask (operator-flagged 2026-05-25:
// 233k existing tasks → all paths in skip-set → files_seen=0 →
// batch flashes 'running' for <100ms then 'complete' before the
// first refreshStatus() lands; UI never sees the active state).
window.__fcToast?.({ text: 'Scan triggered', type: 'success' })
const label = mode === 'deep'
? 'Deep scan triggered (pHash backfill chained)'
: mode === 'verify' ? 'Library verify triggered' : 'Quick scan triggered'
window.__fcToast?.({ text: label, type: 'success' })
await refreshStatus()
// Re-poll twice over ~5s to catch quick-finalize transitions and
// surface a result toast either way.
// surface a result toast either way. Skip the "no new files" hint
// for 'verify' since it doesn't walk the import_root.
setTimeout(async () => {
await refreshStatus()
if (!activeBatch.value) {
// Either scan completed with zero new files, or it never visibly
// started. Fetch the freshest task to differentiate.
await loadTasks(true)
if (!activeBatch.value && mode !== 'verify') {
window.__fcToast?.({
text: 'Scan complete — no new files (everything already on an ImportTask row)',
type: 'info',