Skip to content

@maple-dev/alchemy: typed dashboard props, a managed refresh interval, and adopting a dashboard built in the UI #1891

Description

@jasonkuhrt

Written by an AI agent (Claude) on behalf of @jasonkuhrt.

A team managing its Maple dashboards with @maple-dev/alchemy can't type-check a dashboard, can't manage its refresh interval, and can't take over a dashboard someone already built in the UI.

yield* Maple.Dashboard("service-health", {
	name: "Service health",
	// Type error: not a prop, though the v2 API has it.
	refresh_interval_seconds: 60,
	widgets: [
		// Type-checks, then the API answers 400 at deploy: "timeseries" is not a
		// visualization, and a raw_sql source needs its `sql`.
		{ id: "requests", visualization: "timeseries", data_source: { kind: "raw_sql" } },
	],
})

And declaring a dashboard that was first built in the UI creates a second one beside it, because the provider creates whenever it has no Alchemy state.

What we'd like to write instead:

// Panels as values, checked where they're written, shared across dashboards.
const requests = Maple.DashboardWidget.make({
	id: "requests",
	visualization: "stat",
	data_source: { kind: "raw_sql", sql: "SELECT count() AS value FROM traces WHERE $__orgFilter" },
	display: { title: "Requests" },
	layout: { x: 0, y: 0, w: 3, h: 4 },
})

yield* Maple.Dashboard("service-health", {
	...Maple.DashboardData.make({ name: "Service health", refresh_interval_seconds: 60, widgets: [requests] }),
	// Take over the dashboard built in the UI.
	dashboardId: "dash_…",
})

Heartbeat runs this today through a patch of @maple-dev/alchemy 0.2.4, for two dashboards. #1872 implements it.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions