// 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 = `
scripts/backup/engines/${this.escape(engineId)}.json and run the WebUI regen.
${this.escape(data.tagline || '')}
${docsHTML}
` : ''} `; }, });