Offer "Get files" for any import that lost its files
Models imported before 'partial' existed are stored as 'imported' with an error, so they'd never show the button. Mark them on startup, and key the button on the stored error rather than the status. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
11fe5c25aa
commit
cd95890296
2 changed files with 4 additions and 1 deletions
|
|
@ -30,6 +30,9 @@ function start() {
|
||||||
// A check that was running when the server stopped isn't running now.
|
// A check that was running when the server stopped isn't running now.
|
||||||
db.query(`UPDATE watched_collections SET last_status = NULL WHERE last_status = 'checking'`)
|
db.query(`UPDATE watched_collections SET last_status = NULL WHERE last_status = 'checking'`)
|
||||||
.catch((err) => console.warn('Could not clear stale watch checks:', err.message));
|
.catch((err) => console.warn('Could not clear stale watch checks:', err.message));
|
||||||
|
// Imports recorded before 'partial' existed: a model with an error kept none of its files.
|
||||||
|
db.query(`UPDATE watched_collection_items SET status = 'partial' WHERE status = 'imported' AND error IS NOT NULL`)
|
||||||
|
.catch((err) => console.warn('Could not mark file-less imports:', err.message));
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
timer = setInterval(() => { runDue().catch((err) => console.error('Collection watch failed:', err.message)); }, TICK_MS);
|
timer = setInterval(() => { runDue().catch((err) => console.error('Collection watch failed:', err.message)); }, TICK_MS);
|
||||||
if (timer.unref) timer.unref();
|
if (timer.unref) timer.unref();
|
||||||
|
|
|
||||||
|
|
@ -2200,7 +2200,7 @@ function watchHtml(w) {
|
||||||
${recent.length ? `<div class="watch-recent">${recent.map((i) => `
|
${recent.length ? `<div class="watch-recent">${recent.map((i) => `
|
||||||
<span>${i.model_id
|
<span>${i.model_id
|
||||||
? `<button type="button" class="link-btn" data-open-model="${i.model_id}">${escapeHtml(i.model_name || i.title || `Model ${i.model_id}`)}</button>`
|
? `<button type="button" class="link-btn" data-open-model="${i.model_id}">${escapeHtml(i.model_name || i.title || `Model ${i.model_id}`)}</button>`
|
||||||
: escapeHtml(i.title || i.design_id)}${i.error ? ` <span class="ai-run-error">${escapeHtml(i.error)}</span>` : ''}${i.status === 'partial' && i.model_id
|
: escapeHtml(i.title || i.design_id)}${i.error ? ` <span class="ai-run-error">${escapeHtml(i.error)}</span>` : ''}${i.error && i.model_id
|
||||||
? ` <button type="button" class="link-btn" data-watch="files" data-model-id="${i.model_id}">Get files</button>` : ''}</span>`).join('')}</div>` : ''}
|
? ` <button type="button" class="link-btn" data-watch="files" data-model-id="${i.model_id}">Get files</button>` : ''}</span>`).join('')}</div>` : ''}
|
||||||
</div>`;
|
</div>`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue