From 86933a2cb51cc78c37fe69a029d2134c3845d5ef Mon Sep 17 00:00:00 2001 From: Monika Feigler <80892984+MonikaFeigler@users.noreply.github.com> Date: Mon, 18 May 2026 20:58:24 +0200 Subject: [PATCH] fix(web): move keboola {% endif %} so edit-modal JS is always available (#340) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(web): keboola sync-mode helpers escape the {% if data_source_type == 'keboola' %} guard Edit-modal functions were wrapped inside {% if data_source_type == 'keboola' %} in admin_tables.html. Two of them — _getEditKbSyncMode and onEditKbSyncModeChange — are called from sync-mode radio buttons that are rendered for ALL instance types (not inside any Jinja2 conditional). On a BigQuery or CSV instance the JS functions were absent from the page, causing a ReferenceError when the edit modal was opened. Fix: split the conditional into two regions: 1. Discover helpers (loadKeboolaBuckets, loadKeboolaTables) — remain inside {% if keboola %}, they call the Keboola Storage API. 2. _getEditKbSyncMode + onEditKbSyncModeChange — moved outside the guard, because the sync-mode radio buttons are rendered for all instance types. 3. Phase F2 edit modal + prefillFromKeboolaTable — remain inside {% if keboola %}, called only from Keboola-conditional HTML. Credit @MonikaFeigler. * release: 0.54.27 — /admin/tables edit modal ReferenceError fix on non-Keboola instances --------- Co-authored-by: ZdenekSrotyr --- CHANGELOG.md | 12 ++++++++++++ app/web/templates/admin_tables.html | 7 +++++-- pyproject.toml | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bd05ba..a391067 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,18 @@ CalVer image tags (`stable-YYYY.MM.N`, `dev-YYYY.MM.N`) are produced for every C ## [Unreleased] +## [0.54.27] — 2026-05-18 + +### Fixed +- `/admin/tables` edit modal no longer throws `ReferenceError` on + non-Keboola instances (BigQuery, CSV). Two JS helpers + (`_getEditKbSyncMode`, `onEditKbSyncModeChange`) were wrapped in + the `{% if data_source_type == 'keboola' %}` template guard but + called unconditionally from sync-mode radio buttons rendered for + all instance types. The guard now scopes only the discover / + prefill helpers that actually talk to the Keboola Storage API; + the shared sync-mode helpers ship to every instance. + ## [0.54.26] — 2026-05-18 ### Changed diff --git a/app/web/templates/admin_tables.html b/app/web/templates/admin_tables.html index 0ae567f..c7eed96 100644 --- a/app/web/templates/admin_tables.html +++ b/app/web/templates/admin_tables.html @@ -2234,8 +2234,10 @@ showToast('' + err.message, 'error'); }); } + {% endif %}{# data_source_type == 'keboola' — discover helpers #} - // ── Keboola tab edit modal (Phase F2) ────────────────────────── + // ── Keboola edit-modal sync-mode helpers (always needed — radio buttons + // are rendered for all instance types) ─────────────────────────────── function _getEditKbSyncMode() { var el = document.querySelector('input[name="editKbSyncMode"]:checked'); @@ -2256,6 +2258,7 @@ if (mode === 'direct') onEditKbStrategyChange(); } + {% if data_source_type == 'keboola' %}{# Phase F2 edit modal + prefill — keboola-only #} function _getEditKbStrategy() { var el = document.getElementById('editKbStrategy'); return el ? el.value : 'full_refresh'; @@ -2483,7 +2486,7 @@ } ta.value = 'SELECT *\nFROM kbc."' + bucket + '"."' + sourceTable + '"\nWHERE -- your filter here'; } - {% endif %}{# data_source_type == 'keboola' — discover/prefill JS #} + {% endif %}{# data_source_type == 'keboola' — Phase F2 edit modal + prefill #} // C3: removed dead helper _buildKeboolaLegacyPayload — the Phase F // _buildKeboolaPayload (above) replaced it. diff --git a/pyproject.toml b/pyproject.toml index a1a6ccc..d7a0fee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "agnes-the-ai-analyst" -version = "0.54.26" +version = "0.54.27" description = "Agnes — AI Data Analyst platform for AI analytical systems" requires-python = ">=3.11,<3.14" license = "MIT"