diff --git a/djangorota/djangorota/templates/base.html b/djangorota/djangorota/templates/base.html index a1a02bd..c6f9fd0 100644 --- a/djangorota/djangorota/templates/base.html +++ b/djangorota/djangorota/templates/base.html @@ -162,6 +162,19 @@ if(triggers.includes('leaveUpdated')){ try{ console.debug('[DEBUG] htmx:afterRequest -> leaveUpdated'); if(window._calendars){ const cs = Object.values(window._calendars).filter(c=>c.refreshLeaves); console.debug('[DEBUG] afterRequest -> refreshing', cs.length, 'calendars'); cs.forEach(c => c.refreshLeaves && c.refreshLeaves()); } }catch(e){} } + if(triggers.includes('runCompleted')){ + try{ + // Stop further HTMX polling by removing polling attributes from + // the run status element and its container. The server will return + // out-of-band (OOB) swaps to update the log/result areas in-place + // and to insert a "View final output" button, so a full page + // reload is no longer required. + const el = document.querySelector('#run-status'); + if(el){ el.removeAttribute('hx-get'); el.removeAttribute('hx-trigger'); el.removeAttribute('hx-swap'); } + const container = document.querySelector('#run-status-container'); + if(container){ container.removeAttribute('hx-get'); container.removeAttribute('hx-trigger'); } + }catch(e){ console.error('runCompleted handler failed', e); } + } }catch(e){ console.error('htmx:afterRequest robustness handler', e); } }); diff --git a/djangorota/djangorota/templates/rota/rota_detail.html b/djangorota/djangorota/templates/rota/rota_detail.html index 778b503..9d93070 100644 --- a/djangorota/djangorota/templates/rota/rota_detail.html +++ b/djangorota/djangorota/templates/rota/rota_detail.html @@ -140,8 +140,8 @@
diff --git a/djangorota/djangorota/templates/rota/rota_run_detail.html b/djangorota/djangorota/templates/rota/rota_run_detail.html index 5f4c3a8..3a76d96 100644 --- a/djangorota/djangorota/templates/rota/rota_run_detail.html +++ b/djangorota/djangorota/templates/rota/rota_run_detail.html @@ -5,6 +5,7 @@{{ run.log }}
+ {{ run.log }}{{ result_pretty|default:run.result }}
+ {{ result_pretty|default:run.result }}{escape(run.log or "")}{escape(result_pretty or "")}