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
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
queries | QueryHistoryItem[] | [] | Past queries, newest first. | |
filter | filter | QueryHistoryFilter | 'all' | all (default), succeeded, failed or denied. |
label | label | string | '' | Accessible name of the list. Defaults to "Query history". |
hideFilters | hide-filters | boolean | false | Hides the status filter pills. |
now | now | number | undefined | Reference time for relative times, in epoch milliseconds. Defaults to now. | |
visibleQueries | QueryHistoryItem[] | The queries that pass the current filter. |
Methods
| Method | Description |
|---|---|
focusQuery() | Moves focus to the query at index in the visible list. |
Events
| Event | Detail | Description |
|---|---|---|
mm-open-query | CustomEvent<{ query: QueryHistoryItem }> | Open this query in the editor. |
mm-run | CustomEvent<{ sql: string, query: QueryHistoryItem }> | Run this query again. |
mm-filter | CustomEvent<{ filter: 'all' | 'succeeded' | 'failed' | 'denied' }> | The status filter changed. |
mm-copy | CustomEvent<{ value: string }> | The SQL was copied (from the inner mm-copy-button). |
CSS parts
| Part | Description |
|---|---|
filters | The row of status filter pills. |
list | The list of queries. |
row | Each query row. |
sql | The first line of SQL. |
empty | The empty message. |
Examples
Every state of mm-query-history in Storybook, with keyboard and screen reader tests.