fix(web): move keboola {% endif %} so edit-modal JS is always available (#340)
* 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 <zdenek.srotyr@keboola.com>
This commit is contained in:
parent
c552bf8243
commit
86933a2cb5
3 changed files with 18 additions and 3 deletions
12
CHANGELOG.md
12
CHANGELOG.md
|
|
@ -10,6 +10,18 @@ CalVer image tags (`stable-YYYY.MM.N`, `dev-YYYY.MM.N`) are produced for every C
|
||||||
|
|
||||||
## [Unreleased]
|
## [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
|
## [0.54.26] — 2026-05-18
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
||||||
|
|
@ -2234,8 +2234,10 @@
|
||||||
showToast('' + err.message, 'error');
|
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() {
|
function _getEditKbSyncMode() {
|
||||||
var el = document.querySelector('input[name="editKbSyncMode"]:checked');
|
var el = document.querySelector('input[name="editKbSyncMode"]:checked');
|
||||||
|
|
@ -2256,6 +2258,7 @@
|
||||||
if (mode === 'direct') onEditKbStrategyChange();
|
if (mode === 'direct') onEditKbStrategyChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{% if data_source_type == 'keboola' %}{# Phase F2 edit modal + prefill — keboola-only #}
|
||||||
function _getEditKbStrategy() {
|
function _getEditKbStrategy() {
|
||||||
var el = document.getElementById('editKbStrategy');
|
var el = document.getElementById('editKbStrategy');
|
||||||
return el ? el.value : 'full_refresh';
|
return el ? el.value : 'full_refresh';
|
||||||
|
|
@ -2483,7 +2486,7 @@
|
||||||
}
|
}
|
||||||
ta.value = 'SELECT *\nFROM kbc."' + bucket + '"."' + sourceTable + '"\nWHERE -- your filter here';
|
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
|
// C3: removed dead helper _buildKeboolaLegacyPayload — the Phase F
|
||||||
// _buildKeboolaPayload (above) replaced it.
|
// _buildKeboolaPayload (above) replaced it.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[project]
|
[project]
|
||||||
name = "agnes-the-ai-analyst"
|
name = "agnes-the-ai-analyst"
|
||||||
version = "0.54.26"
|
version = "0.54.27"
|
||||||
description = "Agnes — AI Data Analyst platform for AI analytical systems"
|
description = "Agnes — AI Data Analyst platform for AI analytical systems"
|
||||||
requires-python = ">=3.11,<3.14"
|
requires-python = ">=3.11,<3.14"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue