// Auto-extracted from backup-page.js (verbatim) — augments BackupPage.prototype. Loaded after the base. Object.assign(BackupPage.prototype, { enhanceEngineDetailsButton() { const selector = '[name="CFG_BACKUP_ENGINE"], [name^="CFG_BACKUP_LOC_"][name$="_ENGINE"]'; document.querySelectorAll(`#config-section ${selector}, .backup-location-details ${selector}`).forEach((engineInput) => { const customSelect = engineInput.closest('.custom-select'); const wrapTarget = customSelect || engineInput; const group = wrapTarget.closest('.field-group') || wrapTarget.parentElement; if (!group || group.dataset.engineDetailsBound === '1') return; group.dataset.engineDetailsBound = '1'; const btn = document.createElement('button'); btn.type = 'button'; btn.className = 'backup-secondary-btn backup-engine-details-btn'; btn.dataset.action = 'open-engine-details'; btn.innerHTML = ` Details `; const wrap = document.createElement('div'); wrap.className = 'backup-engine-input-row'; wrapTarget.parentNode.insertBefore(wrap, wrapTarget); wrap.appendChild(wrapTarget); wrap.appendChild(btn); }); }, async openEngineDetailsModal(triggerEl) { const modal = document.getElementById('backup-engine-modal'); const body = document.getElementById('backup-engine-modal-body'); const title = document.getElementById('backup-engine-modal-title'); if (!modal || !body) return; // Find the engine select adjacent to the Details button that fired // this event so per-location Details work even when the user has // changed the select but not saved yet. let engineId = (window.systemConfigs?.CFG_BACKUP_ENGINE || 'restic').trim(); const row = triggerEl?.closest('.backup-engine-input-row'); const sel = row?.querySelector('select, input'); if (sel && sel.value) engineId = sel.value.trim(); body.innerHTML = `
Loading engine details…
`; modal.classList.add('open'); const data = await this.fetchJson(`/data/backup/generated/engines/${encodeURIComponent(engineId)}.json?t=${Date.now()}`); if (!data) { body.innerHTML = `
No details file for engine "${this.escape(engineId)}".
Add scripts/backup/engines/${this.escape(engineId)}.json and run the WebUI regen.
`; return; } if (title) title.textContent = `Backup engine: ${data.name || engineId}`; const propsHTML = (data.properties || []).map(p => `${this.escape(p.label)}${this.escape(p.value)}` ).join(''); const featsHTML = (data.features || []).map(f => `
  • ${this.escape(f)}
  • `).join(''); const docsHTML = data.docs_url ? `${this.escape(data.docs_url)} ↗` : ''; const logoHTML = data.logo ? `` : ''; body.innerHTML = `
    ${logoHTML}

    ${this.escape(data.name || engineId)}

    ${this.escape(data.tagline || '')}

    ${propsHTML ? `${propsHTML}
    ` : ''} ${featsHTML ? `
    Highlights
    ` : ''} ${docsHTML ? `
    Documentation

    ${docsHTML}

    ` : ''} `; }, });