From 9608b7f601bc0c43fc9955bb613769b38b28d0d1 Mon Sep 17 00:00:00 2001 From: Deeman Date: Sun, 1 Mar 2026 19:47:34 +0100 Subject: [PATCH] feat(admin): replace all native confirm() with styled dialog + fix pipeline tabs scrollbar - Add global htmx:confirm handler in base_admin.html that intercepts hx-confirm attributes and shows #confirm-dialog instead of window.confirm() - Convert 4 pipeline HTMX buttons (Run Transform, Run Export, Run Full Pipeline, Run extractor) from onclick+confirm() to hx-confirm - Convert 4 affiliate form/list delete buttons from onclick+confirm() to confirmAction() via event.preventDefault() - Add scrollbar-width:none + ::-webkit-scrollbar{display:none} to .pipeline-tabs to suppress spurious horizontal scrollbar Co-Authored-By: Claude Sonnet 4.6 --- CHANGELOG.md | 4 ++++ .../admin/templates/admin/affiliate_form.html | 2 +- .../templates/admin/affiliate_program_form.html | 2 +- .../admin/templates/admin/base_admin.html | 14 ++++++++++++++ .../admin/partials/affiliate_program_results.html | 2 +- .../templates/admin/partials/affiliate_row.html | 2 +- .../admin/partials/pipeline_overview.html | 2 +- .../admin/partials/pipeline_transform.html | 6 +++--- .../admin/templates/admin/pipeline.html | 3 ++- 9 files changed, 28 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b96aac..eea0357 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## [Unreleased] +### Changed +- **Admin: styled confirm dialog for all destructive actions** — replaced all native `window.confirm()` calls with the existing `#confirm-dialog` styled ``. A new global `htmx:confirm` handler intercepts HTMX confirmation prompts and shows the dialog; form-submit buttons on affiliate pages were updated to use `confirmAction()`. Affected: pipeline Transform tab (Run Transform, Run Export, Run Full Pipeline), pipeline Overview tab (Run extractor), affiliate product delete, affiliate program delete (both form and list variants). +- **Pipeline tabs: no scrollbar** — added `scrollbar-width: none` and `::-webkit-scrollbar { display: none }` to `.pipeline-tabs` to suppress the spurious horizontal scrollbar on narrow viewports. + ### Fixed - **Stale-tier failures no longer exhaust the next proxy tier** — with parallel workers, threads that fetched a proxy just before tier escalation reported failures after the tier changed, immediately blowing through the new tier's circuit breaker before it ever got tried (Rayobyte was skipped entirely). `record_failure(proxy_url)` now checks which tier the proxy belongs to and ignores the circuit breaker when the proxy is from an already-escalated tier. diff --git a/web/src/padelnomics/admin/templates/admin/affiliate_form.html b/web/src/padelnomics/admin/templates/admin/affiliate_form.html index 9acd571..5ea6366 100644 --- a/web/src/padelnomics/admin/templates/admin/affiliate_form.html +++ b/web/src/padelnomics/admin/templates/admin/affiliate_form.html @@ -229,7 +229,7 @@ document.addEventListener('DOMContentLoaded', function() {
+ onclick="event.preventDefault(); confirmAction('Delete this product? This cannot be undone.', this.closest('form'))">Delete
{% endif %} diff --git a/web/src/padelnomics/admin/templates/admin/affiliate_program_form.html b/web/src/padelnomics/admin/templates/admin/affiliate_program_form.html index 9c2949d..70c62a9 100644 --- a/web/src/padelnomics/admin/templates/admin/affiliate_program_form.html +++ b/web/src/padelnomics/admin/templates/admin/affiliate_program_form.html @@ -123,7 +123,7 @@ document.addEventListener('DOMContentLoaded', function() {
+ onclick="event.preventDefault(); confirmAction('Delete this program? Blocked if products reference it.', this.closest('form'))">Delete
{% endif %} diff --git a/web/src/padelnomics/admin/templates/admin/base_admin.html b/web/src/padelnomics/admin/templates/admin/base_admin.html index 28323f6..b607d2d 100644 --- a/web/src/padelnomics/admin/templates/admin/base_admin.html +++ b/web/src/padelnomics/admin/templates/admin/base_admin.html @@ -244,5 +244,19 @@ function confirmAction(message, form) { document.getElementById('confirm-cancel').addEventListener('click', function() { dialog.close(); }, { once: true }); dialog.showModal(); } + +// Intercept hx-confirm to use the styled dialog instead of window.confirm() +document.body.addEventListener('htmx:confirm', function(evt) { + var dialog = document.getElementById('confirm-dialog'); + if (!dialog) return; // fallback: let HTMX use native confirm + evt.preventDefault(); + document.getElementById('confirm-msg').textContent = evt.detail.question; + var ok = document.getElementById('confirm-ok'); + var newOk = ok.cloneNode(true); + ok.replaceWith(newOk); + newOk.addEventListener('click', function() { dialog.close(); evt.detail.issueRequest(true); }, { once: true }); + document.getElementById('confirm-cancel').addEventListener('click', function() { dialog.close(); }, { once: true }); + dialog.showModal(); +}); {% endblock %} diff --git a/web/src/padelnomics/admin/templates/admin/partials/affiliate_program_results.html b/web/src/padelnomics/admin/templates/admin/partials/affiliate_program_results.html index 5d79cce..71f7b41 100644 --- a/web/src/padelnomics/admin/templates/admin/partials/affiliate_program_results.html +++ b/web/src/padelnomics/admin/templates/admin/partials/affiliate_program_results.html @@ -24,7 +24,7 @@
+ onclick="event.preventDefault(); confirmAction('Delete {{ prog.name }}? This is blocked if products reference it.', this.closest('form'))">Delete
diff --git a/web/src/padelnomics/admin/templates/admin/partials/affiliate_row.html b/web/src/padelnomics/admin/templates/admin/partials/affiliate_row.html index 5846ec7..3d62461 100644 --- a/web/src/padelnomics/admin/templates/admin/partials/affiliate_row.html +++ b/web/src/padelnomics/admin/templates/admin/partials/affiliate_row.html @@ -23,7 +23,7 @@
+ onclick="event.preventDefault(); confirmAction('Delete {{ product.name }}?', this.closest('form'))">Delete
diff --git a/web/src/padelnomics/admin/templates/admin/partials/pipeline_overview.html b/web/src/padelnomics/admin/templates/admin/partials/pipeline_overview.html index 43209c8..ce22a1d 100644 --- a/web/src/padelnomics/admin/templates/admin/partials/pipeline_overview.html +++ b/web/src/padelnomics/admin/templates/admin/partials/pipeline_overview.html @@ -40,7 +40,7 @@ hx-target="#pipeline-overview-content" hx-swap="outerHTML" hx-vals='{"extractor": "{{ wf.name }}", "csrf_token": "{{ csrf_token() }}"}' - onclick="if (!confirm('Run {{ wf.name }} extractor?')) return false;">Run + hx-confirm="Run {{ wf.name }} extractor?">Run

{{ wf.schedule_label }}

{% if run %} diff --git a/web/src/padelnomics/admin/templates/admin/partials/pipeline_transform.html b/web/src/padelnomics/admin/templates/admin/partials/pipeline_transform.html index 5f16034..2e5b786 100644 --- a/web/src/padelnomics/admin/templates/admin/partials/pipeline_transform.html +++ b/web/src/padelnomics/admin/templates/admin/partials/pipeline_transform.html @@ -53,7 +53,7 @@ hx-target="#pipeline-transform-content" hx-swap="outerHTML" hx-vals='{"step": "transform", "csrf_token": "{{ csrf_token() }}"}' - onclick="if (!confirm('Run SQLMesh transform (prod --auto-apply)?')) return false;"> + hx-confirm="Run SQLMesh transform (prod --auto-apply)?"> Run Transform @@ -107,7 +107,7 @@ hx-target="#pipeline-transform-content" hx-swap="outerHTML" hx-vals='{"step": "export", "csrf_token": "{{ csrf_token() }}"}' - onclick="if (!confirm('Export serving tables (lakehouse → analytics.duckdb)?')) return false;"> + hx-confirm="Export serving tables (lakehouse → analytics.duckdb)?"> Run Export @@ -138,7 +138,7 @@ hx-target="#pipeline-transform-content" hx-swap="outerHTML" hx-vals='{"step": "pipeline", "csrf_token": "{{ csrf_token() }}"}' - onclick="if (!confirm('Run full ELT pipeline (extract → transform → export)?')) return false;"> + hx-confirm="Run full ELT pipeline (extract → transform → export)?"> Run Full Pipeline diff --git a/web/src/padelnomics/admin/templates/admin/pipeline.html b/web/src/padelnomics/admin/templates/admin/pipeline.html index 7f8d216..511b11b 100644 --- a/web/src/padelnomics/admin/templates/admin/pipeline.html +++ b/web/src/padelnomics/admin/templates/admin/pipeline.html @@ -15,8 +15,9 @@ .pipeline-tabs { display: flex; gap: 0; border-bottom: 2px solid #E2E8F0; margin-bottom: 1.5rem; - overflow-x: auto; -webkit-overflow-scrolling: touch; + overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; } + .pipeline-tabs::-webkit-scrollbar { display: none; } .pipeline-tabs button { padding: 0.625rem 1.25rem; font-size: 0.8125rem; font-weight: 600; color: #64748B; background: none; border: none; cursor: pointer;