Skip to main content

Query history

Past queries with status, source, rows and duration.

Guidance​

Query history lists the queries someone has run, newest first: a status pill only when the run needs attention (failed or denied, always with the word; a succeeded run gets none), the first line of SQL in mono, the source with its provider logo, rows returned, duration and when it ran. Each row opens the query in the editor; "Run again" and "Copy SQL" sit at the end of the row. Status filter pills above the list narrow it down.

Keyboard: the list is one tab stop. Up and Down arrows, Home and End move between queries, Enter opens the focused query, and Tab moves on to that row's actions.

Properties​

PropertyAttributeTypeDefaultDescription
queriesQueryHistoryItem[][]Past queries, newest first.
filterfilterQueryHistoryFilter'all'all (default), succeeded, failed or denied.
labellabelstring''Accessible name of the list. Defaults to "Query history".
hideFiltershide-filtersbooleanfalseHides the status filter pills.
nownownumber | undefinedReference time for relative times, in epoch milliseconds. Defaults to now.
visibleQueriesQueryHistoryItem[]The queries that pass the current filter.

Methods​

MethodDescription
focusQuery()Moves focus to the query at index in the visible list.

Events​

EventDetailDescription
mm-open-queryCustomEvent<{ query: QueryHistoryItem }>Open this query in the editor.
mm-runCustomEvent<{ sql: string, query: QueryHistoryItem }>Run this query again.
mm-filterCustomEvent<{ filter: 'all' | 'succeeded' | 'failed' | 'denied' }>The status filter changed.
mm-copyCustomEvent<{ value: string }>The SQL was copied (from the inner mm-copy-button).

CSS parts​

PartDescription
filtersThe row of status filter pills.
listThe list of queries.
rowEach query row.
sqlThe first line of SQL.
emptyThe empty message.

Examples​

Every state of mm-query-history in Storybook, with keyboard and screen reader tests.