Skip to content

feat: define explore dashboards inline in metrics views via the explore: block#9680

Open
nishantmonu51 wants to merge 3 commits into
mainfrom
explore_as_mv
Open

feat: define explore dashboards inline in metrics views via the explore: block#9680
nishantmonu51 wants to merge 3 commits into
mainfrom
explore_as_mv

Conversation

@nishantmonu51

Copy link
Copy Markdown
Collaborator

Makes the inline explore: block the primary way to get an explore dashboard for a version: 1 metrics view, and builds the editing experience around it:

  • Parser: the inline explore: block now supports dimensions: and measures: field selectors (defaulting to all), and the emitted explore is flagged with defined_in_metrics_view.
  • The metrics view workspace gets a three-way toggle (code / metrics editor / explore editor); the visual explore editor edits the explore: block of the same file next to a live dashboard preview.
  • "Generate Explore Dashboard" now enables the inline explore instead of creating a separate explore file (create-and-preview-explore.ts is replaced by inline-explore.ts); generated metrics views (both AI and simple paths) include the explore: block out of the box.
  • For metrics views with an inline explore, the header CTA shows Preview plus a "Go to dashboard" button that lists the metrics view's canvas dashboards and offers canvas generation.
  • Updated AI agent instructions, JSON schema, docs, and e2e tests; added an e2e suite for inline explore editing and the new header CTA.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@nishantmonu51 nishantmonu51 added Type:Feature New feature request Area:Dashboard Size:L Large change: 500-1,999 lines labels Jul 14, 2026
# Conflicts:
#	web-common/src/features/workspaces/VisualExploreEditing.svelte
DEFAULT_PREVIEW_TABLE_HEIGHT,
} from "../config";

export type WorkspaceView = "code" | "split" | "viz" | "explore";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explore is only for metrics view so adding it to WorkspaceLayoutStore feels incorrect.

Maybe there is a way to make it a generic and take additional view params?

href={getFileHref(exploreFilePath)}
onclick={() => {
if (definedInMetricsView) {
workspaces.get(exploreFilePath).view.set("explore");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Storing the view is responsibility of editor and not this component. Perhaps a query param that gets parsed, stored as view and cleared is a better approach. We could do it (workspace)/files/[...file]/+page.ts, including routing to view based on definedInMetricsView

?.filter(
(res) =>
res.meta?.name?.kind === ResourceKind.Component &&
res.component?.state?.validSpec?.rendererProperties

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just one way to get metrics view. There are other ways that runtime.ResolveCanvas in backend handles. So we would have to call ResolveCanvas on every canvas to get this reverse map.

}

// Resolve the dimensions and measures selectors; when omitted, they default to all fields.
var dimensionsSelector *runtimev1.FieldSelector

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we use the same UI for editing inline and explicit explores we should find a way to keep the parser code in sync. Maybe we can move explore definition specific fields to a new struct and move parsing there?

// Create the Explore file, and navigate to it
await createAndPreviewExplore(client, queryClient, instanceId, resource);
// The generated metrics view defines its explore inline; open it
await previewInlineExplore(queryClient, newMetricsViewFilePath);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this PR changes the backend it can be changed back anytime. So we should check the yaml generated and route based on that.

Same with other cases where we dont provide the yaml in param. Especially the case with AI generated ones where it is not deterministic.

instanceId,
resource,
)}
onclick={() => enableInlineExploreAndPreview(queryClient, filePath)}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option is now a bit misleading since we are not generating anything anymore. Also is incorrect for non-version1 metrics views.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area:Dashboard Size:L Large change: 500-1,999 lines Type:Feature New feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants