Repository navigation
feat: Add data table explorer blocks to Mosaic dashboards - #668
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR replaces the Mosaic Profiler feature with a Data Table Explorer across types, hooks/stores, query clients, React components, dashboard panel wiring, AI tools, CLI UI integration, tests, and documentation. ChangesData Table Explorer Feature Replacement
Estimated code review effort 🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/sqlrooms-cli-ui/README.md`:
- Line 69: Update the README text that still uses the old "profiler" term:
replace the phrase "Data Table Explorer/profiler" (and any other occurrences of
"profiler") with explorer-only wording such as "Data Table Explorer" or
"explorer" so the sentence reads consistently (e.g., "Data Table Explorer flows
use `grid`"); search for the string "profiler" and update references in the
README to match the profiler→explorer renaming.
In `@packages/mosaic/src/data-table-explorer/DataTableExplorerHeader.tsx`:
- Around line 27-36: The header builds Tailwind arbitrary-width classes with
template literals (COLUMN_WIDTH_CLASS, STICKY_ROW_NUMBER_CLASS,
getColumnWidthClass) which Tailwind’s scanner won’t pick up; change these to use
scanner-visible static class names or inline styles so header and rows can’t
diverge: create a shared mapping from the known constants
(DATA_TABLE_EXPLORER_DEFAULT_COLUMN_WIDTH_PX,
DATA_TABLE_EXPLORER_ROW_NUMBER_COLUMN_WIDTH_PX,
DATA_TABLE_EXPLORER_UNSUPPORTED_COLUMN_WIDTH_PX) to explicit static Tailwind
classes (e.g., precomputed "min-w-[140px] w-[140px] max-w-[140px]" strings) that
both DataTableExplorerHeader and DataTableExplorerRows import, or switch the
header/rows to set width/minWidth/maxWidth via style={{ width, minWidth,
maxWidth }} using those constants; update COLUMN_WIDTH_CLASS,
STICKY_ROW_NUMBER_CLASS and getColumnWidthClass to consume the shared mapping or
use inline styles so Tailwind scanning and sizing remain consistent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ec6b1de2-f3c0-47f7-89dd-b735ce5fbc85
📒 Files selected for processing (50)
apps/sqlrooms-cli-ui/README.mdapps/sqlrooms-cli-ui/src/components/DataSourcesPanel.tsxapps/sqlrooms-cli-ui/src/statefulBlockArtifactConfigs.tsapps/sqlrooms-cli-ui/src/store-types.tsapps/sqlrooms-cli-ui/src/store.tsapps/sqlrooms-cli-ui/src/workspace/WorksheetArtifact.tsxpackages/mosaic/README.mdpackages/mosaic/__tests__/DataTableExplorerCompound.test.tsxpackages/mosaic/__tests__/DataTableExplorerQueryClients.test.tspackages/mosaic/__tests__/DataTableExplorerStatusBar.test.tsxpackages/mosaic/__tests__/DataTableExplorerSummaryClients.test.tsxpackages/mosaic/__tests__/MosaicDashboardSlice.test.tspackages/mosaic/__tests__/createDataTableExplorerStore.test.tspackages/mosaic/__tests__/dashboard-ai.test.tspackages/mosaic/__tests__/data-table-explorer.utils.test.tspackages/mosaic/src/ai.tspackages/mosaic/src/chart-types/base-types.tspackages/mosaic/src/chart-types/data-table-explorer-tool.tspackages/mosaic/src/chart-types/index.tspackages/mosaic/src/chart-types/tool-helpers.tspackages/mosaic/src/dashboard/MosaicDashboardEmptyState.tsxpackages/mosaic/src/dashboard/MosaicDashboardSlice.tspackages/mosaic/src/dashboard/core-types.tspackages/mosaic/src/dashboard/dashboard-types.tspackages/mosaic/src/dashboard/defaultPanelActions.tspackages/mosaic/src/dashboard/defaultPanelRenderers.tspackages/mosaic/src/dashboard/initial-state/BuildDashboardManuallyPanel.tsxpackages/mosaic/src/data-table-explorer/DataTableBlockRenderer.tsxpackages/mosaic/src/data-table-explorer/DataTableExplorer.tsxpackages/mosaic/src/data-table-explorer/DataTableExplorerCategoryClient.tspackages/mosaic/src/data-table-explorer/DataTableExplorerCountClient.tspackages/mosaic/src/data-table-explorer/DataTableExplorerHeader.tsxpackages/mosaic/src/data-table-explorer/DataTableExplorerHistogramClient.tspackages/mosaic/src/data-table-explorer/DataTableExplorerPageClient.tspackages/mosaic/src/data-table-explorer/DataTableExplorerRows.tsxpackages/mosaic/src/data-table-explorer/DataTableExplorerStatusBar.tsxpackages/mosaic/src/data-table-explorer/DataTableExplorerUnsupportedSummaryClient.tspackages/mosaic/src/data-table-explorer/MosaicDashboardDataTableExplorerPanelRenderer.tsxpackages/mosaic/src/data-table-explorer/addDataTableExplorerPanelAction.tspackages/mosaic/src/data-table-explorer/createDataTableExplorerStore.tspackages/mosaic/src/data-table-explorer/dataTableExplorerController.tspackages/mosaic/src/data-table-explorer/layout.tspackages/mosaic/src/data-table-explorer/types.tspackages/mosaic/src/data-table-explorer/useDataTableExplorer.tspackages/mosaic/src/data-table-explorer/utils.tspackages/mosaic/src/index.tspackages/mosaic/src/profiler/MosaicProfiler.tsxpackages/mosaic/src/profiler/addProfilerPanelAction.tspackages/mosaic/src/profiler/layout.tspackages/mosaic/src/profiler/types.ts
💤 Files with no reviewable changes (4)
- packages/mosaic/src/profiler/layout.ts
- packages/mosaic/src/profiler/addProfilerPanelAction.ts
- packages/mosaic/src/profiler/types.ts
- packages/mosaic/src/profiler/MosaicProfiler.tsx
| layout. Explicit dashboard creation commands and AI tools require `layoutType` | ||
| so the choice is made once at creation time; auto-created dashboards from chart | ||
| or profiler flows use `grid`. | ||
| or Data Table Explorer flows use `grid`. |
There was a problem hiding this comment.
Remove stale “profiler” wording in dashboard flow docs.
Line 69 still references Data Table Explorer/profiler flows, which conflicts with this PR’s profiler→explorer replacement. Please update to explorer-only wording to avoid confusion.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/sqlrooms-cli-ui/README.md` at line 69, Update the README text that still
uses the old "profiler" term: replace the phrase "Data Table Explorer/profiler"
(and any other occurrences of "profiler") with explorer-only wording such as
"Data Table Explorer" or "explorer" so the sentence reads consistently (e.g.,
"Data Table Explorer flows use `grid`"); search for the string "profiler" and
update references in the README to match the profiler→explorer renaming.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/mosaic/src/data-table-explorer/layout.ts (1)
7-12: ⚡ Quick winAvoid duplicated width literals in class constants.
These class strings repeat pixel values already defined above, which can drift if one side is updated later. Build the classes from the numeric constants to keep a single source of truth.
♻️ Proposed refactor
export const DATA_TABLE_EXPLORER_ROW_NUMBER_WIDTH_CLASS = - 'min-w-[40px] w-[40px] max-w-[40px]'; + `min-w-[${DATA_TABLE_EXPLORER_ROW_NUMBER_COLUMN_WIDTH_PX}px] w-[${DATA_TABLE_EXPLORER_ROW_NUMBER_COLUMN_WIDTH_PX}px] max-w-[${DATA_TABLE_EXPLORER_ROW_NUMBER_COLUMN_WIDTH_PX}px]`; export const DATA_TABLE_EXPLORER_DEFAULT_COLUMN_WIDTH_CLASS = - 'min-w-[140px] w-[140px] max-w-[140px]'; + `min-w-[${DATA_TABLE_EXPLORER_DEFAULT_COLUMN_WIDTH_PX}px] w-[${DATA_TABLE_EXPLORER_DEFAULT_COLUMN_WIDTH_PX}px] max-w-[${DATA_TABLE_EXPLORER_DEFAULT_COLUMN_WIDTH_PX}px]`; export const DATA_TABLE_EXPLORER_UNSUPPORTED_COLUMN_WIDTH_CLASS = - 'min-w-[104px] w-[104px] max-w-[104px]'; + `min-w-[${DATA_TABLE_EXPLORER_UNSUPPORTED_COLUMN_WIDTH_PX}px] w-[${DATA_TABLE_EXPLORER_UNSUPPORTED_COLUMN_WIDTH_PX}px] max-w-[${DATA_TABLE_EXPLORER_UNSUPPORTED_COLUMN_WIDTH_PX}px]`;As per coding guidelines, “Prefer straightforward, maintainable code over clever code”.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/mosaic/src/data-table-explorer/layout.ts` around lines 7 - 12, The three exported class constants DATA_TABLE_EXPLORER_ROW_NUMBER_WIDTH_CLASS, DATA_TABLE_EXPLORER_DEFAULT_COLUMN_WIDTH_CLASS, and DATA_TABLE_EXPLORER_UNSUPPORTED_COLUMN_WIDTH_CLASS duplicate hard-coded pixel literals; introduce corresponding numeric width constants (e.g., ROW_NUMBER_WIDTH = 40, DEFAULT_COLUMN_WIDTH = 140, UNSUPPORTED_COLUMN_WIDTH = 104) and build each class string from those single-source numeric constants (e.g., generate 'min-w-[{N}px] w-[{N}px] max-w-[{N}px]') so updates only change the numeric value referenced by the class builders.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/mosaic/src/data-table-explorer/layout.ts`:
- Around line 7-12: The three exported class constants
DATA_TABLE_EXPLORER_ROW_NUMBER_WIDTH_CLASS,
DATA_TABLE_EXPLORER_DEFAULT_COLUMN_WIDTH_CLASS, and
DATA_TABLE_EXPLORER_UNSUPPORTED_COLUMN_WIDTH_CLASS duplicate hard-coded pixel
literals; introduce corresponding numeric width constants (e.g.,
ROW_NUMBER_WIDTH = 40, DEFAULT_COLUMN_WIDTH = 140, UNSUPPORTED_COLUMN_WIDTH =
104) and build each class string from those single-source numeric constants
(e.g., generate 'min-w-[{N}px] w-[{N}px] max-w-[{N}px]') so updates only change
the numeric value referenced by the class builders.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8c403cbc-219a-4b51-81bf-86d4517d6f86
📒 Files selected for processing (3)
packages/mosaic/src/data-table-explorer/DataTableExplorerHeader.tsxpackages/mosaic/src/data-table-explorer/DataTableExplorerRows.tsxpackages/mosaic/src/data-table-explorer/layout.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/mosaic/src/data-table-explorer/DataTableExplorerHeader.tsx
- packages/mosaic/src/data-table-explorer/DataTableExplorerRows.tsx
There was a problem hiding this comment.
🧹 Nitpick comments (2)
packages/mosaic/src/data-table-explorer/DataTableSelector.tsx (1)
18-176: ⚡ Quick winDocument the new public exports.
DataTableSelector,DataTableSelectorEmptyState,getDataTableSelectorReference, andDataTableSelectorPropsare public exports of themosaicpackage but carry no doc comments. Add brief JSDoc clarifying the contract — notably thatonChange/valueoperate on the dotted table reference (database.schema.table) rather than the bare table name, which is non-obvious from the(tableName: string)signature.As per coding guidelines, "Public exports in
packages/should be kept generic, composable, documented, and free of app/example-specific assumptions".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/mosaic/src/data-table-explorer/DataTableSelector.tsx` around lines 18 - 176, Add brief JSDoc comments for the public exports DataTableSelector, DataTableSelectorEmptyState, getDataTableSelectorReference, and DataTableSelectorProps: document the component purpose, prop contracts, and especially clarify that DataTableSelectorProps.onChange and the value prop expect and return the dotted table reference format "database.schema.table" (not just the bare table name); mention that getDataTableSelectorReference returns that dotted reference and that DataTableSelectorEmptyState is a presentational wrapper rendering the same selector in an empty-state layout. Ensure the comments are concise, placed immediately above each export (DataTableSelectorProps type, DataTableSelector component, DataTableSelectorEmptyState function, and getDataTableSelectorReference function), and avoid app-specific assumptions.packages/mosaic/src/data-table-explorer/DataTableBlockRenderer.tsx (1)
96-156: ⚡ Quick winExtract the duplicated selector header.
The header (
border-brow with{tableSelector}+ optional caption) is repeated verbatim across the loading, not-ready, and ready branches. Extract it once to avoid drift.♻️ Hoist a single header element
const tableSelector = ( <DataTableSelector className="max-w-full" disabled={readOnly || !onTitleChange} onChange={handleTableNameChange} tables={selectableTables} value={tableName} /> ); + const header = ( + <div className="border-border flex shrink-0 items-center gap-2 border-b px-3 py-2"> + {tableSelector} + {caption ? ( + <div className="min-w-0 truncate text-sm font-medium">{caption}</div> + ) : null} + </div> + );Then replace each duplicated block with
{header}.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/mosaic/src/data-table-explorer/DataTableBlockRenderer.tsx` around lines 96 - 156, There is duplicated JSX for the selector header across the loading, not-ready, and ready branches; hoist that markup into a single const (e.g., const header = (<div className="border-border flex shrink-0 items-center gap-2 border-b px-3 py-2">{tableSelector}{caption ? <div className="min-w-0 truncate text-sm font-medium">{caption}</div> : null}</div>);) inside DataTableBlockRenderer.tsx, then replace the three repeated header blocks in the connection.status === 'loading', connection.status !== 'ready', and the final return branch with {header} so the header is defined once and reused.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/mosaic/src/data-table-explorer/DataTableBlockRenderer.tsx`:
- Around line 96-156: There is duplicated JSX for the selector header across the
loading, not-ready, and ready branches; hoist that markup into a single const
(e.g., const header = (<div className="border-border flex shrink-0 items-center
gap-2 border-b px-3 py-2">{tableSelector}{caption ? <div className="min-w-0
truncate text-sm font-medium">{caption}</div> : null}</div>);) inside
DataTableBlockRenderer.tsx, then replace the three repeated header blocks in the
connection.status === 'loading', connection.status !== 'ready', and the final
return branch with {header} so the header is defined once and reused.
In `@packages/mosaic/src/data-table-explorer/DataTableSelector.tsx`:
- Around line 18-176: Add brief JSDoc comments for the public exports
DataTableSelector, DataTableSelectorEmptyState, getDataTableSelectorReference,
and DataTableSelectorProps: document the component purpose, prop contracts, and
especially clarify that DataTableSelectorProps.onChange and the value prop
expect and return the dotted table reference format "database.schema.table" (not
just the bare table name); mention that getDataTableSelectorReference returns
that dotted reference and that DataTableSelectorEmptyState is a presentational
wrapper rendering the same selector in an empty-state layout. Ensure the
comments are concise, placed immediately above each export
(DataTableSelectorProps type, DataTableSelector component,
DataTableSelectorEmptyState function, and getDataTableSelectorReference
function), and avoid app-specific assumptions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a92bb43a-56bd-4e86-80b7-10a43f1accc7
📒 Files selected for processing (9)
apps/sqlrooms-cli-ui/src/workspace/WorksheetArtifact.tsxpackages/documents/README.mdpackages/documents/src/BlockDocumentEditor/node-views/BlockDocumentStatefulBlockNodeView.tsxpackages/documents/src/BlockDocumentStatefulBlockRendererContext.tsxpackages/mosaic/src/data-table-explorer/DataTableBlockRenderer.tsxpackages/mosaic/src/data-table-explorer/DataTableSelector.tsxpackages/mosaic/src/data-table-explorer/createDataTableExplorerStore.tspackages/mosaic/src/data-table-explorer/dataTableExplorerController.tspackages/mosaic/src/data-table-explorer/useDataTableExplorer.ts
✅ Files skipped from review due to trivial changes (1)
- packages/documents/README.md
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/mosaic/src/data-table-explorer/createDataTableExplorerStore.ts
- packages/mosaic/src/data-table-explorer/dataTableExplorerController.ts
Summary
packages/mosaicandapps/sqlrooms-cli-uiTesting
Summary by CodeRabbit
New Features
Changes
Bug Fixes
Documentation