Skip to content

feat(admin): Reorganize the System Queries form into Where, What and How - #8550

Merged
onewland merged 6 commits into
masterfrom
feat/admin-system-queries-sections
Oct 15, 2026
Merged

onewland merged 6 commits into
masterfrom
feat/admin-system-queries-sections

Conversation

@onewland

@onewland onewland commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Reorganizes the System Queries form for readability. The aim is a clearer order of steps, not a visual redesign.

Before

Screenshot 2026-10-15 at 9 53 50 AM Screenshot 2026-10-15 at 9 54 02 AM

After

Screenshot 2026-10-15 at 9 52 44 AM Screenshot 2026-10-15 at 9 53 04 AM

Layout

  • Where: a "Host entry" toggle ("Pick a node" / "Enter host manually"), then storage and host, all on one line.
  • What: the predefined query picker, the editor, the time range and template values.
  • How: a "User mode" / "Sudo mode" toggle next to the Execute button, with a line saying what each mode allows. That text comes from the server's checks: user mode runs SELECT, SHOW and DESCRIBE, and SELECTs may only read system tables. Sudo only runs SYSTEM, ALTER, OPTIMIZE and DROP, needs the sudo role, and is audit-logged with a notification.

The old on/off switches only showed the current state, so "Auto Populate Nodes" read like a label rather than one of two options. The toggles show both options.

Sudo mode

Only the How section turns red, and the button turns red and reads "Execute Sudo Query". The thick red border around the whole form is gone.

Missing fields

The next field needed before the query can run gets an orange outline and a hint: storage first, then host. Hovering the disabled Execute button shows a tooltip saying what's missing, including when the query is empty.

Styling

  • The page headings use the home page's section heading style, now shared as SECTION_HEADING_STYLE in theme.tsx. The Where/What/How labels use a smaller version of it, which also overrides Bootstrap's large, full-width legend styles.
  • The predefined query picker gets a small bold label above the dropdown, and its description shows in smaller gray text. The picker lives in the shared QueryEditor, so Querylog and the Outcomes Analyzer get the same look.
  • The share-link warning (from feat(admin): Pre-fill System Queries from a link #8549) now sits above the page heading.

Other changes

  • ExecuteButton takes an optional color. Other pages don't pass it, so they're unchanged.
  • COLORS.WARNING (#b35c00) is added to theme.tsx for the missing-field cue.

Tests

New tests check the missing-host hint, the disabled button and its tooltip, and that the cue goes away once a host is set. Nothing tests the sudo styling yet.

🤖 Generated with Claude Code

onewland and others added 5 commits October 15, 2026 09:13
Opening /#system-queries?query=...&storage=...&host=host:port fills in
the editor, storage and host, and shows a warning that whoever clicks
Execute is responsible for the query. Nothing runs until the user
clicks Execute, and sudo mode is never set from a link.

Each history card also gets a "Share query" button that copies such a
link for that query.

This lets an agent point someone at a query to review and run, and
makes it easier to share queries with teammates.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Pasting a share link while already on System Queries only changes the
hash, so the page doesn't reload and the form ignored the new link.
Remount the form when the hash changes to one with link params.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Split the form into labelled sections: storage and host (with the
host-entry toggle), the query editor, and the mode toggle next to the
Execute button. The on/off switches become two-option toggles so both
choices are visible, and the mode toggle explains what user and sudo
mode allow.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Use the home page's section heading style for the System Queries
headings (now shared via theme.tsx), with a smaller version for the
Where/What/How labels. Bootstrap's legend styles made those labels
oversized.

In sudo mode, highlight only the How section in red and make the
Execute button red ("Execute Sudo Query") instead of putting a thick
red border around the whole form.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Flag the next field needed before a query can run (storage, then host)
with an orange outline and hint, and explain the disabled Execute button
with a tooltip.

Also put the host-entry toggle on the same line as storage and host,
give the predefined query picker a proper label and smaller description,
and move the share-link warning above the page heading.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@onewland
onewland requested a review from a team as a code owner October 15, 2026 16:52
Base automatically changed from feat/admin-system-query-share-links to master October 15, 2026 18:16
…ueries-sections

# Conflicts:
#	snuba/admin/static/clickhouse_queries/query_display.tsx
#	snuba/admin/static/tests/clickhouse_queries/prefill.spec.tsx
@onewland
onewland merged commit dbbbc4e into master Oct 15, 2026
69 of 70 checks passed
@onewland
onewland deleted the feat/admin-system-queries-sections branch October 15, 2026 21:15
MeredithAnya added a commit that referenced this pull request Oct 20, 2026
…er to use (#8569)

Follow-up to #8554 and #8550.

### Bugs fixed
- Large results no longer break scrolling. Long values wrapped a few
characters per line, and wide tables couldn't scroll sideways.
- The page no longer jumps to the results after Execute.
- The open editor no longer covers the results as you scroll.
- The "Select a host" warning no longer flashes while the node list
loads.
- The Execute button no longer changes size or flickers while a query
runs.
- Copy buttons now work when admin is served over plain http.
- A long query no longer pushes the errors off screen. The query box is
capped at 40% of the window height and scrolls inside it.

### Behaviour changed
- Storage, Host and the host entry toggle sit in a row at the top that
stays visible when the editor is closed. The manual-host rules moved
into a tooltip.
- The User/Sudo toggle and the predefined query dropdown moved into the
editor's title row, next to Close. Their help text and descriptions show
on hover.
- Errors show under the query, next to Execute, which is pinned to the
right. Errors are hidden with the editor, and a failed run reopens it.
- Older results collapse when a newer run becomes the latest.
- Results no longer show their SQL inline; a small SQL button toggles
it.
- The copy buttons on results are now icons with tooltips.
- The result card changes also apply to the Querylog page, which shares
the card with System Queries since #8565.

### Behaviour added
- A results table for System Queries: row numbers, a header that stays
visible, single-line values you can click to expand, and an "Expand to
all N rows" button for long results.
- Execute next to Storage and Host when the editor is closed.
- Host auto-fills with the storage's first node. Links that don't name a
host are left alone.
- "Copy as table" (tab-separated, pastes into spreadsheets) and "Copy as
Markdown".
- A "No results" label on empty results.
- A trash icon to clear saved results.

<img width="1501" height="760" alt="Screenshot 2026-10-19 at 6 04 20 PM"
src="https://github.com/user-attachments/assets/84b61a62-bdb9-4348-b1c0-63a82197abdb"
/>


🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants