feat: include job config and run history in export/import backup
Export bumped to version 3, now includes jobs (with raw unmasked config) and job_runs arrays. Import restores them when present and restarts the scheduler. Payloads without a jobs key leave jobs untouched, keeping v1/v2 backups fully compatible. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
8
js/ui.js
8
js/ui.js
@@ -382,15 +382,17 @@ async function importDB() {
|
||||
document.getElementById('confirm-ok').onclick = async () => {
|
||||
closeConfirm();
|
||||
try {
|
||||
const { instances, history = [] } = JSON.parse(await file.text());
|
||||
const { instances, history = [], jobs, job_runs } = JSON.parse(await file.text());
|
||||
const res = await fetch('/api/import', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ instances, history }),
|
||||
body: JSON.stringify({ instances, history, jobs, job_runs }),
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!res.ok) { showToast(data.error ?? 'Import failed', 'error'); return; }
|
||||
showToast(`Imported ${data.imported} instance${data.imported !== 1 ? 's' : ''}`, 'success');
|
||||
const parts = [`${data.imported} instance${data.imported !== 1 ? 's' : ''}`];
|
||||
if (data.imported_jobs != null) parts.push(`${data.imported_jobs} job${data.imported_jobs !== 1 ? 's' : ''}`);
|
||||
showToast(`Imported ${parts.join(', ')}`, 'success');
|
||||
closeSettingsModal();
|
||||
renderDashboard();
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user