* fix: stop editing rows hidden by restricted view filters
Cancel edits still queued for a row that the backend reported as hidden,
including pasted values, in grid, gallery, timeline, kanban and calendar,
so they are neither sent nor put back on screen. Close the row modal when
its row gets hidden in a restricted view; other views keep it open.
* test: cover builders and ignore broadcast order in restricted view tests
* test: add e2e tests for restricted view row visibility
Cover creating, editing, pasting and dragging rows in a restricted view
while the HTTP response is held after the server commits, the row modal
closing only in restricted views, and view default values.
* fix: hide rows created with the grid's floating add button when filtered out
createNewRowConfirmed used the single-row endpoint, which doesn't return
hidden_row_ids, so a restricted editor kept a row the view's filters
exclude. Create it through the batch endpoint and report hidden rows like
the other create paths.
* test: expect the batch endpoint for the grid's floating add button
* fix: cancel queued kanban edits when a drag hides the card
* fix: report rows hidden by restricted view filters in batch responses
Compute row_ids_not_visible_in_view with one filter query in the API instead
of reusing visibility stashed by the realtime receivers, so dependent formula
and lookup filters are evaluated after the update. Ignore views of another
table.
Move kanban drag and grid cross-group drag to the batch update, so a row
dragged out of a restricted view is hidden and the move call is skipped.
Merge the frontend helpers into reportRowsNotVisibleInView and remove hidden
rows even when they don't match the active grid search.
* refactor: rename row_ids_not_visible_in_view to hidden_row_ids
---------
Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
* refactor: move formula field-reference visitors from premium to core
* feat: add ButtonField model and fixture (#1722)
* feat: add read-only button field type backend (#1722)
* feat: resolve database formulas client-side for the button field (#1722)
* feat: add button field type frontend (#1722)
* chore: add changelog entry for button field (#1722)
* fix: disable button field cells when the url formula is broken (#1722)
* fix: encode whitespace in resolved button field urls (#1722)
* fix: rename button field visitor tests to avoid pytest module collision
* test: add button field to expected premium export outputs
* test: add button field to remaining interesting-table test expectations
Registering the button field in construct_all_possible_field_kwargs
changed the interesting test table used by several golden-output
tests. Update the affected expectations (serialized row value, CSV
export column, and generated schema entry) to match actual behavior.
* feat: put the button field behind the button-field feature flag
* fix: address button field review nits
* fix: renumber button field migration after develop merge
* docs: describe the button field as an action field in API docs
* fix: handle raw formulas and missing field references in button fields
* fix(review): remap binary-op field refs, cache parse trees, extend button field tests
- visit both operands in BaserowFormulaReplaceFieldReferences.visitBinaryOp so
get() references inside binary expressions are remapped on import/duplication
- cache client-side formula parse trees so large grids do not re-parse the same
button formula for every row
- add tests for the urlInvalid submission block, the field-store fallback in
functional grid cells, and duplication with broken field references
* fix: keep button field type registered when the feature flag is off
Gating registration behind the flag meant that disabling it after button
fields existed made every registry lookup for those fields raise, breaking
all row, field and export endpoints for the affected tables.
The type is now always registered on both backend and frontend, matching
how other gated field types work. Creating a button field (or converting
a field to one) is rejected with ERROR_FEATURE_DISABLED while the flag is
off, and the field type dropdown hides the type entirely via the new
isVisibleInDropdown hook. Existing button fields keep rendering and their
tables keep working.
* fix: keep brackets when remapping field references in formulas
* fix: keep the button url formula mode when remapping field references
Assigning the remapped formula string to `url_formula` made the patched
`save()` re-wrap it through `to_python` as `simple` mode, undoing the
raw-mode guard in `replace_field_id_references`. A raw literal URL then
became an unparseable formula, so duplicating a table left the button
broken. Assign the whole formula object so mode and version survive.
* fix(review): share the formula field id cache and cover the flag-off cases
Move `get_table_field_ids` and its `table_schema_changed` invalidation into
core next to the visitors, so validating a button field's url formula no
longer costs a query per field on every field response. The AI prompt
validation now reads the same cache instead of its own copy.
Also list the edited field's own type in the field form dropdown even when
hidden, otherwise an existing button field renders with a blank type once
the feature flag is turned back off, and drop the always-null cell backup
on type conversion.
* chore(review): tidy the button field export branch and flag docs spacing
* test: cover the formula parse tree cache
The cache is shared by every resolveFormula caller, including the builder,
so record what it guarantees: one parse per distinct formula, raw formulas
never parsed, failures not cached, and oldest-first eviction at the cap.
Also state the read-only invariant the reuse depends on.
* fix: guard and cache the formula field reference helpers (#1722)
`get()` and `get('fields')` both parse and both pass the create API, so
remapping them raised an uncaught IndexError that aborted the whole
duplication or import job. Guard every index instead.
`extract_field_id_dependencies` also parsed raw formulas, unlike its two
sibling helpers, and re-parsed on every call. It now short-circuits raw
mode and caches the extracted ids per formula string.
* fix: keep the AI prompt's mode when remapping field references (#1722)
Moving the reference visitors to core added a raw short-circuit that
returns a bare string. `AIFieldType.after_import_serialized` re-saved
that string, so `to_python` re-wrapped a raw natural language prompt as
`simple` mode and every row's generation then failed on parsing the
prose.
Assign the whole formula object instead, the same way the button field
already does, and cover a raw prompt surviving an export/import.
* feat: add the encode_uri and encode_uri_component formula functions (#1722)
A button field's URL is built by concatenating row values, so a value
holding a reserved character corrupts it: `shoes#7` truncates to a
fragment and `a&b=1` injects a parameter. Encoding every value
automatically is not an option, because a value can legitimately be the
whole URL.
These mirror the two functions that already exist in the database
formula language and let a formula escape the parts that need it. The
backend and the browser encode identically, since button URLs resolve
client-side and everything else resolves on the server.
* fix: address review on the button field backend (#1722)
The field no longer creates a database column. It held nothing but an
always-null boolean, and that boolean leaked into the API docs and the
Local Baserow schema. `get_model_field` returns None and a
`NoDatabaseColumnField` is contributed to the generated model instead,
which Django treats as non concrete. A `ButtonFieldConverter` handles
conversion in both directions, since the lenient schema editor cannot
alter into or out of a column-less field, and the serializer is now
always-null while staying writable so the read-only validator still
rejects a write.
Also from review: only creation is gated by the feature flag, so an
existing button field stays editable with the flag off; dependencies are
read off the cached table model rather than two queries per field; and
the client is only told to re-fetch when a referenced field appears or
disappears, not when one is renamed or retyped.
* fix: address review on the button field frontend (#1722)
Without a label the button showed the percent-encoded URL. The URL is
now resolved once as the user built it and only the href is encoded, so
the label reads `https://example.com/Red Button` while the link points
at `Red%20Button`. With no label and no URL it reads "Click me".
Also from review: a read-only field the search cannot match no longer
disables optimistic row updates for every edit in a searched view, which
a valueless field like this one did; the parse tree cache evicts the
least recently used entry rather than the oldest inserted one; and the
field type reports its icon class statically and no longer claims its
cells are booleans in the API docs.
* fix: hide button fields from public views and require a label (#1722)
Button fields are no longer handed to visitors of a publicly shared view.
A new `FieldType.can_be_in_public_view` flag drives the exclusion, applied
to the public view info endpoint, the public rows queryset and the two
public websocket signal paths, so a visible field option isn't enough to
expose the label and the URL formula.
The label is now mandatory. It's the only text a button shows, so it must
be set when the field is created or converted into a button, and it can't
be emptied afterwards. The client-side fallbacks to the resolved URL and
to a default label are gone with it.