From 4f9cb43ac822e30570ac4fbc01cc877f13417d2d Mon Sep 17 00:00:00 2001 From: Paul Huliganga Date: Tue, 21 Apr 2026 15:03:18 -0400 Subject: [PATCH] feat(templates): expandable failure details in detail history tab MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rows with errors, blockers, or warnings now show a 'â–ļ click for details' hint and expand inline on click, matching the behaviour in History & Audit. Co-Authored-By: Claude Sonnet 4.6 --- web/static/js/templates.js | 45 ++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/web/static/js/templates.js b/web/static/js/templates.js index f477d7f..7b95943 100644 --- a/web/static/js/templates.js +++ b/web/static/js/templates.js @@ -444,23 +444,50 @@ function _renderDetailTab(t, tabKey) { if (!records.length) { content.innerHTML = `
â„šī¸No migration history for this template yet.
`; } else { + const rows = [...records].reverse().map(r => { + const hasDetail = r.error || (r.blockers||[]).length || (r.warnings||[]).length; + const detailHtml = hasDetail ? ` + + +
+ ${(r.blockers||[]).map(b => `
đŸšĢ ${escHtml(b)}
`).join('')} + ${(r.warnings||[]).map(w => `
⚠ ${escHtml(w)}
`).join('')} + ${r.error ? `
❌ ${escHtml(r.error)}
` : ''} +
+ + ` : ''; + return ` + + ${(r.timestamp||'').slice(0,19).replace('T',' ')} + ${escHtml(r.action||'—')} + + ${r.status} + ${hasDetail ? 'â–ļ click for details' : ''} + + ${escHtml(r.docusign_template_id||'—')} + ${detailHtml}`; + }).join(''); + content.innerHTML = `
- - ${[...records].reverse().map(r => ` - - - - - - `).join('')} - + ${rows}
TimeActionStatusDocusign ID
${(r.timestamp||'').slice(0,19).replace('T',' ')}${escHtml(r.action||'—')}${r.status}${escHtml(r.docusign_template_id||'—')}
`; + + content.querySelectorAll('.row-expandable').forEach(row => { + row.addEventListener('click', () => { + const next = row.nextElementSibling; + if (next?.classList.contains('row-expanded-content')) { + const open = next.style.display !== 'none'; + next.style.display = open ? 'none' : 'table-row'; + row.querySelector('span[style*="text-muted"]').textContent = open ? 'â–ļ click for details' : 'â–ŧ hide details'; + } + }); + }); } }).catch(() => { content.innerHTML = `
❌Failed to load history.
`;