Support multi-column label_column config, plus a runtime API and UI for setting it#2817
Open
simonw wants to merge 1 commit into
Open
Support multi-column label_column config, plus a runtime API and UI for setting it#2817simonw wants to merge 1 commit into
simonw wants to merge 1 commit into
Conversation
…or setting it - label_column config can now be a string or an ordered list of columns, joined with a space to build a row's display label. Database.label_column_for_table() is renamed to label_columns_for_table() and always returns a list. - Adds a label_columns internal DB table, get/set/remove_label_columns() methods, and a set-label-columns permission so the label can be overridden at runtime independently of config (config only seeds the value the first time a table is seen). - Adds a POST /<database>/<table>/-/set-label-columns JSON endpoint, modeled on the existing set-column-type endpoint. - Adds a "Set label column(s)" table action and modal for calling that endpoint from the table page. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019oYhPa7o24kd8Cwx3i4GiD
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2817 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 73 73
Lines 12037 12129 +92
=====================================
- Misses 12037 12129 +92 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Let’s design a datasette feature providing a UI for setting the label column (or columns) for a table
Start by reviewing how label columns currently work
There are two parts to this. First, we will expand the definition of a label column so that it can be configured (in configuration) as an ordered list of columns - currently it can only be one.
Then we will design a system for optionally storing that configuration in the internal database, complete with a table-level permission for setting them and a JSON endpoint, consistent with other similar endpoints
Finally we will design a UI for calling that endpoint
joined with a space to build a row's display label. Database.label_column_for_table()
is renamed to label_columns_for_table() and always returns a list.
methods, and a set-label-columns permission so the label can be overridden
at runtime independently of config (config only seeds the value the first
time a table is seen).
/<database>/<table>/-/set-label-columnsJSON endpoint, modeledon the existing set-column-type endpoint.
endpoint from the table page.
Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_019oYhPa7o24kd8Cwx3i4GiD
📚 Documentation preview 📚: https://datasette--2817.org.readthedocs.build/en/2817/