Move debug links into jump menu

This commit is contained in:
Simon Willison 2026-05-23 16:57:09 -07:00
commit be1b5b2b5c
12 changed files with 173 additions and 65 deletions

View file

@ -1398,4 +1398,4 @@ Actor is allowed to view the ``/-/permissions`` debug tools.
debug-menu
----------
Controls if the various debug pages are displayed in the navigation menu.
Controls if the various debug pages are displayed in the jump menu.

View file

@ -13,6 +13,11 @@ Unreleased
- Fixed a bug where stale tables and other related resources were not removed from ``catalog_*`` tables when a database was removed. (:issue:`2723`)
- Fixed a Safari bug with the table search mechanism triggered by pressing ``/``. (:issue:`2724`)
- New "Jump to..." menu item, always visible, for triggering the previously undocumented ``/`` menu. (:issue:`2725`)
- The ``/`` jump-to search interface now covers databases, views, canned queries and plugin-provided items in addition to tables. The endpoint backing it has been renamed from ``/-/tables`` to ``/-/jump``.
- New :ref:`plugin_hook_jump_items_sql` plugin hook, allowing plugins to contribute additional items to the jump-to menu by returning SQL that queries the internal catalog.
- ``datasette.jump.JumpSQL.menu_item()`` is a shortcut for adding individual jump menu items that are not backed by resources in the internal catalog.
- New :ref:`javascript_plugins_makeJumpSections` JavaScript plugin hook, allowing plugins to add custom blank-state sections to the jump-to menu before the user has typed a query.
- Debug menu links now appear in the jump-to menu instead of the top-right app menu.
- New documented :ref:`datasette.fixtures.populate_fixture_database(conn) <datasette_fixtures_populate_fixture_database>` helper for creating the fixture database tables used by Datasette's own tests, intended for plugin test suites.
.. _v1_0_a29:
@ -274,7 +279,7 @@ Other changes
~~~~~~~~~~~~~
- The internal ``catalog_views`` table now tracks SQLite views alongside tables in the introspection database. (:issue:`2495`)
- Hitting the ``/`` brings up a search interface for navigating to databases, tables, views, canned queries and plugin-provided items that the current user can view. A new ``/-/jump`` endpoint supports this functionality, and JavaScript plugins can add custom blank-state sections using ``makeJumpSections()``. (:issue:`2523`)
- Hitting the ``/`` brings up a search interface for navigating to tables that the current user can view. A new ``/-/tables`` endpoint supports this functionality. (:issue:`2523`)
- Datasette attempts to detect some configuration errors on startup.
- Datasette now supports Python 3.14 and no longer tests against Python 3.9.

View file

@ -152,8 +152,6 @@ Shows currently attached databases. `Databases example <https://latest.datasette
Returns a JSON list of items that the current actor has permission to view for Datasette's jump menu. By default this includes visible databases, tables, views and canned queries, and plugins can contribute additional items.
The endpoint supports a ``?q=`` query parameter for filtering items by name.
Plugins can provide an optional ``display_name`` field from
``jump_items_sql`` by returning a ``display_name`` column.
`Jump example <https://latest.datasette.io/-/jump>`_:

View file

@ -1943,22 +1943,21 @@ This example adds a "Plugin dashboard" result for signed-in users:
def jump_items_sql(actor):
if not actor:
return None
return JumpSQL(sql="""
SELECT
'dashboard' AS type,
'plugin-dashboard' AS label,
'Dashboard' AS description,
'/-/plugin-dashboard' AS url,
NULL AS database_name,
NULL AS resource_name,
'plugin dashboard' AS search_text,
80 AS sort_key,
'my-plugin' AS source,
'Plugin dashboard' AS display_name
""")
return JumpSQL.menu_item(
item_type="dashboard",
label="plugin-dashboard",
description="Dashboard",
url="/-/plugin-dashboard",
search_text="plugin dashboard",
sort_key=80,
source="my-plugin",
display_name="Plugin dashboard",
)
Use ``params=`` to pass SQL parameters. Datasette will automatically namespace those parameters before combining SQL fragments from different plugins.
``JumpSQL.menu_item(...)`` is a shortcut for adding a single jump menu item that is not backed by a resource in Datasette's internal catalog tables. It returns ``NULL`` for ``database_name`` and ``resource_name`` and accepts the keyword arguments shown above.
.. _plugin_actions:
Action hooks

View file

@ -235,12 +235,12 @@ If you run ``datasette plugins --all`` it will include default plugins that ship
]
},
{
"name": "datasette.default_menu_links",
"name": "datasette.default_debug_menu",
"static": false,
"templates": false,
"version": null,
"hooks": [
"menu_links"
"jump_items_sql"
]
},
{