Add web UI to edit and delete stored queries

Stored query pages now offer Edit and Delete actions in the query
actions menu, gated by the update-query and delete-query permissions.

- New QueryEditView (GET/POST at /<db>/<query>/-/edit) renders a
  pre-filled form for editing a query's title, description, SQL and
  privacy, reusing the create-query analysis UI. Changing the SQL still
  requires execute-sql; metadata-only edits do not.
- QueryDeleteView gains a GET confirmation page and HTML form POST that
  redirects to the query list, while keeping the existing JSON API.
- New default query_actions hook adds the Edit/Delete links for stored
  (non-config, non-trusted) queries the actor is allowed to manage.

Permission semantics (already enforced by default_query_permissions_sql)
are surfaced in the UI: owners can always edit/delete their queries;
non-private queries can be edited/deleted by any actor with the relevant
permission; private queries remain owner-only.

Shared the create-query form styles into _query_form_styles.html so the
edit form can reuse them.

https://claude.ai/code/session_019GU9g3pZAERukLKYNa4uAL
This commit is contained in:
Claude 2026-06-01 21:00:04 +00:00
commit 5b6cf45568
No known key found for this signature in database
13 changed files with 825 additions and 135 deletions

View file

@ -77,6 +77,7 @@ def documented_views():
"QueryCreateAnalyzeView",
"QueryDeleteView",
"QueryDefinitionView",
"QueryEditView",
"QueryListView",
"QueryParametersView",
"QueryStoreView",