Repository navigation
Draft: Explore as search-first visualization (prototype) - #2985
elizabetdev wants to merge 72 commits into
Conversation
…r/pie/treemap/heatmap/patterns) - Add global DisplayType.Treemap + DBTreemapChart renderer (recharts), wired into Chart Explorer tabs/preview and raw-SQL/query-param maps - Unify search analysisMode into a single URL-backed view switcher with legacy aliasing (results->list, delta->heatmap, pattern->patterns) - Add inline aggregation config strip (aggFn/value/groupBy/topN) with smart defaults - Refactor DBSearchPage render into a per-view switch; hide histogram for aggregated views; move mode selection out of the filter sidebar into a top toolbar Co-authored-by: Cursor <cursoragent@cursor.com>
- SearchColumnPicker: checklist dropdown (search + All/None + Apply) that replaces the SELECT SQL editor for the List view; commits the comma-separated select string - SearchSortMenu: structured sort control replacing ORDER BY. Value/Name + direction for aggregated views (table/bar/pie/treemap); column + direction for List; revert - Thread agg sort state (sort/sortDir) through useSearchAggConfig into the aggregated view config (aliases the metric as "Value" for stable ordering) Co-authored-by: Cursor <cursoragent@cursor.com>
…h toolbar Remove the SELECT and ORDER BY SQL editors from the top query bar now that the Columns picker and Sort menu cover the common cases. Keep a power-user escape hatch: a List-view 'Advanced' popover in the results toolbar still exposes the raw SELECT and ORDER BY editors for expressions/aliases/multi-column ordering. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…nput Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Allow metric sources in the search page source selector. Since metrics have no raw rows, the view switcher hides List / Event deltas / Event patterns for metric sources and only offers the aggregated chart views (time series, number, summary table, bar, pie, treemap), auto-switching away from List when a metric source is chosen. The aggregation bar swaps the free-text value expression for the metric name/type picker (MetricNameSelect) and drops count-style agg fns. aggViewChartConfig now carries metricTables + metric select fields, and holds off querying until a metric name is picked (showing a prompt instead of the 'no query support for metric type=gauge' error). Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the original search experience intact at /search (restored from main) and move the in-progress view-switcher redesign to a new /explore page, surfaced in the nav with an "Experimental" badge. - Restore DBSearchPage.tsx to the main version so /search is unchanged - Add DBExplorePage.tsx (the redesign) with /explore routes and self-navigation pointed at /explore - Re-add the analysis-mode Tabs in DBSearchPageFilters, guarded on setAnalysisMode so the old page keeps them and Explore stays clean - Support a configurable nav badge (badgeLabel/badgeColor) and add the Explore nav link with an "Experimental" badge Co-authored-by: Cursor <cursoragent@cursor.com>
…ands Restructure the experimental Explore page toolbar into three bands per the new wireframes: - Context band: source selector, "Saved views" button (opens the saved searches flyout), a save-status pill (Unsaved/Saved/edited), contextual Save / Save as... actions, an Alerts dropdown, and an overflow menu. - Query band: query input with an expand/collapse toggle plus time picker, Live, and Run controls. - Results band: a combined stats line (result count, scanned rows, elapsed) above the view switcher and Sort / Columns / generated-SQL / export row. Extract ExploreContextBand and ExploreResultsToolbar into a dedicated components/Explore folder, and add the SavedSearchesFlyout used by the context band. Co-authored-by: Cursor <cursoragent@cursor.com>
Introduce ExploreQueryEditor, a self-contained query editor card for the experimental Explore page, so the Explore layout can evolve without touching the shared SearchWhereInput used by the Search page. - Bordered card with SQL/Lucene language tabs on the left and the time picker, Live, Run, and expand toggle in the header on the right. - Reuses the existing SQL (CodeMirror) and Lucene (autocomplete) editors for the body. - Default the Explore query language to SQL. - Add an opt-in showLineNumbers prop to SQLInlineEditor (default off) and enable it for the Explore SQL editor. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the reuse-based Explore query editor with a CodeMirror-backed QueryEditor so both SQL and Lucene get line numbers and syntax highlighting in a single unified editor. - Add a presentational QueryEditor (SQL via the app's ClickHouse dialect, Lucene via a small custom StreamLanguage highlighter), theme-aware, with Enter-to-submit and Tab-to-complete. - ExploreQueryEditor now wraps QueryEditor with react-hook-form wiring, the ClickHouse field list for autocomplete, and the syntax-reference modal. - Add @codemirror/language dependency. Co-authored-by: Cursor <cursoragent@cursor.com>
Remove the top header block (breadcrumbs, editable title, created/updated byline) from the Explore page and surface the Favorite toggle and Tags control inside the context band instead, so all saved-view controls live in the new toolbar structure. Co-authored-by: Cursor <cursoragent@cursor.com>
The @uiw basicSetup only registers CodeMirror's defaultHighlightStyle as a fallback, so identifiers and operators stayed uncolored and the editor looked unhighlighted. Add an explicit, high-priority HighlightStyle shared by SQL and Lucene with mid-tone colors that read on both light and dark backgrounds. - Add @lezer/highlight dependency. Co-authored-by: Cursor <cursoragent@cursor.com>
Two focused UX improvements to the Explore query editor: - Open the field/variable completion list as soon as the editor is focused, so users can discover available fields without knowing exact names. - Enter now submits the query and keeps the caret in the editor, so the query can be tweaked while results load instead of losing focus on submit. Co-authored-by: Cursor <cursoragent@cursor.com>
… toolbar - Add an "Add to dashboard" button for chart-tile views that opens the shared SaveToDashboardModal with the current aggregation rendered as a tile config. - Move "Show generated SQL" and "Export" into a 3-dots overflow menu. - Make the results controls (Sort, Columns, Add to dashboard, overflow) all consistent bordered secondary buttons so they no longer feel lost. Co-authored-by: Cursor <cursoragent@cursor.com>
Surface Error/Warning counts as clickable pills in the Explore results toolbar for log sources, backed by a parallel grouped-count query. Clicking a pill scopes the search to (or clears) that severity via a new `setIncludedValues` filter mutator, which sets a column's included set to an OR-set of values in one update. Collapse the results/scanned-rows/elapsed line into a single compact "<N> results · <N> scanned · <N>ms" stat with abbreviated scanned rows, and color the severity pills with the shared semantic status tokens. Also rename the aggregated table view to "Grouped table" and add a save icon to the "Save view" button. Co-authored-by: Cursor <cursoragent@cursor.com>
Add a chart-explorer-style Builder | SQL toggle to the Explore query bar. In SQL mode the query bar becomes a full raw-SQL editor (sqlTemplate + macros) and results render as a user-selectable chart display type, reusing the existing raw-SQL config/execution pipeline. SQL mode is URL-only for now and is not persisted to saved searches (Save is disabled with a tooltip). Co-authored-by: Cursor <cursoragent@cursor.com>
Render the error/warning severity summary as secondary toolbar buttons with status icons and a count chip (matching the Columns/Sort controls), tinting with the semantic status color only while active. Treat a bucket as active via a subset test so both severities can be filtered at once. Co-authored-by: Cursor <cursoragent@cursor.com>
- Auto-expand the builder query editor (remove the manual expand toggle and line numbers; grow with content up to a max height, then scroll) - Drive SQL-mode chrome off the live editor toggle so builder-only controls (histogram, severity, sort/columns, agg controls) hide the instant you switch to SQL, while query execution still waits for Run - Unify the Builder/SQL switch and SQL/Lucene toggle into a single three-way control (SQL | Lucene | Advanced) Co-authored-by: Cursor <cursoragent@cursor.com>
Merge the read-only stats line and the view/actions line into one row: the view switcher, severity pills, and result/scanned-row/elapsed stats sit on the left, while add-to-dashboard and the overflow menu stay pinned right. A shape-the-view row now appears only when the active view exposes controls (aggregation on the left; columns / sort on the right). - Partition the view switcher into raw vs chart views separated by a divider so the icon strip reads as two related clusters. - Let the toolbar's left cluster wrap gracefully so the severity pills and stats are never pushed under the actions on narrow layouts. - Flatten the query editor so the mode toggle, editor, and filters no longer sit inside a card. Co-authored-by: Cursor <cursoragent@cursor.com>
… focus Keep the sidebar as a single Filters heading, leave Experimental in sentence case, and defer CodeMirror autocomplete so focus no longer updates the editor mid-cycle. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the one-line aggregation bar with series cards so Explore chart views can author multiple series, per-series Where, and aliases. Share those cards with the tile editor and move display settings into a persistent Tile settings rail. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
… filter pills Give metric charts shareable display settings and a series menu that can filter in place or open correlated logs and traces. Series filters now use the same SQL query editor as the page bar, with clauses promoting into per-series pills that travel in the URL. Co-authored-by: Cursor <cursoragent@cursor.com>
The icon addon sat 2px off the input and implied it only picked a name. Make it a labelled series action, drop WHERE staging from the explorer, and warn when applying a different metric clears the series filter. Co-authored-by: Cursor <cursoragent@cursor.com>
…switcher Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # packages/app/package.json # packages/app/src/DBSearchPage.tsx # packages/app/src/components/ChartEditor/PromqlChartEditor.tsx # packages/app/src/components/ChartEditor/types.ts # packages/app/src/components/DBEditTimeChartForm/ChartActionBar.tsx # packages/app/src/components/DBEditTimeChartForm/ChartSeriesEditor.tsx # packages/app/src/components/DBEditTimeChartForm/EditTimeChartForm.tsx # packages/app/src/components/DBTimeChart.tsx # packages/app/src/components/SQLEditor/SQLInlineEditor.tsx # packages/app/tests/e2e/components/ChartEditorComponent.ts # scripts/ci/ratchet-baseline.json
Attach a bar to the Explore results table holding Display, SQL/CSV, Columns and Sort. Columns now offers map/JSON sub-keys, and Columns and Sort drop their SQL tabs, since hand-written SQL goes in the query editor. Make Advanced a mode, switched from the top row: on opens the SQL generated from the current view, off returns to the search UI (confirming before discarding edits). Views stay put across the switch; the Events view shows the SQL's rows in the same table, with the row side panel where the columns allow. Columns and Sort are disabled while it is on, and "Reset to generated" is gone. Co-authored-by: Cursor <cursoragent@cursor.com>
Metric sources open in a Browse view: a wall of sparkline tiles grouped by entity and quantity, an attribute rail and search pills, and an in-place drill-down with aggregation, split, small multiples and Edit as chart. Co-authored-by: Cursor <cursoragent@cursor.com>
The Narrow rail rendered inside the results column, which pushed the Browse/Charts switcher above it. It now takes the same slot and collapse state as the filters sidebar. Co-authored-by: Cursor <cursoragent@cursor.com>
Shipping the experiment was rewriting the tile editor, Search patterns, chart tooltips, and theme tokens. Those stay as they are, and Explore uses its own series editor, metric browser, and pattern picker. Co-authored-by: Cursor <cursoragent@cursor.com>
| />, | ||
| ); | ||
|
|
||
| expect(screen.getByTestId('granularity-picker')).toHaveValue('5 minutes'); |
There was a problem hiding this comment.
Granularity tests expect old labels
The control now displays “5 Minutes Granularity,” but this assertion still expects “5 minutes.” The Explore settings test also selects an exact “1 hour” option, which is now “1 Hour Granularity.” The unit assertion fails, and the settings test cannot find its option. Update both tests to match the restored labels.
| onInsertSeriesRef?: (letter: string) => void; | ||
| }; | ||
|
|
||
| export function ExploreChartSeriesEditor({ |
There was a problem hiding this comment.
The extracted ExploreChartSeriesEditor.tsx is 783 lines. The guide requires files to stay within 300 lines. SearchAggControls.tsx and FieldPicker.tsx also exceed that limit. Split these new files into focused components and helpers before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| data-testid="save-search-modal" | ||
| opened={opened} | ||
| onClose={closeAndReset} | ||
| title="Save Search" |
There was a problem hiding this comment.
The new save dialog uses “Save Search,” “Add Tag,” and other title-case labels. The guide requires sentence case for all static user-facing text. Use “Save search,” “Add tag,” and the same casing elsewhere in the new UI before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| <Button | ||
| variant="secondary" | ||
| size="xs" | ||
| px={8} | ||
| aria-label="More actions" | ||
| data-testid="results-overflow-menu" | ||
| > | ||
| <IconDotsVertical size={16} /> | ||
| </Button> |
There was a problem hiding this comment.
The new “More actions” control is a Button containing only an icon. The guide requires ActionIcon for controls with no text. Replace the wrapper with ActionIcon before merging, keeping its accessible name.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| size="xs" | ||
| rightSection={ | ||
| <ActionIcon | ||
| variant="transparent" |
There was a problem hiding this comment.
Tag action uses unapproved variant
The new tag-removal control uses variant="transparent". The guide only allows the approved Button and ActionIcon variants, which exclude transparent. Use subtle for this utility action before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| ) : data?.data.length === 0 ? ( | ||
| <div className="d-flex h-100 w-100 align-items-center justify-content-center text-muted"> | ||
| No data found within time range. | ||
| </div> |
There was a problem hiding this comment.
Empty screens skip shared component
The new treemap renders its no-data message in a custom div. The guide requires EmptyState for every empty or no-data state. Use it here before merging. The new metric and field-picking prompts in Explore need the same change.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Editing the results table, charts, and filters in place made every merge with main a conflict. Explore now renders its own copies, and the shared components go back to the branch point. Co-authored-by: Cursor <cursoragent@cursor.com>
| @@ -0,0 +1,1147 @@ | |||
| // Explore-owned copy. The shared module stays as it is on main, so this prototype does not conflict with it. | |||
There was a problem hiding this comment.
The new Explore/owned directory copies whole shared implementations, including DBTimeChart and ChartUtils. The guide explicitly says to edit files directly rather than create component copies, and to factor shared logic into a sibling module. These copies require fixes to be repeated in two places. Keep the shared implementation and isolate Explore’s differences behind focused components or options. This repository requirement must be satisfied before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Explore keeps its own page copies. Shared files take main, including heatmap mode and the nav badge. Co-authored-by: Cursor <cursoragent@cursor.com>
| if ((isSqlMode || isSqlUiMode) && !isSqlModeSearchView(view)) { | ||
| viewBeforeSqlRef.current = view; | ||
| setView('list'); |
There was a problem hiding this comment.
| return { | ||
| name: savedSearch?.name || 'Explore SQL chart', | ||
| configType: 'sql', | ||
| sqlTemplate: rawSqlChartConfig.sqlTemplate, | ||
| connection: rawSqlChartConfig.connection, | ||
| source: searchedConfig.source ?? undefined, | ||
| displayType: rawSqlChartConfig.displayType ?? DisplayType.Table, | ||
| granularity: rawSqlChartConfig.granularity, | ||
| }; |
There was a problem hiding this comment.
Adding a SQL chart to a dashboard drops the search and filter pills. rawSqlChartConfig.filters includes both, but this saved config keeps only the template. The dashboard supplies its own filters, so $__filters no longer means the same query and the tile can show broader results. Bake the Explore filters into the saved query or add a supported way to preserve them.
| case 'treemap': | ||
| return DisplayType.Treemap; |
| const parts = splitTopLevel(body, 'AND', { allowEmptyLast: true }); | ||
| if (parts == null) { | ||
| return { filters: {}, remainder: where }; | ||
| } | ||
|
|
||
| const filters: FilterState = {}; | ||
| const remainderParts: string[] = []; | ||
|
|
||
| parts.forEach((part, i) => { | ||
| const parsed = parsePromotablePart(part, language); | ||
| const isLast = i === parts.length - 1; | ||
| if (parsed != null && (!isLast || commitLast)) { | ||
| mergeStates(filters, parsed); |
There was a problem hiding this comment.
Pasting ServiceName = 'api' AND ServiceName = 'worker' unions both values into one IN filter instead of keeping the impossible AND. Splitting on AND before accounting for a top-level OR can also change precedence. Explore then returns different rows from the entered SQL. Only promote expressions whose full meaning can be preserved.
| if (sel.range != null) { | ||
| if (!into[field]) { | ||
| into[field] = emptySelection(); | ||
| } | ||
| into[field].range = sel.range; |
There was a problem hiding this comment.
Typing Duration > 500 AND Duration < 900 leaves only the upper bound because mergeStates replaces range. Entering the bounds separately has the same problem in mergeFilterValues; parseQuery also replaces repeated ranges. Intersect the bounds rather than replacing them, so the query keeps both constraints.
| const handleExploreChartSettingsChange = useCallback( | ||
| (settings: ChartConfigDisplaySettings) => { | ||
| setAggConfig({ | ||
| granularity: settings.granularity ?? 'auto', | ||
| alignDateRangeToGranularity: | ||
| settings.alignDateRangeToGranularity ?? false, | ||
| fillNulls: settings.fillNulls === false ? false : 0, | ||
| compareToPreviousPeriod: settings.compareToPreviousPeriod ?? false, | ||
| fitYAxisToData: settings.fitYAxisToData ?? false, | ||
| numberFormat: settings.numberFormat, | ||
| }); |
There was a problem hiding this comment.
Some chart settings do nothing
Chart settings offers controls whose values are discarded on Apply. The drawer returns seriesLimit, table layout settings, and number-chart colors, but this handler saves none of them. Users spend time changing controls that have no effect. Hide unsupported controls or carry their values through query state, rendering, and dashboard export.
| case 'kind': | ||
| return `kind:${token.value}`; |
There was a problem hiding this comment.
Spaced metric kinds cannot filter
The Exponential histogram filter writes kind:exponential histogram, but parsing reads two words and recognizes neither as that kind. Clicking it can hide matching metrics instead of selecting them. Quote spaced kind values and let the tokenizer read quoted colon values as one token.
| export const fieldIdentifier = (field: Field): string => | ||
| field.path.length > 1 | ||
| ? `${field.path[0]}['${field.path[1]}']` | ||
| : field.path[0]; |
There was a problem hiding this comment.
Field picks build broken paths
fieldIdentifier inserts an unescaped key and keeps only two path parts. Picking a map key such as it's produces LogAttributes['it's'], which is invalid SQL. Deeper paths also lose their tail. Use the existing type-aware path helper so field picks preserve the full path and escape keys.
| <Box> | ||
| <Text size="xs" mb="xs"> | ||
| Name | ||
| </Text> | ||
| <InputControlled | ||
| data-testid="save-search-name-input" | ||
| control={control} | ||
| name="name" | ||
| rules={{ required: true, validate: isValidName }} | ||
| /> |
There was a problem hiding this comment.
Saved-search naming skips shared control
The new save dialog asks for the saved-search name through InputControlled. The repository guide requires InlineNameInput for user-created object names and explicitly forbids a Name field inside a save modal. Move naming inline and use InlineNameInputControlled. This repository requirement must be satisfied before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| .drill { | ||
| border: 1px solid var(--color-border); | ||
| border-radius: var(--mantine-radius-sm); | ||
| background: var(--color-bg-body); | ||
| padding: var(--mantine-spacing-sm); | ||
| margin-bottom: var(--mantine-spacing-sm); |
There was a problem hiding this comment.
Metric cards skip shared styling
The metric drill-down draws a bordered chart card with custom CSS. The guide requires ChartCard for chart cards rather than a hand-built bordered wrapper. Use the shared card for this surface; the small-multiple cards follow the same pattern. This repository requirement must be satisfied before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
The lockfile still listed @codemirror/language on the app after package.json dropped it, so every CI install failed. Treemap also had no arm in the PromQL tile converter, which failed the app image build. Co-authored-by: Cursor <cursoragent@cursor.com>
Duplicate code analysis200 new clones introduced by this PR.
If one of these duplicates a helper that already exists, import it instead jscpd compared this branch against |
What this is trying to do
This is a prototype of Explore: one place to search telemetry and, when the question needs a shape, turn that search into a chart — without becoming a second dashboard editor.
Search today is a results table. Charts live on dashboards, behind a different mental model (tiles, display settings, formula rows). The bet here is that people start with “what happened?” and only sometimes need “show me that as a number / time series / pie.” Explore should feel like Search first, visualization second.
Preview
Link: https://hyperdx-oss-git-elizabet-search-view-switcher-hyperdx.vercel.app/explore
Product intent
A / B, click-to-insert letters) change what you asked. Tile chrome (colors, fill-nulls, number format) stays on Add to dashboard / the tile editor.What is explicitly not the goal
Test plan
Prototype only; treat this as a walkthrough, not a merge checklist.
A / B) via letter chips; Run; Add to dashboard keeps bothMade with Cursor