Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(notebooks): add saved notebook widgets to dashboards (#104852)

Marius Andra15d5f987fde7
diff --git a/common/storybook/.storybook/public/notebook-dashboard-widget.html b/common/storybook/.storybook/public/notebook-dashboard-widget.html
new file mode 100644
index 000000000000..5526460da7f7
--- /dev/null
+++ b/common/storybook/.storybook/public/notebook-dashboard-widget.html
@@ -0,0 +1,79 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <title>Notebook widget example</title>
+ <style>
+ body {
+ margin: 0;
+ padding: 24px;
+ font: 14px system-ui;
+ color: #27252a;
+ background: #fff;
+ }
+ h2 {
+ font-size: 20px;
+ margin: 0 0 8px;
+ }
+ p {
+ color: #6b6770;
+ margin: 0 0 30px;
+ }
+ .row {
+ display: grid;
+ grid-template-columns: 65px 1fr 55px;
+ gap: 12px;
+ align-items: center;
+ margin: 24px 0;
+ }
+ .bar {
+ height: 30px;
+ background: #7856d8;
+ border-radius: 4px;
+ }
+ .value {
+ text-align: right;
+ font-weight: 600;
+ }
+ </style>
+ </head>
+ <body>
+ <h2>Revenue by plan</h2>
+ <p>Calculated in Python from notebook dataframes</p>
+ <div id="rows">Loading saved results…</div>
+ <script>
+ const channel = new MessageChannel()
+ channel.port1.onmessage = ({ data }) => {
+ if (data.type !== 'data-response' || !data.ok) {
+ return
+ }
+ const container = document.getElementById('rows')
+ container.replaceChildren()
+ const max = Math.max(...data.result.rows.map((row) => row[1]))
+ for (const [label, value] of data.result.rows) {
+ const row = document.createElement('div')
+ row.className = 'row'
+ const name = document.createElement('span')
+ name.textContent = label
+ const bar = document.createElement('div')
+ bar.className = 'bar'
+ bar.style.width = `${(value / max) * 100}%`
+ const number = document.createElement('span')
+ number.className = 'value'
+ number.textContent = `$${value}`
+ row.append(name, bar, number)
+ container.append(row)
+ }
+ channel.port1.postMessage({ channel: 'posthog-canvas', type: 'rendered' })
+ }
+ parent.postMessage({ channel: 'posthog-canvas', type: 'notebook-connect' }, '*', [channel.port2])
+ channel.port1.postMessage({
+ channel: 'posthog-canvas',
+ type: 'data-request',
+ id: 'saved-revenue',
+ method: 'stateGet',
+ payload: { key: '__posthog_notebook_frame__:revenue:0:100' },
+ })
+ </script>
+ </body>
+</html>
diff --git a/docs/internal/generated-notebook-widgets.md b/docs/internal/generated-notebook-widgets.md
index fb45869748e0..afb5c1edb090 100644
--- a/docs/internal/generated-notebook-widgets.md
+++ b/docs/internal/generated-notebook-widgets.md
@@ -12,6 +12,34 @@ Costs come from recorded gateway usage and include the same markup as PostHog AI
Older versions and generations without available usage records do not show a cost.
The estimate does not include separate failed or canceled generation jobs, or notebook compute.
+## Dashboard widgets
+
+Choose **Add to dashboard** from a generated widget's notebook menu to save its selected version, input mappings, and completed dataframe results.
+Both generated notebook widgets and dashboard widgets must be enabled.
+The selected widget version must have an available preview before the menu offers **Add to dashboard**.
+Notebook widgets are added from the notebook, rather than the dashboard's generic widget picker.
+Each snapshot holds up to 5,000 rows per dataframe and 8 MiB in total. Adding a widget fails if any required result has expired or cannot be fully captured within these limits.
+Opening a dashboard reads these saved rows without starting notebook compute. Each viewer still needs access to the source notebook, queries, and connected data sources, and must consent to the exact generated build before it reads data.
+Public dashboards show a placeholder instead of notebook results.
+The widget fills the dashboard tile below its header.
+Use the tile's **…** menu to open the notebook, refresh its results, view source, or check the saved time, automated review, and build ID.
+
+**Refresh from notebook** runs the saved notebook's data cells in document order through the backend notebook runner.
+Dashboard refresh opts into running prepared embedded insights alongside SQL and Python cells with `include_prepared_insights=true`.
+This option requires generated notebook widgets to be enabled. Ordinary **Run all** still runs SQL and Python cells only.
+Insights without a prepared dataframe query cannot supply widget inputs.
+Refresh keeps the existing results visible and replaces the snapshot only after every cell and the new capture succeed.
+The snapshot and dashboard tile are saved together. A refused dashboard save leaves no new snapshot, and a stale refresh cannot overwrite a newer snapshot.
+Refresh continues when the dashboard tab is hidden. Keep the dashboard open until the refresh finishes: closing it before publication leaves the previous snapshot in place and does not stop the backend notebook run.
+Dashboard refresh can execute up to 50 cells, including prepared insights. Display-only insights do not count toward this limit.
+If source runs were deleted, snapshot metadata remains available so the widget can be refreshed, but saved rows cannot be read until source authorization can be checked again.
+Snapshot creation allows 10 requests per hour per credential or user. Refresh publication uses a separate limit of 60 requests per hour.
+A daily cleanup removes snapshots created more than seven days ago if no active dashboard tile references them. Copies on other dashboards keep their shared snapshot.
+Dashboard date ranges and filters do not change notebook variables. Refresh uses the notebook's saved variables and can incur Python compute charges.
+The dashboard keeps the selected generated version; generating a new version in the notebook does not replace dashboard widgets.
+
+## Notebook previews
+
- Generation runs as a durable background job. The notebook shows its phase, elapsed time, cancellation, and terminal errors. Queued jobs stop immediately when canceled.
- Failed jobs expose a stable error code and the failed source-generation, security-review, or publishing phase. AI request logs include upstream status and request IDs when available.
- Source generation and security review send Claude requests through the native Anthropic Messages format in both local and cloud environments.
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 8eb56c6d7d38..5322b0bed6c8 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -5937,9 +5937,9 @@ snapshots:
products-dashboards-add-insight-to-dashboard-modal--with-more-insight-types--light:
hash: v1.k794b7964.6c001db5555f48832f11ae8d9dcc535dff4e22044bb6dfce15db3a2a522f1fa9.GQCxp64JkEqDCNEeSD6gPtc5rwlzjHFJ-QnZu4lRips
products-dashboards-dashboard-widgets-overview--all-widget-types--dark:
- hash: v1.k794b7964.0dc6c93831aac8ced60c1755761d80daa5e2460eeeb25ba032715b2ffbe8389f.VUPR5i-Wv-uSknUcmvpTwR_HfEBhII6D7BiO4IfoPkI
+ hash: v1.k794b7964.c8ccf56e7a97ed764ef1b9feff1fbefb1e3b8677fbf34e950adb91fb8ad0c65a.SP6nwmHbLhfX64P11e8X6ceeDvQynhdRrSCHXsblts8
products-dashboards-dashboard-widgets-overview--all-widget-types--light:
- hash: v1.k794b7964.ff282a9973ca858d711068f40c38476ca61718c14dc0192b04302179ba90e620.VxNKePplQsPhDiq_0V-OpyhiEQmqEJ6xpgddoddLkUY
+ hash: v1.k794b7964.76d3914773ce95c73661a095c09cd13d3886fc71ed8619b405b52d03af75309e.7h4Yavt5bAp86IDjoyzG4duYQRyU4pDb5kMndOnOut0
products-dashboards-dashboard-widgets-widget-types-activity-recent-events--default--dark:
hash: v1.k794b7964.c69d28ef03335511de9b7dd75d5ad1c0458272d5d8f340083cdb86acc3b3c888.KB3MNhE9xEjVSl9hmVpz2jLC0IAmOTvaVZBmrl3pNKs
products-dashboards-dashboard-widgets-widget-types-activity-recent-events--default--light:
@@ -6476,6 +6476,26 @@ snapshots:
hash: v1.k794b7964.0c4ff880090d289792e07ce7cb7359a1b6ebc7f22018412f5e69b76d39b06c1c.5jO-D_nxXdrKXxqLu2eyHsS3a_h_Szw2YhyhYhVl4j4
products-mcp-analytics-shared-filters--narrow--light:
hash: v1.k794b7964.562db8df12c68befe57f8919f809de1df19a1ce38ac4df71182b1ef4dd992e60.gfWAYEniMvycz6kgaG9x41uOeVArlCV8Kr0Qoe09bfk
+ products-notebooks-dashboard-widget--access-denied--dark:
+ hash: v1.k794b7964.f93f5836e1334a281785def757008dc8ffa21aa628abdad3699de6be7dfc57da.7iLBmN3IxFb-xnmud9sGvyawwuRnGQQ9NcMP5NXo6Os
+ products-notebooks-dashboard-widget--access-denied--light:
+ hash: v1.k794b7964.f12c96e51ba15ba72a9e624e28c236e2117b2b1702aa983d7a0ad522c3d1e75e.YItBs3XBt1hkittNdQn6r9NQeXD--YdOXRkOMzg8qs0
+ products-notebooks-dashboard-widget--add-to-dashboard--dark:
+ hash: v1.k794b7964.844a153c1d7d1b06b48367d4adf6668d3e8ef3e56ed5568b5952381efc64a184._CUmLNH3L2iQ0i8D4aztJBWbZ1t2RZz1wGseuQg-1Fs
+ products-notebooks-dashboard-widget--add-to-dashboard--light:
+ hash: v1.k794b7964.3024152d6b954ce8d4f622b473bfbdd097cf33879c41f92089237c0c612e90f6.Sqi5WDWpiccNT_xzbnlo4DfcaWH0KIER6kjG5MjsP38
+ products-notebooks-dashboard-widget--empty--dark:
+ hash: v1.k794b7964.0dea0b55f93423d05eadf5d965f98c95171d4cd5b6ba6be4cd0d265d853d1aa7.i7496pxyxpeOzZ8QDSw1qmagFet5LEI8LDAi9WN6Jng
+ products-notebooks-dashboard-widget--empty--light:
+ hash: v1.k794b7964.ce20c9c0ca821377cafb8ceaf4fa05f35cbf81c8cbc52eca3102931da8964707.SCZnaWqvLA4G_OlXL6t59CdqUZ7HsuVPpySBjv5ggmI
+ products-notebooks-dashboard-widget--read-only--dark:
+ hash: v1.k794b7964.f93f5836e1334a281785def757008dc8ffa21aa628abdad3699de6be7dfc57da.2AA9ygi_gqL8QHhUkw5mj0PC7s_AN4chVGHNQCE-Uwg
+ products-notebooks-dashboard-widget--read-only--light:
+ hash: v1.k794b7964.f12c96e51ba15ba72a9e624e28c236e2117b2b1702aa983d7a0ad522c3d1e75e.YcRdcnzh482NfnqgUYORV1OuHO8cnTPSZWL8kBEU0y4
+ products-notebooks-dashboard-widget--saved-results--dark:
+ hash: v1.k794b7964.f93f5836e1334a281785def757008dc8ffa21aa628abdad3699de6be7dfc57da.3fn8SNwLnaHNnbN_MopoEAmij74NXlwTFqZ_0EvbX5I
+ products-notebooks-dashboard-widget--saved-results--light:
+ hash: v1.k794b7964.f12c96e51ba15ba72a9e624e28c236e2117b2b1702aa983d7a0ad522c3d1e75e.ZrLMAxC9Z4gZ5qqJz7qFUUC7ykih0WvLmTJxitYD9Mg
products-notebooks-notebook-widget-trust-controls--gate--dark:
hash: v1.k794b7964.97a5e7b5f92071f677d09773a3dea88ead3c9a71e85dbd6f6de8875ffc7a3036.9u2VOZ-O_aSU002VK8iAydGcjIYBXzRIacAelaDLJ6Y
products-notebooks-notebook-widget-trust-controls--gate--light:
diff --git a/frontend/src/scenes/dashboard/DashboardItems.tsx b/frontend/src/scenes/dashboard/DashboardItems.tsx
index 35791a2a0edf..6ea4737e70f5 100644
--- a/frontend/src/scenes/dashboard/DashboardItems.tsx
+++ b/frontend/src/scenes/dashboard/DashboardItems.tsx
@@ -689,6 +689,7 @@ export function DashboardItems({ showCreateAnomalyAlertButton }: DashboardItemsP
onUpdateWidgetTile={async (patch) => {
await updateWidgetTile({ tile, ...patch })
}}
+ onConfigPublished={() => loadDashboard({ action: DashboardLoadAction.Update })}
toggleShowDescription={() => toggleTileDescription(tile.id)}
onDuplicate={() => duplicateTile(tile)}
onRemove={commonTileProps.removeFromDashboard}
diff --git a/posthog/settings/web.py b/posthog/settings/web.py
index 2f2533ee2d26..f66b6eb215bf 100644
--- a/posthog/settings/web.py
+++ b/posthog/settings/web.py
@@ -822,6 +822,7 @@ SPECTACULAR_SETTINGS = {
"ExperimentResultsWidgetTypeEnum": ["experiment_results"],
"SurveyResultsWidgetTypeEnum": ["survey_results"],
"LogsListWidgetTypeEnum": ["logs_list"],
+ "NotebookWidgetTypeEnum": ["notebook_widget"],
"ConversationsRecentTicketsWidgetTypeEnum": ["conversations_recent_tickets"],
}
),
diff --git a/posthog/tasks/scheduled.py b/posthog/tasks/scheduled.py
index 063782e6f2e8..3a47f4bd5d81 100644
--- a/posthog/tasks/scheduled.py
+++ b/posthog/tasks/scheduled.py
@@ -108,6 +108,7 @@ from products.feature_flags.backend.tasks import (
from products.legal_documents.backend.facade.tasks import reconcile_pending_legal_documents
from products.logs.backend.facade.tasks import logs_alert_events_cleanup_task
from products.mcp_registry.backend.facade.tasks import MCP_REGISTRY_SYNC_CRONTAB, run_mcp_registry_sync
+from products.notebooks.backend.facade.tasks import cleanup_widget_snapshots
from products.pulse.backend.tasks import mark_stale_pulse_briefs_failed
from products.reminders.backend.tasks import process_due_reminders
from products.signals.backend.tasks import (
@@ -1001,6 +1002,13 @@ def setup_periodic_tasks(sender: Celery, **kwargs: Any) -> None:
name="apply canvas build artifact retention",
)
+ add_periodic_task_with_expiry(
+ sender,
+ crontab(hour="2", minute="17"),
+ cleanup_widget_snapshots.s(),
+ name="remove unreferenced notebook widget snapshots",
+ )
+
add_periodic_task_with_expiry(
sender,
crontab(minute="*/2"),
diff --git a/products/dashboards/backend/api/dashboard.py b/products/dashboards/backend/api/dashboard.py
index 05236458578c..67d8c13da36f 100644
--- a/products/dashboards/backend/api/dashboard.py
+++ b/products/dashboards/backend/api/dashboard.py
@@ -152,11 +152,8 @@ from products.dashboards.backend.widget_access import (
)
from products.dashboards.backend.widget_availability import get_widget_feature_enabled
from products.dashboards.backend.widget_catalog import get_widget_catalog_entries
-from products.dashboards.backend.widget_create import prepare_widget_tile_create
-from products.dashboards.backend.widget_layouts import (
- collect_dashboard_sm_layouts_for_dashboard,
- stack_widget_layout_at_bottom,
-)
+from products.dashboards.backend.widget_create import create_widget_tile, prepare_widget_tile_create
+from products.dashboards.backend.widget_layouts import collect_dashboard_sm_layouts_for_dashboard
from products.dashboards.backend.widget_query_throttle import get_dashboard_widget_query_throttle_error
from products.dashboards.backend.widget_registry import (
EXPECTED_WIDGET_TYPES,
@@ -3574,43 +3571,13 @@ class DashboardsViewSet(
existing_sm_layouts: builtins.list[dict[str, Any]] | None = None,
pending_sm_layouts: builtins.list[dict[str, Any]] | None = None,
) -> DashboardTile:
- widget_type = payload["widget_type"]
- config = payload["config"]
- normalized_widget_type, validated_config = prepare_widget_tile_create(
- team=self.team,
- widget_type=widget_type,
- config=config,
+ return create_widget_tile(
+ dashboard=dashboard,
user=user,
user_access_control=user_access_control,
- )
- _check_dashboard_widget_count_limit(dashboard=dashboard, user=user)
- layouts = payload.get("layouts")
- if layouts is None:
- layouts = stack_widget_layout_at_bottom(
- widget_type=normalized_widget_type,
- existing_sm_layouts=existing_sm_layouts or [],
- pending_sm_layouts=pending_sm_layouts,
- )
- tile_defaults: dict[str, Any] = {
- "layouts": layouts,
- }
- if "show_description" in payload:
- tile_defaults["show_description"] = payload["show_description"]
-
- widget = DashboardWidget.objects.create(
- team_id=self.team_id,
- widget_type=normalized_widget_type,
- name=payload.get("name") or None,
- description=payload.get("description", ""),
- config=validated_config,
- created_by=user,
- last_modified_by=user,
- )
- return DashboardTile.objects.create(
- dashboard=dashboard,
- team_id=dashboard.team_id,
- widget=widget,
- **tile_defaults,
+ payload=payload,
+ existing_sm_layouts=existing_sm_layouts,
+ pending_sm_layouts=pending_sm_layouts,
)
@extend_schema(
diff --git a/products/dashboards/backend/api/test/test_dashboard_widgets.py b/products/dashboards/backend/api/test/test_dashboard_widgets.py
index ce0ec1b6cae5..404ed634b2dd 100644
--- a/products/dashboards/backend/api/test/test_dashboard_widgets.py
+++ b/products/dashboards/backend/api/test/test_dashboard_widgets.py
@@ -2,7 +2,7 @@ from typing import Any
import time_machine
from posthog.test.base import APIBaseTest
-from unittest.mock import ANY, PropertyMock, patch
+from unittest.mock import ANY, MagicMock, PropertyMock, patch
from django.test import override_settings
@@ -595,6 +595,20 @@ class TestDashboardWidgets(APIBaseTest):
assert tile["widget"]["name"] == "Errors"
assert tile["layouts"]["sm"]["w"] == 6
+ @parameterized.expand([({},), ({"notebookShortId": None, "snapshotId": None},)])
+ @patch("products.dashboards.backend.widget_create.widget_flag_enabled", return_value=True)
+ def test_batch_add_rejects_notebook_widgets_without_saved_results(
+ self, config: dict[str, object], _flag: MagicMock
+ ) -> None:
+ dashboard_id, _ = self.dashboard_api.create_dashboard({"name": "dashboard"})
+ response = self.client.post(
+ f"/api/projects/{self.team.id}/dashboards/{dashboard_id}/widgets/batch/",
+ {"widgets": [{"widget_type": "notebook_widget", "config": config}]},
+ )
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert "Add this widget from a notebook" in str(response.json())
+ assert not DashboardTile.objects.filter(dashboard_id=dashboard_id).exists()
+
@override_settings(IN_UNIT_TESTING=True)
def test_widgets_batch_endpoint_rejects_legacy_error_tracking_widget_type(self) -> None:
dashboard_id, _ = self.dashboard_api.create_dashboard({"name": "dashboard"})
diff --git a/products/dashboards/backend/facade/widget_publication.py b/products/dashboards/backend/facade/widget_publication.py
new file mode 100644
index 000000000000..1710b3b2fc92
--- /dev/null
+++ b/products/dashboards/backend/facade/widget_publication.py
@@ -0,0 +1,3 @@
+from products.dashboards.backend.widget_publication import publish_widget, referenced_notebook_snapshot_ids
+
+__all__ = ["publish_widget", "referenced_notebook_snapshot_ids"]
diff --git a/products/dashboards/backend/widget_create.py b/products/dashboards/backend/widget_create.py
index 25fdef70d6c5..9fe90f96a782 100644
--- a/products/dashboards/backend/widget_create.py
+++ b/products/dashboards/backend/widget_create.py
@@ -6,12 +6,17 @@ from rest_framework import serializers
from posthog.models.team import Team
from posthog.models.user import User
+from posthog.resource_limits import LimitKey, check_count_limit
from products.access_control.backend.facade.user_access_control import UserAccessControl
from products.dashboards.backend.feature_flags import dashboard_widgets_enabled, widget_flag_enabled
+from products.dashboards.backend.models.dashboard import Dashboard
+from products.dashboards.backend.models.dashboard_tile import DashboardTile
from products.dashboards.backend.models.dashboard_widget import DashboardWidget
from products.dashboards.backend.widget_access import check_widget_tile_product_access
+from products.dashboards.backend.widget_layouts import stack_widget_layout_at_bottom
from products.dashboards.backend.widget_registry import validate_widget_config
+from products.dashboards.backend.widget_specs.configs import NOTEBOOK_WIDGET_TYPE
from products.dashboards.backend.widget_specs.registry import get_widget_spec
@@ -48,4 +53,60 @@ def prepare_widget_tile_create(
# team_id stays on probe_widget for RBAC; pydantic validation is shape-only — team
# defaults (e.g. filterTestAccounts) resolve at query time in widgets/config.py.
validated_config = validate_widget_config(widget_type, config)
+ if widget_type == NOTEBOOK_WIDGET_TYPE and not validated_config.get("snapshotId"):
+ raise serializers.ValidationError({"config": "Add this widget from a notebook to save its results first."})
return widget_type, validated_config
+
+
+def create_widget_tile(
+ *,
+ dashboard: Dashboard,
+ user: User,
+ user_access_control: UserAccessControl,
+ payload: dict[str, Any],
+ existing_sm_layouts: list[dict[str, Any]] | None = None,
+ pending_sm_layouts: list[dict[str, Any]] | None = None,
+) -> DashboardTile:
+ widget_type = payload["widget_type"]
+ config = payload["config"]
+ normalized_widget_type, validated_config = prepare_widget_tile_create(
+ team=dashboard.team,
+ widget_type=widget_type,
+ config=config,
+ user=user,
+ user_access_control=user_access_control,
+ )
+ check_count_limit(
+ team=dashboard.team,
+ key=LimitKey.MAX_WIDGETS_PER_DASHBOARD,
+ current_count=dashboard.tiles.filter(widget_id__isnull=False).exclude(deleted=True).count(),
+ user=user,
+ )
+ layouts = payload.get("layouts")
+ if layouts is None:
+ layouts = stack_widget_layout_at_bottom(
+ widget_type=normalized_widget_type,
+ existing_sm_layouts=existing_sm_layouts or [],
+ pending_sm_layouts=pending_sm_layouts,
+ )
+ tile_defaults: dict[str, Any] = {
+ "layouts": layouts,
+ }
+ if "show_description" in payload:
+ tile_defaults["show_description"] = payload["show_description"]
+
+ widget = DashboardWidget.objects.for_team(dashboard.team_id).create(
+ team_id=dashboard.team_id,
+ widget_type=normalized_widget_type,
+ name=payload.get("name") or None,
+ description=payload.get("description", ""),
+ config=validated_config,
+ created_by=user,
+ last_modified_by=user,
+ )
+ return DashboardTile.objects.create(
+ dashboard=dashboard,
+ team_id=dashboard.team_id,
+ widget=widget,
+ **tile_defaults,
+ )
diff --git a/products/dashboards/backend/widget_publication.py b/products/dashboards/backend/widget_publication.py
new file mode 100644
index 000000000000..29f0c9038f7a
--- /dev/null
+++ b/products/dashboards/backend/widget_publication.py
@@ -0,0 +1,113 @@
+from typing import Any
+
+from django.shortcuts import get_object_or_404
+from django.utils.timezone import now
+
+from rest_framework.exceptions import PermissionDenied, ValidationError
+
+from posthog.exceptions import Conflict
+from posthog.models import Team, User
+from posthog.user_permissions import UserPermissions
+
+from products.access_control.backend.facade.user_access_control import UserAccessControl
+from products.dashboards.backend.feature_flags import dashboard_widgets_enabled
+from products.dashboards.backend.models.dashboard import Dashboard
+from products.dashboards.backend.models.dashboard_tile import DashboardTile
+from products.dashboards.backend.models.dashboard_widget import DashboardWidget
+from products.dashboards.backend.widget_access import check_widget_tile_product_access
+from products.dashboards.backend.widget_create import create_widget_tile
+from products.dashboards.backend.widget_layouts import collect_dashboard_sm_layouts_for_dashboard
+from products.dashboards.backend.widget_registry import validate_widget_config
+
+
+def referenced_notebook_snapshot_ids(*, team_id: int, snapshot_ids: list[str]) -> set[str]:
+ return set(
+ DashboardTile.objects.filter(
+ team_id=team_id,
+ dashboard__team_id=team_id,
+ dashboard__deleted=False,
+ widget__team_id=team_id,
+ widget__widget_type="notebook_widget",
+ widget__config__snapshotId__in=snapshot_ids,
+ )
+ .exclude(deleted=True)
+ .values_list("widget__config__snapshotId", flat=True)
+ )
+
+
+class DashboardWidgetPublication:
+ def __init__(self, *, team: Team, user: User, dashboard_id: int | None, tile_id: int | None) -> None:
+ self.team = team
+ self.user = user
+ self.tile_id = tile_id
+ self.access = UserAccessControl(user=user, team=team)
+ if tile_id is not None:
+ tile = get_object_or_404(DashboardTile, id=tile_id, team_id=team.id, dashboard__deleted=False)
+ dashboard_id = tile.dashboard_id
+ self.dashboard = get_object_or_404(Dashboard, id=dashboard_id, team_id=team.id, deleted=False)
+ if not dashboard_widgets_enabled(team=team, user=user):
+ raise ValidationError("Dashboard widgets are not enabled for this project.")
+ if not UserPermissions(user, team).dashboard(
+ self.dashboard
+ ).can_edit or not self.access.check_access_level_for_object(self.dashboard, "editor"):
+ raise PermissionDenied("You don't have edit permissions for this dashboard.")
+
+ def publish(
+ self,
+ *,
+ widget_type: str,
+ config: dict[str, Any],
+ name: str,
+ expected_config: dict[str, Any] | None = None,
+ ) -> None:
+ """Attach results in the caller's transaction so a failed tile write rolls back its results too."""
+ if self.tile_id is None:
+ create_widget_tile(
+ dashboard=self.dashboard,
+ user=self.user,
+ user_access_control=self.access,
+ payload={"widget_type": widget_type, "config": config, "name": name},
+ existing_sm_layouts=collect_dashboard_sm_layouts_for_dashboard(self.dashboard),
+ )
+ return
+ tile = get_object_or_404(
+ DashboardTile.objects.select_for_update(),
+ id=self.tile_id,
+ team_id=self.team.id,
+ dashboard=self.dashboard,
+ dashboard__deleted=False,
+ )
+ widget = get_object_or_404(
+ DashboardWidget.objects.for_team(self.team.id).select_for_update(), id=tile.widget_id
+ )
+ check_widget_tile_product_access(widget, self.access)
+ if (
+ widget.widget_type != widget_type
+ or expected_config is None
+ or any(widget.config.get(key) != value for key, value in expected_config.items())
+ ):
+ raise Conflict("This widget changed during refresh. Reload the dashboard and try again.")
+ widget.config = validate_widget_config(widget_type, {**widget.config, **config})
+ widget.last_modified_by = self.user
+ widget.last_modified_at = now()
+ widget.save()
+
+
+def publish_widget(
+ *,
+ team_id: int,
+ user_id: int,
+ dashboard_id: int | None,
+ tile_id: int | None,
+ widget_type: str,
+ config: dict[str, Any],
+ name: str,
+ expected_config: dict[str, Any] | None = None,
+) -> None:
+ destination = DashboardWidgetPublication(
+ team=Team.objects.get(id=team_id),
+ user=User.objects.get(id=user_id),
+ dashboard_id=dashboard_id,
+ tile_id=tile_id,
+ )
+ destination.publish(widget_type=widget_type, config=config, name=name, expected_config=expected_config)
diff --git a/products/dashboards/backend/widget_specs/configs.py b/products/dashboards/backend/widget_specs/configs.py
index 72f3cceb2883..af0829ed2532 100644
--- a/products/dashboards/backend/widget_specs/configs.py
+++ b/products/dashboards/backend/widget_specs/configs.py
@@ -36,6 +36,25 @@ EXPERIMENT_RESULTS_WIDGET_TYPE = "experiment_results"
SURVEY_RESULTS_WIDGET_TYPE = "survey_results"
LOGS_LIST_WIDGET_TYPE = "logs_list"
CONVERSATIONS_RECENT_TICKETS_WIDGET_TYPE = "conversations_recent_tickets"
+NOTEBOOK_WIDGET_TYPE = "notebook_widget"
+
+
+class NotebookWidgetConfig(BaseModel):
+ model_config = ConfigDict(extra="forbid")
+
+ notebookShortId: str | None = Field(
+ default=None, min_length=1, max_length=128, description="Source notebook short ID."
+ )
+ snapshotId: UUID | None = Field(
+ default=None, description="Immutable notebook widget snapshot. Add one from a notebook widget's menu."
+ )
+
+ @model_validator(mode="after")
+ def validate_reference(self) -> Self:
+ if bool(self.notebookShortId) != bool(self.snapshotId):
+ raise ValueError("Provide both the notebook and its widget snapshot.")
+ return self
+
ActivityEventsPropertyKey = Annotated[
str,
diff --git a/products/dashboards/backend/widget_specs/registry.py b/products/dashboards/backend/widget_specs/registry.py
index 8455c79ab790..b08e3a1c6ed5 100644
--- a/products/dashboards/backend/widget_specs/registry.py
+++ b/products/dashboards/backend/widget_specs/registry.py
@@ -14,6 +14,7 @@ from products.dashboards.backend.widget_specs.configs import (
EXPERIMENT_RESULTS_WIDGET_TYPE,
EXPERIMENTS_LIST_WIDGET_TYPE,
LOGS_LIST_WIDGET_TYPE,
+ NOTEBOOK_WIDGET_TYPE,
SESSION_REPLAY_LIST_WIDGET_TYPE,
SURVEY_RESULTS_WIDGET_TYPE,
ActivityEventsListWidgetConfig,
@@ -22,11 +23,13 @@ from products.dashboards.backend.widget_specs.configs import (
ExperimentResultsWidgetConfig,
ExperimentsListWidgetConfig,
LogsListWidgetConfig,
+ NotebookWidgetConfig,
SessionReplayListWidgetConfig,
SurveyResultsWidgetConfig,
)
DashboardWidgetType = Literal[
+ "notebook_widget",
"activity_events_list",
"error_tracking_list",
"session_replay_list",
@@ -119,10 +122,27 @@ def _load_widget_specs() -> dict[str, WidgetSpec]:
from products.dashboards.backend.widgets.experiment_results import run_experiment_results_widget # noqa: PLC0415
from products.dashboards.backend.widgets.experiments_list import run_experiments_list_widget # noqa: PLC0415
from products.dashboards.backend.widgets.logs_list import run_logs_list_widget # noqa: PLC0415
+ from products.dashboards.backend.widgets.notebook_widget import run_notebook_widget # noqa: PLC0415
from products.dashboards.backend.widgets.session_replay_list import run_session_replay_list_widget # noqa: PLC0415
from products.dashboards.backend.widgets.survey_results import run_survey_results_widget # noqa: PLC0415
return {
+ NOTEBOOK_WIDGET_TYPE: WidgetSpec(
+ widget_type=NOTEBOOK_WIDGET_TYPE,
+ config_model=NotebookWidgetConfig,
+ query_fn=run_notebook_widget,
+ required_scopes=("notebook:read", "query:read"),
+ group_id="notebooks",
+ group_label="Notebooks",
+ label="Notebook widget",
+ description="A generated notebook widget with saved dataframe results. Add it from a notebook widget's menu. Dashboard filters do not change notebook variables.",
+ required_product_access=None,
+ product_access_denied_message=None,
+ availability_requirements=(),
+ form_fields=(),
+ filter_fields=(),
+ creation_flag="notebook-generated-widgets",
+ ),
ACTIVITY_EVENTS_LIST_WIDGET_TYPE: WidgetSpec(
widget_type=ACTIVITY_EVENTS_LIST_WIDGET_TYPE,
config_model=ActivityEventsListWidgetConfig,
diff --git a/products/dashboards/backend/widgets/notebook_widget.py b/products/dashboards/backend/widgets/notebook_widget.py
new file mode 100644
index 000000000000..e410ea7edfa9
--- /dev/null
+++ b/products/dashboards/backend/widgets/notebook_widget.py
@@ -0,0 +1,11 @@
+from posthog.models import Team, User
+
+from products.dashboards.backend.widget_specs.configs import NOTEBOOK_WIDGET_TYPE
+from products.dashboards.backend.widget_specs.registry import validate_widget_config
+
+
+def run_notebook_widget(
+ team: Team, config: dict[str, object], user: User | None = None, *, include_total_count: bool = True
+) -> dict[str, object]:
+ # Results use the notebook endpoints so their object, query, and source permissions also apply here.
+ return validate_widget_config(NOTEBOOK_WIDGET_TYPE, config)
diff --git a/products/dashboards/frontend/components/DashboardWidgetItem/DashboardWidgetItem.test.tsx b/products/dashboards/frontend/components/DashboardWidgetItem/DashboardWidgetItem.test.tsx
index ad0e61518813..ab0043b0ad62 100644
--- a/products/dashboards/frontend/components/DashboardWidgetItem/DashboardWidgetItem.test.tsx
+++ b/products/dashboards/frontend/components/DashboardWidgetItem/DashboardWidgetItem.test.tsx
@@ -32,6 +32,7 @@ jest.mock('../../widget_types/widgetAvailability', () => ({
jest.mock('../../widgets/registry', () => ({
getDashboardWidgetDefinition: () => ({
Component: () => <div>Widget body</div>,
+ MenuItems: () => <button>Widget action</button>,
TileFilters: () => <div data-attr="widget-tile-filters">filters</div>,
EditModal: ({
isOpen,
@@ -142,7 +143,7 @@ describe('DashboardWidgetItem', () => {
}).unmount()
})
- it('does not render tile filters without product access', () => {
+ it('does not render tile filters or widget actions without product access', async () => {
jest.mocked(userHasDashboardWidgetProductAccess).mockReturnValue(false)
const { container } = render(
@@ -159,6 +160,8 @@ describe('DashboardWidgetItem', () => {
)
expect(container.querySelector('[data-attr="widget-tile-filters"]')).toBeNull()
+ await userEvent.click(screen.getByLabelText('more'))
+ expect(screen.queryByText('Widget action')).not.toBeInTheDocument()
})
it('renders insight-style more menu with view, dashboard section, and refresh data', async () => {
@@ -184,6 +187,7 @@ describe('DashboardWidgetItem', () => {
await userEvent.click(screen.getByLabelText('more'))
+ expect(screen.getByText('Widget action')).toBeVisible()
expect(screen.getByText('View').closest('a')).toHaveAttribute('href', '/project/997/error_tracking')
expect(
screen
diff --git a/products/dashboards/frontend/components/DashboardWidgetItem/DashboardWidgetItem.tsx b/products/dashboards/frontend/components/DashboardWidgetItem/DashboardWidgetItem.tsx
index fbcec03197e7..a9606c145f5e 100644
--- a/products/dashboards/frontend/components/DashboardWidgetItem/DashboardWidgetItem.tsx
+++ b/products/dashboards/frontend/components/DashboardWidgetItem/DashboardWidgetItem.tsx
@@ -44,6 +44,7 @@ import { WidgetCardHeader, widgetCardShouldHideMoreButton } from '../WidgetCard/
import { WidgetRuntimeAvailabilityGuard } from '../WidgetRuntimeAvailabilityGuard/WidgetRuntimeAvailabilityGuard'
type DashboardWidgetItemProps = {
+ onConfigPublished?: () => void
tile: DashboardTile
placement: DashboardPlacement
dashboardId?: number | null
@@ -145,6 +146,7 @@ function DashboardWidgetItemContent({
onRefreshWidgetData,
onApplyWidgetIssueMetadataChange,
onUpdateWidgetTile,
+ onConfigPublished,
toggleShowDescription,
onDragHandleMouseDown,
showEditingControls,
@@ -195,11 +197,13 @@ function DashboardWidgetItemContent({
await onUpdateWidgetTile({ config })
}
: undefined,
+ onConfigPublished: canUpdateWidgetTileConfig ? onConfigPublished : undefined,
}
const TileFilters = definition?.TileFilters
const { isAvailable: showTileFilters } = useWidgetAvailability(headerCatalogEntry.availability)
const EditModal = definition?.EditModal
+ const MenuItems = definition?.MenuItems
const hasDashboardSectionActions =
!!(onMoveToDashboard || onCopyToDashboard || onRemove) ||
@@ -238,6 +242,11 @@ function DashboardWidgetItemContent({
refreshControl={refreshControl}
moreButtonOverlay={
<>
+ {!showSharedPlaceholder && hasProductAccess && MenuItems && (
+ <Suspense fallback={null}>
+ <MenuItems {...componentProps} />
+ </Suspense>
+ )}
{titleHref && (
<LemonButton to={titleHref} fullWidth>
View
@@ -320,6 +329,7 @@ function DashboardWidgetItemContent({
/>
) : (
<WidgetCardBody
+ padding={definition?.bodyPadding}
locked={!hasProductAccess}
error={!isUnknownWidgetType && hasProductAccess ? error : undefined}
onRefresh={isUnknownWidgetType ? undefined : onRefresh}
@@ -380,6 +390,7 @@ export const DashboardWidgetItem = React.forwardRef<HTMLDivElement, DashboardWid
onRefreshWidgetData,
onApplyWidgetIssueMetadataChange,
onUpdateWidgetTile,
+ onConfigPublished,
toggleShowDescription,
showResizeHandles,
canEnterEditModeFromEdge,
@@ -451,6 +462,7 @@ export const DashboardWidgetItem = React.forwardRef<HTMLDivElement, DashboardWid
onRefreshWidgetData={onRefreshWidgetData}
onApplyWidgetIssueMetadataChange={onApplyWidgetIssueMetadataChange}
onUpdateWidgetTile={onUpdateWidgetTile}
+ onConfigPublished={onConfigPublished}
canEditDashboard={canEditDashboard}
toggleShowDescription={toggleShowDescription}
isDashboardEditMode={isDashboardEditMode}
diff --git a/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsx b/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsx
index 03c3d4af3841..a833c903484f 100644
--- a/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsx
+++ b/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsx
@@ -12,6 +12,7 @@ import { cn } from 'lib/utils/css-classes'
const HedgehogChart = pngHoggie(chartPng)
export type WidgetCardBodyProps = React.HTMLAttributes<HTMLDivElement> & {
+ padding?: boolean
locked?: boolean
lockedMessage?: string
error?: string | null
@@ -57,6 +58,7 @@ function WidgetCardBodyContent({
}
export function WidgetCardBody({
+ padding = true,
locked,
lockedMessage = 'You do not have access to view this widget.',
error,
@@ -70,7 +72,8 @@ export function WidgetCardBody({
<div
data-slot="widget-card-body"
className={clsx(
- '@container/widget-card WidgetCard__body flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden p-4 pt-2',
+ '@container/widget-card WidgetCard__body flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden',
+ padding && 'p-4 pt-2',
className
)}
{...divProps}
diff --git a/products/dashboards/frontend/components/WidgetCard/widgetOverviewStoryFixtures.ts b/products/dashboards/frontend/components/WidgetCard/widgetOverviewStoryFixtures.ts
index 2cfce4755a08..635e87e88600 100644
--- a/products/dashboards/frontend/components/WidgetCard/widgetOverviewStoryFixtures.ts
+++ b/products/dashboards/frontend/components/WidgetCard/widgetOverviewStoryFixtures.ts
@@ -437,6 +437,9 @@ export const surveyResultsSamplePayload = {
/** New widget types: add a case here. See products/dashboards/CONTRIBUTING.md. */
export function getWidgetOverviewDemoState(catalogKey: DashboardWidgetCatalogKey): WidgetOverviewDemoState {
+ if (catalogKey === 'notebook_widget') {
+ return { config: {}, result: {}, loading: false }
+ }
const catalogEntry = getDashboardWidgetCatalogEntry(catalogKey)
const defaultConfig = catalogEntry.defaultConfig as Record<string, unknown>
const defaultTitle = catalogEntry.headerTitle ?? catalogEntry.label
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index 25af06955289..27092fe6c731 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -679,6 +679,7 @@ export interface _DashboardPatchTileLayoutsOpenApiApi {
* * `experiment_results` - experiment_results
* * `experiments_list` - experiments_list
* * `logs_list` - logs_list
+ * * `notebook_widget` - notebook_widget
* * `session_replay_list` - session_replay_list
* * `survey_results` - survey_results
*/
@@ -692,10 +693,18 @@ export const DashboardPatchWidgetOpenApiWidgetTypeEnumApi = {
ExperimentResults: 'experiment_results',
ExperimentsList: 'experiments_list',
LogsList: 'logs_list',
+ NotebookWidget: 'notebook_widget',
SessionReplayList: 'session_replay_list',
SurveyResults: 'survey_results',
} as const
+export interface NotebookWidgetConfigApi {
+ /** Source notebook short ID. */
+ notebookShortId?: string | null
+ /** Immutable notebook widget snapshot. Add one from a notebook widget's menu. */
+ snapshotId?: string | null
+}
+
export type WidgetDateRangeApiDateFrom =
| (typeof WidgetDateRangeApiDateFrom)[keyof typeof WidgetDateRangeApiDateFrom]
| null
@@ -1127,6 +1136,7 @@ export interface ConversationsRecentTicketsWidgetConfigApi {
}
export type DashboardWidgetConfigApi =
+ | NotebookWidgetConfigApi
| ActivityEventsListWidgetConfigApi
| ErrorTrackingListWidgetConfigApi
| SessionReplayListWidgetConfigApi
@@ -1147,6 +1157,7 @@ export interface DashboardPatchWidgetOpenApiApi {
* * `experiment_results` - experiment_results
* * `experiments_list` - experiments_list
* * `logs_list` - logs_list
+ * * `notebook_widget` - notebook_widget
* * `session_replay_list` - session_replay_list
* * `survey_results` - survey_results */
widget_type?: DashboardPatchWidgetOpenApiWidgetTypeEnumApi
@@ -9766,6 +9777,31 @@ export interface _TileLayoutsOpenApiApi {
xs?: _TileLayoutBoxOpenApiApi
}
+export type NotebookWidgetAddRequestOpenApiApiWidgetType =
+ (typeof NotebookWidgetAddRequestOpenApiApiWidgetType)[keyof typeof NotebookWidgetAddRequestOpenApiApiWidgetType]
+
+export const NotebookWidgetAddRequestOpenApiApiWidgetType = {
+ NotebookWidget: 'notebook_widget',
+} as const
+
+export interface NotebookWidgetAddRequestOpenApiApi {
+ /**
+ * Optional custom display name for the widget tile.
+ * @maxLength 400
+ * @nullable
+ */
+ name?: string | null
+ /** Optional markdown description shown when show_description is enabled. */
+ description?: string
+ /** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */
+ layouts?: _TileLayoutsOpenApiApi
+ /** Whether to show the description on the dashboard tile. */
+ show_description?: boolean
+ widget_type: NotebookWidgetAddRequestOpenApiApiWidgetType
+ /** Configuration for the notebook widget widget. */
+ config: NotebookWidgetConfigApi
+}
+
export type ActivityEventsListWidgetAddRequestOpenApiApiWidgetType =
(typeof ActivityEventsListWidgetAddRequestOpenApiApiWidgetType)[keyof typeof ActivityEventsListWidgetAddRequestOpenApiApiWidgetType]
@@ -9967,6 +10003,7 @@ export interface ConversationsRecentTicketsWidgetAddRequestOpenApiApi {
}
export type AddDashboardWidgetRequestApi =
+ | NotebookWidgetAddRequestOpenApiApi
| ActivityEventsListWidgetAddRequestOpenApiApi
| ErrorTrackingListWidgetAddRequestOpenApiApi
| SessionReplayListWidgetAddRequestOpenApiApi
@@ -9981,7 +10018,7 @@ export type AddDashboardWidgetRequestApi =
*/
export interface AddDashboardWidgetsBatchRequestOpenApiApi {
/**
- * Widget tiles to add atomically. Supported widget_type values: activity_events_list, conversations_recent_tickets, error_tracking_list, experiment_results, experiments_list, logs_list, session_replay_list, survey_results. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).
+ * Widget tiles to add atomically. Supported widget_type values: activity_events_list, conversations_recent_tickets, error_tracking_list, experiment_results, experiments_list, logs_list, notebook_widget, session_replay_list, survey_results. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).
* @minItems 1
* @maxItems 10
*/
@@ -9993,6 +10030,29 @@ export interface AddDashboardWidgetsBatchResponseApi {
tiles: DashboardTileApi[]
}
+export type NotebookWidgetUpdateRequestOpenApiApiWidgetType =
+ (typeof NotebookWidgetUpdateRequestOpenApiApiWidgetType)[keyof typeof NotebookWidgetUpdateRequestOpenApiApiWidgetType]
+
+export const NotebookWidgetUpdateRequestOpenApiApiWidgetType = {
+ NotebookWidget: 'notebook_widget',
+} as const
+
+export interface NotebookWidgetUpdateRequestOpenApiApi {
+ /** ID of the widget tile to update. Use dashboard-get to look up widget tile IDs. */
+ tile_id: number
+ /**
+ * New display name for the widget. Empty string or null clears it; omit to leave unchanged.
+ * @maxLength 400
+ * @nullable
+ */
+ name?: string | null
+ /** New markdown description for the widget. Omit to leave unchanged. */
+ description?: string
+ widget_type: NotebookWidgetUpdateRequestOpenApiApiWidgetType
+ /** New configuration for the notebook widget widget. Omit to leave unchanged. */
+ config?: NotebookWidgetConfigApi
+}
+
export type ActivityEventsListWidgetUpdateRequestOpenApiApiWidgetType =
(typeof ActivityEventsListWidgetUpdateRequestOpenApiApiWidgetType)[keyof typeof ActivityEventsListWidgetUpdateRequestOpenApiApiWidgetType]
@@ -10178,6 +10238,7 @@ export interface ConversationsRecentTicketsWidgetUpdateRequestOpenApiApi {
}
export type UpdateDashboardWidgetRequestApi =
+ | NotebookWidgetUpdateRequestOpenApiApi
| ActivityEventsListWidgetUpdateRequestOpenApiApi
| ErrorTrackingListWidgetUpdateRequestOpenApiApi
| SessionReplayListWidgetUpdateRequestOpenApiApi
@@ -10252,6 +10313,27 @@ export interface BulkUpdateTagsResponseApi {
skipped: BulkUpdateTagsErrorApi[]
}
+export type NotebookWidgetCatalogEntryOpenApiApiWidgetType =
+ (typeof NotebookWidgetCatalogEntryOpenApiApiWidgetType)[keyof typeof NotebookWidgetCatalogEntryOpenApiApiWidgetType]
+
+export const NotebookWidgetCatalogEntryOpenApiApiWidgetType = {
+ NotebookWidget: 'notebook_widget',
+} as const
+
+export interface NotebookWidgetCatalogEntryOpenApiApi {
+ widget_type: NotebookWidgetCatalogEntryOpenApiApiWidgetType
+ group_id: string
+ group_label: string
+ label: string
+ description: string
+ /** OpenAPI config shape for this widget type (documentation; matches batch-add/PATCH schemas). */
+ readonly config_schema: NotebookWidgetConfigApi
+ /** @nullable */
+ required_product_access?: string | null
+ /** Whether tiles of this type self-update in real time after load. Live tiles show a fixed real-time window and cannot apply test-account filtering to the stream, so their config takes neither dateRange nor filterTestAccounts. */
+ live: boolean
+}
+
export type ActivityEventsListWidgetCatalogEntryOpenApiApiWidgetType =
(typeof ActivityEventsListWidgetCatalogEntryOpenApiApiWidgetType)[keyof typeof ActivityEventsListWidgetCatalogEntryOpenApiApiWidgetType]
@@ -10421,6 +10503,7 @@ export interface ConversationsRecentTicketsWidgetCatalogEntryOpenApiApi {
}
export type WidgetCatalogEntryApi =
+ | NotebookWidgetCatalogEntryOpenApiApi
| ActivityEventsListWidgetCatalogEntryOpenApiApi
| ErrorTrackingListWidgetCatalogEntryOpenApiApi
| SessionReplayListWidgetCatalogEntryOpenApiApi
@@ -10466,6 +10549,15 @@ export interface PatchedDataColorThemeApi {
readonly created_by?: UserBasicApi
}
+/**
+ * * `notebook_widget` - notebook_widget
+ */
+export type NotebookWidgetTypeEnumApi = (typeof NotebookWidgetTypeEnumApi)[keyof typeof NotebookWidgetTypeEnumApi]
+
+export const NotebookWidgetTypeEnumApi = {
+ NotebookWidget: 'notebook_widget',
+} as const
+
/**
* * `activity_events_list` - activity_events_list
*/
diff --git a/products/dashboards/frontend/generated/api.zod.ts b/products/dashboards/frontend/generated/api.zod.ts
index e4875accbc37..f587f8be5a23 100644
--- a/products/dashboards/frontend/generated/api.zod.ts
+++ b/products/dashboards/frontend/generated/api.zod.ts
@@ -483,59 +483,61 @@ export const dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneYMin = 0
export const dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneWMax = 12
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneLimitDefault = 25
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneLimitMax = 50
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneNotebookShortIdOneMax = 128
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemKeyMax = 400
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitDefault = 25
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitMax = 50
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemLabelOneMax = 400
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemKeyMax = 400
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemValueOneItemOneMax = 4000
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemLabelOneMax = 400
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemValueOneMax = 100
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemValueOneItemOneMax = 4000
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemValueTwoMax = 4000
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemValueOneMax = 100
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneMax = 20
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemValueTwoMax = 4000
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitDefault = 10
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitMax = 25
-
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoOrderByDefault = `occurrences`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoOrderDirectionDefault = `DESC`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoStatusDefault = `active`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneMax = 20
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeLimitDefault = 10
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeLimitMax = 25
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeOrderByDefault = `start_time`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeOrderByDefault = `occurrences`
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeOrderDirectionDefault = `DESC`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeStatusDefault = `active`
+
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourLimitDefault = 10
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourLimitMax = 25
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderByDefault = `created_at`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderByDefault = `start_time`
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderDirectionDefault = `DESC`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourStatusDefault = `all`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitDefault = 10
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitMax = 25
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveLimitDefault = 10
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveLimitMax = 25
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitDefault = 50
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitMax = 100
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveOrderByDefault = `created_at`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveOrderDirectionDefault = `DESC`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveStatusDefault = `all`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitDefault = 10
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitMax = 25
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenOrderByDefault = `latest`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenWrapLinesDefault = false
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenTimezoneDefault = `UTC`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitDefault = 10
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitMax = 25
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitDefault = 50
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitMax = 100
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightStatusDefault = `all`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightChannelDefault = `all`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightAssigneesMax = 100
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightOrderByDefault = `latest`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightWrapLinesDefault = false
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightTimezoneDefault = `UTC`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineLimitDefault = 10
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineLimitMax = 25
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightSearchDefault = ``
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightSearchMax = 200
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineStatusDefault = `all`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineChannelDefault = `all`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineAssigneesMax = 100
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightSavedViewIdOneMax = 12
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineSearchDefault = ``
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineSearchMax = 200
+
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineSavedViewIdOneMax = 12
export const dashboardsPartialUpdateBodyTilesItemWidgetOneNameMax = 400
@@ -713,18 +715,39 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
'experiment_results',
'experiments_list',
'logs_list',
+ 'notebook_widget',
'session_replay_list',
'survey_results',
])
.describe(
- '\* `activity_events_list` - activity_events_list\n\* `conversations_recent_tickets` - conversations_recent_tickets\n\* `error_tracking_list` - error_tracking_list\n\* `experiment_results` - experiment_results\n\* `experiments_list` - experiments_list\n\* `logs_list` - logs_list\n\* `session_replay_list` - session_replay_list\n\* `survey_results` - survey_results'
+ '\* `activity_events_list` - activity_events_list\n\* `conversations_recent_tickets` - conversations_recent_tickets\n\* `error_tracking_list` - error_tracking_list\n\* `experiment_results` - experiment_results\n\* `experiments_list` - experiments_list\n\* `logs_list` - logs_list\n\* `notebook_widget` - notebook_widget\n\* `session_replay_list` - session_replay_list\n\* `survey_results` - survey_results'
)
.optional()
.describe(
- 'Widget type identifier (cannot be changed on update).\n\n\* `activity_events_list` - activity_events_list\n\* `conversations_recent_tickets` - conversations_recent_tickets\n\* `error_tracking_list` - error_tracking_list\n\* `experiment_results` - experiment_results\n\* `experiments_list` - experiments_list\n\* `logs_list` - logs_list\n\* `session_replay_list` - session_replay_list\n\* `survey_results` - survey_results'
+ 'Widget type identifier (cannot be changed on update).\n\n\* `activity_events_list` - activity_events_list\n\* `conversations_recent_tickets` - conversations_recent_tickets\n\* `error_tracking_list` - error_tracking_list\n\* `experiment_results` - experiment_results\n\* `experiments_list` - experiments_list\n\* `logs_list` - logs_list\n\* `notebook_widget` - notebook_widget\n\* `session_replay_list` - session_replay_list\n\* `survey_results` - survey_results'
),
config: zod
.union([
+ zod.object({
+ notebookShortId: zod
+ .union([
+ zod
+ .string()
+ .min(1)
+ .max(
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneNotebookShortIdOneMax
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Source notebook short ID.'),
+ snapshotId: zod
+ .union([zod.uuid(), zod.null()])
+ .optional()
+ .describe(
+ "Immutable notebook widget snapshot. Add one from a notebook widget's menu."
+ ),
+ }),
zod.object({
dateRange: zod
.union([
@@ -809,9 +832,9 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneLimitMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneLimitDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitDefault
)
.describe('Maximum number of events to return.'),
eventName: zod
@@ -829,14 +852,14 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
.string()
.min(1)
.max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemKeyMax
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemKeyMax
),
label: zod
.union([
zod
.string()
.max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemLabelOneMax
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemLabelOneMax
),
zod.null(),
])
@@ -890,19 +913,19 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
zod
.string()
.max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemValueOneItemOneMax
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemValueOneItemOneMax
),
zod.number(),
zod.boolean(),
])
)
.max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemValueOneMax
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemValueOneMax
),
zod
.string()
.max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemValueTwoMax
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemValueTwoMax
),
zod.number(),
zod.boolean(),
@@ -912,7 +935,7 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
})
)
.max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneMax
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneMax
),
zod.null(),
])
@@ -1005,21 +1028,21 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeLimitMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeLimitDefault
)
.describe('Maximum number of issues to return.'),
orderBy: zod
.enum(['last_seen', 'first_seen', 'occurrences', 'users', 'sessions'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoOrderByDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeOrderByDefault
)
.describe('Issue ranking column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoOrderDirectionDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
status: zod
@@ -1032,7 +1055,7 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
'all',
])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoStatusDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeStatusDefault
)
.describe('Issue status filter.'),
assignee: zod
@@ -1132,9 +1155,9 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeLimitMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourLimitMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeLimitDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourLimitDefault
)
.describe('Maximum number of recordings to return.'),
orderBy: zod
@@ -1147,13 +1170,13 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
'console_error_count',
])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeOrderByDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderByDefault
)
.describe('Recording ranking column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeOrderDirectionDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
savedFilterId: zod
@@ -1173,27 +1196,27 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourLimitMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveLimitMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourLimitDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveLimitDefault
)
.describe('Maximum number of experiments to return.'),
orderBy: zod
.enum(['created_at', 'name', 'start_date'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderByDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveOrderByDefault
)
.describe('Experiment list sort column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderDirectionDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
status: zod
.enum(['draft', 'running', 'paused', 'exposure_frozen', 'stopped', 'all'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourStatusDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveStatusDefault
)
.describe('Experiment status filter.'),
createdBy: zod
@@ -1243,9 +1266,9 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitDefault
)
.describe('Maximum number of recent responses to return.'),
}),
@@ -1276,15 +1299,15 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitDefault
)
.describe('Maximum number of log lines to return.'),
orderBy: zod
.enum(['latest', 'earliest'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenOrderByDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightOrderByDefault
)
.describe('Sort by newest (latest) or oldest (earliest) first.'),
severityLevels: zod
@@ -1300,7 +1323,7 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
wrapLines: zod
.boolean()
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenWrapLinesDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightWrapLinesDefault
)
.describe(
'Wrap long log lines instead of truncating them to a single row.'
@@ -1308,7 +1331,7 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
timezone: zod
.enum(['UTC', 'local'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenTimezoneDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightTimezoneDefault
)
.describe(
"Render log timestamps in UTC or in each viewer's local timezone."
@@ -1324,15 +1347,15 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineLimitMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineLimitDefault
)
.describe('Maximum number of tickets to return.'),
status: zod
.enum(['new', 'open', 'pending', 'on_hold', 'resolved', 'all'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightStatusDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineStatusDefault
)
.describe('Ticket status filter.'),
priorities: zod
@@ -1344,7 +1367,7 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
channel: zod
.enum(['widget', 'email', 'slack', 'teams', 'github', 'all'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightChannelDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineChannelDefault
)
.describe('Ticket channel filter.'),
assignees: zod
@@ -1357,18 +1380,16 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
}),
])
)
- .max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightAssigneesMax
- )
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineAssigneesMax)
.optional()
.describe(
"Only show tickets assigned to these users or roles. 'me' means the requesting user and 'unassigned' means tickets without an assignment. Empty shows all assignees."
),
search: zod
.string()
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightSearchMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineSearchMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightSearchDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineSearchDefault
)
.describe(
'Search requester name or email, ticket subject, message text, or ticket number.'
@@ -1378,7 +1399,7 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod
zod
.string()
.max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightSavedViewIdOneMax
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineSavedViewIdOneMax
),
zod.null(),
])
@@ -1586,72 +1607,76 @@ export const DashboardsUpdateTextTileCreateBody = /* @__PURE__ */ zod.object({
*/
export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneNameMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOneLimitDefault = 25
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOneLimitMax = 50
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOneNotebookShortIdOneMax = 128
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemKeyMax = 400
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoNameMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemLabelOneMax = 400
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitDefault = 25
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitMax = 50
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneItemOneMax = 4000
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemKeyMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneMax = 100
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemLabelOneMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemValueTwoMax = 4000
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneItemOneMax = 4000
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneMax = 20
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneMax = 100
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoNameMax = 400
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemValueTwoMax = 4000
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitDefault = 10
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitMax = 25
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneMax = 20
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneOrderByDefault = `occurrences`
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneOrderDirectionDefault = `DESC`
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneStatusDefault = `active`
export const dashboardsWidgetsBatchCreateBodyWidgetsItemThreeNameMax = 400
export const dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneLimitDefault = 10
export const dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneLimitMax = 25
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneOrderByDefault = `start_time`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneOrderByDefault = `occurrences`
export const dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneOrderDirectionDefault = `DESC`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneStatusDefault = `active`
export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourNameMax = 400
export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneLimitDefault = 10
export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneLimitMax = 25
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderByDefault = `created_at`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderByDefault = `start_time`
export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderDirectionDefault = `DESC`
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneStatusDefault = `all`
export const dashboardsWidgetsBatchCreateBodyWidgetsItemFiveNameMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixNameMax = 400
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneLimitDefault = 10
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneLimitMax = 25
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitDefault = 10
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitMax = 25
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneOrderByDefault = `created_at`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneOrderDirectionDefault = `DESC`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneStatusDefault = `all`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixNameMax = 400
export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenNameMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitDefault = 50
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitMax = 100
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitDefault = 10
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitMax = 25
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneOrderByDefault = `latest`
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneWrapLinesDefault = false
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneTimezoneDefault = `UTC`
export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightNameMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitDefault = 10
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitMax = 25
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitDefault = 50
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitMax = 100
+
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneOrderByDefault = `latest`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneWrapLinesDefault = false
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneTimezoneDefault = `UTC`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineNameMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneStatusDefault = `all`
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneChannelDefault = `all`
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneAssigneesMax = 100
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneLimitDefault = 10
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneLimitMax = 25
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneSearchDefault = ``
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneSearchMax = 200
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneStatusDefault = `all`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneChannelDefault = `all`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneAssigneesMax = 100
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneSavedViewIdOneMax = 12
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneSearchDefault = ``
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneSearchMax = 200
+
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneSavedViewIdOneMax = 12
export const dashboardsWidgetsBatchCreateBodyWidgetsMax = 10
@@ -1719,6 +1744,89 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
.boolean()
.optional()
.describe('Whether to show the description on the dashboard tile.'),
+ widget_type: zod.enum(['notebook_widget']),
+ config: zod
+ .object({
+ notebookShortId: zod
+ .union([
+ zod
+ .string()
+ .min(1)
+ .max(
+ dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOneNotebookShortIdOneMax
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Source notebook short ID.'),
+ snapshotId: zod
+ .union([zod.uuid(), zod.null()])
+ .optional()
+ .describe(
+ "Immutable notebook widget snapshot. Add one from a notebook widget's menu."
+ ),
+ })
+ .describe('Configuration for the notebook widget widget.'),
+ }),
+ zod.object({
+ name: zod
+ .string()
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoNameMax)
+ .nullish()
+ .describe('Optional custom display name for the widget tile.'),
+ description: zod
+ .string()
+ .optional()
+ .describe('Optional markdown description shown when show_description is enabled.'),
+ layouts: zod
+ .object({
+ sm: zod
+ .object({
+ x: zod
+ .number()
+ .optional()
+ .describe('Column position in the dashboard grid (0-indexed).'),
+ y: zod
+ .number()
+ .optional()
+ .describe('Row position in the dashboard grid (0-indexed).'),
+ w: zod
+ .number()
+ .optional()
+ .describe('Width in grid columns. The desktop grid is 12 columns wide.'),
+ h: zod.number().optional().describe('Height in grid rows.'),
+ })
+ .optional()
+ .describe(
+ 'Layout for the standard (desktop) breakpoint. The grid is 12 columns wide.'
+ ),
+ xs: zod
+ .object({
+ x: zod
+ .number()
+ .optional()
+ .describe('Column position in the dashboard grid (0-indexed).'),
+ y: zod
+ .number()
+ .optional()
+ .describe('Row position in the dashboard grid (0-indexed).'),
+ w: zod
+ .number()
+ .optional()
+ .describe('Width in grid columns. The desktop grid is 12 columns wide.'),
+ h: zod.number().optional().describe('Height in grid rows.'),
+ })
+ .optional()
+ .describe(
+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'
+ ),
+ })
+ .optional()
+ .describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),
+ show_description: zod
+ .boolean()
+ .optional()
+ .describe('Whether to show the description on the dashboard tile.'),
widget_type: zod.enum(['activity_events_list']),
config: zod
.object({
@@ -1805,8 +1913,8 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOneLimitMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOneLimitDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitDefault)
.describe('Maximum number of events to return.'),
eventName: zod
.union([zod.string().min(1), zod.null()])
@@ -1821,14 +1929,14 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
.string()
.min(1)
.max(
- dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemKeyMax
+ dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemKeyMax
),
label: zod
.union([
zod
.string()
.max(
- dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemLabelOneMax
+ dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemLabelOneMax
),
zod.null(),
])
@@ -1882,19 +1990,19 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
zod
.string()
.max(
- dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneItemOneMax
+ dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneItemOneMax
),
zod.number(),
zod.boolean(),
])
)
.max(
- dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneMax
+ dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneMax
),
zod
.string()
.max(
- dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemValueTwoMax
+ dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemValueTwoMax
),
zod.number(),
zod.boolean(),
@@ -1904,7 +2012,7 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
})
)
.max(
- dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneMax
+ dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneMax
),
zod.null(),
])
@@ -1916,7 +2024,7 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
zod.object({
name: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoNameMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeNameMax)
.nullish()
.describe('Optional custom display name for the widget tile.'),
description: zod
@@ -2058,22 +2166,22 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneLimitDefault)
.describe('Maximum number of issues to return.'),
orderBy: zod
.enum(['last_seen', 'first_seen', 'occurrences', 'users', 'sessions'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneOrderByDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneOrderByDefault)
.describe('Issue ranking column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneOrderDirectionDefault
+ dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
status: zod
.enum(['archived', 'active', 'resolved', 'pending_release', 'suppressed', 'all'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneStatusDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneStatusDefault)
.describe('Issue status filter.'),
assignee: zod
.union([
@@ -2091,7 +2199,7 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
zod.object({
name: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeNameMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemFourNameMax)
.nullish()
.describe('Optional custom display name for the widget tile.'),
description: zod
@@ -2233,8 +2341,8 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneLimitMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneLimitDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneLimitDefault)
.describe('Maximum number of recordings to return.'),
orderBy: zod
.enum([
@@ -2245,12 +2353,12 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
'click_count',
'console_error_count',
])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneOrderByDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderByDefault)
.describe('Recording ranking column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneOrderDirectionDefault
+ dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
savedFilterId: zod
@@ -2271,7 +2379,7 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
zod.object({
name: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemFourNameMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemFiveNameMax)
.nullish()
.describe('Optional custom display name for the widget tile.'),
description: zod
@@ -2333,22 +2441,22 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneLimitMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneLimitDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneLimitDefault)
.describe('Maximum number of experiments to return.'),
orderBy: zod
.enum(['created_at', 'name', 'start_date'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderByDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneOrderByDefault)
.describe('Experiment list sort column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderDirectionDefault
+ dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
status: zod
.enum(['draft', 'running', 'paused', 'exposure_frozen', 'stopped', 'all'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneStatusDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneStatusDefault)
.describe('Experiment status filter.'),
createdBy: zod
.union([zod.number(), zod.null()])
@@ -2360,7 +2468,7 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
zod.object({
name: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemFiveNameMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSixNameMax)
.nullish()
.describe('Optional custom display name for the widget tile.'),
description: zod
@@ -2431,7 +2539,7 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
zod.object({
name: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSixNameMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenNameMax)
.nullish()
.describe('Optional custom display name for the widget tile.'),
description: zod
@@ -2523,8 +2631,8 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitDefault)
.describe('Maximum number of recent responses to return.'),
})
.describe('Configuration for the survey results widget.'),
@@ -2532,7 +2640,7 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
zod.object({
name: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenNameMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemEightNameMax)
.nullish()
.describe('Optional custom display name for the widget tile.'),
description: zod
@@ -2617,12 +2725,12 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitDefault)
.describe('Maximum number of log lines to return.'),
orderBy: zod
.enum(['latest', 'earliest'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneOrderByDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneOrderByDefault)
.describe('Sort by newest (latest) or oldest (earliest) first.'),
severityLevels: zod
.array(zod.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal']))
@@ -2634,11 +2742,11 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
.describe('Only show logs from these services. Empty shows all services.'),
wrapLines: zod
.boolean()
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneWrapLinesDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneWrapLinesDefault)
.describe('Wrap long log lines instead of truncating them to a single row.'),
timezone: zod
.enum(['UTC', 'local'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneTimezoneDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneTimezoneDefault)
.describe("Render log timestamps in UTC or in each viewer's local timezone."),
savedViewId: zod
.union([zod.string(), zod.null()])
@@ -2652,7 +2760,7 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
zod.object({
name: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemEightNameMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemNineNameMax)
.nullish()
.describe('Optional custom display name for the widget tile.'),
description: zod
@@ -2714,12 +2822,12 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneLimitDefault)
.describe('Maximum number of tickets to return.'),
status: zod
.enum(['new', 'open', 'pending', 'on_hold', 'resolved', 'all'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneStatusDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneStatusDefault)
.describe('Ticket status filter.'),
priorities: zod
.array(zod.enum(['low', 'medium', 'high', 'critical']))
@@ -2727,7 +2835,7 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
.describe('Only show tickets with these priorities. Empty shows all priorities.'),
channel: zod
.enum(['widget', 'email', 'slack', 'teams', 'github', 'all'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneChannelDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneChannelDefault)
.describe('Ticket channel filter.'),
assignees: zod
.array(
@@ -2739,15 +2847,15 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
}),
])
)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneAssigneesMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneAssigneesMax)
.optional()
.describe(
"Only show tickets assigned to these users or roles. 'me' means the requesting user and 'unassigned' means tickets without an assignment. Empty shows all assignees."
),
search: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneSearchMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneSearchDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneSearchMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneSearchDefault)
.describe(
'Search requester name or email, ticket subject, message text, or ticket number.'
),
@@ -2756,7 +2864,7 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
zod
.string()
.max(
- dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneSavedViewIdOneMax
+ dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneSavedViewIdOneMax
),
zod.null(),
])
@@ -2772,7 +2880,7 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
.min(1)
.max(dashboardsWidgetsBatchCreateBodyWidgetsMax)
.describe(
- 'Widget tiles to add atomically. Supported widget_type values: activity_events_list, conversations_recent_tickets, error_tracking_list, experiment_results, experiments_list, logs_list, session_replay_list, survey_results. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).'
+ 'Widget tiles to add atomically. Supported widget_type values: activity_events_list, conversations_recent_tickets, error_tracking_list, experiment_results, experiments_list, logs_list, notebook_widget, session_replay_list, survey_results. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).'
),
})
.describe('OpenAPI-only batch-add schema with widget_type-discriminated config shapes for agents.')
@@ -2788,72 +2896,76 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod
*/
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneNameMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOneLimitDefault = 25
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOneLimitMax = 50
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOneNotebookShortIdOneMax = 128
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemKeyMax = 400
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoNameMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemLabelOneMax = 400
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitDefault = 25
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitMax = 50
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneItemOneMax = 4000
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemKeyMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneMax = 100
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemLabelOneMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemValueTwoMax = 4000
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneItemOneMax = 4000
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneMax = 20
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneMax = 100
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoNameMax = 400
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemValueTwoMax = 4000
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitDefault = 10
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitMax = 25
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneMax = 20
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneOrderByDefault = `occurrences`
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneOrderDirectionDefault = `DESC`
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneStatusDefault = `active`
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeNameMax = 400
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneLimitDefault = 10
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneLimitMax = 25
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneOrderByDefault = `start_time`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneOrderByDefault = `occurrences`
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneOrderDirectionDefault = `DESC`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneStatusDefault = `active`
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourNameMax = 400
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneLimitDefault = 10
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneLimitMax = 25
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderByDefault = `created_at`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderByDefault = `start_time`
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderDirectionDefault = `DESC`
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneStatusDefault = `all`
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveNameMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixNameMax = 400
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneLimitDefault = 10
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneLimitMax = 25
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitDefault = 10
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitMax = 25
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneOrderByDefault = `created_at`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneOrderDirectionDefault = `DESC`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneStatusDefault = `all`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixNameMax = 400
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenNameMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitDefault = 50
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitMax = 100
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitDefault = 10
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitMax = 25
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneOrderByDefault = `latest`
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneWrapLinesDefault = false
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneTimezoneDefault = `UTC`
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightNameMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitDefault = 10
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitMax = 25
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitDefault = 50
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitMax = 100
+
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneOrderByDefault = `latest`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneWrapLinesDefault = false
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneTimezoneDefault = `UTC`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineNameMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneStatusDefault = `all`
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneChannelDefault = `all`
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneAssigneesMax = 100
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneLimitDefault = 10
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneLimitMax = 25
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneSearchDefault = ``
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneSearchMax = 200
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneStatusDefault = `all`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneChannelDefault = `all`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneAssigneesMax = 100
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneSavedViewIdOneMax = 12
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneSearchDefault = ``
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneSearchMax = 200
+
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneSavedViewIdOneMax = 12
export const dashboardsUpdateWidgetsBatchBodyWidgetsMax = 10
@@ -2877,6 +2989,46 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
.string()
.optional()
.describe('New markdown description for the widget. Omit to leave unchanged.'),
+ widget_type: zod.enum(['notebook_widget']),
+ config: zod
+ .object({
+ notebookShortId: zod
+ .union([
+ zod
+ .string()
+ .min(1)
+ .max(
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOneNotebookShortIdOneMax
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Source notebook short ID.'),
+ snapshotId: zod
+ .union([zod.uuid(), zod.null()])
+ .optional()
+ .describe(
+ "Immutable notebook widget snapshot. Add one from a notebook widget's menu."
+ ),
+ })
+ .optional()
+ .describe('New configuration for the notebook widget widget. Omit to leave unchanged.'),
+ }),
+ zod.object({
+ tile_id: zod
+ .number()
+ .describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
+ name: zod
+ .string()
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoNameMax)
+ .nullish()
+ .describe(
+ 'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
+ ),
+ description: zod
+ .string()
+ .optional()
+ .describe('New markdown description for the widget. Omit to leave unchanged.'),
widget_type: zod.enum(['activity_events_list']),
config: zod
.object({
@@ -2963,8 +3115,8 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOneLimitMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOneLimitDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitDefault)
.describe('Maximum number of events to return.'),
eventName: zod
.union([zod.string().min(1), zod.null()])
@@ -2979,14 +3131,14 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
.string()
.min(1)
.max(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemKeyMax
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemKeyMax
),
label: zod
.union([
zod
.string()
.max(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemLabelOneMax
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemLabelOneMax
),
zod.null(),
])
@@ -3040,19 +3192,19 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
zod
.string()
.max(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneItemOneMax
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneItemOneMax
),
zod.number(),
zod.boolean(),
])
)
.max(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneMax
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneMax
),
zod
.string()
.max(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemValueTwoMax
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemValueTwoMax
),
zod.number(),
zod.boolean(),
@@ -3062,7 +3214,7 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
})
)
.max(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneMax
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneMax
),
zod.null(),
])
@@ -3078,7 +3230,7 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
.describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
name: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoNameMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeNameMax)
.nullish()
.describe(
'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
@@ -3173,22 +3325,22 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneLimitDefault)
.describe('Maximum number of issues to return.'),
orderBy: zod
.enum(['last_seen', 'first_seen', 'occurrences', 'users', 'sessions'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneOrderByDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneOrderByDefault)
.describe('Issue ranking column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneOrderDirectionDefault
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
status: zod
.enum(['archived', 'active', 'resolved', 'pending_release', 'suppressed', 'all'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneStatusDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneStatusDefault)
.describe('Issue status filter.'),
assignee: zod
.union([
@@ -3210,7 +3362,7 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
.describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
name: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeNameMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourNameMax)
.nullish()
.describe(
'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
@@ -3305,8 +3457,8 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneLimitMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneLimitDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneLimitDefault)
.describe('Maximum number of recordings to return.'),
orderBy: zod
.enum([
@@ -3317,12 +3469,12 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
'click_count',
'console_error_count',
])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneOrderByDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderByDefault)
.describe('Recording ranking column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneOrderDirectionDefault
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
savedFilterId: zod
@@ -3347,7 +3499,7 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
.describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
name: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourNameMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveNameMax)
.nullish()
.describe(
'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
@@ -3362,22 +3514,22 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneLimitMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneLimitDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneLimitDefault)
.describe('Maximum number of experiments to return.'),
orderBy: zod
.enum(['created_at', 'name', 'start_date'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderByDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneOrderByDefault)
.describe('Experiment list sort column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderDirectionDefault
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
status: zod
.enum(['draft', 'running', 'paused', 'exposure_frozen', 'stopped', 'all'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneStatusDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneStatusDefault)
.describe('Experiment status filter.'),
createdBy: zod
.union([zod.number(), zod.null()])
@@ -3393,7 +3545,7 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
.describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
name: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveNameMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixNameMax)
.nullish()
.describe(
'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
@@ -3421,7 +3573,7 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
.describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
name: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixNameMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenNameMax)
.nullish()
.describe(
'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
@@ -3466,8 +3618,8 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitDefault)
.describe('Maximum number of recent responses to return.'),
})
.optional()
@@ -3479,7 +3631,7 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
.describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
name: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenNameMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightNameMax)
.nullish()
.describe(
'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
@@ -3517,12 +3669,12 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitDefault)
.describe('Maximum number of log lines to return.'),
orderBy: zod
.enum(['latest', 'earliest'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneOrderByDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneOrderByDefault)
.describe('Sort by newest (latest) or oldest (earliest) first.'),
severityLevels: zod
.array(zod.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal']))
@@ -3534,11 +3686,11 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
.describe('Only show logs from these services. Empty shows all services.'),
wrapLines: zod
.boolean()
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneWrapLinesDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneWrapLinesDefault)
.describe('Wrap long log lines instead of truncating them to a single row.'),
timezone: zod
.enum(['UTC', 'local'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneTimezoneDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneTimezoneDefault)
.describe("Render log timestamps in UTC or in each viewer's local timezone."),
savedViewId: zod
.union([zod.string(), zod.null()])
@@ -3556,7 +3708,7 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
.describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
name: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightNameMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineNameMax)
.nullish()
.describe(
'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
@@ -3571,12 +3723,12 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
limit: zod
.number()
.min(1)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneLimitDefault)
.describe('Maximum number of tickets to return.'),
status: zod
.enum(['new', 'open', 'pending', 'on_hold', 'resolved', 'all'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneStatusDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneStatusDefault)
.describe('Ticket status filter.'),
priorities: zod
.array(zod.enum(['low', 'medium', 'high', 'critical']))
@@ -3584,7 +3736,7 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
.describe('Only show tickets with these priorities. Empty shows all priorities.'),
channel: zod
.enum(['widget', 'email', 'slack', 'teams', 'github', 'all'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneChannelDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneChannelDefault)
.describe('Ticket channel filter.'),
assignees: zod
.array(
@@ -3596,15 +3748,15 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
}),
])
)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneAssigneesMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneAssigneesMax)
.optional()
.describe(
"Only show tickets assigned to these users or roles. 'me' means the requesting user and 'unassigned' means tickets without an assignment. Empty shows all assignees."
),
search: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneSearchMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneSearchDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneSearchMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneSearchDefault)
.describe(
'Search requester name or email, ticket subject, message text, or ticket number.'
),
@@ -3613,7 +3765,7 @@ export const DashboardsUpdateWidgetsBatchBody = /* @__PURE__ */ zod
zod
.string()
.max(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneSavedViewIdOneMax
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneSavedViewIdOneMax
),
zod.null(),
])
diff --git a/products/dashboards/frontend/generated/widget-config-property-keys.json b/products/dashboards/frontend/generated/widget-config-property-keys.json
index 82a90ed6015a..3eb0a5d213e9 100644
--- a/products/dashboards/frontend/generated/widget-config-property-keys.json
+++ b/products/dashboards/frontend/generated/widget-config-property-keys.json
@@ -1,5 +1,6 @@
{
"configPropertyKeys": {
+ "notebook_widget": ["notebookShortId", "snapshotId"],
"activity_events_list": [
"dateRange",
"eventName",
@@ -52,6 +53,14 @@
]
},
"configPropertyTrees": {
+ "notebook_widget": {
+ "notebookShortId": {
+ "$type": "string"
+ },
+ "snapshotId": {
+ "$type": "string"
+ }
+ },
"activity_events_list": {
"dateRange": {
"date_from": {
diff --git a/products/dashboards/frontend/generated/widget-config-schemas/notebookWidgetConfig.zod.ts b/products/dashboards/frontend/generated/widget-config-schemas/notebookWidgetConfig.zod.ts
new file mode 100644
index 000000000000..72e1815e4531
--- /dev/null
+++ b/products/dashboards/frontend/generated/widget-config-schemas/notebookWidgetConfig.zod.ts
@@ -0,0 +1,23 @@
+/**
+ * Generated by orval v8.14.0 🍺
+ * Do not edit manually.
+ * PostHog API - 1 ops
+ * OpenAPI spec version: 1.0.0
+ */
+import { z as zod } from 'zod'
+
+export const notebookWidgetConfigNotebookShortIdOneMax = 128
+
+export const NotebookWidgetConfig = /* @__PURE__ */ zod.object({
+ notebookShortId: zod
+ .union([zod.string().min(1).max(notebookWidgetConfigNotebookShortIdOneMax), zod.null()])
+ .optional()
+ .describe('Source notebook short ID.'),
+ snapshotId: zod
+ .union([zod.uuid(), zod.null()])
+ .optional()
+ .describe("Immutable notebook widget snapshot. Add one from a notebook widget's menu."),
+})
+
+export type NotebookWidgetConfig = zod.input<typeof NotebookWidgetConfig>
+export type NotebookWidgetConfigOutput = zod.output<typeof NotebookWidgetConfig>
diff --git a/products/dashboards/frontend/generated/widget-configs.zod.ts b/products/dashboards/frontend/generated/widget-configs.zod.ts
index 57906e669279..26a469ecfb0e 100644
--- a/products/dashboards/frontend/generated/widget-configs.zod.ts
+++ b/products/dashboards/frontend/generated/widget-configs.zod.ts
@@ -9,6 +9,7 @@ import { ErrorTrackingListWidgetConfig } from './widget-config-schemas/errorTrac
import { ExperimentResultsWidgetConfig as ExperimentResultsWidgetConfigComponent } from './widget-config-schemas/experimentResultsWidgetConfig.zod'
import { ExperimentsListWidgetConfig } from './widget-config-schemas/experimentsListWidgetConfig.zod'
import { LogsListWidgetConfig } from './widget-config-schemas/logsListWidgetConfig.zod'
+import { NotebookWidgetConfig as NotebookWidgetConfigComponent } from './widget-config-schemas/notebookWidgetConfig.zod'
import { SessionReplayListWidgetConfig } from './widget-config-schemas/sessionReplayListWidgetConfig.zod'
import { SurveyResultsWidgetConfig as SurveyResultsWidgetConfigComponent } from './widget-config-schemas/surveyResultsWidgetConfig.zod'
import { WidgetFilterEntry } from './widget-config-schemas/widgetFilterEntry.zod'
@@ -20,6 +21,7 @@ export const errorTrackingWidgetConfigSchema = /* @__PURE__ */ ErrorTrackingList
export const experimentResultsWidgetConfigSchema = /* @__PURE__ */ ExperimentResultsWidgetConfigComponent
export const experimentsWidgetConfigSchema = /* @__PURE__ */ ExperimentsListWidgetConfig
export const logsWidgetConfigSchema = /* @__PURE__ */ LogsListWidgetConfig
+export const notebookWidgetConfigSchema = /* @__PURE__ */ NotebookWidgetConfigComponent
export const sessionReplayWidgetConfigSchema = /* @__PURE__ */ SessionReplayListWidgetConfig
export const surveyResultsWidgetConfigSchema = /* @__PURE__ */ SurveyResultsWidgetConfigComponent
export const widgetFilterEntrySchema = /* @__PURE__ */ WidgetFilterEntry
@@ -30,6 +32,7 @@ export type ErrorTrackingWidgetConfig = zod.infer<typeof errorTrackingWidgetConf
export type ExperimentResultsWidgetConfig = zod.infer<typeof experimentResultsWidgetConfigSchema>
export type ExperimentsWidgetConfig = zod.infer<typeof experimentsWidgetConfigSchema>
export type LogsWidgetConfig = zod.infer<typeof logsWidgetConfigSchema>
+export type NotebookWidgetConfig = zod.infer<typeof notebookWidgetConfigSchema>
export type SessionReplayWidgetConfig = zod.infer<typeof sessionReplayWidgetConfigSchema>
export type SurveyResultsWidgetConfig = zod.infer<typeof surveyResultsWidgetConfigSchema>
@@ -76,6 +79,8 @@ export const logsWidgetFormSchema = logsWidgetConfigSchema.pick({
timezone: true,
})
+export const notebookWidgetFormSchema = notebookWidgetConfigSchema.pick({})
+
export const sessionReplayWidgetFormSchema = sessionReplayWidgetConfigSchema.pick({
limit: true,
orderBy: true,
diff --git a/products/dashboards/frontend/generated/widget-form-fields.json b/products/dashboards/frontend/generated/widget-form-fields.json
index 8cbdb9227406..4852e2ba3f6f 100644
--- a/products/dashboards/frontend/generated/widget-form-fields.json
+++ b/products/dashboards/frontend/generated/widget-form-fields.json
@@ -42,6 +42,13 @@
"formFields": ["limit", "dateRange", "wrapLines", "timezone"],
"live": false
},
+ "notebook_widget": {
+ "configSchemaExport": "notebookWidgetConfigSchema",
+ "configTypeExport": "NotebookWidgetConfig",
+ "formSchemaExport": "notebookWidgetFormSchema",
+ "formFields": [],
+ "live": false
+ },
"session_replay_list": {
"configSchemaExport": "sessionReplayWidgetConfigSchema",
"configTypeExport": "SessionReplayWidgetConfig",
diff --git a/products/dashboards/frontend/widget_types/catalog.ts b/products/dashboards/frontend/widget_types/catalog.ts
index 71d104367ca7..7433e8afe098 100644
--- a/products/dashboards/frontend/widget_types/catalog.ts
+++ b/products/dashboards/frontend/widget_types/catalog.ts
@@ -1,6 +1,6 @@
import type { ComponentType } from 'react'
-import { IconFlask, IconList, IconLive, IconMessage, IconRewindPlay, IconWarning } from '@posthog/icons'
+import { IconFlask, IconList, IconLive, IconMessage, IconNotebook, IconRewindPlay, IconWarning } from '@posthog/icons'
import { urls } from 'scenes/urls'
@@ -14,6 +14,7 @@ import {
experimentResultsWidgetConfigSchema,
experimentsWidgetConfigSchema,
logsWidgetConfigSchema,
+ notebookWidgetConfigSchema,
sessionReplayWidgetConfigSchema,
surveyResultsWidgetConfigSchema,
} from '../generated/widget-configs.zod'
@@ -72,6 +73,7 @@ export type DashboardWidgetTileFiltersCatalogConfig = {
/** Product area labels keyed by catalog `groupId`. New groups: add here. */
export const DASHBOARD_WIDGET_GROUP_LABELS = {
+ notebooks: 'Notebooks',
activity: 'Activity',
error_tracking: 'Error tracking',
session_replay: 'Session replay',
@@ -87,6 +89,7 @@ export function getDashboardWidgetGroupLabel(groupId: string): string {
/** Product icons shown next to group headings in the Add widget picker, keyed by `groupId`. */
export const DASHBOARD_WIDGET_GROUP_ICONS = {
+ notebooks: IconNotebook,
activity: IconLive,
error_tracking: IconWarning,
session_replay: IconRewindPlay,
@@ -149,6 +152,7 @@ export type DashboardWidgetCatalogEntry = {
badge?: string
description: string
defaultConfig: Record<string, unknown>
+ hideFromPicker?: boolean
defaultLayout: { w: number; h: number; minW: number; minH?: number }
productAccess?: DashboardWidgetProductAccess
headerLayout?: DashboardWidgetHeaderLayout
@@ -170,6 +174,19 @@ export type DashboardWidgetCatalogEntry = {
/** New widget types: add here. See products/dashboards/CONTRIBUTING.md. */
export const DASHBOARD_WIDGET_CATALOG = {
+ notebook_widget: {
+ hideFromPicker: true,
+ groupId: 'notebooks',
+ label: 'Notebook widget',
+ description: 'Saved results from a generated notebook widget.',
+ headerMeta: { showDateRange: false },
+ defaultConfig: notebookWidgetConfigSchema.parse({}),
+ defaultLayout: { w: 6, h: 6, minW: 3, minH: 4 },
+ sharedPlaceholder: {
+ title: 'Notebook widget',
+ message: 'Sign in with access to the source notebook to view this widget.',
+ },
+ },
conversations_recent_tickets: {
groupId: 'conversations',
label: 'Recent tickets',
@@ -400,6 +417,9 @@ function getDashboardWidgetCatalogGroups(): DashboardWidgetCatalogGroup[] {
const groupsById = new Map<string, DashboardWidgetCatalogGroup>()
for (const [widgetType, entry] of Object.entries(DASHBOARD_WIDGET_CATALOG)) {
+ if ('hideFromPicker' in entry && entry.hideFromPicker) {
+ continue
+ }
let group = groupsById.get(entry.groupId)
if (!group) {
diff --git a/products/dashboards/frontend/widgets/AddWidgetModal.test.tsx b/products/dashboards/frontend/widgets/AddWidgetModal.test.tsx
index 7ad4738a509b..a42e9e7cab9c 100644
--- a/products/dashboards/frontend/widgets/AddWidgetModal.test.tsx
+++ b/products/dashboards/frontend/widgets/AddWidgetModal.test.tsx
@@ -77,6 +77,7 @@ describe('AddWidgetModal', () => {
expect(screen.getByText('Error tracking', { selector: 'h5' })).toBeInTheDocument()
expect(screen.getByLabelText('Top issues')).toBeInTheDocument()
expect(screen.getByText(/Ranked list of the most impactful error tracking issues/i)).toBeInTheDocument()
+ expect(screen.queryByText('Notebook widget')).not.toBeInTheDocument()
})
it('shows alphabetized badges for each widget product section', () => {
diff --git a/products/dashboards/frontend/widgets/addWidgetModalUtils.ts b/products/dashboards/frontend/widgets/addWidgetModalUtils.ts
index 0c18cada4aa6..62cd932ae007 100644
--- a/products/dashboards/frontend/widgets/addWidgetModalUtils.ts
+++ b/products/dashboards/frontend/widgets/addWidgetModalUtils.ts
@@ -27,7 +27,7 @@ export function buildAddWidgetPayloads(selectedTypes: Iterable<string>): AddWidg
for (const widgetType of selectedTypes) {
const catalogEntry = DASHBOARD_WIDGET_CATALOG[widgetType as DashboardWidgetCatalogKey]
- if (!catalogEntry) {
+ if (!catalogEntry || ('hideFromPicker' in catalogEntry && catalogEntry.hideFromPicker)) {
continue
}
payloads.push({ widgetType, config: catalogEntry.defaultConfig })
diff --git a/products/dashboards/frontend/widgets/previews/dashboardWidgetPreviews.ts b/products/dashboards/frontend/widgets/previews/dashboardWidgetPreviews.ts
index e68c009035d1..bbd045b8571d 100644
--- a/products/dashboards/frontend/widgets/previews/dashboardWidgetPreviews.ts
+++ b/products/dashboards/frontend/widgets/previews/dashboardWidgetPreviews.ts
@@ -1,3 +1,5 @@
+import { NotebookWidgetPreview } from 'products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidget'
+
import type { DashboardWidgetCatalogKey } from '../../widget_types/catalog'
import { ActivityEventsWidgetPreview } from './ActivityEventsWidgetPreview'
import { ConversationsWidgetPreview } from './ConversationsWidgetPreview'
@@ -13,6 +15,7 @@ import { SurveyResultsWidgetPreview } from './SurveysWidgetPreviews'
// on every logged-in page load.
/** New widget types: add preview components here. See products/dashboards/CONTRIBUTING.md. */
export const DASHBOARD_WIDGET_PREVIEWS: Record<DashboardWidgetCatalogKey, () => JSX.Element> = {
+ notebook_widget: NotebookWidgetPreview,
conversations_recent_tickets: ConversationsWidgetPreview,
activity_events_list: ActivityEventsWidgetPreview,
error_tracking_list: ErrorTrackingWidgetPreview,
diff --git a/products/dashboards/frontend/widgets/registry.tsx b/products/dashboards/frontend/widgets/registry.tsx
index 7df3828429a3..6a8e64a83272 100644
--- a/products/dashboards/frontend/widgets/registry.tsx
+++ b/products/dashboards/frontend/widgets/registry.tsx
@@ -36,6 +36,21 @@ import { parseSurveyResultsWidgetConfigApiError } from './surveys/surveysWidgetC
const ActivityEventsWidget = lazyWithRetry(() =>
import('./activity/ActivityEventsWidget').then((m) => ({ default: m.ActivityEventsWidget }))
)
+const NotebookDashboardWidget = lazyWithRetry(() =>
+ import('products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidget').then((m) => ({
+ default: m.NotebookDashboardWidget,
+ }))
+)
+const NotebookDashboardWidgetMenu = lazyWithRetry(() =>
+ import('products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidgetMenu').then((m) => ({
+ default: m.NotebookDashboardWidgetMenu,
+ }))
+)
+const EditNotebookWidgetModal = lazyWithRetry(() =>
+ import('products/notebooks/frontend/NotebookDashboardWidget/EditNotebookWidgetModal').then((m) => ({
+ default: m.EditNotebookWidgetModal,
+ }))
+)
const ConversationsWidget = lazyWithRetry(() =>
import('./conversations/ConversationsWidget').then((m) => ({ default: m.ConversationsWidget }))
)
@@ -174,6 +189,8 @@ export type DashboardWidgetSlot<P> = ComponentType<P> | LazyExoticComponent<Comp
export type DashboardWidgetDefinition = {
Component: DashboardWidgetSlot<DashboardWidgetComponentProps>
+ MenuItems?: DashboardWidgetSlot<DashboardWidgetComponentProps>
+ bodyPadding?: boolean
TileFilters?: DashboardWidgetSlot<DashboardWidgetTileFiltersProps>
EditModal?: DashboardWidgetSlot<DashboardWidgetEditModalProps>
TopHeading?: DashboardWidgetSlot<DashboardWidgetTopHeadingProps>
@@ -204,6 +221,7 @@ export type DashboardWidgetComponentProps = {
/** Support list only — assignee controls when false stay read-only. */
canMutateConversationsTickets?: boolean
onUpdateConfig?: (config: Record<string, unknown>) => void | Promise<void>
+ onConfigPublished?: () => void
}
export type DashboardWidgetMetadataPatch = {
@@ -227,6 +245,13 @@ export type DashboardWidgetEditModalProps = {
* `satisfies Record<DashboardWidgetCatalogKey, …>` fails typecheck if catalog grows without a matching key.
*/
export const DASHBOARD_WIDGET_REGISTRY = {
+ notebook_widget: {
+ Component: NotebookDashboardWidget,
+ MenuItems: NotebookDashboardWidgetMenu,
+ bodyPadding: false,
+ EditModal: EditNotebookWidgetModal,
+ parseConfigApiError: () => null,
+ },
conversations_recent_tickets: {
Component: ConversationsWidget,
TopHeading: ConversationsWidgetTopHeading,
diff --git a/products/dashboards/frontend/widgets/widgetConfigSchemaParity.test.ts b/products/dashboards/frontend/widgets/widgetConfigSchemaParity.test.ts
index d875885c8c61..51158d360ae7 100644
--- a/products/dashboards/frontend/widgets/widgetConfigSchemaParity.test.ts
+++ b/products/dashboards/frontend/widgets/widgetConfigSchemaParity.test.ts
@@ -7,6 +7,7 @@ import {
experimentResultsWidgetConfigSchema,
experimentsWidgetConfigSchema,
logsWidgetConfigSchema,
+ notebookWidgetConfigSchema,
sessionReplayWidgetConfigSchema,
surveyResultsWidgetConfigSchema,
widgetFilterEntrySchema,
@@ -20,6 +21,7 @@ const WIDGET_CONFIG_SCHEMAS = {
experiments_list: experimentsWidgetConfigSchema,
experiment_results: experimentResultsWidgetConfigSchema,
logs_list: logsWidgetConfigSchema,
+ notebook_widget: notebookWidgetConfigSchema,
survey_results: surveyResultsWidgetConfigSchema,
} as const
diff --git a/products/notebooks/backend/facade/tasks.py b/products/notebooks/backend/facade/tasks.py
new file mode 100644
index 000000000000..e21663c36f85
--- /dev/null
+++ b/products/notebooks/backend/facade/tasks.py
@@ -0,0 +1,3 @@
+from products.notebooks.backend.tasks.widget_snapshots import cleanup_widget_snapshots
+
+__all__ = ["cleanup_widget_snapshots"]
diff --git a/products/notebooks/backend/facade/widget_snapshots.py b/products/notebooks/backend/facade/widget_snapshots.py
new file mode 100644
index 000000000000..85bad8359132
--- /dev/null
+++ b/products/notebooks/backend/facade/widget_snapshots.py
@@ -0,0 +1,3 @@
+from products.notebooks.backend.widget_snapshots import WidgetSnapshots
+
+__all__ = ["WidgetSnapshots"]
diff --git a/products/notebooks/backend/notebook_run.py b/products/notebooks/backend/notebook_run.py
index 44c600771767..bc4023cf2402 100644
--- a/products/notebooks/backend/notebook_run.py
+++ b/products/notebooks/backend/notebook_run.py
@@ -37,13 +37,11 @@ from products.notebooks.backend.sql_v2_metrics import (
record_notebook_run_terminal,
)
from products.notebooks.backend.sql_v2_runs import finish_node_run
-from products.notebooks.backend.sql_v2_state import extract_cells
+from products.notebooks.backend.sql_v2_state import MAX_NOTEBOOK_CELLS, NotebookCellLimitExceeded, extract_cells
from products.notebooks.backend.sql_v2_variables import build_notebook_variables
logger = structlog.get_logger(__name__)
-# The cell kinds a run executes. A `Query` cell embeds a saved insight and a widget renders
-# a frame, so neither has code to run.
RUNNABLE_CELL_TYPES = ("sql", "python")
_NOTHING_TO_RUN = (
@@ -81,7 +79,7 @@ class NotebookRunStart:
sandbox_hourly_price: float | None
-def plan_notebook_cells(notebook: Notebook) -> list[PlannedCell]:
+def plan_notebook_cells(notebook: Notebook, *, include_prepared_insights: bool = False) -> list[PlannedCell]:
"""The cells this run will execute, in document order, as the plan is stored.
The whole cell is frozen here, code included, not just which cells run. Two reasons, and
@@ -92,18 +90,24 @@ def plan_notebook_cells(notebook: Notebook) -> list[PlannedCell]:
check, closes that. It also makes the run reproducible — a cell edited or deleted
mid-run still executes what the plan captured, which is what the record claims it ran.
"""
- return [
+ plan = [
PlannedCell(
node_id=cell.node_id,
- cell_type=cell.cell_type,
+ cell_type="sql" if cell.cell_type == "saved_insight" else cell.cell_type,
dataframe_name=cell.dataframe_name,
code=cell.code,
connection_id=cell.connection_id,
send_raw_query=cell.send_raw_query,
)
for cell in extract_cells(notebook.content)
- if cell.cell_type in RUNNABLE_CELL_TYPES and cell.code.strip()
+ if (cell.cell_type in RUNNABLE_CELL_TYPES or (include_prepared_insights and cell.cell_type == "saved_insight"))
+ and cell.code.strip()
]
+ if len(plan) > MAX_NOTEBOOK_CELLS:
+ raise NotebookCellLimitExceeded(
+ f"A notebook run can execute at most {MAX_NOTEBOOK_CELLS} cells. Remove cells before running it again."
+ )
+ return plan
def _create_notebook_run(
@@ -112,6 +116,7 @@ def _create_notebook_run(
team: Team,
*,
trigger: str,
+ include_prepared_insights: bool = False,
) -> NotebookRunStart:
"""Create the run record for `notebook` and price the sandbox it may start.
@@ -119,7 +124,7 @@ def _create_notebook_run(
matches the document a reader will compare the results against. Starting the workflow is
the caller's last step, once the record exists.
"""
- cell_plan = plan_notebook_cells(notebook)
+ cell_plan = plan_notebook_cells(notebook, include_prepared_insights=include_prepared_insights)
if not cell_plan:
raise NotebookRunNothingToRun(_NOTHING_TO_RUN)
@@ -168,7 +173,12 @@ class NotebookRunStarted:
def start_notebook_run(
- *, team_id: int, notebook_short_id: str, user_id: int | None, trigger: str
+ *,
+ team_id: int,
+ notebook_short_id: str,
+ user_id: int | None,
+ trigger: str,
+ include_prepared_insights: bool = False,
) -> NotebookRunStarted:
"""Create the run record for a notebook addressed by id, and price the sandbox it may start.
@@ -176,7 +186,13 @@ def start_notebook_run(
`NotebookRunAlreadyRunning` when one is already in flight.
"""
notebook = resolve_team_notebook(team_id, notebook_short_id)
- start = _create_notebook_run(notebook, resolve_user(user_id), notebook.team, trigger=trigger)
+ start = _create_notebook_run(
+ notebook,
+ resolve_user(user_id),
+ notebook.team,
+ trigger=trigger,
+ include_prepared_insights=include_prepared_insights,
+ )
return NotebookRunStarted(
run_id=start.notebook_run.id,
node_ids=[cell["node_id"] for cell in start.notebook_run.cell_plan],
diff --git a/products/notebooks/backend/presentation/views/notebook.py b/products/notebooks/backend/presentation/views/notebook.py
index 078f742fb378..15348587dedd 100644
--- a/products/notebooks/backend/presentation/views/notebook.py
+++ b/products/notebooks/backend/presentation/views/notebook.py
@@ -2,6 +2,7 @@ import math
import hashlib
from collections import Counter
from typing import Any, cast
+from uuid import UUID
from django.conf import settings
from django.core.cache import cache
@@ -94,6 +95,7 @@ from products.notebooks.backend.facade.sql_v2 import (
dispatch_cell_run,
kernel_sandbox_is_live,
)
+from products.notebooks.backend.facade.widget_snapshots import WidgetSnapshots
from products.notebooks.backend.facade.widgets import (
WidgetConflictError,
WidgetError,
@@ -136,9 +138,16 @@ from products.notebooks.backend.presentation.widget_serializers import (
WidgetVersionPageSerializer,
WidgetVersionQuerySerializer,
)
+from products.notebooks.backend.presentation.widget_snapshot_serializers import (
+ WidgetSnapshotPublishSerializer,
+ WidgetSnapshotRequestSerializer,
+ WidgetSnapshotSerializer,
+)
from products.notebooks.backend.presentation.widget_throttles import (
WidgetFrameBurstThrottle,
WidgetFrameSustainedThrottle,
+ WidgetSnapshotPublishThrottle,
+ WidgetSnapshotThrottle,
)
from products.notebooks.backend.python_analysis import analyze_python_globals
from products.notebooks.backend.query_validation import InvalidNotebookQueryError, normalize_notebook_query_nodes
@@ -790,6 +799,115 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidD
def _authorize_widget_run(self, run: NotebookNodeRun) -> None:
self._require_run_connection_access(run, self._current_user())
+ @extend_schema(
+ operation_id="notebooks_widget_snapshot_create",
+ request=WidgetSnapshotRequestSerializer,
+ responses={201: WidgetSnapshotSerializer, 400: WidgetErrorSerializer, 409: WidgetErrorSerializer},
+ )
+ @action(
+ methods=["POST"],
+ url_path="widget_snapshots",
+ detail=True,
+ required_scopes=["notebook:write", "query:read"],
+ throttle_classes=[WidgetSnapshotThrottle],
+ )
+ def widget_snapshot_create(self, request: Request, **kwargs) -> Response:
+ self._require_query_access()
+ if not is_notebook_widget_enabled(self._current_user()):
+ raise Http404()
+ serializer = WidgetSnapshotRequestSerializer(data=request.data)
+ serializer.is_valid(raise_exception=True)
+ service = WidgetSnapshots(self.get_object(), self._authorize_widget_run)
+ try:
+ snapshot = service.capture(**serializer.validated_data)
+ return Response(WidgetSnapshotSerializer(service.describe(snapshot)).data, status=201)
+ except WidgetError as error:
+ return self._widget_error_response(error)
+
+ @extend_schema(
+ operation_id="notebooks_widget_snapshot_publish",
+ request=WidgetSnapshotPublishSerializer,
+ responses={201: WidgetSnapshotSerializer, 400: WidgetErrorSerializer, 409: WidgetErrorSerializer},
+ )
+ @action(
+ methods=["POST"],
+ url_path="widget_snapshots/publish",
+ detail=True,
+ required_scopes=["notebook:write", "query:read", "dashboard:write"],
+ throttle_classes=[WidgetSnapshotPublishThrottle],
+ )
+ def widget_snapshot_publish(self, request: Request, **kwargs) -> Response:
+ self._require_query_access()
+ user = self._current_user()
+ if user is None or not is_notebook_widget_enabled(user):
+ raise Http404()
+ serializer = WidgetSnapshotPublishSerializer(data=request.data)
+ serializer.is_valid(raise_exception=True)
+ service = WidgetSnapshots(self.get_object(), self._authorize_widget_run)
+ try:
+ snapshot = service.publish(user=user, **serializer.validated_data)
+ return Response(WidgetSnapshotSerializer(service.describe(snapshot)).data, status=201)
+ except WidgetError as error:
+ return self._widget_error_response(error)
+
+ @extend_schema(
+ operation_id="notebooks_widget_snapshot_retrieve",
+ responses={200: WidgetSnapshotSerializer},
+ parameters=[OpenApiParameter("snapshot_id", OpenApiTypes.UUID, OpenApiParameter.PATH)],
+ )
+ @action(
+ methods=["GET"],
+ url_path="widget_snapshots/(?P<snapshot_id>[^/.]+)",
+ detail=True,
+ required_scopes=["notebook:read", "query:read"],
+ )
+ def widget_snapshot_retrieve(self, request: Request, snapshot_id: str, **kwargs) -> Response:
+ if not is_notebook_widget_enabled(self._current_user()):
+ raise Http404()
+ self._require_query_access()
+ service = WidgetSnapshots(self.get_object(), self._authorize_widget_run)
+ try:
+ snapshot = service.get(UUID(snapshot_id))
+ return Response(WidgetSnapshotSerializer(service.describe(snapshot)).data)
+ except ValueError:
+ raise Http404()
+ except WidgetError as error:
+ return self._widget_error_response(error)
+
+ @extend_schema(
+ operation_id="notebooks_widget_snapshot_frame",
+ responses={200: WidgetFrameSerializer},
+ parameters=[
+ WidgetFrameQuerySerializer,
+ OpenApiParameter("snapshot_id", OpenApiTypes.UUID, OpenApiParameter.PATH),
+ OpenApiParameter("frame_name", OpenApiTypes.STR, OpenApiParameter.PATH),
+ ],
+ )
+ @action(
+ methods=["GET"],
+ url_path="widget_snapshots/(?P<snapshot_id>[^/.]+)/frames/(?P<frame_name>[^/.]+)",
+ detail=True,
+ required_scopes=["notebook:read", "query:read"],
+ throttle_classes=[WidgetFrameBurstThrottle, WidgetFrameSustainedThrottle],
+ )
+ def widget_snapshot_frame(self, request: Request, snapshot_id: str, frame_name: str, **kwargs) -> Response:
+ if not is_notebook_widget_enabled(self._current_user()):
+ raise Http404()
+ self._require_query_access()
+ query = WidgetFrameQuerySerializer(data=request.query_params)
+ query.is_valid(raise_exception=True)
+ service = WidgetSnapshots(self.get_object(), self._authorize_widget_run)
+ try:
+ snapshot = service.get(UUID(snapshot_id))
+ frame = service.read_frame(
+ snapshot, frame_name, query.validated_data["offset"], query.validated_data["limit"]
+ )
+ return Response(WidgetFrameSerializer(frame).data)
+ except ValueError:
+ raise Http404()
+ except WidgetError as error:
+ return self._widget_error_response(error)
+
@extend_schema(
operation_id="notebooks_widget_generate",
request=WidgetGenerateRequestSerializer,
@@ -1904,6 +2022,9 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidD
serializer = NotebookRunStartRequestSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
+ include_prepared_insights = serializer.validated_data["include_prepared_insights"]
+ if include_prepared_insights and not is_notebook_widget_enabled(user):
+ raise Http404()
notebook = self._get_notebook_for_kernel()
self._require_query_access()
@@ -1928,8 +2049,9 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidD
user_id=user.id if isinstance(user, User) else None,
# A session cookie is the editor; anything else is a programmatic client.
trigger=classify_request_source(request)[0],
+ include_prepared_insights=include_prepared_insights,
)
- except NotebookRunNothingToRun as e:
+ except (NotebookRunNothingToRun, NotebookCellLimitExceeded) as e:
return Response({"detail": str(e)}, status=400)
except NotebookRunAlreadyRunning as e:
# 409, not 429: a conflict with the notebook's state rather than a rate — the same
diff --git a/products/notebooks/backend/presentation/widget_snapshot_serializers.py b/products/notebooks/backend/presentation/widget_snapshot_serializers.py
new file mode 100644
index 000000000000..0750141d8b35
--- /dev/null
+++ b/products/notebooks/backend/presentation/widget_snapshot_serializers.py
@@ -0,0 +1,48 @@
+from typing import Any
+
+from rest_framework import serializers
+
+from products.notebooks.backend.presentation.widget_serializers import (
+ WidgetInputBindingsField,
+ WidgetInputContractItemSerializer,
+ WidgetSecurityReviewSerializer,
+)
+
+
+class WidgetSnapshotRequestSerializer(serializers.Serializer):
+ node_id = serializers.CharField(max_length=128, help_text="Notebook widget node to add to a dashboard.")
+ version_id = serializers.UUIDField(help_text="Immutable widget version to keep on the dashboard.")
+ notebook_run_id = serializers.UUIDField(
+ required=False, help_text="Completed whole-notebook run supplying every input after refresh."
+ )
+ previous_snapshot_id = serializers.UUIDField(
+ required=False, help_text="Snapshot being refreshed; its version and input mappings must match."
+ )
+
+
+class WidgetSnapshotPublishSerializer(WidgetSnapshotRequestSerializer):
+ dashboard_id = serializers.IntegerField(required=False, min_value=1, help_text="Dashboard to add the widget to.")
+ tile_id = serializers.IntegerField(required=False, min_value=1, help_text="Existing dashboard tile to refresh.")
+ name = serializers.CharField(
+ required=False, max_length=400, default="", help_text="Title for a new dashboard widget."
+ )
+
+ def validate(self, attrs: dict[str, Any]) -> dict[str, Any]:
+ if ("dashboard_id" in attrs) == ("tile_id" in attrs):
+ raise serializers.ValidationError("Choose a dashboard to add to or a tile to refresh.")
+ if "tile_id" in attrs and ("previous_snapshot_id" not in attrs or "notebook_run_id" not in attrs):
+ raise serializers.ValidationError("Refreshing requires the previous snapshot and a completed notebook run.")
+ return attrs
+
+
+class WidgetSnapshotSerializer(serializers.Serializer):
+ id = serializers.UUIDField(help_text="Immutable snapshot containing the widget's saved dataframe results.")
+ node_id = serializers.CharField(help_text="Source widget node in the notebook.")
+ version_id = serializers.UUIDField(help_text="Pinned generated widget version.")
+ created_at = serializers.DateTimeField(help_text="When all dataframe results were saved.")
+ frame_names = serializers.ListField(child=serializers.CharField(), help_text="Allowed dataframe slots.")
+ input_bindings = WidgetInputBindingsField(help_text="Frozen input mappings and Hog transforms.")
+ input_contract = WidgetInputContractItemSerializer(many=True, help_text="Pinned widget input schemas.")
+ artifact_url = serializers.URLField(allow_null=True, help_text="Short-lived URL for the pinned widget build.")
+ build_hash = serializers.CharField(allow_null=True, help_text="Exact build hash used for execution consent.")
+ security_review = WidgetSecurityReviewSerializer(allow_null=True, help_text="Review of the pinned widget source.")
diff --git a/products/notebooks/backend/presentation/widget_throttles.py b/products/notebooks/backend/presentation/widget_throttles.py
index 6e3aa062853a..f45eb58ca39b 100644
--- a/products/notebooks/backend/presentation/widget_throttles.py
+++ b/products/notebooks/backend/presentation/widget_throttles.py
@@ -1,5 +1,25 @@
+from typing import TYPE_CHECKING
+
from posthog.rate_limit import _UserBucketRateThrottle
+if TYPE_CHECKING:
+ from rest_framework.request import Request
+ from rest_framework.views import APIView
+
+
+class WidgetSnapshotThrottle(_UserBucketRateThrottle):
+ scope = "notebook_widget_snapshot"
+ rate = "10/hour"
+
+
+class WidgetSnapshotPublishThrottle(WidgetSnapshotThrottle):
+ def allow_request(self, request: "Request", view: "APIView") -> bool:
+ if isinstance(request.data, dict) and request.data.get("tile_id") is not None:
+ self.scope = "notebook_widget_snapshot_refresh"
+ self.rate = "60/hour"
+ self.num_requests, self.duration = self.parse_rate(self.rate)
+ return super().allow_request(request, view)
+
class WidgetFrameBurstThrottle(_UserBucketRateThrottle):
scope = "notebook_widget_frame_burst"
diff --git a/products/notebooks/backend/sql_v2_serializers.py b/products/notebooks/backend/sql_v2_serializers.py
index b256510e1064..19930139aad8 100644
--- a/products/notebooks/backend/sql_v2_serializers.py
+++ b/products/notebooks/backend/sql_v2_serializers.py
@@ -662,6 +662,11 @@ class NotebookSQLV2InterruptResponseSerializer(serializers.Serializer):
class NotebookRunStartRequestSerializer(serializers.Serializer):
+ include_prepared_insights = serializers.BooleanField(
+ required=False,
+ default=False,
+ help_text="Include prepared embedded insights when refreshing a dashboard widget. Requires notebook widgets to be enabled.",
+ )
variables = NotebookVariableSerializer(
many=True,
required=False,
diff --git a/products/notebooks/backend/sql_v2_state.py b/products/notebooks/backend/sql_v2_state.py
index dddda895696f..d02715a67d30 100644
--- a/products/notebooks/backend/sql_v2_state.py
+++ b/products/notebooks/backend/sql_v2_state.py
@@ -156,8 +156,12 @@ def validate_cell_count(previous_content: Any, next_content: Any) -> None:
or by a path that predates it — stays editable, so its owner can delete cells down instead
of finding every save rejected. A save that leaves the count unchanged always passes.
"""
- next_count = sum(cell.cell_type != "saved_insight" for cell in extract_cells(next_content))
- previous_count = sum(cell.cell_type != "saved_insight" for cell in extract_cells(previous_content))
+ next_count = sum(
+ cell.cell_type != "saved_insight" or bool(cell.code.strip()) for cell in extract_cells(next_content)
+ )
+ previous_count = sum(
+ cell.cell_type != "saved_insight" or bool(cell.code.strip()) for cell in extract_cells(previous_content)
+ )
if next_count <= MAX_NOTEBOOK_CELLS or next_count <= previous_count:
return
raise NotebookCellLimitExceeded(
diff --git a/products/notebooks/backend/tasks/widget_snapshots.py b/products/notebooks/backend/tasks/widget_snapshots.py
new file mode 100644
index 000000000000..e902944dac20
--- /dev/null
+++ b/products/notebooks/backend/tasks/widget_snapshots.py
@@ -0,0 +1,24 @@
+from datetime import timedelta
+
+from django.utils import timezone
+
+from celery import shared_task
+
+from products.notebooks.backend.models import NotebookWidgetSnapshot
+
+
+@shared_task(ignore_result=True, soft_time_limit=300, time_limit=330)
+def cleanup_widget_snapshots() -> None:
+ from products.notebooks.backend.widget_snapshots import (
+ WidgetSnapshots, # noqa: PLC0415 — keeps widget runtime off Celery startup
+ )
+
+ team_ids = (
+ NotebookWidgetSnapshot.objects.unscoped()
+ .filter(created_at__lt=timezone.now() - timedelta(days=7))
+ .order_by()
+ .values_list("team_id", flat=True)
+ .distinct()
+ )
+ for team_id in team_ids.iterator():
+ WidgetSnapshots.delete_unreferenced(team_id)
diff --git a/products/notebooks/backend/test/test_notebook_run.py b/products/notebooks/backend/test/test_notebook_run.py
index b8185b2f1e80..8393288dc58b 100644
--- a/products/notebooks/backend/test/test_notebook_run.py
+++ b/products/notebooks/backend/test/test_notebook_run.py
@@ -14,6 +14,7 @@ from posthog.models.utils import UUIDT
from products.notebooks.backend.models import Notebook, NotebookNodeRun, NotebookRun
from products.notebooks.backend.notebook_run import node_run_request_for, plan_notebook_cells
+from products.notebooks.backend.sql_v2_state import MAX_NOTEBOOK_CELLS, NotebookCellLimitExceeded
from products.notebooks.backend.temporal.notebook_run import (
NotebookRunCellInput,
NotebookRunInput,
@@ -45,6 +46,7 @@ class TestRunPlanCellShapes(APIBaseTest):
@parameterized.expand(
[
("raw_string", '<SQLV2 nodeId="s1" query="select 1" />'),
+ ("prepared_insight", '<Query nodeId="s1" dataframeQuery="select 1" returnVariable="insight_df" />'),
("bare_hogql", '<SQLV2 nodeId="s1" query={{"kind":"HogQLQuery","query":"select 1"}} />'),
(
"wrapped_in_a_data_table",
@@ -55,8 +57,22 @@ class TestRunPlanCellShapes(APIBaseTest):
def test_a_sql_cell_carrying_its_query_prop_is_planned(self, _name: str, tag: str) -> None:
notebook = Notebook(team=self.team, short_id="nbshape", content=markdown_content(f"# Doc\n\n{tag}\n"))
- assert [cell["node_id"] for cell in plan_notebook_cells(notebook)] == ["s1"]
- assert plan_notebook_cells(notebook)[0]["code"] == "select 1"
+ plan = plan_notebook_cells(notebook, include_prepared_insights=True)
+ assert [cell["node_id"] for cell in plan] == ["s1"]
+ assert plan[0]["code"] == "select 1"
+ assert plan[0]["cell_type"] == "sql"
+
+ def test_prepared_insights_do_not_change_the_default_run_or_cell_limit(self) -> None:
+ notebook = Notebook(
+ team=self.team,
+ content=markdown_content(
+ '<SQLV2 nodeId="sql" code="select 1" />\n\n'
+ + "\n\n".join(f'<Query nodeId="q{i}" dataframeQuery="select 1" />' for i in range(MAX_NOTEBOOK_CELLS))
+ ),
+ )
+ assert [cell["node_id"] for cell in plan_notebook_cells(notebook)] == ["sql"]
+ with self.assertRaises(NotebookCellLimitExceeded):
+ plan_notebook_cells(notebook, include_prepared_insights=True)
def test_code_still_wins_when_a_cell_carries_both(self) -> None:
notebook = Notebook(
@@ -91,6 +107,23 @@ class TestNotebookRunEndpoints(APIBaseTest):
assert [cell["node_id"] for cell in notebook_run.cell_plan] == ["s1", "p1"]
assert mock_start.call_args.args[0].node_ids == ["s1", "p1"]
+ @parameterized.expand([(False, 404), (True, 200)])
+ def test_prepared_insights_require_explicit_opt_in_and_widget_flag(
+ self, mock_start: MagicMock, _flag: MagicMock, enabled: bool, expected_status: int
+ ) -> None:
+ self.notebook.content = markdown_content('<Query nodeId="insight" dataframeQuery="select 1" />')
+ self.notebook.save(update_fields=["content"])
+ with patch(
+ "products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=enabled
+ ):
+ response = self.client.post(self.runs_url, data={"include_prepared_insights": True}, format="json")
+ assert response.status_code == expected_status
+ if enabled:
+ assert response.json()["cell_count"] == 1
+ assert mock_start.call_args.args[0].node_ids == ["insight"]
+ else:
+ mock_start.assert_not_called()
+
def test_a_notebook_with_nothing_to_run_is_refused(self, mock_start, _flag) -> None:
notebook = Notebook.objects.create(
team=self.team, short_id="nbrunemp", content=markdown_content("# Just prose\n")
@@ -103,6 +136,43 @@ class TestNotebookRunEndpoints(APIBaseTest):
assert "nothing to run" in response.json()["detail"]
mock_start.assert_not_called()
+ @parameterized.expand([("at_limit", MAX_NOTEBOOK_CELLS, 200), ("over_limit", MAX_NOTEBOOK_CELLS + 1, 400)])
+ def test_prepared_insights_obey_the_run_limit(
+ self, mock_start: MagicMock, _flag: MagicMock, _name: str, count: int, status: int
+ ) -> None:
+ self.notebook.content = markdown_content(
+ "\n\n".join(
+ [
+ '<PythonV2 nodeId="python" code="print(1)" />',
+ '<Insight nodeId="display" id="example" />',
+ *(
+ f'<Query nodeId="i{index}" dataframeQuery="select 1" returnVariable="df_{index}" />'
+ for index in range(count - 1)
+ ),
+ ]
+ )
+ )
+ self.notebook.save(update_fields=["content"])
+ with patch(
+ "products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=True
+ ):
+ response = self.client.post(
+ self.runs_url,
+ data={
+ "include_prepared_insights": True,
+ "variables": [{"name": "country", "type": "string", "value": "US"}],
+ },
+ format="json",
+ )
+ assert response.status_code == status, response.json()
+ if status == 200:
+ assert response.json()["cell_count"] == count
+ else:
+ mock_start.assert_not_called()
+ assert not NotebookRun.objects.for_team(self.team.id).filter(notebook=self.notebook).exists()
+ self.notebook.refresh_from_db()
+ assert self.notebook.variables is None
+
def test_a_second_run_while_one_is_active_is_refused(self, _start, _flag) -> None:
assert self.client.post(self.runs_url, data={}, format="json").status_code == 200
diff --git a/products/notebooks/backend/test/test_sql_v2_state.py b/products/notebooks/backend/test/test_sql_v2_state.py
index 24e2f0c75419..9617e5c3dcc5 100644
--- a/products/notebooks/backend/test/test_sql_v2_state.py
+++ b/products/notebooks/backend/test/test_sql_v2_state.py
@@ -272,16 +272,30 @@ class TestCellCountLimit(SimpleTestCase):
("under", MAX_NOTEBOOK_CELLS - 1, True),
("at_the_limit", MAX_NOTEBOOK_CELLS, True),
("over", MAX_NOTEBOOK_CELLS + 1, False),
+ ("prepared_insights_at_limit", MAX_NOTEBOOK_CELLS, True, "Query"),
+ ("prepared_insights_over_limit", MAX_NOTEBOOK_CELLS + 1, False, "Insight"),
]
)
- def test_growth_is_refused_past_the_ceiling(self, _name: str, next_count: int, allowed: bool) -> None:
+ def test_growth_is_refused_past_the_ceiling(
+ self, _name: str, next_count: int, allowed: bool, insight_tag: str | None = None
+ ) -> None:
# Without a ceiling an agent adds cells in a loop, and every SQL or Python cell it adds
# is a query or a sandbox execution. Nothing else bounds that.
+ content = (
+ cells_markdown(next_count)
+ if insight_tag is None
+ else markdown_content(
+ "\n\n".join(
+ f'<{insight_tag} nodeId="i{index}" dataframeQuery="select 1" returnVariable="df_{index}" />'
+ for index in range(next_count)
+ )
+ )
+ )
if allowed:
- validate_cell_count(None, cells_markdown(next_count))
+ validate_cell_count(None, content)
return
with self.assertRaises(NotebookCellLimitExceeded):
- validate_cell_count(None, cells_markdown(next_count))
+ validate_cell_count(None, content)
@parameterized.expand([("unchanged", 0), ("shrinking", -1)])
def test_a_notebook_already_over_the_ceiling_stays_editable(self, _name: str, delta: int) -> None:
diff --git a/products/notebooks/backend/test/test_widgets.py b/products/notebooks/backend/test/test_widgets.py
index 317d9939dd5c..abc73972ef35 100644
--- a/products/notebooks/backend/test/test_widgets.py
+++ b/products/notebooks/backend/test/test_widgets.py
@@ -16,6 +16,7 @@ from django.utils import timezone
import httpx
from anthropic import APIStatusError
from parameterized import parameterized
+from rest_framework.exceptions import PermissionDenied
from posthog.constants import AvailableFeature
from posthog.models import Team
@@ -29,16 +30,22 @@ from products.canvas.backend.notebook_integration import (
_strip_legacy_frame_bridge,
validate_notebook_canvas_source,
)
+from products.dashboards.backend.models.dashboard import Dashboard
+from products.dashboards.backend.models.dashboard_tile import DashboardTile
+from products.dashboards.backend.models.dashboard_widget import DashboardWidget
from products.notebooks.backend.models import (
GeneratedWidget,
GeneratedWidgetGenerationJob,
GeneratedWidgetVersion,
Notebook,
NotebookNodeRun,
+ NotebookRun,
NotebookWidgetInstance,
+ NotebookWidgetSnapshot,
)
from products.notebooks.backend.presentation.widget_serializers import WidgetGenerateRequestSerializer
-from products.notebooks.backend.presentation.widget_throttles import WidgetFrameBurstThrottle
+from products.notebooks.backend.presentation.widget_throttles import WidgetFrameBurstThrottle, WidgetSnapshotThrottle
+from products.notebooks.backend.tasks.widget_snapshots import cleanup_widget_snapshots
from products.notebooks.backend.widget_generation import (
WIDGET_MODEL_MAX_TOKENS,
WIDGET_MODEL_TEMPERATURE,
@@ -65,9 +72,11 @@ from products.notebooks.backend.widget_models import (
MAX_WIDGET_EFFECTIVE_PROMPT_LENGTH,
MAX_WIDGET_PROMPT_LENGTH,
)
+from products.notebooks.backend.widget_snapshots import WidgetSnapshots
from products.notebooks.backend.widgets import (
JOB_STALE_AFTER,
MAX_FRAME_BYTES,
+ WidgetConflictError,
WidgetError,
WidgetInputInspection,
WidgetRateLimitError,
@@ -620,6 +629,291 @@ class TestWidgetData(APIBaseTest):
assert version is not None
return version
+ @parameterized.expand(
+ [
+ ("preview", {"types": [["lat", "float64"]], "first_page": [[1]], "row_count": 3}, [[2]]),
+ ("null_envelope", None, [[]]),
+ ("non_object_envelope", [], [[]]),
+ ("null_preview", {"types": [["lat", "float64"]], "first_page": None, "row_count": 3}, [[2]]),
+ ]
+ )
+ def test_dashboard_snapshot_keeps_rows_and_version_after_the_kernel_stops(
+ self, _name: str, envelope: Any, expected_rows: list[list[int]]
+ ) -> None:
+ version = self._pinned_version(self._mapping())
+ run = self._run(value=1)
+ run.envelope = envelope
+ run.save(update_fields=["envelope"])
+ authorize = MagicMock()
+ snapshots = WidgetSnapshots(self.notebook, authorize)
+ with patch(
+ "products.notebooks.backend.widgets.fetch_sql_v2_page",
+ side_effect=lambda *args, **kwargs: {
+ "rows": [[1]] if kwargs["offset"] == 0 else [[2], [3]],
+ "row_count": 3,
+ },
+ ) as fetch:
+ snapshot = snapshots.capture(self.NODE_ID, version.id)
+ assert fetch.call_args.kwargs == {"offset": 1, "limit": 500}
+ self._run(value=99)
+ with patch(
+ "products.notebooks.backend.widgets.fetch_sql_v2_page", side_effect=AssertionError("must not use kernel")
+ ):
+ saved = snapshots.get(snapshot.id)
+ frame = snapshots.read_frame(saved, self.INPUT_NAME, 1, 1)
+ assert saved.version_id == version.id
+ assert frame["rows"] == expected_rows
+ assert frame["nextOffset"] == 2
+ assert str(frame["runId"]) == str(run.id)
+ authorize.assert_called_with(run)
+ assert snapshots.read_frame(saved, self.INPUT_NAME, 0, 1)["nextOffset"] == 1
+ assert snapshots.read_frame(saved, self.INPUT_NAME, 2, 1)["nextOffset"] is None
+ assert snapshots.read_frame(saved, self.INPUT_NAME, 3, 1)["rows"] == []
+
+ def test_dashboard_refresh_uses_only_its_completed_notebook_run(self) -> None:
+ version = self._pinned_version(self._mapping())
+ parent = NotebookRun.objects.for_team(self.team.id).create(
+ team_id=self.team.id, notebook=self.notebook, user=self.user, status=NotebookRun.Status.DONE
+ )
+ run = self._run(value=1)
+ run.notebook_run = parent
+ run.envelope = {"types": [["lat", "float64"]], "first_page": [[1]], "row_count": 1}
+ run.save(update_fields=["notebook_run", "envelope"])
+ self._run(value=99)
+ snapshots = WidgetSnapshots(self.notebook, lambda _run: None)
+ snapshot = snapshots.capture(self.NODE_ID, version.id, parent.id)
+ assert snapshots.read_frame(snapshot, self.INPUT_NAME, 0, 10)["rows"] == [[1]]
+ parent.status = NotebookRun.Status.FAILED
+ parent.save(update_fields=["status"])
+ with self.assertRaises(WidgetConflictError):
+ snapshots.capture(self.NODE_ID, version.id, parent.id)
+ assert NotebookWidgetSnapshot.objects.for_team(self.team.id).count() == 1
+
+ @patch("products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=True)
+ def test_snapshot_creation_pins_metadata_and_rejects_changed_inputs(self, _flag: MagicMock) -> None:
+ instance = self._mapping()
+ version = self._pinned_version(instance)
+ run = self._run()
+ run.envelope = {"types": [["lat", "float64"]], "first_page": [[1]], "row_count": 1}
+ run.save(update_fields=["envelope"])
+ path = f"/api/projects/{self.team.id}/notebooks/{self.notebook.short_id}/widget_snapshots/"
+ payload = {"node_id": self.NODE_ID, "version_id": str(version.id)}
+ with patch(
+ "products.canvas.backend.notebook_integration.list_notebook_canvas_versions",
+ return_value=[SimpleNamespace(artifact_url="https://example.com/widget.html", build_hash="a" * 64)],
+ ):
+ response = self.client.post(path, payload)
+ assert response.status_code == 201
+ assert response.json()["version_id"] == str(version.id)
+ assert response.json()["frame_names"] == [self.INPUT_NAME]
+ assert response.json()["build_hash"] == "a" * 64
+ snapshot_id = response.json()["id"]
+ with patch(
+ "products.notebooks.backend.presentation.views.notebook.NotebookViewSet._authorize_widget_run",
+ side_effect=PermissionDenied(),
+ ):
+ assert self.client.get(f"{path}{snapshot_id}/").status_code == 403
+ instance.input_bindings = {self.INPUT_NAME: {"source": "other_df"}}
+ instance.save(update_fields=["input_bindings"])
+ response = self.client.post(path, {**payload, "previous_snapshot_id": snapshot_id})
+ assert response.status_code == 409
+ assert response.json()["code"] == "snapshot_inputs_changed"
+ assert NotebookWidgetSnapshot.objects.for_team(self.team.id).count() == 1
+
+ def test_incomplete_dashboard_snapshot_does_not_publish_partial_results(self) -> None:
+ version = self._pinned_version(self._mapping())
+ self._run()
+ with patch("products.notebooks.backend.widgets.fetch_sql_v2_page", return_value={"rows": []}):
+ with self.assertRaises(WidgetConflictError):
+ WidgetSnapshots(self.notebook, lambda _run: None).capture(self.NODE_ID, version.id)
+ assert not NotebookWidgetSnapshot.objects.for_team(self.team.id).exists()
+
+ @patch("products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=True)
+ @patch("products.dashboards.backend.widget_publication.dashboard_widgets_enabled", return_value=True)
+ @patch("products.dashboards.backend.widget_create.dashboard_widgets_enabled", return_value=True)
+ @patch("products.dashboards.backend.widget_create.widget_flag_enabled", return_value=True)
+ @patch("products.canvas.backend.notebook_integration.list_notebook_canvas_versions", return_value=[])
+ def test_dashboard_publication_attaches_results_atomically(self, *_mocks: MagicMock) -> None:
+ version = self._pinned_version(self._mapping())
+ run = self._run()
+ run.envelope = {"first_page": [[1]], "row_count": 1}
+ run.save(update_fields=["envelope"])
+ dashboard = Dashboard.objects.create(team=self.team, created_by=self.user)
+ path = f"/api/projects/{self.team.id}/notebooks/{self.notebook.short_id}/widget_snapshots/publish/"
+ payload = {
+ "node_id": self.NODE_ID,
+ "version_id": str(version.id),
+ "dashboard_id": dashboard.id,
+ "name": "Results",
+ }
+
+ with patch("products.dashboards.backend.widget_create.widget_flag_enabled", return_value=False):
+ assert self.client.post(path, payload).status_code == 400
+ assert not NotebookWidgetSnapshot.objects.for_team(self.team.id).exists()
+ assert not dashboard.tiles.exists()
+
+ response = self.client.post(path, payload)
+ assert response.status_code == 201, response.json()
+ snapshot_id = response.json()["id"]
+ tile = dashboard.tiles.get()
+ assert tile.widget is not None
+ assert tile.widget.config == {"notebookShortId": self.notebook.short_id, "snapshotId": snapshot_id}
+ assert tile.widget.name == "Results"
+
+ parent = NotebookRun.objects.for_team(self.team.id).create(
+ team_id=self.team.id, notebook=self.notebook, user=self.user, status=NotebookRun.Status.DONE
+ )
+ run.notebook_run = parent
+ run.envelope["first_page"] = [[2]]
+ run.save(update_fields=["notebook_run", "envelope"])
+ refresh = {
+ "node_id": self.NODE_ID,
+ "version_id": str(version.id),
+ "tile_id": tile.id,
+ "previous_snapshot_id": snapshot_id,
+ "notebook_run_id": str(parent.id),
+ }
+ response = self.client.post(path, refresh)
+ assert response.status_code == 201, response.json()
+ tile.widget.refresh_from_db()
+ assert tile.widget.config["snapshotId"] == response.json()["id"]
+ assert self.client.post(path, refresh).status_code == 409
+ assert NotebookWidgetSnapshot.objects.for_team(self.team.id).count() == 2
+ tile.widget.refresh_from_db()
+ assert tile.widget.config["snapshotId"] == response.json()["id"]
+
+ other_team = Team.objects.create(organization=self.organization, name="Other project")
+ other_dashboard = Dashboard.objects.create(team=other_team)
+ other_widget = DashboardWidget.objects.for_team(other_team.id).create(
+ team_id=other_team.id, widget_type="notebook_widget", config=tile.widget.config
+ )
+ other_tile = DashboardTile.objects.create(team_id=other_team.id, dashboard=other_dashboard, widget=other_widget)
+ assert self.client.post(path, {**payload, "dashboard_id": other_dashboard.id}).status_code == 404
+ assert self.client.post(path, {**refresh, "tile_id": other_tile.id}).status_code == 404
+ assert NotebookWidgetSnapshot.objects.for_team(self.team.id).count() == 2
+
+ self.organization.available_product_features = [
+ {"key": AvailableFeature.ACCESS_CONTROL, "name": AvailableFeature.ACCESS_CONTROL}
+ ]
+ self.organization.save()
+ viewer = self._create_user("[email protected]", level=OrganizationMembership.Level.MEMBER)
+ AccessControl.objects.create(
+ resource="dashboard", resource_id=str(dashboard.id), team=self.team, access_level="viewer"
+ )
+ self.client.force_login(viewer)
+ assert self.client.post(path, payload).status_code == 403
+ assert self.client.post(path, {**refresh, "previous_snapshot_id": response.json()["id"]}).status_code == 403
+ assert NotebookWidgetSnapshot.objects.for_team(self.team.id).count() == 2
+
+ @patch("products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=True)
+ def test_snapshot_frame_endpoint_checks_query_access_and_notebook_ownership(self, _flag: MagicMock) -> None:
+ version = self._pinned_version(self._mapping())
+ run = self._run()
+ run.envelope = {"types": [["lat", "float64"]], "first_page": [[1]], "row_count": 1}
+ run.save(update_fields=["envelope"])
+ snapshot = WidgetSnapshots(self.notebook, lambda _run: None).capture(self.NODE_ID, version.id)
+ path = f"/api/projects/{self.team.id}/notebooks/{self.notebook.short_id}/widget_snapshots/{snapshot.id}/frames/{self.INPUT_NAME}/"
+ assert self.client.get(path).status_code == 200
+ with patch(
+ "products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=False
+ ):
+ assert self.client.get(path).status_code == 404
+ with patch(
+ "products.notebooks.backend.presentation.views.notebook.NotebookViewSet._has_query_access",
+ return_value=False,
+ ):
+ assert self.client.get(path).status_code == 403
+ other = Notebook.objects.create(team=self.team, created_by=self.user)
+ assert self.client.get(path.replace(self.notebook.short_id, other.short_id)).status_code == 404
+ run.delete()
+ metadata_path = path.split("frames/")[0]
+ assert self.client.get(metadata_path).status_code == 200
+ response = self.client.get(path)
+ assert response.status_code == 409
+ assert response.json()["code"] == "snapshot_source_missing"
+ fresh_run = self._run()
+ fresh_run.envelope = {"types": [["lat", "float64"]], "first_page": [[2]], "row_count": 1}
+ fresh_run.save(update_fields=["envelope"])
+ response = self.client.post(
+ metadata_path.replace(f"{snapshot.id}/", ""),
+ {"node_id": self.NODE_ID, "version_id": str(version.id), "previous_snapshot_id": str(snapshot.id)},
+ )
+ assert response.status_code == 201, response.json()
+ assert self.client.get(path.replace(str(snapshot.id), response.json()["id"])).json()["rows"] == [[2]]
+ snapshot.team = Team.objects.create(organization=self.organization, name="Other project")
+ snapshot.save(update_fields=["team_id"])
+ assert self.client.get(path).status_code == 404
+
+ def test_snapshot_cleanup_keeps_copied_tiles_and_recent_snapshots(self) -> None:
+ version = self._pinned_version(self._mapping())
+ run = self._run()
+ run.envelope = {"first_page": [[1]], "row_count": 1}
+ run.save(update_fields=["envelope"])
+ snapshots = WidgetSnapshots(self.notebook, lambda _run: None)
+ referenced, orphan, recent = [snapshots.capture(self.NODE_ID, version.id) for _ in range(3)]
+ NotebookWidgetSnapshot.objects.for_team(self.team.id).filter(id__in=[referenced.id, orphan.id]).update(
+ created_at=timezone.now() - timedelta(days=8)
+ )
+ tiles = []
+ for _ in range(2):
+ dashboard = Dashboard.objects.create(team=self.team)
+ widget = DashboardWidget.objects.for_team(self.team.id).create(
+ team_id=self.team.id,
+ widget_type="notebook_widget",
+ config={"notebookShortId": self.notebook.short_id, "snapshotId": str(referenced.id)},
+ )
+ tiles.append(DashboardTile.objects.create(team_id=self.team.id, dashboard=dashboard, widget=widget))
+ cleanup_widget_snapshots()
+ assert set(NotebookWidgetSnapshot.objects.for_team(self.team.id).values_list("id", flat=True)) == {
+ referenced.id,
+ recent.id,
+ }
+ tiles[0].delete()
+ cleanup_widget_snapshots()
+ assert NotebookWidgetSnapshot.objects.for_team(self.team.id).filter(id=referenced.id).exists()
+ tiles[1].deleted = True
+ tiles[1].save(update_fields=["deleted"])
+ cleanup_widget_snapshots()
+ assert list(NotebookWidgetSnapshot.objects.for_team(self.team.id).values_list("id", flat=True)) == [recent.id]
+
+ @patch("products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=True)
+ @patch("products.dashboards.backend.widget_publication.dashboard_widgets_enabled", return_value=True)
+ @patch("products.dashboards.backend.widget_create.dashboard_widgets_enabled", return_value=True)
+ @patch("products.dashboards.backend.widget_create.widget_flag_enabled", return_value=True)
+ @patch("products.canvas.backend.notebook_integration.list_notebook_canvas_versions", return_value=[])
+ def test_dashboard_refresh_does_not_share_the_snapshot_creation_bucket(self, *_mocks: MagicMock) -> None:
+ version = self._pinned_version(self._mapping())
+ run = self._run()
+ run.envelope = {"first_page": [[1]], "row_count": 1}
+ run.save(update_fields=["envelope"])
+ dashboard = Dashboard.objects.create(team=self.team)
+ url = f"/api/projects/{self.team.id}/notebooks/{self.notebook.short_id}/widget_snapshots/publish/"
+ payload = {"node_id": self.NODE_ID, "version_id": str(version.id), "dashboard_id": dashboard.id}
+ cache.clear()
+ with (
+ patch.object(WidgetSnapshotThrottle, "rate", "1/hour"),
+ patch("posthog.rate_limit.is_rate_limit_enabled", return_value=True),
+ ):
+ response = self.client.post(url, payload)
+ assert response.status_code == 201, response.json()
+ assert self.client.post(url, payload).status_code == 429
+ parent = NotebookRun.objects.for_team(self.team.id).create(
+ team_id=self.team.id, notebook=self.notebook, user=self.user, status=NotebookRun.Status.DONE
+ )
+ run.notebook_run = parent
+ run.save(update_fields=["notebook_run"])
+ refresh = self.client.post(
+ url,
+ {
+ "node_id": self.NODE_ID,
+ "version_id": str(version.id),
+ "tile_id": dashboard.tiles.get().id,
+ "previous_snapshot_id": response.json()["id"],
+ "notebook_run_id": str(parent.id),
+ },
+ )
+ assert refresh.status_code == 201, refresh.json()
+
@parameterized.expand([("all_ready", False), ("unrun_sibling", True)])
def test_inspection_uses_latest_successful_run_and_authorizes_it(self, _name: str, unrun_sibling: bool) -> None:
self._run(value=1)
diff --git a/products/notebooks/backend/widget_snapshots.py b/products/notebooks/backend/widget_snapshots.py
new file mode 100644
index 000000000000..6af2d3cede9a
--- /dev/null
+++ b/products/notebooks/backend/widget_snapshots.py
@@ -0,0 +1,326 @@
+import copy
+import json
+import time
+from collections.abc import Callable
+from datetime import timedelta
+from itertools import islice
+from typing import Any, cast
+from uuid import UUID
+
+from django.db import transaction
+from django.db.models import Func, IntegerField, JSONField, Value
+from django.db.models.fields.json import KeyTransform
+from django.http import Http404
+from django.utils import timezone
+
+from posthog.models import User
+
+from products.dashboards.backend.facade.widget_publication import publish_widget, referenced_notebook_snapshot_ids
+from products.notebooks.backend.models import Notebook, NotebookNodeRun, NotebookRun, NotebookWidgetSnapshot
+from products.notebooks.backend.sql_v2_direct import sync_direct_run
+from products.notebooks.backend.widgets import (
+ MAX_FRAME_PAGE_ROWS,
+ MAX_FRAME_TOTAL_ROWS,
+ WidgetConflictError,
+ WidgetError,
+ _bounded_rows,
+ _dataframe_owners,
+ _get_instance_and_version,
+ _security_review_state,
+ read_widget_frame,
+)
+
+MAX_SNAPSHOT_BYTES = 8 * 1024 * 1024
+SNAPSHOT_CAPTURE_SECONDS = 30
+
+
+class WidgetSnapshots:
+ @staticmethod
+ def delete_unreferenced(team_id: int) -> int:
+ candidates = (
+ NotebookWidgetSnapshot.objects.for_team(team_id)
+ .filter(created_at__lt=timezone.now() - timedelta(days=7))
+ .order_by("id")
+ .values_list("id", flat=True)
+ .iterator(chunk_size=100)
+ )
+ deleted = 0
+ while batch := list(islice(candidates, 100)):
+ referenced = referenced_notebook_snapshot_ids(team_id=team_id, snapshot_ids=[str(pk) for pk in batch])
+ count, _ = (
+ NotebookWidgetSnapshot.objects.for_team(team_id)
+ .filter(id__in=batch)
+ .exclude(id__in=referenced)
+ .delete()
+ )
+ deleted += count
+ return deleted
+
+ def __init__(self, notebook: Notebook, authorize_run: Callable[[NotebookNodeRun], None]) -> None:
+ self.notebook = notebook
+ self.authorize_run = authorize_run
+
+ def publish(
+ self,
+ *,
+ user: User,
+ node_id: str,
+ version_id: UUID,
+ dashboard_id: int | None = None,
+ tile_id: int | None = None,
+ name: str = "",
+ notebook_run_id: UUID | None = None,
+ previous_snapshot_id: UUID | None = None,
+ ) -> NotebookWidgetSnapshot:
+ def attach(snapshot: NotebookWidgetSnapshot) -> None:
+ publish_widget(
+ team_id=self.notebook.team_id,
+ user_id=user.id,
+ dashboard_id=dashboard_id,
+ tile_id=tile_id,
+ widget_type="notebook_widget",
+ config={"notebookShortId": self.notebook.short_id, "snapshotId": str(snapshot.id)},
+ name=name,
+ expected_config={"notebookShortId": self.notebook.short_id, "snapshotId": str(previous_snapshot_id)}
+ if previous_snapshot_id is not None
+ else None,
+ )
+
+ return self.capture(node_id, version_id, notebook_run_id, previous_snapshot_id, publish=attach)
+
+ def capture(
+ self,
+ node_id: str,
+ version_id: UUID,
+ notebook_run_id: UUID | None = None,
+ previous_snapshot_id: UUID | None = None,
+ *,
+ publish: Callable[[NotebookWidgetSnapshot], None] | None = None,
+ ) -> NotebookWidgetSnapshot:
+ snapshot = self._prepare(node_id, version_id, notebook_run_id, previous_snapshot_id)
+ with transaction.atomic():
+ snapshot.save(force_insert=True)
+ if publish is not None:
+ publish(snapshot)
+ return snapshot
+
+ def _prepare(
+ self,
+ node_id: str,
+ version_id: UUID,
+ notebook_run_id: UUID | None = None,
+ previous_snapshot_id: UUID | None = None,
+ ) -> NotebookWidgetSnapshot:
+ instance, version = _get_instance_and_version(self.notebook, node_id, version_id)
+ bindings = copy.deepcopy(instance.input_bindings)
+ if previous_snapshot_id is not None:
+ previous = self.get(previous_snapshot_id)
+ if previous.node_id != node_id or previous.version_id != version_id or previous.input_bindings != bindings:
+ raise WidgetConflictError(
+ "The widget's inputs changed. Add it to the dashboard again to use its new inputs.",
+ "snapshot_inputs_changed",
+ )
+ owners = _dataframe_owners(self.notebook)
+ runs = NotebookNodeRun.objects.for_team(self.notebook.team_id).filter(
+ notebook=self.notebook, status=NotebookNodeRun.Status.DONE
+ )
+ if notebook_run_id is not None:
+ completed = NotebookRun.objects.for_team(self.notebook.team_id).filter(
+ notebook=self.notebook, id=notebook_run_id, status=NotebookRun.Status.DONE
+ )
+ if not completed.exists():
+ raise WidgetConflictError("Wait for the notebook to finish before saving its results.", "run_not_ready")
+ runs = runs.filter(notebook_run_id=notebook_run_id)
+ frames: dict[str, Any] = {}
+ source_runs: dict[str, str] = {}
+ deadline = time.monotonic() + SNAPSHOT_CAPTURE_SECONDS
+ size = 0
+ for contract in version.input_contract:
+ slot = contract["slot"]
+ binding = bindings.get(slot, {})
+ source = binding.get("source") or contract.get("sourceName") or slot
+ run = runs.filter(node_id=owners.get(source)).order_by("-created_at").first()
+ if run is None:
+ raise WidgetConflictError(
+ f'Run the cell that creates "{source}" before adding this widget.', "frame_not_ready"
+ )
+ self.authorize_run(run)
+ # Read the producer's result, since collaborators have separate kernels.
+ producer = User.objects.filter(id=run.user_id).first() if run.user_id else None
+ first = read_widget_frame(
+ notebook=self.notebook,
+ node_id=node_id,
+ frame_name=slot,
+ authorize_run=self.authorize_run,
+ user=producer,
+ version_id=version_id,
+ run_id=run.id,
+ limit=1,
+ ).frame
+ first["runId"] = str(run.id)
+ rows = list(cast(list[list[object]], first["rows"]))
+ target = min(cast(int, first["totalRowCount"]), MAX_FRAME_TOTAL_ROWS)
+ envelope = run.envelope if isinstance(run.envelope, dict) else {}
+ preview = envelope.get("first_page")
+ cached_rows = preview if isinstance(preview, list) and len(preview) >= target else sync_direct_run(run)
+ if cached_rows is None and run.node_type == NotebookNodeRun.NodeType.HOGQL:
+ # Kernel HogQL paging re-executes the query and could mix rows from different results.
+ raise WidgetConflictError(
+ "The SQL results expired. Run the notebook and try again.", "snapshot_results_expired"
+ )
+ while len(rows) < target:
+ if time.monotonic() >= deadline:
+ raise WidgetConflictError(
+ "Saving the results took too long. Reduce the dataframe size and try again.", "snapshot_timeout"
+ )
+ if cached_rows is not None:
+ page = _bounded_rows(
+ name=slot,
+ run_id=run.id,
+ columns=cast(list[dict[str, str]], first["columns"]),
+ candidates=cached_rows[len(rows) : len(rows) + MAX_FRAME_PAGE_ROWS],
+ total_row_count=cast(int, first["totalRowCount"]),
+ offset=len(rows),
+ )
+ else:
+ page = read_widget_frame(
+ notebook=self.notebook,
+ node_id=node_id,
+ frame_name=slot,
+ authorize_run=self.authorize_run,
+ user=producer,
+ version_id=version_id,
+ run_id=run.id,
+ offset=len(rows),
+ limit=MAX_FRAME_PAGE_ROWS,
+ ).frame
+ if not page["rows"]:
+ raise WidgetConflictError(
+ "Some results are no longer available. Run the notebook and try again.", "snapshot_incomplete"
+ )
+ if page["totalRowCount"] != first["totalRowCount"]:
+ raise WidgetConflictError(
+ "The dataframe changed while saving. Run the notebook and try again.",
+ "snapshot_results_changed",
+ )
+ rows.extend(cast(list[list[object]], page["rows"])[: target - len(rows)])
+ if len(json.dumps(rows).encode()) + size > MAX_SNAPSHOT_BYTES:
+ raise WidgetError(
+ "Widget results must fit within 8 MiB. Reduce the dataframe size and try again.",
+ "snapshot_too_large",
+ )
+ frame = {**first, "rows": rows, "includedRowCount": len(rows), "nextOffset": None}
+ size += len(json.dumps(frame).encode())
+ if size > MAX_SNAPSHOT_BYTES:
+ raise WidgetError(
+ "Widget results must fit within 8 MiB. Reduce the dataframe size and try again.",
+ "snapshot_too_large",
+ )
+ frames[slot] = frame
+ source_runs[slot] = str(run.id)
+ instance.refresh_from_db(fields=["input_bindings"])
+ if instance.input_bindings != bindings:
+ raise WidgetConflictError(
+ "The widget's inputs changed while saving. Try adding it again.", "snapshot_inputs_changed"
+ )
+ return NotebookWidgetSnapshot(
+ team_id=self.notebook.team_id,
+ notebook=self.notebook,
+ node_id=node_id,
+ version=version,
+ input_bindings=bindings,
+ source_runs=source_runs,
+ frames=frames,
+ )
+
+ def get(self, snapshot_id: UUID) -> NotebookWidgetSnapshot:
+ snapshot = (
+ NotebookWidgetSnapshot.objects.for_team(self.notebook.team_id)
+ .filter(notebook=self.notebook, id=snapshot_id)
+ .select_related("version", "version__widget")
+ .defer("frames")
+ .first()
+ )
+ if snapshot is None:
+ raise Http404()
+ self._authorize_sources(snapshot, require_all=False)
+ return snapshot
+
+ def _authorize_sources(self, snapshot: NotebookWidgetSnapshot, *, require_all: bool) -> None:
+ run_ids = set(snapshot.source_runs.values())
+ runs = list(
+ NotebookNodeRun.objects.for_team(self.notebook.team_id)
+ .filter(notebook=self.notebook, id__in=run_ids)
+ .defer("envelope", "code")
+ )
+ if require_all and len(runs) != len(run_ids):
+ raise WidgetConflictError(
+ "The source results were deleted. Refresh this widget from the notebook.", "snapshot_source_missing"
+ )
+ for run in runs:
+ self.authorize_run(run)
+
+ def describe(self, snapshot: NotebookWidgetSnapshot) -> dict[str, Any]:
+ from products.canvas.backend import (
+ notebook_integration as canvas_facade, # noqa: PLC0415 — keeps Canvas off startup
+ )
+
+ try:
+ versions = canvas_facade.list_notebook_canvas_versions(
+ team_id=self.notebook.team_id,
+ canvas_id=snapshot.version.widget.canvas_id,
+ version_ids=[snapshot.version.canvas_source_version_id],
+ )
+ except canvas_facade.NotebookCanvasNotFoundError:
+ versions = []
+ artifact = next(iter(versions), None)
+ return {
+ "id": snapshot.id,
+ "node_id": snapshot.node_id,
+ "version_id": snapshot.version_id,
+ "created_at": snapshot.created_at,
+ "frame_names": list(snapshot.source_runs),
+ "input_bindings": snapshot.input_bindings,
+ "input_contract": snapshot.version.input_contract,
+ "artifact_url": artifact.artifact_url if artifact else None,
+ "build_hash": artifact.build_hash if artifact else None,
+ "security_review": _security_review_state(snapshot.version),
+ }
+
+ def read_frame(self, snapshot: NotebookWidgetSnapshot, name: str, offset: int, limit: int) -> dict[str, Any]:
+ if name not in snapshot.source_runs:
+ raise WidgetError("This dataframe is not available to this widget.", "frame_not_allowed")
+ self._authorize_sources(snapshot, require_all=True)
+ frame = KeyTransform(name, "frames")
+ rows = KeyTransform("rows", frame)
+ saved = (
+ NotebookWidgetSnapshot.objects.for_team(self.notebook.team_id)
+ .filter(id=snapshot.id, notebook=self.notebook)
+ .values(
+ run_id=KeyTransform("runId", frame),
+ columns=KeyTransform("columns", frame),
+ total=KeyTransform("totalRowCount", frame),
+ row_count=Func(rows, function="jsonb_array_length", output_field=IntegerField()),
+ page_rows=Func(
+ rows,
+ Value(f"$[{offset} to {offset + min(limit, MAX_FRAME_PAGE_ROWS) - 1}]"),
+ function="jsonb_path_query_array",
+ output_field=JSONField(),
+ ),
+ )
+ .get()
+ )
+ page = _bounded_rows(
+ name=name,
+ run_id=UUID(saved["run_id"]),
+ columns=saved["columns"],
+ candidates=saved["page_rows"],
+ total_row_count=saved["total"],
+ offset=offset,
+ )
+ end = offset + len(cast(list[list[object]], page["rows"]))
+ return {
+ **page,
+ "nextOffset": end if end < saved["row_count"] else None,
+ "truncated": end < saved["total"],
+ }
diff --git a/products/notebooks/frontend/NotebookDashboardWidget/EditNotebookWidgetModal.tsx b/products/notebooks/frontend/NotebookDashboardWidget/EditNotebookWidgetModal.tsx
new file mode 100644
index 000000000000..4d33008aee72
--- /dev/null
+++ b/products/notebooks/frontend/NotebookDashboardWidget/EditNotebookWidgetModal.tsx
@@ -0,0 +1,56 @@
+import { useActions, useValues } from 'kea'
+
+import { LemonBanner, LemonButton, LemonModal } from '@posthog/lemon-ui'
+
+import { urls } from 'scenes/urls'
+
+import { EditWidgetModalTileDetailsSection } from 'products/dashboards/frontend/widgets/EditWidgetModalTileDetailsSection'
+import type { DashboardWidgetEditModalProps } from 'products/dashboards/frontend/widgets/registry'
+
+import { editNotebookWidgetLogic } from './editNotebookWidgetLogic'
+
+export function EditNotebookWidgetModal(props: DashboardWidgetEditModalProps): JSX.Element | null {
+ return props.isOpen ? <EditNotebookWidgetModalContent {...props} /> : null
+}
+
+function EditNotebookWidgetModalContent(props: DashboardWidgetEditModalProps): JSX.Element {
+ const { tileName, tileDescription, saving, error } = useValues(editNotebookWidgetLogic(props))
+ const { setTileName, setTileDescription, submit } = useActions(editNotebookWidgetLogic(props))
+ return (
+ <LemonModal
+ isOpen
+ title="Widget settings"
+ onClose={saving ? undefined : props.onClose}
+ width={560}
+ footer={
+ <>
+ <LemonButton onClick={props.onClose} disabledReason={saving ? 'Saving…' : undefined}>
+ Cancel
+ </LemonButton>
+ <LemonButton type="primary" loading={saving} onClick={submit}>
+ Save
+ </LemonButton>
+ </>
+ }
+ >
+ <div className="flex flex-col gap-4">
+ <EditWidgetModalTileDetailsSection
+ tileName={tileName}
+ tileDescription={tileDescription}
+ defaultTitle={props.defaultTitle ?? 'Notebook widget'}
+ saving={saving}
+ setTileName={setTileName}
+ setTileDescription={setTileDescription}
+ />
+ <p className="mb-0 text-secondary">
+ This tile keeps a saved widget version and its results. To change its code or inputs, edit the
+ notebook and add the widget again.
+ </p>
+ {typeof props.config.notebookShortId === 'string' ? (
+ <LemonButton to={urls.notebook(props.config.notebookShortId)}>Open notebook</LemonButton>
+ ) : null}
+ {error ? <LemonBanner type="error">{error}</LemonBanner> : null}
+ </div>
+ </LemonModal>
+ )
+}
diff --git a/products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidget.stories.tsx b/products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidget.stories.tsx
new file mode 100644
index 000000000000..6b99b28b7c75
--- /dev/null
+++ b/products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidget.stories.tsx
@@ -0,0 +1,168 @@
+import type { Meta, StoryObj } from '@storybook/react'
+import { useActions } from 'kea'
+
+import { LemonButton } from '@posthog/lemon-ui'
+
+import { mswDecorator } from '~/mocks/browser'
+import { DashboardPlacement, DashboardTile } from '~/types'
+
+import { DashboardWidgetItem } from 'products/dashboards/frontend/components/DashboardWidgetItem/DashboardWidgetItem'
+
+import { notebookWidgetDashboardLogic } from '../NotebookNodeGeneratedWidget/notebookWidgetDashboardLogic'
+import { NotebookWidgetDashboardModal } from '../NotebookNodeGeneratedWidget/NotebookWidgetDashboardModal'
+import { NotebookDashboardWidget } from './NotebookDashboardWidget'
+
+const snapshot = {
+ id: '00000000-0000-4000-8000-000000000042',
+ node_id: 'revenue-widget',
+ version_id: '00000000-0000-4000-8000-000000000041',
+ created_at: '2026-09-01T10:00:00Z',
+ frame_names: ['revenue'],
+ input_bindings: {},
+ input_contract: [
+ {
+ slot: 'revenue',
+ sourceName: 'revenue',
+ columns: [
+ { name: 'plan', type: 'String' },
+ { name: 'revenue', type: 'Float64' },
+ ],
+ schemaHash: '',
+ },
+ ],
+ artifact_url: `${window.location.origin}/notebook-dashboard-widget.html`,
+ build_hash: 'a'.repeat(64),
+ security_review: {
+ severity: 'none',
+ summary: 'No security issues found.',
+ findings: [],
+ model: 'claude-haiku-4-5',
+ review_version: '1',
+ reviewed_at: '2026-09-01T10:00:00Z',
+ },
+}
+
+const meta: Meta<typeof NotebookDashboardWidget> = {
+ title: 'Products/Notebooks/Dashboard widget',
+ component: NotebookDashboardWidget,
+ render: (args) => (
+ <DashboardWidgetItem
+ className="h-full"
+ tile={
+ {
+ id: args.tileId,
+ widget: {
+ id: '00000000-0000-4000-8000-000000000044',
+ widget_type: 'notebook_widget',
+ name: 'Revenue by plan',
+ description: '',
+ config: args.config,
+ },
+ } as DashboardTile
+ }
+ placement={DashboardPlacement.Dashboard}
+ result={args.result}
+ loading={args.loading}
+ onRefresh={() => undefined}
+ onUpdateWidgetTile={() => undefined}
+ onConfigPublished={args.onConfigPublished}
+ canEditDashboard={!!args.onConfigPublished}
+ showEditingControls
+ />
+ ),
+ decorators: [
+ mswDecorator({}),
+ (Story) => (
+ <div className="h-[520px] w-full max-w-3xl">
+ <Story />
+ </div>
+ ),
+ ],
+ args: {
+ tileId: 42,
+ config: { notebookShortId: 'example', snapshotId: snapshot.id },
+ result: {},
+ loading: false,
+ onConfigPublished: () => undefined,
+ },
+ parameters: {
+ mockDate: '2026-09-01T10:30:00Z',
+ msw: {
+ mocks: {
+ get: {
+ '/api/projects/:team_id/notebooks/:short_id/widget_snapshots/:snapshot_id/': snapshot,
+ '/api/projects/:team_id/notebooks/:short_id/widget_snapshots/:snapshot_id/frames/:frame_name/': {
+ name: 'revenue',
+ runId: '00000000-0000-4000-8000-000000000043',
+ columns: snapshot.input_contract[0].columns,
+ rows: [
+ ['Starter', 120],
+ ['Growth', 480],
+ ['Scale', 950],
+ ],
+ totalRowCount: 3,
+ includedRowCount: 3,
+ offset: 0,
+ nextOffset: null,
+ truncated: false,
+ },
+ '/api/projects/:team_id/notebooks/:short_id/widgets/:node_id/source/': {
+ source: 'export default function RevenueWidget() { /* Example widget source */ }',
+ },
+ },
+ },
+ },
+ },
+}
+export default meta
+type Story = StoryObj<typeof meta>
+
+export const SavedResults: Story = {}
+export const Empty: Story = { args: { config: {} }, render: (args) => <NotebookDashboardWidget {...args} /> }
+export const ReadOnly: Story = { args: { onConfigPublished: undefined } }
+export const AccessDenied: Story = {
+ parameters: {
+ msw: {
+ mocks: {
+ get: {
+ '/api/projects/:team_id/notebooks/:short_id/widget_snapshots/:snapshot_id/': [
+ 403,
+ { detail: 'Access denied' },
+ ],
+ },
+ },
+ },
+ },
+}
+
+function AddToDashboardExample(): JSX.Element {
+ const props = {
+ notebookShortId: 'example',
+ nodeId: 'revenue-widget',
+ versionId: snapshot.version_id,
+ title: 'Revenue by plan',
+ persistNotebook: async () => {},
+ }
+ const { open } = useActions(notebookWidgetDashboardLogic(props))
+ return (
+ <>
+ <LemonButton onClick={open}>Add to dashboard</LemonButton>
+ <NotebookWidgetDashboardModal {...props} />
+ </>
+ )
+}
+
+export const AddToDashboard: Story = {
+ render: () => <AddToDashboardExample />,
+ parameters: {
+ msw: {
+ mocks: {
+ get: {
+ '/api/environments/:team_id/dashboards/': {
+ results: [{ id: 1, name: 'Revenue overview', user_access_level: 'editor', deleted: false }],
+ },
+ },
+ },
+ },
+ },
+}
diff --git a/products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidget.tsx b/products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidget.tsx
new file mode 100644
index 000000000000..4fb0bc73dac2
--- /dev/null
+++ b/products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidget.tsx
@@ -0,0 +1,161 @@
+import { useActions, useValues } from 'kea'
+
+import { LemonBanner, LemonButton, LemonModal } from '@posthog/lemon-ui'
+
+import { teamLogic } from 'scenes/teamLogic'
+import { urls } from 'scenes/urls'
+import { userLogic } from 'scenes/userLogic'
+
+import type { DashboardWidgetComponentProps } from 'products/dashboards/frontend/widgets/registry'
+
+import { notebooksWidgetSnapshotFrame } from '../generated/api'
+import { NotebookWidgetTrustControls } from '../NotebookNodeGeneratedWidget/NotebookWidgetTrustControls'
+import {
+ getNotebookWidgetTrust,
+ notebookWidgetTrustLogic,
+} from '../NotebookNodeGeneratedWidget/notebookWidgetTrustLogic'
+import { WidgetArtifactFrame } from '../NotebookNodeGeneratedWidget/WidgetArtifactFrame'
+import { applyReusableWidgetBinding, getReusableWidgetInputBinding } from '../ReusableWidget/reusableWidgetBindings'
+import { NotebookDashboardWidgetProps, notebookDashboardWidgetLogic } from './notebookDashboardWidgetLogic'
+
+export function NotebookDashboardWidget({
+ tileId,
+ config,
+ onConfigPublished,
+}: DashboardWidgetComponentProps): JSX.Element {
+ if (typeof config.notebookShortId !== 'string' || typeof config.snapshotId !== 'string') {
+ return <NotebookWidgetPreview />
+ }
+ return (
+ <SavedNotebookWidget
+ tileId={tileId}
+ notebookShortId={config.notebookShortId}
+ snapshotId={config.snapshotId}
+ onSnapshotPublished={onConfigPublished}
+ />
+ )
+}
+
+export function NotebookWidgetPreview(): JSX.Element {
+ return (
+ <div className="flex h-full min-h-40 flex-col items-center justify-center gap-2 p-4 text-center">
+ <strong>Bring notebook results to your dashboard</strong>
+ <span className="text-secondary">
+ Open a generated widget's menu in a notebook and choose Add to dashboard.
+ </span>
+ <LemonButton to={urls.notebooks()} size="small">
+ Open notebooks
+ </LemonButton>
+ </div>
+ )
+}
+
+function SavedNotebookWidget(props: NotebookDashboardWidgetProps): JSX.Element {
+ const logic = notebookDashboardWidgetLogic(props)
+ const { snapshot, snapshotLoading, error, runId, polling, progress, sourceOpen, sourceLoading, source } =
+ useValues(logic)
+ const { loadSnapshot, pollRun, setError, setSourceOpen } = useActions(logic)
+ const { user } = useValues(userLogic)
+ const { currentTeamId } = useValues(teamLogic)
+ const { sessionBuildHashes, trustByUser } = useValues(notebookWidgetTrustLogic)
+ const { trustBuild } = useActions(notebookWidgetTrustLogic)
+ const trusted = getNotebookWidgetTrust({
+ sessionBuildHashes,
+ trustByUser,
+ userId: user?.id ?? null,
+ buildHash: snapshot?.build_hash ?? null,
+ }).buildTrusted
+ const canRender = trusted || (snapshot?.security_review?.severity === 'none' && snapshot.frame_names.length === 0)
+
+ return (
+ <div className="flex h-full min-h-0 flex-col">
+ {progress ? (
+ <div className="p-2 text-secondary text-sm" role="status">
+ {progress}
+ <div>Keep this dashboard open until the refresh finishes.</div>
+ </div>
+ ) : null}
+ {error ? (
+ <LemonBanner
+ type="warning"
+ className="m-2"
+ action={{
+ children: runId ? 'Check run' : 'Reload saved results',
+ onClick: runId ? pollRun : loadSnapshot,
+ loading: polling || snapshotLoading,
+ }}
+ >
+ {error}
+ </LemonBanner>
+ ) : null}
+ {snapshotLoading && !snapshot ? <div className="p-4 text-secondary">Loading saved results…</div> : null}
+ {snapshot && !snapshot.artifact_url ? (
+ <div className="p-4 text-secondary">
+ This widget's build is unavailable. Open the notebook to check it.
+ </div>
+ ) : null}
+ {snapshot?.artifact_url ? (
+ <>
+ {!canRender ? (
+ <NotebookWidgetTrustControls
+ variant="gate"
+ buildHash={snapshot.build_hash}
+ securityReview={snapshot.security_review}
+ isEditable={false}
+ onRun={() => {
+ if (snapshot.build_hash) {
+ trustBuild(user?.id ?? null, snapshot.build_hash)
+ }
+ }}
+ onViewSource={() => setSourceOpen(true)}
+ />
+ ) : null}
+ {canRender ? (
+ <div className="relative min-h-0 flex-1 overflow-hidden">
+ <WidgetArtifactFrame
+ key={snapshot.id}
+ artifactUrl={snapshot.artifact_url}
+ title="Saved notebook widget"
+ allowedFrames={snapshot.frame_names}
+ onReadFrame={async (name, offset, limit, _runId, signal) => {
+ const frame = await notebooksWidgetSnapshotFrame(
+ String(currentTeamId),
+ props.notebookShortId,
+ snapshot.id,
+ name,
+ { offset, limit },
+ { signal }
+ )
+ return applyReusableWidgetBinding(
+ frame,
+ name,
+ getReusableWidgetInputBinding(snapshot.input_bindings, name),
+ snapshot.input_contract
+ .find((input) => input.slot === name)
+ ?.columns?.map((column) => column.name) ?? []
+ )
+ }}
+ onArtifactUnavailable={() =>
+ setError('The widget preview did not load. Reload the saved results to try again.')
+ }
+ onError={(message) =>
+ setError(
+ message ||
+ 'The widget could not display its saved results. Open the notebook to check it.'
+ )
+ }
+ />
+ </div>
+ ) : null}
+ </>
+ ) : null}
+ <LemonModal isOpen={sourceOpen} title="Widget source" onClose={() => setSourceOpen(false)} width={800}>
+ {sourceLoading ? (
+ <p>Loading source…</p>
+ ) : (
+ <pre className="ph-no-capture max-h-96 overflow-auto whitespace-pre-wrap break-words">{source}</pre>
+ )}
+ </LemonModal>
+ </div>
+ )
+}
diff --git a/products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidgetMenu.tsx b/products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidgetMenu.tsx
new file mode 100644
index 000000000000..309fe95847c5
--- /dev/null
+++ b/products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidgetMenu.tsx
@@ -0,0 +1,83 @@
+import { useActions, useValues } from 'kea'
+
+import { LemonButton, LemonDialog, LemonDivider } from '@posthog/lemon-ui'
+
+import { humanFriendlyDetailedTime } from 'lib/utils/datetime'
+import { urls } from 'scenes/urls'
+
+import type { DashboardWidgetComponentProps } from 'products/dashboards/frontend/widgets/registry'
+
+import { NotebookWidgetTrustControls } from '../NotebookNodeGeneratedWidget/NotebookWidgetTrustControls'
+import { notebookDashboardWidgetLogic } from './notebookDashboardWidgetLogic'
+
+export function NotebookDashboardWidgetMenu({
+ tileId,
+ config,
+ onConfigPublished,
+}: DashboardWidgetComponentProps): JSX.Element {
+ const notebookShortId = config.notebookShortId as string
+ const logic = notebookDashboardWidgetLogic({
+ tileId,
+ notebookShortId,
+ snapshotId: config.snapshotId as string,
+ onSnapshotPublished: onConfigPublished,
+ })
+ const { snapshot, refreshing, runId, stopping, sourceLoading } = useValues(logic)
+ const { refresh, stopRun, setSourceOpen } = useActions(logic)
+
+ return (
+ <>
+ <LemonButton fullWidth to={urls.notebook(notebookShortId)}>
+ Open notebook
+ </LemonButton>
+ {onConfigPublished ? (
+ <LemonButton
+ fullWidth
+ loading={refreshing}
+ disabledReason={!snapshot ? 'Load the saved results first' : undefined}
+ onClick={() =>
+ LemonDialog.open({
+ title: 'Refresh from notebook?',
+ description:
+ 'This runs all saved data cells using the notebook’s variables. Python compute may incur charges. Dashboard filters do not change these results.',
+ primaryButton: { children: 'Run notebook', onClick: refresh },
+ secondaryButton: { children: 'Cancel' },
+ })
+ }
+ >
+ Refresh from notebook
+ </LemonButton>
+ ) : null}
+ {runId ? (
+ <LemonButton fullWidth loading={stopping} onClick={stopRun}>
+ Stop
+ </LemonButton>
+ ) : null}
+ <LemonButton
+ fullWidth
+ loading={sourceLoading}
+ disabledReason={!snapshot ? 'Load the saved results first' : undefined}
+ onClick={() => setSourceOpen(true)}
+ data-attr="notebook-widget-view-source"
+ >
+ View source
+ </LemonButton>
+ {snapshot ? (
+ <div className="flex flex-col gap-2 px-2 py-1.5">
+ <span className="text-xs text-secondary">
+ Saved {humanFriendlyDetailedTime(snapshot.created_at)}
+ </span>
+ <NotebookWidgetTrustControls
+ variant="menu"
+ buildHash={snapshot.build_hash}
+ securityReview={snapshot.security_review}
+ isEditable={false}
+ onRun={() => {}}
+ onViewSource={() => setSourceOpen(true)}
+ />
+ </div>
+ ) : null}
+ <LemonDivider />
+ </>
+ )
+}
diff --git a/products/notebooks/frontend/NotebookDashboardWidget/editNotebookWidgetLogic.ts b/products/notebooks/frontend/NotebookDashboardWidget/editNotebookWidgetLogic.ts
new file mode 100644
index 000000000000..de250dc846d0
--- /dev/null
+++ b/products/notebooks/frontend/NotebookDashboardWidget/editNotebookWidgetLogic.ts
@@ -0,0 +1,65 @@
+import { MakeLogicType, actions, defaults, kea, listeners, path, props, reducers } from 'kea'
+
+import {
+ buildWidgetTileMetadataPatch,
+ getWidgetEditModalTileDefaults,
+ widgetEditModalTileActions,
+} from 'products/dashboards/frontend/widgets/editWidgetModalBuilders'
+import type { DashboardWidgetEditModalProps } from 'products/dashboards/frontend/widgets/registry'
+
+export interface editNotebookWidgetValues {
+ tileName: string
+ tileDescription: string
+ saving: boolean
+ error: string | null
+}
+export interface editNotebookWidgetActions {
+ setTileName: (tileName: string) => { tileName: string }
+ setTileDescription: (tileDescription: string) => { tileDescription: string }
+ submit: () => void
+ setSaving: (saving: boolean) => { saving: boolean }
+ setError: (error: string | null) => { error: string | null }
+}
+export type editNotebookWidgetLogicType = MakeLogicType<
+ editNotebookWidgetValues,
+ editNotebookWidgetActions,
+ DashboardWidgetEditModalProps
+>
+
+export const editNotebookWidgetLogic = kea<editNotebookWidgetLogicType>([
+ props({} as DashboardWidgetEditModalProps),
+ path(['products', 'notebooks', 'editNotebookWidgetLogic']),
+ actions({
+ ...widgetEditModalTileActions,
+ submit: () => ({}),
+ setSaving: (saving: boolean) => ({ saving }),
+ setError: (error: string | null) => ({ error }),
+ }),
+ defaults(({ props }) => getWidgetEditModalTileDefaults(props)),
+ reducers({
+ tileName: ['', { setTileName: (_, { tileName }) => tileName }],
+ tileDescription: ['', { setTileDescription: (_, { tileDescription }) => tileDescription }],
+ saving: [false, { setSaving: (_, { saving }) => saving }],
+ error: [null as string | null, { setError: (_, { error }) => error }],
+ }),
+ listeners(({ actions, values, props }) => ({
+ submit: async () => {
+ if (values.saving) {
+ return
+ }
+ actions.setSaving(true)
+ actions.setError(null)
+ try {
+ await props.onSave(
+ props.config,
+ buildWidgetTileMetadataPatch(props, values.tileName, values.tileDescription)
+ )
+ props.onClose()
+ } catch {
+ actions.setError('Could not save the widget settings. Try again.')
+ } finally {
+ actions.setSaving(false)
+ }
+ },
+ })),
+])
diff --git a/products/notebooks/frontend/NotebookDashboardWidget/notebookDashboardWidgetLogic.test.ts b/products/notebooks/frontend/NotebookDashboardWidget/notebookDashboardWidgetLogic.test.ts
new file mode 100644
index 000000000000..e4c7e7b6f27d
--- /dev/null
+++ b/products/notebooks/frontend/NotebookDashboardWidget/notebookDashboardWidgetLogic.test.ts
@@ -0,0 +1,158 @@
+import { expectLogic } from 'kea-test-utils'
+
+import { ApiError } from 'lib/api-error'
+
+import { initKeaTests } from '~/test/init'
+
+import {
+ notebooksRunsCreate,
+ notebooksRunsRetrieve,
+ notebooksWidgetSnapshotPublish,
+ notebooksWidgetSnapshotRetrieve,
+} from '../generated/api'
+import type {
+ NotebookRunStartResponseApi,
+ NotebookRunStatusResponseApi,
+ WidgetSnapshotApi,
+} from '../generated/api.schemas'
+import { notebookDashboardWidgetLogic } from './notebookDashboardWidgetLogic'
+
+jest.mock('../generated/api', () => ({
+ notebooksRunsCreate: jest.fn(),
+ notebooksRunsRetrieve: jest.fn(),
+ notebooksRunsInterruptCreate: jest.fn(),
+ notebooksWidgetSnapshotPublish: jest.fn(),
+ notebooksWidgetSnapshotRetrieve: jest.fn(),
+ notebooksWidgetSource: jest.fn(),
+}))
+
+const snapshot = {
+ id: 'saved',
+ node_id: 'widget',
+ version_id: 'version',
+ frame_names: ['revenue'],
+} as WidgetSnapshotApi
+
+describe('notebookDashboardWidgetLogic', () => {
+ let logic: ReturnType<typeof notebookDashboardWidgetLogic.build>
+ const update = jest.fn()
+ beforeEach(async () => {
+ initKeaTests()
+ jest.clearAllMocks()
+ jest.mocked(notebooksWidgetSnapshotRetrieve).mockResolvedValue(snapshot)
+ logic = notebookDashboardWidgetLogic({
+ tileId: 1,
+ notebookShortId: 'notebook',
+ snapshotId: snapshot.id,
+ onSnapshotPublished: update,
+ })
+ await expectLogic(logic, () => {
+ logic.mount()
+ }).toFinishAllListeners()
+ })
+ afterEach(() => logic.unmount())
+
+ it('opens saved results without starting compute and replaces them only after a successful run and save', async () => {
+ expect(logic.values.snapshot).toEqual(snapshot)
+ expect(notebooksRunsCreate).not.toHaveBeenCalled()
+ jest.mocked(notebooksRunsCreate).mockResolvedValue({ run_id: 'run' } as NotebookRunStartResponseApi)
+ jest.mocked(notebooksRunsRetrieve).mockResolvedValue({
+ run_id: 'run',
+ status: 'done',
+ } as NotebookRunStatusResponseApi)
+ let finishCapture!: (saved: WidgetSnapshotApi) => void
+ let captureStarted!: () => void
+ const started = new Promise<void>((resolve) => {
+ captureStarted = resolve
+ })
+ jest.mocked(notebooksWidgetSnapshotPublish).mockImplementation(
+ () =>
+ new Promise((resolve) => {
+ finishCapture = resolve
+ captureStarted()
+ })
+ )
+ logic.actions.refresh()
+ logic.actions.refresh()
+ await started
+ expect(logic.values.snapshot).toEqual(snapshot)
+ expect(update).not.toHaveBeenCalled()
+ expect(notebooksRunsCreate).toHaveBeenCalledTimes(1)
+ await expectLogic(logic, () => finishCapture({ ...snapshot, id: 'new' })).toFinishAllListeners()
+ expect(update).toHaveBeenCalledTimes(1)
+ expect(logic.values.snapshot?.id).toBe('new')
+ expect(notebooksWidgetSnapshotPublish).toHaveBeenCalledWith(expect.any(String), 'notebook', {
+ node_id: 'widget',
+ version_id: 'version',
+ notebook_run_id: 'run',
+ previous_snapshot_id: 'saved',
+ tile_id: 1,
+ })
+ })
+
+ it.each([false, true])('resumes polling after a network error when hidden=%s', async (hidden) => {
+ jest.useFakeTimers()
+ const hiddenSpy = jest.spyOn(document, 'hidden', 'get').mockReturnValue(hidden)
+ document.dispatchEvent(new Event('visibilitychange'))
+ try {
+ jest.mocked(notebooksRunsCreate).mockResolvedValue({ run_id: 'run' } as NotebookRunStartResponseApi)
+ jest.mocked(notebooksRunsRetrieve)
+ .mockRejectedValueOnce(new Error('Network unavailable'))
+ .mockResolvedValueOnce({
+ run_id: 'run',
+ status: 'running',
+ current_index: 0,
+ cell_count: 1,
+ } as NotebookRunStatusResponseApi)
+ .mockResolvedValue({ run_id: 'run', status: 'done' } as NotebookRunStatusResponseApi)
+ jest.mocked(notebooksWidgetSnapshotPublish).mockResolvedValue({ ...snapshot, id: 'new' })
+ update.mockResolvedValue(undefined)
+ await expectLogic(logic, () => logic.actions.refresh()).toFinishAllListeners()
+ expect(logic.values.runId).toBe('run')
+ expect(logic.values.error).toBe('Network unavailable')
+ await expectLogic(logic, () => logic.actions.pollRun()).toFinishAllListeners()
+ expect(logic.values.error).toBeNull()
+ await expectLogic(logic, () => {
+ jest.advanceTimersByTime(2000)
+ }).toFinishAllListeners()
+ expect(update).toHaveBeenCalledTimes(1)
+ expect(notebooksRunsCreate).toHaveBeenCalledTimes(1)
+ } finally {
+ hiddenSpy.mockRestore()
+ document.dispatchEvent(new Event('visibilitychange'))
+ jest.useRealTimers()
+ }
+ })
+
+ it.each([
+ [
+ new ApiError('Conflict', 409, undefined, { detail: 'Refresh this widget from the notebook.' }),
+ 'Refresh this widget from the notebook.',
+ ],
+ [new Error('Network error'), 'Could not load the saved results. Check your notebook access and try again.'],
+ ])('shows the API detail or a fallback when saved results cannot load', async (error, message) => {
+ jest.mocked(notebooksWidgetSnapshotRetrieve).mockRejectedValueOnce(error)
+ await expectLogic(logic, () => logic.actions.loadSnapshot()).toFinishAllListeners()
+ expect(logic.values.error).toBe(message)
+ })
+
+ it.each(['run', 'publish'])('keeps the previous snapshot after a failed %s', async (step) => {
+ jest.mocked(notebooksRunsCreate).mockResolvedValue({ run_id: 'run' } as NotebookRunStartResponseApi)
+ jest.mocked(notebooksRunsRetrieve).mockResolvedValue({
+ run_id: 'run',
+ status: step === 'run' ? 'failed' : 'done',
+ error: step === 'run' ? 'Cell failed' : null,
+ } as NotebookRunStatusResponseApi)
+ jest.mocked(notebooksWidgetSnapshotPublish).mockImplementation(async () => {
+ if (step === 'publish') {
+ throw new Error('Results expired')
+ }
+ return { ...snapshot, id: 'new' }
+ })
+ await expectLogic(logic, () => logic.actions.refresh()).toFinishAllListeners()
+ expect(logic.values.snapshot).toEqual(snapshot)
+ expect(logic.values.refreshing).toBe(false)
+ expect(logic.values.error).toBeTruthy()
+ expect(update).not.toHaveBeenCalled()
+ })
+})
diff --git a/products/notebooks/frontend/NotebookDashboardWidget/notebookDashboardWidgetLogic.ts b/products/notebooks/frontend/NotebookDashboardWidget/notebookDashboardWidgetLogic.ts
new file mode 100644
index 000000000000..162cb431e901
--- /dev/null
+++ b/products/notebooks/frontend/NotebookDashboardWidget/notebookDashboardWidgetLogic.ts
@@ -0,0 +1,261 @@
+import { MakeLogicType, actions, afterMount, kea, key, listeners, path, props, reducers } from 'kea'
+import { loaders } from 'kea-loaders'
+
+import { ApiError } from 'lib/api-error'
+import { teamLogic } from 'scenes/teamLogic'
+
+import {
+ notebooksRunsCreate,
+ notebooksRunsInterruptCreate,
+ notebooksRunsRetrieve,
+ notebooksWidgetSnapshotPublish,
+ notebooksWidgetSnapshotRetrieve,
+ notebooksWidgetSource,
+} from '../generated/api'
+import type { WidgetSnapshotApi } from '../generated/api.schemas'
+
+export interface NotebookDashboardWidgetProps {
+ tileId: number
+ notebookShortId: string
+ snapshotId: string
+ onSnapshotPublished?: () => void
+}
+
+export interface notebookDashboardWidgetValues {
+ snapshot: WidgetSnapshotApi | null
+ snapshotLoading: boolean
+ source: string | null
+ sourceLoading: boolean
+ sourceOpen: boolean
+ refreshing: boolean
+ polling: boolean
+ stopping: boolean
+ runId: string | null
+ error: string | null
+ progress: string | null
+}
+export interface notebookDashboardWidgetActions {
+ loadSnapshot: () => void
+ loadSnapshotSuccess: (snapshot: WidgetSnapshotApi | null) => { snapshot: WidgetSnapshotApi | null }
+ loadSnapshotFailure: (error: string, errorObject?: unknown) => { error: string; errorObject?: unknown }
+ loadSource: () => void
+ loadSourceFailure: (error: string) => { error: string }
+ setSourceOpen: (sourceOpen: boolean) => { sourceOpen: boolean }
+ refresh: () => void
+ pollRun: () => void
+ stopRun: () => void
+ setRefreshing: (refreshing: boolean) => { refreshing: boolean }
+ setPolling: (polling: boolean) => { polling: boolean }
+ setStopping: (stopping: boolean) => { stopping: boolean }
+ setRunId: (runId: string | null) => { runId: string | null }
+ setError: (error: string | null) => { error: string | null }
+ setProgress: (progress: string | null) => { progress: string | null }
+}
+export type notebookDashboardWidgetLogicType = MakeLogicType<
+ notebookDashboardWidgetValues,
+ notebookDashboardWidgetActions,
+ NotebookDashboardWidgetProps
+>
+
+export const notebookDashboardWidgetLogic = kea<notebookDashboardWidgetLogicType>([
+ props({} as NotebookDashboardWidgetProps),
+ key(({ tileId, snapshotId }) => `${tileId}-${snapshotId}`),
+ path((key) => ['products', 'notebooks', 'notebookDashboardWidgetLogic', key]),
+ actions({
+ refresh: () => ({}),
+ pollRun: () => ({}),
+ stopRun: () => ({}),
+ setSourceOpen: (sourceOpen: boolean) => ({ sourceOpen }),
+ setRefreshing: (refreshing: boolean) => ({ refreshing }),
+ setPolling: (polling: boolean) => ({ polling }),
+ setStopping: (stopping: boolean) => ({ stopping }),
+ setRunId: (runId: string | null) => ({ runId }),
+ setError: (error: string | null) => ({ error }),
+ setProgress: (progress: string | null) => ({ progress }),
+ }),
+ loaders(({ props, values }) => ({
+ snapshot: [
+ null as WidgetSnapshotApi | null,
+ {
+ loadSnapshot: () =>
+ notebooksWidgetSnapshotRetrieve(
+ String(teamLogic.values.currentTeamId),
+ props.notebookShortId,
+ values.snapshot?.id ?? props.snapshotId
+ ),
+ },
+ ],
+ source: [
+ null as string | null,
+ {
+ loadSource: async () => {
+ if (!values.snapshot) {
+ return null
+ }
+ return (
+ await notebooksWidgetSource(
+ String(teamLogic.values.currentTeamId),
+ props.notebookShortId,
+ values.snapshot.node_id,
+ { version_id: values.snapshot.version_id }
+ )
+ ).source
+ },
+ },
+ ],
+ })),
+ reducers({
+ sourceOpen: [false, { setSourceOpen: (_, { sourceOpen }) => sourceOpen }],
+ refreshing: [false, { setRefreshing: (_, { refreshing }) => refreshing }],
+ polling: [false, { setPolling: (_, { polling }) => polling }],
+ stopping: [false, { setStopping: (_, { stopping }) => stopping }],
+ runId: [null as string | null, { setRunId: (_, { runId }) => runId }],
+ error: [null as string | null, { setError: (_, { error }) => error, loadSnapshot: () => null }],
+ progress: [null as string | null, { setProgress: (_, { progress }) => progress }],
+ }),
+ listeners(({ actions, values, props, cache }) => ({
+ loadSnapshotFailure: ({ errorObject }) =>
+ actions.setError(
+ (errorObject instanceof ApiError && errorObject.detail) ||
+ 'Could not load the saved results. Check your notebook access and try again.'
+ ),
+ loadSourceFailure: () => actions.setError('Could not load the widget source. Open the notebook to try again.'),
+ setSourceOpen: ({ sourceOpen }) => {
+ if (sourceOpen) {
+ actions.loadSource()
+ }
+ },
+ refresh: async () => {
+ if (values.refreshing || !values.snapshot || !props.onSnapshotPublished) {
+ return
+ }
+ const signal: AbortSignal = cache.abortSignal
+ actions.setRefreshing(true)
+ actions.setError(null)
+ actions.setProgress('Starting notebook…')
+ try {
+ const run = await notebooksRunsCreate(String(teamLogic.values.currentTeamId), props.notebookShortId, {
+ include_prepared_insights: true,
+ })
+ if (signal.aborted) {
+ return
+ }
+ actions.setRunId(run.run_id)
+ actions.pollRun()
+ cache.disposables.add(
+ () => {
+ const timer = setInterval(() => actions.pollRun(), 2000)
+ return () => clearInterval(timer)
+ },
+ 'notebook-run',
+ { pauseOnPageHidden: false }
+ )
+ } catch (error) {
+ if (signal.aborted) {
+ return
+ }
+ actions.setError(error instanceof Error ? error.message : 'Could not start the notebook. Try again.')
+ actions.setRefreshing(false)
+ actions.setProgress(null)
+ }
+ },
+ pollRun: async () => {
+ if (values.polling || !values.runId || !values.snapshot) {
+ return
+ }
+ const signal: AbortSignal = cache.abortSignal
+ actions.setPolling(true)
+ try {
+ const projectId = String(teamLogic.values.currentTeamId)
+ const run = await notebooksRunsRetrieve(projectId, props.notebookShortId, values.runId)
+ if (signal.aborted) {
+ return
+ }
+ if (run.status === 'running') {
+ actions.setError(null)
+ actions.setProgress(`Running cell ${run.current_index + 1} of ${run.cell_count}…`)
+ cache.disposables.add(
+ () => {
+ const timer = setInterval(() => actions.pollRun(), 2000)
+ return () => clearInterval(timer)
+ },
+ 'notebook-run',
+ { pauseOnPageHidden: false }
+ )
+ return
+ }
+ cache.disposables.dispose('notebook-run')
+ actions.setRunId(null)
+ if (run.status !== 'done') {
+ throw new Error(run.error || 'The notebook did not finish. Your saved results have not changed.')
+ }
+ actions.setProgress('Saving results…')
+ const snapshot = await notebooksWidgetSnapshotPublish(projectId, props.notebookShortId, {
+ node_id: values.snapshot.node_id,
+ version_id: values.snapshot.version_id,
+ notebook_run_id: run.run_id,
+ previous_snapshot_id: values.snapshot.id,
+ tile_id: props.tileId,
+ })
+ if (signal.aborted) {
+ return
+ }
+ actions.loadSnapshotSuccess(snapshot)
+ props.onSnapshotPublished?.()
+ } catch (error) {
+ if (signal.aborted) {
+ return
+ }
+ actions.setError(
+ error instanceof Error
+ ? error.message
+ : 'Could not refresh this widget. Your saved results have not changed.'
+ )
+ cache.disposables.dispose('notebook-run')
+ } finally {
+ actions.setPolling(false)
+ if (!values.runId) {
+ actions.setRefreshing(false)
+ actions.setProgress(null)
+ }
+ }
+ },
+ stopRun: async () => {
+ if (!values.runId || values.stopping) {
+ return
+ }
+ const signal: AbortSignal = cache.abortSignal
+ actions.setStopping(true)
+ try {
+ await notebooksRunsInterruptCreate(
+ String(teamLogic.values.currentTeamId),
+ props.notebookShortId,
+ values.runId
+ )
+ if (signal.aborted) {
+ return
+ }
+ actions.pollRun()
+ } catch {
+ if (signal.aborted) {
+ return
+ }
+ actions.setError('Could not stop the notebook. Open it to check the run.')
+ } finally {
+ actions.setStopping(false)
+ }
+ },
+ })),
+ afterMount(({ actions, cache }) => {
+ cache.disposables.add(
+ () => {
+ const controller = new AbortController()
+ cache.abortSignal = controller.signal
+ return () => controller.abort()
+ },
+ 'lifecycle',
+ { pauseOnPageHidden: false }
+ )
+ actions.loadSnapshot()
+ }),
+])
diff --git a/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.stories.tsx b/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.stories.tsx
index 5e5118f90a49..84ddc94c33ad 100644
--- a/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.stories.tsx
+++ b/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.stories.tsx
@@ -41,7 +41,7 @@ const meta: Meta = {
component: WidgetNotebook,
parameters: {
layout: 'fullscreen',
- featureFlags: [FEATURE_FLAGS.NOTEBOOK_GENERATED_WIDGETS],
+ featureFlags: [FEATURE_FLAGS.NOTEBOOK_GENERATED_WIDGETS, FEATURE_FLAGS.DASHBOARD_WIDGETS],
testOptions: {
waitForSelector: '[data-attr="notebook-generated-widget-run-button"]',
},
diff --git a/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.test.tsx b/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.test.tsx
index 9002ec70e03a..b1239e12b9d4 100644
--- a/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.test.tsx
+++ b/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.test.tsx
@@ -6,6 +6,8 @@ import { expectLogic } from 'kea-test-utils'
import api from 'lib/api'
import { parseMarkdownNotebook } from 'lib/components/MarkdownNotebook/markdown'
+import { FEATURE_FLAGS } from 'lib/constants'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { buildMarkdownNotebookContent, getMarkdownNotebookMarkdown } from 'scenes/notebooks/Notebook/markdownNotebookV2'
import { MarkdownNotebookV2 } from 'scenes/notebooks/Notebook/MarkdownNotebookV2Renderer'
import { NotebookLogicProps, notebookLogic } from 'scenes/notebooks/Notebook/notebookLogic'
@@ -72,6 +74,7 @@ describe('NotebookNodeGeneratedWidget', () => {
beforeEach(async () => {
initKeaTests()
+ featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.DASHBOARD_WIDGETS]: true })
jest.spyOn(api.notebooks, 'collabStream').mockResolvedValue(undefined as never)
jest.spyOn(api.notebooks, 'get').mockResolvedValue(cachedNotebook)
jest.spyOn(api.notebooks, 'markdownSave').mockImplementation(async (_shortId, notebook) => ({
@@ -646,6 +649,10 @@ describe('NotebookNodeGeneratedWidget', () => {
}
expect(screen.queryByText('Open reusable widget')).toBeNull()
fireEvent.click(screen.getByLabelText('More actions'))
+ fireEvent.click(screen.getByText('Add to dashboard'))
+ expect(await screen.findByText('Add widget to dashboard')).toBeTruthy()
+ fireEvent.click(screen.getByText('Cancel'))
+ fireEvent.click(screen.getByLabelText('More actions'))
expect(screen.queryByText('Open reusable widget') !== null).toBe(isReusable)
if (isReusable) {
expect(screen.getByText('Open reusable widget').closest('a')?.getAttribute('href')).toContain(
@@ -778,8 +785,11 @@ describe('NotebookNodeGeneratedWidget', () => {
</BindLogic>
)
- expect(await screen.findByText(/preview is no longer available/)).toBeTruthy()
- fireEvent.click(screen.getByText('View source'))
+ const unavailablePreview = await screen.findByText(/preview is no longer available/)
+ fireEvent.click(screen.getByLabelText('More actions'))
+ expect(screen.queryByText('Add to dashboard')).toBeNull()
+ fireEvent.click(screen.getByLabelText('More actions'))
+ fireEvent.click(within(unavailablePreview.parentElement!).getByText('View source'))
await waitFor(() =>
expect(notebooksWidgetSource).toHaveBeenCalledWith(
diff --git a/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.tsx b/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.tsx
index 135e21cb34f6..49757d2aaf83 100644
--- a/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.tsx
+++ b/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.tsx
@@ -4,8 +4,10 @@ import { type ReactNode, useEffect } from 'react'
import { LemonBanner, LemonButton, LemonSelect } from '@posthog/lemon-ui'
import { useComponentPanelState } from 'lib/components/MarkdownNotebook/componentPanelContext'
+import { FEATURE_FLAGS } from 'lib/constants'
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
import { Spinner } from 'lib/lemon-ui/Spinner'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { createPostHogWidgetNode } from 'scenes/notebooks/Nodes/NodeWrapper'
import { notebookNodeLogic } from 'scenes/notebooks/Nodes/notebookNodeLogic'
import { UnsupportedNodePlaceholder } from 'scenes/notebooks/Nodes/sharedNodeSupport'
@@ -23,6 +25,8 @@ import {
} from './notebookNodeGeneratedWidgetLogic'
import { NotebookNodeGeneratedWidgetSettings } from './NotebookNodeGeneratedWidgetSettings'
import { NotebookWidgetBetaNotice } from './NotebookWidgetBetaNotice'
+import { notebookWidgetDashboardLogic } from './notebookWidgetDashboardLogic'
+import { NotebookWidgetDashboardModal } from './NotebookWidgetDashboardModal'
import { NotebookWidgetGenerationModal } from './NotebookWidgetGenerationModal'
import { NotebookWidgetSourceModal } from './NotebookWidgetSourceModal'
import { NotebookWidgetTrustControls } from './NotebookWidgetTrustControls'
@@ -67,6 +71,7 @@ function ExpandedWidget({
const { isEditable, notebookLogic } = useValues(nodeLogic)
const { currentTeamId } = useValues(teamLogic)
const { user } = useValues(userLogic)
+ const { featureFlags } = useValues(featureFlagLogic)
const notebookShortId = notebookLogic.props.shortId
// Markdown props are cast without runtime validation, so a hand-written or legacy
// tag can supply a non-string prompt or an unsupported model. Coerce both here, the
@@ -133,6 +138,23 @@ function ExpandedWidget({
} = useActions(logic)
const { trustBuild } = useActions(trustLogic)
const { setMenuItems, updateAttributes } = useActions(nodeLogic)
+ const dashboardProps = {
+ notebookShortId,
+ nodeId: attributes.nodeId,
+ versionId: selectedVersionId ?? '',
+ title: attributes.title || 'Notebook widget',
+ persistNotebook: logicProps.persistNotebook,
+ }
+ const { open: openDashboardModal } = useActions(notebookWidgetDashboardLogic(dashboardProps))
+ const selectedArtifactUrl =
+ selectedVersionId === status?.current_version_id ? status?.artifact_url : selectedVersion?.artifact_url
+ const canAddToDashboard =
+ isEditable &&
+ selectedVersionId &&
+ selectedArtifactUrl &&
+ currentTeamId &&
+ !artifactUnavailable &&
+ featureFlags[FEATURE_FLAGS.DASHBOARD_WIDGETS]
const selectedBuildHash =
selectedVersionId === status?.current_version_id
? (status?.build_hash ?? null)
@@ -144,6 +166,7 @@ function ExpandedWidget({
useEffect(() => {
setMenuItems([
+ canAddToDashboard ? { label: 'Add to dashboard', onClick: openDashboardModal } : null,
status?.is_reusable && status.widget_id
? { label: 'Open reusable widget', to: urls.reusableWidget(status.widget_id) }
: null,
@@ -172,6 +195,8 @@ function ExpandedWidget({
])
}, [
isEditable,
+ canAddToDashboard,
+ openDashboardModal,
openSourceModal,
selectedBuildHash,
selectedSecurityReview,
@@ -203,8 +228,6 @@ function ExpandedWidget({
}
const initialPrompt = prompt.trim()
- const selectedArtifactUrl =
- selectedVersionId === status?.current_version_id ? status?.artifact_url : selectedVersion?.artifact_url
const widgetTrust = getNotebookWidgetTrust({
trustByUser,
sessionBuildHashes,
@@ -251,6 +274,7 @@ function ExpandedWidget({
return (
<>
{trustControls('gate')}
+ <NotebookWidgetDashboardModal {...dashboardProps} />
{!componentPanelState ? <NotebookWidgetSourceModal {...logicProps} /> : null}
</>
)
@@ -258,6 +282,7 @@ function ExpandedWidget({
return (
<>
<div className="flex h-full min-h-0 w-full flex-col">
+ <NotebookWidgetDashboardModal {...dashboardProps} />
{isWorking && workingStatus && !componentPanelState?.showEditPanel ? (
<div className="flex flex-wrap items-center gap-2 border-b p-2 text-sm">
<span className="flex items-center gap-2" role="status" aria-live="polite">
diff --git a/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookWidgetDashboardModal.tsx b/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookWidgetDashboardModal.tsx
new file mode 100644
index 000000000000..eeb2b3c41110
--- /dev/null
+++ b/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookWidgetDashboardModal.tsx
@@ -0,0 +1,68 @@
+import { useActions, useValues } from 'kea'
+
+import { LemonBanner, LemonButton, LemonModal, LemonSelect } from '@posthog/lemon-ui'
+
+import { dashboardsModel } from '~/models/dashboardsModel'
+import { AccessControlLevel } from '~/types'
+
+import { NotebookWidgetDashboardProps, notebookWidgetDashboardLogic } from './notebookWidgetDashboardLogic'
+
+export function NotebookWidgetDashboardModal(props: NotebookWidgetDashboardProps): JSX.Element {
+ const { isOpen, saving, error, dashboardId } = useValues(notebookWidgetDashboardLogic(props))
+ const { close, addToDashboard, selectDashboard } = useActions(notebookWidgetDashboardLogic(props))
+ const { nameSortedDashboards, dashboardsLoading } = useValues(dashboardsModel)
+ return (
+ <LemonModal
+ isOpen={isOpen}
+ onClose={saving ? undefined : close}
+ title="Add widget to dashboard"
+ width={480}
+ footer={
+ <>
+ <LemonButton onClick={close} disabledReason={saving ? 'Saving results…' : undefined}>
+ Cancel
+ </LemonButton>
+ <LemonButton
+ type="primary"
+ onClick={addToDashboard}
+ loading={saving}
+ disabledReason={!dashboardId ? 'Choose a dashboard' : undefined}
+ data-attr="notebook-widget-add-to-dashboard"
+ >
+ Add to dashboard
+ </LemonButton>
+ </>
+ }
+ >
+ <div className="flex flex-col gap-4">
+ <p className="mb-0">
+ Save this widget and its current dataframe results on a dashboard. Opening the dashboard will not
+ run notebook code.
+ </p>
+ <LemonSelect
+ value={dashboardId}
+ onChange={selectDashboard}
+ loading={dashboardsLoading}
+ disabledReason={saving ? 'Saving results…' : undefined}
+ fullWidth
+ placeholder="Choose a dashboard"
+ options={nameSortedDashboards
+ .filter((dashboard) => !dashboard.deleted)
+ .map((dashboard) => ({
+ value: dashboard.id,
+ label: dashboard.name || 'Untitled',
+ disabledReason:
+ dashboard.user_access_level === AccessControlLevel.Viewer
+ ? 'You need edit access to this dashboard'
+ : undefined,
+ }))}
+ />
+ <span className="text-secondary text-sm">
+ Use Refresh from notebook on the dashboard to update the data. Notebook variables control the
+ results.
+ </span>
+ {error ? <LemonBanner type="error">{error}</LemonBanner> : null}
+ </div>
+ </LemonModal>
+ )
+}
diff --git a/products/notebooks/frontend/NotebookNodeGeneratedWidget/notebookWidgetDashboardLogic.ts b/products/notebooks/frontend/NotebookNodeGeneratedWidget/notebookWidgetDashboardLogic.ts
new file mode 100644
index 000000000000..02d3db15e3a3
--- /dev/null
+++ b/products/notebooks/frontend/NotebookNodeGeneratedWidget/notebookWidgetDashboardLogic.ts
@@ -0,0 +1,86 @@
+import { LogicWrapper, MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
+
+import { lemonToast } from 'lib/lemon-ui/LemonToast'
+import { teamLogic } from 'scenes/teamLogic'
+
+import { dashboardsModel } from '~/models/dashboardsModel'
+
+import { notebooksWidgetSnapshotPublish } from '../generated/api'
+
+export interface NotebookWidgetDashboardProps {
+ notebookShortId: string
+ nodeId: string
+ versionId: string
+ title: string
+ persistNotebook: () => Promise<void>
+}
+
+export interface notebookWidgetDashboardValues {
+ isOpen: boolean
+ saving: boolean
+ error: string | null
+ dashboardId: number | null
+}
+export interface notebookWidgetDashboardActions {
+ loadDashboards: () => void
+ open: () => void
+ close: () => void
+ selectDashboard: (dashboardId: number | null) => { dashboardId: number | null }
+ addToDashboard: () => void
+ setSaving: (saving: boolean) => { saving: boolean }
+ setError: (error: string | null) => { error: string | null }
+}
+export type notebookWidgetDashboardLogicType = MakeLogicType<
+ notebookWidgetDashboardValues,
+ notebookWidgetDashboardActions,
+ NotebookWidgetDashboardProps
+>
+
+export const notebookWidgetDashboardLogic: LogicWrapper<notebookWidgetDashboardLogicType> =
+ kea<notebookWidgetDashboardLogicType>([
+ props({} as NotebookWidgetDashboardProps),
+ key(({ notebookShortId, nodeId }) => `${notebookShortId}-${nodeId}`),
+ path((key) => ['products', 'notebooks', 'notebookWidgetDashboardLogic', key]),
+ connect({ actions: [dashboardsModel, ['loadDashboards']] }),
+ actions({
+ open: () => ({}),
+ close: () => ({}),
+ addToDashboard: () => ({}),
+ selectDashboard: (dashboardId: number | null) => ({ dashboardId }),
+ setSaving: (saving: boolean) => ({ saving }),
+ setError: (error: string | null) => ({ error }),
+ }),
+ reducers({
+ isOpen: [false, { open: () => true, close: () => false }],
+ saving: [false, { setSaving: (_, { saving }) => saving }],
+ error: [null as string | null, { setError: (_, { error }) => error, open: () => null }],
+ dashboardId: [null as number | null, { selectDashboard: (_, { dashboardId }) => dashboardId }],
+ }),
+ listeners(({ actions, values, props }) => ({
+ open: () => actions.loadDashboards(),
+ addToDashboard: async () => {
+ if (values.saving || !values.dashboardId) {
+ return
+ }
+ const dashboardId = values.dashboardId
+ actions.setSaving(true)
+ actions.setError(null)
+ try {
+ await props.persistNotebook()
+ const projectId = String(teamLogic.values.currentTeamId)
+ await notebooksWidgetSnapshotPublish(projectId, props.notebookShortId, {
+ node_id: props.nodeId,
+ version_id: props.versionId,
+ dashboard_id: dashboardId,
+ name: props.title,
+ })
+ lemonToast.success('Widget added to dashboard')
+ actions.close()
+ } catch (error) {
+ actions.setError(error instanceof Error ? error.message : 'Could not add this widget. Try again.')
+ } finally {
+ actions.setSaving(false)
+ }
+ },
+ })),
+ ])
diff --git a/products/notebooks/frontend/generated/api.schemas.ts b/products/notebooks/frontend/generated/api.schemas.ts
index f42f426e68a3..633accf73c51 100644
--- a/products/notebooks/frontend/generated/api.schemas.ts
+++ b/products/notebooks/frontend/generated/api.schemas.ts
@@ -964,6 +964,8 @@ export interface NotebookKernelStatusResponseApi {
}
export interface NotebookRunStartRequestApi {
+ /** Include prepared embedded insights when refreshing a dashboard widget. Requires notebook widgets to be enabled. */
+ include_prepared_insights?: boolean
/** Replace the notebook's variables with this list before the run starts, so the results match what the document declares. Omit it to run with the variables already saved. */
variables?: NotebookVariableApi[]
}
@@ -1292,6 +1294,88 @@ export interface NotebookSQLV2StateResponseApi {
cells: NotebookCellStateApi[]
}
+export interface WidgetSnapshotRequestApi {
+ /**
+ * Notebook widget node to add to a dashboard.
+ * @maxLength 128
+ */
+ node_id: string
+ /** Immutable widget version to keep on the dashboard. */
+ version_id: string
+ /** Completed whole-notebook run supplying every input after refresh. */
+ notebook_run_id?: string
+ /** Snapshot being refreshed; its version and input mappings must match. */
+ previous_snapshot_id?: string
+}
+
+/**
+ * Frozen input mappings and Hog transforms.
+ */
+export type WidgetSnapshotApiInputBindings = {
+ [key: string]: {
+ source: string
+ hog?: string
+ }
+}
+
+export interface WidgetSnapshotApi {
+ /** Immutable snapshot containing the widget's saved dataframe results. */
+ id: string
+ /** Source widget node in the notebook. */
+ node_id: string
+ /** Pinned generated widget version. */
+ version_id: string
+ /** When all dataframe results were saved. */
+ created_at: string
+ /** Allowed dataframe slots. */
+ frame_names: string[]
+ /** Frozen input mappings and Hog transforms. */
+ input_bindings: WidgetSnapshotApiInputBindings
+ /** Pinned widget input schemas. */
+ input_contract: WidgetInputContractItemApi[]
+ /**
+ * Short-lived URL for the pinned widget build.
+ * @nullable
+ */
+ artifact_url: string | null
+ /**
+ * Exact build hash used for execution consent.
+ * @nullable
+ */
+ build_hash: string | null
+ /** Review of the pinned widget source. */
+ security_review: WidgetSecurityReviewApi | null
+}
+
+export interface WidgetSnapshotPublishApi {
+ /**
+ * Notebook widget node to add to a dashboard.
+ * @maxLength 128
+ */
+ node_id: string
+ /** Immutable widget version to keep on the dashboard. */
+ version_id: string
+ /** Completed whole-notebook run supplying every input after refresh. */
+ notebook_run_id?: string
+ /** Snapshot being refreshed; its version and input mappings must match. */
+ previous_snapshot_id?: string
+ /**
+ * Dashboard to add the widget to.
+ * @minimum 1
+ */
+ dashboard_id?: number
+ /**
+ * Existing dashboard tile to refresh.
+ * @minimum 1
+ */
+ tile_id?: number
+ /**
+ * Title for a new dashboard widget.
+ * @maxLength 400
+ */
+ name?: string
+}
+
/**
* Notebook-local input mappings keyed by contract slot. Each value names a source dataframe and may include pure Hog source for reshaping its rows.
*/
@@ -1542,6 +1626,28 @@ export type NotebooksListParams = {
user?: string
}
+export type NotebooksWidgetSnapshotFrameParams = {
+ /**
+ * Maximum rows in this page.
+ * @minimum 1
+ * @maximum 500
+ */
+ limit?: number
+ /**
+ * Zero-based row offset.
+ * @minimum 0
+ */
+ offset?: number
+ /**
+ * Completed run selected by the first page request.
+ */
+ run_id?: string
+ /**
+ * Version requesting the data.
+ */
+ version_id?: string
+}
+
export type NotebooksWidgetFrameParams = {
limit?: number
offset?: number
diff --git a/products/notebooks/frontend/generated/api.ts b/products/notebooks/frontend/generated/api.ts
index 42ccc33eeff4..1ee4d3e7ed14 100644
--- a/products/notebooks/frontend/generated/api.ts
+++ b/products/notebooks/frontend/generated/api.ts
@@ -28,6 +28,7 @@ import type {
NotebookSQLV2StateResponseApi,
NotebooksListParams,
NotebooksWidgetFrameParams,
+ NotebooksWidgetSnapshotFrameParams,
NotebooksWidgetSourceParams,
NotebooksWidgetVersionsParams,
PaginatedNotebookMinimalListApi,
@@ -50,6 +51,9 @@ import type {
WidgetGenerateRequestApi,
WidgetPinRequestApi,
WidgetRevertRequestApi,
+ WidgetSnapshotApi,
+ WidgetSnapshotPublishApi,
+ WidgetSnapshotRequestApi,
WidgetSourceApi,
WidgetStatusApi,
WidgetVersionPageApi,
@@ -798,6 +802,109 @@ export const notebooksSqlV2StateRetrieve = async (
})
}
+export const getNotebooksWidgetSnapshotCreateUrl = (projectId: string, shortId: string) => {
+ return `/api/projects/${projectId}/notebooks/${shortId}/widget_snapshots/`
+}
+
+/**
+ * The API for interacting with Notebooks. This feature is in early access and the API can have breaking changes without announcement.
+ */
+export const notebooksWidgetSnapshotCreate = async (
+ projectId: string,
+ shortId: string,
+ widgetSnapshotRequestApi: WidgetSnapshotRequestApi,
+ options?: RequestInit
+): Promise<WidgetSnapshotApi> => {
+ return apiMutator<WidgetSnapshotApi>(getNotebooksWidgetSnapshotCreateUrl(projectId, shortId), {
+ ...options,
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
+ body: JSON.stringify(widgetSnapshotRequestApi),
+ })
+}
+
+export const getNotebooksWidgetSnapshotRetrieveUrl = (projectId: string, shortId: string, snapshotId: string) => {
+ return `/api/projects/${projectId}/notebooks/${shortId}/widget_snapshots/${snapshotId}/`
+}
+
+/**
+ * The API for interacting with Notebooks. This feature is in early access and the API can have breaking changes without announcement.
+ */
+export const notebooksWidgetSnapshotRetrieve = async (
+ projectId: string,
+ shortId: string,
+ snapshotId: string,
+ options?: RequestInit
+): Promise<WidgetSnapshotApi> => {
+ return apiMutator<WidgetSnapshotApi>(getNotebooksWidgetSnapshotRetrieveUrl(projectId, shortId, snapshotId), {
+ ...options,
+ method: 'GET',
+ })
+}
+
+export const getNotebooksWidgetSnapshotFrameUrl = (
+ projectId: string,
+ shortId: string,
+ snapshotId: string,
+ frameName: string,
+ params?: NotebooksWidgetSnapshotFrameParams
+) => {
+ const normalizedParams = new URLSearchParams()
+
+ Object.entries(params || {}).forEach(([key, value]) => {
+ if (value !== undefined) {
+ normalizedParams.append(key, value === null ? 'null' : String(value))
+ }
+ })
+
+ const stringifiedParams = normalizedParams.toString()
+
+ return stringifiedParams.length > 0
+ ? `/api/projects/${projectId}/notebooks/${shortId}/widget_snapshots/${snapshotId}/frames/${frameName}/?${stringifiedParams}`
+ : `/api/projects/${projectId}/notebooks/${shortId}/widget_snapshots/${snapshotId}/frames/${frameName}/`
+}
+
+/**
+ * The API for interacting with Notebooks. This feature is in early access and the API can have breaking changes without announcement.
+ */
+export const notebooksWidgetSnapshotFrame = async (
+ projectId: string,
+ shortId: string,
+ snapshotId: string,
+ frameName: string,
+ params?: NotebooksWidgetSnapshotFrameParams,
+ options?: RequestInit
+): Promise<WidgetFrameApi> => {
+ return apiMutator<WidgetFrameApi>(
+ getNotebooksWidgetSnapshotFrameUrl(projectId, shortId, snapshotId, frameName, params),
+ {
+ ...options,
+ method: 'GET',
+ }
+ )
+}
+
+export const getNotebooksWidgetSnapshotPublishUrl = (projectId: string, shortId: string) => {
+ return `/api/projects/${projectId}/notebooks/${shortId}/widget_snapshots/publish/`
+}
+
+/**
+ * The API for interacting with Notebooks. This feature is in early access and the API can have breaking changes without announcement.
+ */
+export const notebooksWidgetSnapshotPublish = async (
+ projectId: string,
+ shortId: string,
+ widgetSnapshotPublishApi: WidgetSnapshotPublishApi,
+ options?: RequestInit
+): Promise<WidgetSnapshotApi> => {
+ return apiMutator<WidgetSnapshotApi>(getNotebooksWidgetSnapshotPublishUrl(projectId, shortId), {
+ ...options,
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
+ body: JSON.stringify(widgetSnapshotPublishApi),
+ })
+}
+
export const getNotebooksWidgetAttachUrl = (projectId: string, shortId: string, nodeId: string) => {
return `/api/projects/${projectId}/notebooks/${shortId}/widgets/${nodeId}/attach/`
}
diff --git a/products/notebooks/frontend/generated/api.zod.ts b/products/notebooks/frontend/generated/api.zod.ts
index 10faf7035090..0c94b5dc5eb4 100644
--- a/products/notebooks/frontend/generated/api.zod.ts
+++ b/products/notebooks/frontend/generated/api.zod.ts
@@ -635,9 +635,16 @@ export const NotebooksKernelStopCreateBody = /* @__PURE__ */ zod.object({
/**
* Run every SQL and Python cell of a markdown notebook, in document order, stopping at the first cell that does not finish. Returns as soon as the run starts; poll the run status endpoint until the status is terminal. Flag-gated (revamped-py-notebooks).
*/
+export const notebooksRunsCreateBodyIncludePreparedInsightsDefault = false
export const notebooksRunsCreateBodyVariablesItemNameMax = 200
export const NotebooksRunsCreateBody = /* @__PURE__ */ zod.object({
+ include_prepared_insights: zod
+ .boolean()
+ .default(notebooksRunsCreateBodyIncludePreparedInsightsDefault)
+ .describe(
+ 'Include prepared embedded insights when refreshing a dashboard widget. Requires notebook widgets to be enabled.'
+ ),
variables: zod
.array(
zod
@@ -763,6 +770,58 @@ export const NotebooksSqlV2RunCreateBody = /* @__PURE__ */ zod.object({
),
})
+/**
+ * The API for interacting with Notebooks. This feature is in early access and the API can have breaking changes without announcement.
+ */
+export const notebooksWidgetSnapshotCreateBodyNodeIdMax = 128
+
+export const NotebooksWidgetSnapshotCreateBody = /* @__PURE__ */ zod.object({
+ node_id: zod
+ .string()
+ .max(notebooksWidgetSnapshotCreateBodyNodeIdMax)
+ .describe('Notebook widget node to add to a dashboard.'),
+ version_id: zod.uuid().describe('Immutable widget version to keep on the dashboard.'),
+ notebook_run_id: zod
+ .uuid()
+ .optional()
+ .describe('Completed whole-notebook run supplying every input after refresh.'),
+ previous_snapshot_id: zod
+ .uuid()
+ .optional()
+ .describe('Snapshot being refreshed; its version and input mappings must match.'),
+})
+
+/**
+ * The API for interacting with Notebooks. This feature is in early access and the API can have breaking changes without announcement.
+ */
+export const notebooksWidgetSnapshotPublishBodyNodeIdMax = 128
+
+export const notebooksWidgetSnapshotPublishBodyNameDefault = ``
+export const notebooksWidgetSnapshotPublishBodyNameMax = 400
+
+export const NotebooksWidgetSnapshotPublishBody = /* @__PURE__ */ zod.object({
+ node_id: zod
+ .string()
+ .max(notebooksWidgetSnapshotPublishBodyNodeIdMax)
+ .describe('Notebook widget node to add to a dashboard.'),
+ version_id: zod.uuid().describe('Immutable widget version to keep on the dashboard.'),
+ notebook_run_id: zod
+ .uuid()
+ .optional()
+ .describe('Completed whole-notebook run supplying every input after refresh.'),
+ previous_snapshot_id: zod
+ .uuid()
+ .optional()
+ .describe('Snapshot being refreshed; its version and input mappings must match.'),
+ dashboard_id: zod.number().min(1).optional().describe('Dashboard to add the widget to.'),
+ tile_id: zod.number().min(1).optional().describe('Existing dashboard tile to refresh.'),
+ name: zod
+ .string()
+ .max(notebooksWidgetSnapshotPublishBodyNameMax)
+ .default(notebooksWidgetSnapshotPublishBodyNameDefault)
+ .describe('Title for a new dashboard widget.'),
+})
+
/**
* The API for interacting with Notebooks. This feature is in early access and the API can have breaking changes without announcement.
*/
diff --git a/products/notebooks/mcp/tools.yaml b/products/notebooks/mcp/tools.yaml
index bbbfc110bcf2..da95a256acc0 100644
--- a/products/notebooks/mcp/tools.yaml
+++ b/products/notebooks/mcp/tools.yaml
@@ -521,6 +521,18 @@ tools:
notebooks-widget-revert:
operation: notebooks_widget_revert
enabled: false
+ notebooks-widget-snapshot-create:
+ operation: notebooks_widget_snapshot_create
+ enabled: false
+ notebooks-widget-snapshot-frame:
+ operation: notebooks_widget_snapshot_frame
+ enabled: false
+ notebooks-widget-snapshot-publish:
+ operation: notebooks_widget_snapshot_publish
+ enabled: false
+ notebooks-widget-snapshot-retrieve:
+ operation: notebooks_widget_snapshot_retrieve
+ enabled: false
notebooks-widget-source:
operation: notebooks_widget_source
enabled: false
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 545622496855..3b5214e50277 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -6182,6 +6182,38 @@ export namespace Schemas {
GithubPr: 'github_pr',
} as const;
+ export type NotebookWidgetAddRequestOpenApiWidgetType = typeof NotebookWidgetAddRequestOpenApiWidgetType[keyof typeof NotebookWidgetAddRequestOpenApiWidgetType];
+
+
+ export const NotebookWidgetAddRequestOpenApiWidgetType = {
+ NotebookWidget: 'notebook_widget',
+ } as const;
+
+ export interface NotebookWidgetConfig {
+ /** Source notebook short ID. */
+ notebookShortId?: string | null;
+ /** Immutable notebook widget snapshot. Add one from a notebook widget's menu. */
+ snapshotId?: string | null;
+ }
+
+ export interface NotebookWidgetAddRequestOpenApi {
+ /**
+ * Optional custom display name for the widget tile.
+ * @maxLength 400
+ * @nullable
+ */
+ name?: string | null;
+ /** Optional markdown description shown when show_description is enabled. */
+ description?: string;
+ /** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */
+ layouts?: _TileLayoutsOpenApi;
+ /** Whether to show the description on the dashboard tile. */
+ show_description?: boolean;
+ widget_type: NotebookWidgetAddRequestOpenApiWidgetType;
+ /** Configuration for the notebook widget widget. */
+ config: NotebookWidgetConfig;
+ }
+
export type ErrorTrackingListWidgetAddRequestOpenApiWidgetType = typeof ErrorTrackingListWidgetAddRequestOpenApiWidgetType[keyof typeof ErrorTrackingListWidgetAddRequestOpenApiWidgetType];
@@ -6676,14 +6708,14 @@ export namespace Schemas {
config: ConversationsRecentTicketsWidgetConfig;
}
- export type AddDashboardWidgetRequest = ActivityEventsListWidgetAddRequestOpenApi | ErrorTrackingListWidgetAddRequestOpenApi | SessionReplayListWidgetAddRequestOpenApi | ExperimentsListWidgetAddRequestOpenApi | ExperimentResultsWidgetAddRequestOpenApi | SurveyResultsWidgetAddRequestOpenApi | LogsListWidgetAddRequestOpenApi | ConversationsRecentTicketsWidgetAddRequestOpenApi;
+ export type AddDashboardWidgetRequest = NotebookWidgetAddRequestOpenApi | ActivityEventsListWidgetAddRequestOpenApi | ErrorTrackingListWidgetAddRequestOpenApi | SessionReplayListWidgetAddRequestOpenApi | ExperimentsListWidgetAddRequestOpenApi | ExperimentResultsWidgetAddRequestOpenApi | SurveyResultsWidgetAddRequestOpenApi | LogsListWidgetAddRequestOpenApi | ConversationsRecentTicketsWidgetAddRequestOpenApi;
/**
* OpenAPI-only batch-add schema with widget_type-discriminated config shapes for agents.
*/
export interface AddDashboardWidgetsBatchRequestOpenApi {
/**
- * Widget tiles to add atomically. Supported widget_type values: activity_events_list, conversations_recent_tickets, error_tracking_list, experiment_results, experiments_list, logs_list, session_replay_list, survey_results. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).
+ * Widget tiles to add atomically. Supported widget_type values: activity_events_list, conversations_recent_tickets, error_tracking_list, experiment_results, experiments_list, logs_list, notebook_widget, session_replay_list, survey_results. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).
* @minItems 1
* @maxItems 10
*/
@@ -9619,7 +9651,7 @@ export namespace Schemas {
team: number;
}
- export type DashboardWidgetConfig = ActivityEventsListWidgetConfig | ErrorTrackingListWidgetConfig | SessionReplayListWidgetConfig | ExperimentsListWidgetConfig | ExperimentResultsWidgetConfig | SurveyResultsWidgetConfig | LogsListWidgetConfig | ConversationsRecentTicketsWidgetConfig;
+ export type DashboardWidgetConfig = NotebookWidgetConfig | ActivityEventsListWidgetConfig | ErrorTrackingListWidgetConfig | SessionReplayListWidgetConfig | ExperimentsListWidgetConfig | ExperimentResultsWidgetConfig | SurveyResultsWidgetConfig | LogsListWidgetConfig | ConversationsRecentTicketsWidgetConfig;
export interface DashboardWidget {
readonly id: string;
@@ -24421,6 +24453,7 @@ export namespace Schemas {
* * `experiment_results` - experiment_results
* * `experiments_list` - experiments_list
* * `logs_list` - logs_list
+ * * `notebook_widget` - notebook_widget
* * `session_replay_list` - session_replay_list
* * `survey_results` - survey_results
*/
@@ -24434,6 +24467,7 @@ export namespace Schemas {
ExperimentResults: 'experiment_results',
ExperimentsList: 'experiments_list',
LogsList: 'logs_list',
+ NotebookWidget: 'notebook_widget',
SessionReplayList: 'session_replay_list',
SurveyResults: 'survey_results',
} as const;
@@ -24449,6 +24483,7 @@ export namespace Schemas {
* * `experiment_results` - experiment_results
* * `experiments_list` - experiments_list
* * `logs_list` - logs_list
+ * * `notebook_widget` - notebook_widget
* * `session_replay_list` - session_replay_list
* * `survey_results` - survey_results */
widget_type?: DashboardPatchWidgetOpenApiWidgetTypeEnum;
@@ -60231,6 +60266,8 @@ export namespace Schemas {
}
export interface NotebookRunStartRequest {
+ /** Include prepared embedded insights when refreshing a dashboard widget. Requires notebook widgets to be enabled. */
+ include_prepared_insights?: boolean;
/** Replace the notebook's variables with this list before the run starts, so the results match what the document declares. Omit it to run with the variables already saved. */
variables?: NotebookVariable[];
}
@@ -60462,6 +60499,60 @@ export namespace Schemas {
cells: NotebookCellState[];
}
+ export type NotebookWidgetCatalogEntryOpenApiWidgetType = typeof NotebookWidgetCatalogEntryOpenApiWidgetType[keyof typeof NotebookWidgetCatalogEntryOpenApiWidgetType];
+
+
+ export const NotebookWidgetCatalogEntryOpenApiWidgetType = {
+ NotebookWidget: 'notebook_widget',
+ } as const;
+
+ export interface NotebookWidgetCatalogEntryOpenApi {
+ widget_type: NotebookWidgetCatalogEntryOpenApiWidgetType;
+ group_id: string;
+ group_label: string;
+ label: string;
+ description: string;
+ /** OpenAPI config shape for this widget type (documentation; matches batch-add/PATCH schemas). */
+ readonly config_schema: NotebookWidgetConfig;
+ /** @nullable */
+ required_product_access?: string | null;
+ /** Whether tiles of this type self-update in real time after load. Live tiles show a fixed real-time window and cannot apply test-account filtering to the stream, so their config takes neither dateRange nor filterTestAccounts. */
+ live: boolean;
+ }
+
+ /**
+ * * `notebook_widget` - notebook_widget
+ */
+ export type NotebookWidgetTypeEnum = typeof NotebookWidgetTypeEnum[keyof typeof NotebookWidgetTypeEnum];
+
+
+ export const NotebookWidgetTypeEnum = {
+ NotebookWidget: 'notebook_widget',
+ } as const;
+
+ export type NotebookWidgetUpdateRequestOpenApiWidgetType = typeof NotebookWidgetUpdateRequestOpenApiWidgetType[keyof typeof NotebookWidgetUpdateRequestOpenApiWidgetType];
+
+
+ export const NotebookWidgetUpdateRequestOpenApiWidgetType = {
+ NotebookWidget: 'notebook_widget',
+ } as const;
+
+ export interface NotebookWidgetUpdateRequestOpenApi {
+ /** ID of the widget tile to update. Use dashboard-get to look up widget tile IDs. */
+ tile_id: number;
+ /**
+ * New display name for the widget. Empty string or null clears it; omit to leave unchanged.
+ * @maxLength 400
+ * @nullable
+ */
+ name?: string | null;
+ /** New markdown description for the widget. Omit to leave unchanged. */
+ description?: string;
+ widget_type: NotebookWidgetUpdateRequestOpenApiWidgetType;
+ /** New configuration for the notebook widget widget. Omit to leave unchanged. */
+ config?: NotebookWidgetConfig;
+ }
+
/**
* Optional structured payload for rich client-side rendering, specific to the notification type. For `web_analytics_digest`, holds the weekly metrics (visitors, pageviews, sessions, bounce rate, session duration with week-over-week change), top pages, and top sources used to render the digest card.
* @nullable
@@ -77627,7 +77718,7 @@ export namespace Schemas {
config?: SurveyResultsWidgetConfig;
}
- export type UpdateDashboardWidgetRequest = ActivityEventsListWidgetUpdateRequestOpenApi | ErrorTrackingListWidgetUpdateRequestOpenApi | SessionReplayListWidgetUpdateRequestOpenApi | ExperimentsListWidgetUpdateRequestOpenApi | ExperimentResultsWidgetUpdateRequestOpenApi | SurveyResultsWidgetUpdateRequestOpenApi | LogsListWidgetUpdateRequestOpenApi | ConversationsRecentTicketsWidgetUpdateRequestOpenApi;
+ export type UpdateDashboardWidgetRequest = NotebookWidgetUpdateRequestOpenApi | ActivityEventsListWidgetUpdateRequestOpenApi | ErrorTrackingListWidgetUpdateRequestOpenApi | SessionReplayListWidgetUpdateRequestOpenApi | ExperimentsListWidgetUpdateRequestOpenApi | ExperimentResultsWidgetUpdateRequestOpenApi | SurveyResultsWidgetUpdateRequestOpenApi | LogsListWidgetUpdateRequestOpenApi | ConversationsRecentTicketsWidgetUpdateRequestOpenApi;
/**
* OpenAPI-only batch-update schema with widget_type-discriminated config shapes for agents.
@@ -100206,7 +100297,7 @@ export namespace Schemas {
generation_id: string;
}
- export type WidgetCatalogEntry = ActivityEventsListWidgetCatalogEntryOpenApi | ErrorTrackingListWidgetCatalogEntryOpenApi | SessionReplayListWidgetCatalogEntryOpenApi | ExperimentsListWidgetCatalogEntryOpenApi | ExperimentResultsWidgetCatalogEntryOpenApi | SurveyResultsWidgetCatalogEntryOpenApi | LogsListWidgetCatalogEntryOpenApi | ConversationsRecentTicketsWidgetCatalogEntryOpenApi;
+ export type WidgetCatalogEntry = NotebookWidgetCatalogEntryOpenApi | ActivityEventsListWidgetCatalogEntryOpenApi | ErrorTrackingListWidgetCatalogEntryOpenApi | SessionReplayListWidgetCatalogEntryOpenApi | ExperimentsListWidgetCatalogEntryOpenApi | ExperimentResultsWidgetCatalogEntryOpenApi | SurveyResultsWidgetCatalogEntryOpenApi | LogsListWidgetCatalogEntryOpenApi | ConversationsRecentTicketsWidgetCatalogEntryOpenApi;
export interface WidgetCatalogResponse {
/** Registered dashboard widget types available when dashboard-widgets is enabled. */
@@ -100353,6 +100444,86 @@ export namespace Schemas {
expected_current_version_id: string;
}
+ /**
+ * Frozen input mappings and Hog transforms.
+ */
+ export type WidgetSnapshotInputBindings = {[key: string]: {
+ source: string;
+ hog?: string;
+ }};
+
+ export interface WidgetSnapshot {
+ /** Immutable snapshot containing the widget's saved dataframe results. */
+ id: string;
+ /** Source widget node in the notebook. */
+ node_id: string;
+ /** Pinned generated widget version. */
+ version_id: string;
+ /** When all dataframe results were saved. */
+ created_at: string;
+ /** Allowed dataframe slots. */
+ frame_names: string[];
+ /** Frozen input mappings and Hog transforms. */
+ input_bindings: WidgetSnapshotInputBindings;
+ /** Pinned widget input schemas. */
+ input_contract: WidgetInputContractItem[];
+ /**
+ * Short-lived URL for the pinned widget build.
+ * @nullable
+ */
+ artifact_url: string | null;
+ /**
+ * Exact build hash used for execution consent.
+ * @nullable
+ */
+ build_hash: string | null;
+ /** Review of the pinned widget source. */
+ security_review: WidgetSecurityReview | null;
+ }
+
+ export interface WidgetSnapshotPublish {
+ /**
+ * Notebook widget node to add to a dashboard.
+ * @maxLength 128
+ */
+ node_id: string;
+ /** Immutable widget version to keep on the dashboard. */
+ version_id: string;
+ /** Completed whole-notebook run supplying every input after refresh. */
+ notebook_run_id?: string;
+ /** Snapshot being refreshed; its version and input mappings must match. */
+ previous_snapshot_id?: string;
+ /**
+ * Dashboard to add the widget to.
+ * @minimum 1
+ */
+ dashboard_id?: number;
+ /**
+ * Existing dashboard tile to refresh.
+ * @minimum 1
+ */
+ tile_id?: number;
+ /**
+ * Title for a new dashboard widget.
+ * @maxLength 400
+ */
+ name?: string;
+ }
+
+ export interface WidgetSnapshotRequest {
+ /**
+ * Notebook widget node to add to a dashboard.
+ * @maxLength 128
+ */
+ node_id: string;
+ /** Immutable widget version to keep on the dashboard. */
+ version_id: string;
+ /** Completed whole-notebook run supplying every input after refresh. */
+ notebook_run_id?: string;
+ /** Snapshot being refreshed; its version and input mappings must match. */
+ previous_snapshot_id?: string;
+ }
+
export interface WidgetSource {
/** Read-only source code for the current widget version. */
source: string;
@@ -112841,6 +113012,28 @@ export namespace Schemas {
user?: string;
};
+ export type NotebooksWidgetSnapshotFrameParams = {
+ /**
+ * Maximum rows in this page.
+ * @minimum 1
+ * @maximum 500
+ */
+ limit?: number;
+ /**
+ * Zero-based row offset.
+ * @minimum 0
+ */
+ offset?: number;
+ /**
+ * Completed run selected by the first page request.
+ */
+ run_id?: string;
+ /**
+ * Version requesting the data.
+ */
+ version_id?: string;
+ };
+
export type NotebooksWidgetFrameParams = {
limit?: number;
offset?: number;
diff --git a/services/mcp/src/generated/dashboards/api.ts b/services/mcp/src/generated/dashboards/api.ts
index de6f9c4058e3..db1dcd493d90 100644
--- a/services/mcp/src/generated/dashboards/api.ts
+++ b/services/mcp/src/generated/dashboards/api.ts
@@ -257,59 +257,61 @@ export const dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneYMin = 0
export const dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneWMax = 12
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneLimitDefault = 25
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneLimitMax = 50
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneNotebookShortIdOneMax = 128
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemKeyMax = 400
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitDefault = 25
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitMax = 50
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemLabelOneMax = 400
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemKeyMax = 400
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemValueOneItemOneMax = 4000
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemLabelOneMax = 400
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemValueOneMax = 100
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemValueOneItemOneMax = 4000
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemValueTwoMax = 4000
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemValueOneMax = 100
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneMax = 20
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemValueTwoMax = 4000
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitDefault = 10
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitMax = 25
-
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoOrderByDefault = `occurrences`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoOrderDirectionDefault = `DESC`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoStatusDefault = `active`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneMax = 20
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeLimitDefault = 10
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeLimitMax = 25
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeOrderByDefault = `start_time`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeOrderByDefault = `occurrences`
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeOrderDirectionDefault = `DESC`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeStatusDefault = `active`
+
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourLimitDefault = 10
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourLimitMax = 25
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderByDefault = `created_at`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderByDefault = `start_time`
export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderDirectionDefault = `DESC`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourStatusDefault = `all`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitDefault = 10
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitMax = 25
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveLimitDefault = 10
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveLimitMax = 25
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitDefault = 50
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitMax = 100
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveOrderByDefault = `created_at`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveOrderDirectionDefault = `DESC`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveStatusDefault = `all`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitDefault = 10
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitMax = 25
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenOrderByDefault = `latest`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenWrapLinesDefault = false
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenTimezoneDefault = `UTC`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitDefault = 10
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitMax = 25
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitDefault = 50
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitMax = 100
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightStatusDefault = `all`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightChannelDefault = `all`
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightAssigneesMax = 100
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightOrderByDefault = `latest`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightWrapLinesDefault = false
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightTimezoneDefault = `UTC`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineLimitDefault = 10
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineLimitMax = 25
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightSearchDefault = ``
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightSearchMax = 200
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineStatusDefault = `all`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineChannelDefault = `all`
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineAssigneesMax = 100
-export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightSavedViewIdOneMax = 12
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineSearchDefault = ``
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineSearchMax = 200
+
+export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineSavedViewIdOneMax = 12
export const dashboardsPartialUpdateBodyTilesItemWidgetOneNameMax = 400
@@ -485,18 +487,39 @@ export const DashboardsPartialUpdateBody = () => zod
'experiment_results',
'experiments_list',
'logs_list',
+ 'notebook_widget',
'session_replay_list',
'survey_results',
])
.describe(
- '\* `activity_events_list` - activity_events_list\n\* `conversations_recent_tickets` - conversations_recent_tickets\n\* `error_tracking_list` - error_tracking_list\n\* `experiment_results` - experiment_results\n\* `experiments_list` - experiments_list\n\* `logs_list` - logs_list\n\* `session_replay_list` - session_replay_list\n\* `survey_results` - survey_results'
+ '\* `activity_events_list` - activity_events_list\n\* `conversations_recent_tickets` - conversations_recent_tickets\n\* `error_tracking_list` - error_tracking_list\n\* `experiment_results` - experiment_results\n\* `experiments_list` - experiments_list\n\* `logs_list` - logs_list\n\* `notebook_widget` - notebook_widget\n\* `session_replay_list` - session_replay_list\n\* `survey_results` - survey_results'
)
.optional()
.describe(
- 'Widget type identifier (cannot be changed on update).\n\n\* `activity_events_list` - activity_events_list\n\* `conversations_recent_tickets` - conversations_recent_tickets\n\* `error_tracking_list` - error_tracking_list\n\* `experiment_results` - experiment_results\n\* `experiments_list` - experiments_list\n\* `logs_list` - logs_list\n\* `session_replay_list` - session_replay_list\n\* `survey_results` - survey_results'
+ 'Widget type identifier (cannot be changed on update).\n\n\* `activity_events_list` - activity_events_list\n\* `conversations_recent_tickets` - conversations_recent_tickets\n\* `error_tracking_list` - error_tracking_list\n\* `experiment_results` - experiment_results\n\* `experiments_list` - experiments_list\n\* `logs_list` - logs_list\n\* `notebook_widget` - notebook_widget\n\* `session_replay_list` - session_replay_list\n\* `survey_results` - survey_results'
),
config: zod
.union([
+ zod.object({
+ notebookShortId: zod
+ .union([
+ zod
+ .string()
+ .min(1)
+ .max(
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneNotebookShortIdOneMax
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Source notebook short ID.'),
+ snapshotId: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Immutable notebook widget snapshot. Add one from a notebook widget's menu."
+ ),
+ }),
zod.object({
dateRange: zod
.union([
@@ -581,9 +604,9 @@ export const DashboardsPartialUpdateBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneLimitMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneLimitDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitDefault
)
.describe('Maximum number of events to return.'),
eventName: zod
@@ -601,14 +624,14 @@ export const DashboardsPartialUpdateBody = () => zod
.string()
.min(1)
.max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemKeyMax
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemKeyMax
),
label: zod
.union([
zod
.string()
.max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemLabelOneMax
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemLabelOneMax
),
zod.null(),
])
@@ -662,19 +685,19 @@ export const DashboardsPartialUpdateBody = () => zod
zod
.string()
.max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemValueOneItemOneMax
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemValueOneItemOneMax
),
zod.number(),
zod.boolean(),
])
)
.max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemValueOneMax
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemValueOneMax
),
zod
.string()
.max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneItemValueTwoMax
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneItemValueTwoMax
),
zod.number(),
zod.boolean(),
@@ -684,7 +707,7 @@ export const DashboardsPartialUpdateBody = () => zod
})
)
.max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOnePropertiesOneMax
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoPropertiesOneMax
),
zod.null(),
])
@@ -777,21 +800,21 @@ export const DashboardsPartialUpdateBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeLimitMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoLimitDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeLimitDefault
)
.describe('Maximum number of issues to return.'),
orderBy: zod
.enum(['last_seen', 'first_seen', 'occurrences', 'users', 'sessions'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoOrderByDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeOrderByDefault
)
.describe('Issue ranking column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoOrderDirectionDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
status: zod
@@ -804,7 +827,7 @@ export const DashboardsPartialUpdateBody = () => zod
'all',
])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneTwoStatusDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeStatusDefault
)
.describe('Issue status filter.'),
assignee: zod
@@ -904,9 +927,9 @@ export const DashboardsPartialUpdateBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeLimitMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourLimitMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeLimitDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourLimitDefault
)
.describe('Maximum number of recordings to return.'),
orderBy: zod
@@ -919,13 +942,13 @@ export const DashboardsPartialUpdateBody = () => zod
'console_error_count',
])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeOrderByDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderByDefault
)
.describe('Recording ranking column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneThreeOrderDirectionDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
savedFilterId: zod
@@ -945,27 +968,27 @@ export const DashboardsPartialUpdateBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourLimitMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveLimitMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourLimitDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveLimitDefault
)
.describe('Maximum number of experiments to return.'),
orderBy: zod
.enum(['created_at', 'name', 'start_date'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderByDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveOrderByDefault
)
.describe('Experiment list sort column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourOrderDirectionDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
status: zod
.enum(['draft', 'running', 'paused', 'exposure_frozen', 'stopped', 'all'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFourStatusDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneFiveStatusDefault
)
.describe('Experiment status filter.'),
createdBy: zod
@@ -1015,9 +1038,9 @@ export const DashboardsPartialUpdateBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSixLimitDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitDefault
)
.describe('Maximum number of recent responses to return.'),
}),
@@ -1048,15 +1071,15 @@ export const DashboardsPartialUpdateBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenLimitDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitDefault
)
.describe('Maximum number of log lines to return.'),
orderBy: zod
.enum(['latest', 'earliest'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenOrderByDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightOrderByDefault
)
.describe('Sort by newest (latest) or oldest (earliest) first.'),
severityLevels: zod
@@ -1072,7 +1095,7 @@ export const DashboardsPartialUpdateBody = () => zod
wrapLines: zod
.boolean()
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenWrapLinesDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightWrapLinesDefault
)
.describe(
'Wrap long log lines instead of truncating them to a single row.'
@@ -1080,7 +1103,7 @@ export const DashboardsPartialUpdateBody = () => zod
timezone: zod
.enum(['UTC', 'local'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneSevenTimezoneDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightTimezoneDefault
)
.describe(
"Render log timestamps in UTC or in each viewer's local timezone."
@@ -1096,15 +1119,15 @@ export const DashboardsPartialUpdateBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineLimitMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightLimitDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineLimitDefault
)
.describe('Maximum number of tickets to return.'),
status: zod
.enum(['new', 'open', 'pending', 'on_hold', 'resolved', 'all'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightStatusDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineStatusDefault
)
.describe('Ticket status filter.'),
priorities: zod
@@ -1116,7 +1139,7 @@ export const DashboardsPartialUpdateBody = () => zod
channel: zod
.enum(['widget', 'email', 'slack', 'teams', 'github', 'all'])
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightChannelDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineChannelDefault
)
.describe('Ticket channel filter.'),
assignees: zod
@@ -1129,18 +1152,16 @@ export const DashboardsPartialUpdateBody = () => zod
}),
])
)
- .max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightAssigneesMax
- )
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineAssigneesMax)
.optional()
.describe(
"Only show tickets assigned to these users or roles. 'me' means the requesting user and 'unassigned' means tickets without an assignment. Empty shows all assignees."
),
search: zod
.string()
- .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightSearchMax)
+ .max(dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineSearchMax)
.default(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightSearchDefault
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineSearchDefault
)
.describe(
'Search requester name or email, ticket subject, message text, or ticket number.'
@@ -1150,7 +1171,7 @@ export const DashboardsPartialUpdateBody = () => zod
zod
.string()
.max(
- dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneEightSavedViewIdOneMax
+ dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneNineSavedViewIdOneMax
),
zod.null(),
])
@@ -1522,72 +1543,76 @@ export const DashboardsWidgetsBatchCreateQueryParams = () => zod.object({
export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneNameMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOneLimitDefault = 25
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOneLimitMax = 50
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOneNotebookShortIdOneMax = 128
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemKeyMax = 400
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoNameMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemLabelOneMax = 400
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitDefault = 25
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitMax = 50
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneItemOneMax = 4000
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemKeyMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneMax = 100
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemLabelOneMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemValueTwoMax = 4000
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneItemOneMax = 4000
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneMax = 20
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneMax = 100
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoNameMax = 400
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemValueTwoMax = 4000
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitDefault = 10
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitMax = 25
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneMax = 20
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneOrderByDefault = `occurrences`
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneOrderDirectionDefault = `DESC`
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneStatusDefault = `active`
export const dashboardsWidgetsBatchCreateBodyWidgetsItemThreeNameMax = 400
export const dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneLimitDefault = 10
export const dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneLimitMax = 25
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneOrderByDefault = `start_time`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneOrderByDefault = `occurrences`
export const dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneOrderDirectionDefault = `DESC`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneStatusDefault = `active`
export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourNameMax = 400
export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneLimitDefault = 10
export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneLimitMax = 25
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderByDefault = `created_at`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderByDefault = `start_time`
export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderDirectionDefault = `DESC`
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneStatusDefault = `all`
export const dashboardsWidgetsBatchCreateBodyWidgetsItemFiveNameMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixNameMax = 400
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneLimitDefault = 10
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneLimitMax = 25
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitDefault = 10
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitMax = 25
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneOrderByDefault = `created_at`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneOrderDirectionDefault = `DESC`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneStatusDefault = `all`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSixNameMax = 400
export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenNameMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitDefault = 50
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitMax = 100
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitDefault = 10
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitMax = 25
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneOrderByDefault = `latest`
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneWrapLinesDefault = false
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneTimezoneDefault = `UTC`
export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightNameMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitDefault = 10
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitMax = 25
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitDefault = 50
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitMax = 100
+
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneOrderByDefault = `latest`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneWrapLinesDefault = false
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneTimezoneDefault = `UTC`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineNameMax = 400
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneStatusDefault = `all`
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneChannelDefault = `all`
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneAssigneesMax = 100
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneLimitDefault = 10
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneLimitMax = 25
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneSearchDefault = ``
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneSearchMax = 200
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneStatusDefault = `all`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneChannelDefault = `all`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneAssigneesMax = 100
-export const dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneSavedViewIdOneMax = 12
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneSearchDefault = ``
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneSearchMax = 200
+
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneSavedViewIdOneMax = 12
export const dashboardsWidgetsBatchCreateBodyWidgetsMax = 10
@@ -1655,6 +1680,89 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
.boolean()
.optional()
.describe('Whether to show the description on the dashboard tile.'),
+ widget_type: zod.enum(['notebook_widget']),
+ config: zod
+ .object({
+ notebookShortId: zod
+ .union([
+ zod
+ .string()
+ .min(1)
+ .max(
+ dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOneNotebookShortIdOneMax
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Source notebook short ID.'),
+ snapshotId: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Immutable notebook widget snapshot. Add one from a notebook widget's menu."
+ ),
+ })
+ .describe('Configuration for the notebook widget widget.'),
+ }),
+ zod.object({
+ name: zod
+ .string()
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoNameMax)
+ .nullish()
+ .describe('Optional custom display name for the widget tile.'),
+ description: zod
+ .string()
+ .optional()
+ .describe('Optional markdown description shown when show_description is enabled.'),
+ layouts: zod
+ .object({
+ sm: zod
+ .object({
+ x: zod
+ .number()
+ .optional()
+ .describe('Column position in the dashboard grid (0-indexed).'),
+ y: zod
+ .number()
+ .optional()
+ .describe('Row position in the dashboard grid (0-indexed).'),
+ w: zod
+ .number()
+ .optional()
+ .describe('Width in grid columns. The desktop grid is 12 columns wide.'),
+ h: zod.number().optional().describe('Height in grid rows.'),
+ })
+ .optional()
+ .describe(
+ 'Layout for the standard (desktop) breakpoint. The grid is 12 columns wide.'
+ ),
+ xs: zod
+ .object({
+ x: zod
+ .number()
+ .optional()
+ .describe('Column position in the dashboard grid (0-indexed).'),
+ y: zod
+ .number()
+ .optional()
+ .describe('Row position in the dashboard grid (0-indexed).'),
+ w: zod
+ .number()
+ .optional()
+ .describe('Width in grid columns. The desktop grid is 12 columns wide.'),
+ h: zod.number().optional().describe('Height in grid rows.'),
+ })
+ .optional()
+ .describe(
+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'
+ ),
+ })
+ .optional()
+ .describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),
+ show_description: zod
+ .boolean()
+ .optional()
+ .describe('Whether to show the description on the dashboard tile.'),
widget_type: zod.enum(['activity_events_list']),
config: zod
.object({
@@ -1741,8 +1849,8 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOneLimitMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOneLimitDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitDefault)
.describe('Maximum number of events to return.'),
eventName: zod
.union([zod.string().min(1), zod.null()])
@@ -1757,14 +1865,14 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
.string()
.min(1)
.max(
- dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemKeyMax
+ dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemKeyMax
),
label: zod
.union([
zod
.string()
.max(
- dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemLabelOneMax
+ dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemLabelOneMax
),
zod.null(),
])
@@ -1818,19 +1926,19 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
zod
.string()
.max(
- dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneItemOneMax
+ dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneItemOneMax
),
zod.number(),
zod.boolean(),
])
)
.max(
- dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneMax
+ dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneMax
),
zod
.string()
.max(
- dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneItemValueTwoMax
+ dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneItemValueTwoMax
),
zod.number(),
zod.boolean(),
@@ -1840,7 +1948,7 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
})
)
.max(
- dashboardsWidgetsBatchCreateBodyWidgetsItemOneConfigOnePropertiesOneMax
+ dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOnePropertiesOneMax
),
zod.null(),
])
@@ -1852,7 +1960,7 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
zod.object({
name: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoNameMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeNameMax)
.nullish()
.describe('Optional custom display name for the widget tile.'),
description: zod
@@ -1994,22 +2102,22 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneLimitDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneLimitDefault)
.describe('Maximum number of issues to return.'),
orderBy: zod
.enum(['last_seen', 'first_seen', 'occurrences', 'users', 'sessions'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneOrderByDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneOrderByDefault)
.describe('Issue ranking column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneOrderDirectionDefault
+ dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
status: zod
.enum(['archived', 'active', 'resolved', 'pending_release', 'suppressed', 'all'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemTwoConfigOneStatusDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneStatusDefault)
.describe('Issue status filter.'),
assignee: zod
.union([
@@ -2027,7 +2135,7 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
zod.object({
name: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeNameMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemFourNameMax)
.nullish()
.describe('Optional custom display name for the widget tile.'),
description: zod
@@ -2169,8 +2277,8 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneLimitMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneLimitDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneLimitDefault)
.describe('Maximum number of recordings to return.'),
orderBy: zod
.enum([
@@ -2181,12 +2289,12 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
'click_count',
'console_error_count',
])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneOrderByDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderByDefault)
.describe('Recording ranking column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsWidgetsBatchCreateBodyWidgetsItemThreeConfigOneOrderDirectionDefault
+ dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
savedFilterId: zod
@@ -2207,7 +2315,7 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
zod.object({
name: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemFourNameMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemFiveNameMax)
.nullish()
.describe('Optional custom display name for the widget tile.'),
description: zod
@@ -2269,22 +2377,22 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneLimitMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneLimitDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneLimitDefault)
.describe('Maximum number of experiments to return.'),
orderBy: zod
.enum(['created_at', 'name', 'start_date'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderByDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneOrderByDefault)
.describe('Experiment list sort column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneOrderDirectionDefault
+ dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
status: zod
.enum(['draft', 'running', 'paused', 'exposure_frozen', 'stopped', 'all'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFourConfigOneStatusDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemFiveConfigOneStatusDefault)
.describe('Experiment status filter.'),
createdBy: zod
.union([zod.number(), zod.null()])
@@ -2296,7 +2404,7 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
zod.object({
name: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemFiveNameMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSixNameMax)
.nullish()
.describe('Optional custom display name for the widget tile.'),
description: zod
@@ -2367,7 +2475,7 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
zod.object({
name: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSixNameMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenNameMax)
.nullish()
.describe('Optional custom display name for the widget tile.'),
description: zod
@@ -2459,8 +2567,8 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSixConfigOneLimitDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitDefault)
.describe('Maximum number of recent responses to return.'),
})
.describe('Configuration for the survey results widget.'),
@@ -2468,7 +2576,7 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
zod.object({
name: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenNameMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemEightNameMax)
.nullish()
.describe('Optional custom display name for the widget tile.'),
description: zod
@@ -2553,12 +2661,12 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneLimitDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitDefault)
.describe('Maximum number of log lines to return.'),
orderBy: zod
.enum(['latest', 'earliest'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneOrderByDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneOrderByDefault)
.describe('Sort by newest (latest) or oldest (earliest) first.'),
severityLevels: zod
.array(zod.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal']))
@@ -2570,11 +2678,11 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
.describe('Only show logs from these services. Empty shows all services.'),
wrapLines: zod
.boolean()
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneWrapLinesDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneWrapLinesDefault)
.describe('Wrap long log lines instead of truncating them to a single row.'),
timezone: zod
.enum(['UTC', 'local'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemSevenConfigOneTimezoneDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneTimezoneDefault)
.describe("Render log timestamps in UTC or in each viewer's local timezone."),
savedViewId: zod
.union([zod.string(), zod.null()])
@@ -2588,7 +2696,7 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
zod.object({
name: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemEightNameMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemNineNameMax)
.nullish()
.describe('Optional custom display name for the widget tile.'),
description: zod
@@ -2650,12 +2758,12 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneLimitDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneLimitDefault)
.describe('Maximum number of tickets to return.'),
status: zod
.enum(['new', 'open', 'pending', 'on_hold', 'resolved', 'all'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneStatusDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneStatusDefault)
.describe('Ticket status filter.'),
priorities: zod
.array(zod.enum(['low', 'medium', 'high', 'critical']))
@@ -2663,7 +2771,7 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
.describe('Only show tickets with these priorities. Empty shows all priorities.'),
channel: zod
.enum(['widget', 'email', 'slack', 'teams', 'github', 'all'])
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneChannelDefault)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneChannelDefault)
.describe('Ticket channel filter.'),
assignees: zod
.array(
@@ -2675,15 +2783,15 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
}),
])
)
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneAssigneesMax)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneAssigneesMax)
.optional()
.describe(
"Only show tickets assigned to these users or roles. 'me' means the requesting user and 'unassigned' means tickets without an assignment. Empty shows all assignees."
),
search: zod
.string()
- .max(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneSearchMax)
- .default(dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneSearchDefault)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneSearchMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneSearchDefault)
.describe(
'Search requester name or email, ticket subject, message text, or ticket number.'
),
@@ -2692,7 +2800,7 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
zod
.string()
.max(
- dashboardsWidgetsBatchCreateBodyWidgetsItemEightConfigOneSavedViewIdOneMax
+ dashboardsWidgetsBatchCreateBodyWidgetsItemNineConfigOneSavedViewIdOneMax
),
zod.null(),
])
@@ -2708,7 +2816,7 @@ export const DashboardsWidgetsBatchCreateBody = () => zod
.min(1)
.max(dashboardsWidgetsBatchCreateBodyWidgetsMax)
.describe(
- 'Widget tiles to add atomically. Supported widget_type values: activity_events_list, conversations_recent_tickets, error_tracking_list, experiment_results, experiments_list, logs_list, session_replay_list, survey_results. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).'
+ 'Widget tiles to add atomically. Supported widget_type values: activity_events_list, conversations_recent_tickets, error_tracking_list, experiment_results, experiments_list, logs_list, notebook_widget, session_replay_list, survey_results. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).'
),
})
.describe('OpenAPI-only batch-add schema with widget_type-discriminated config shapes for agents.')
@@ -2737,72 +2845,76 @@ export const DashboardsUpdateWidgetsBatchQueryParams = () => zod.object({
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneNameMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOneLimitDefault = 25
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOneLimitMax = 50
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOneNotebookShortIdOneMax = 128
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemKeyMax = 400
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoNameMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemLabelOneMax = 400
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitDefault = 25
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitMax = 50
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneItemOneMax = 4000
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemKeyMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneMax = 100
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemLabelOneMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemValueTwoMax = 4000
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneItemOneMax = 4000
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneMax = 20
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneMax = 100
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoNameMax = 400
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemValueTwoMax = 4000
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitDefault = 10
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitMax = 25
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneMax = 20
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneOrderByDefault = `occurrences`
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneOrderDirectionDefault = `DESC`
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneStatusDefault = `active`
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeNameMax = 400
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneLimitDefault = 10
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneLimitMax = 25
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneOrderByDefault = `start_time`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneOrderByDefault = `occurrences`
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneOrderDirectionDefault = `DESC`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneStatusDefault = `active`
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourNameMax = 400
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneLimitDefault = 10
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneLimitMax = 25
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderByDefault = `created_at`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderByDefault = `start_time`
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderDirectionDefault = `DESC`
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneStatusDefault = `all`
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveNameMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixNameMax = 400
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneLimitDefault = 10
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneLimitMax = 25
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitDefault = 10
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitMax = 25
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneOrderByDefault = `created_at`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneOrderDirectionDefault = `DESC`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneStatusDefault = `all`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSixNameMax = 400
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenNameMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitDefault = 50
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitMax = 100
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitDefault = 10
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitMax = 25
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneOrderByDefault = `latest`
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneWrapLinesDefault = false
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneTimezoneDefault = `UTC`
export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightNameMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitDefault = 10
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitMax = 25
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitDefault = 50
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitMax = 100
+
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneOrderByDefault = `latest`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneWrapLinesDefault = false
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneTimezoneDefault = `UTC`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineNameMax = 400
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneStatusDefault = `all`
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneChannelDefault = `all`
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneAssigneesMax = 100
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneLimitDefault = 10
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneLimitMax = 25
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneSearchDefault = ``
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneSearchMax = 200
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneStatusDefault = `all`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneChannelDefault = `all`
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneAssigneesMax = 100
-export const dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneSavedViewIdOneMax = 12
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneSearchDefault = ``
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneSearchMax = 200
+
+export const dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneSavedViewIdOneMax = 12
export const dashboardsUpdateWidgetsBatchBodyWidgetsMax = 10
@@ -2826,6 +2938,46 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
.string()
.optional()
.describe('New markdown description for the widget. Omit to leave unchanged.'),
+ widget_type: zod.enum(['notebook_widget']),
+ config: zod
+ .object({
+ notebookShortId: zod
+ .union([
+ zod
+ .string()
+ .min(1)
+ .max(
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOneNotebookShortIdOneMax
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Source notebook short ID.'),
+ snapshotId: zod
+ .union([zod.string(), zod.null()])
+ .optional()
+ .describe(
+ "Immutable notebook widget snapshot. Add one from a notebook widget's menu."
+ ),
+ })
+ .optional()
+ .describe('New configuration for the notebook widget widget. Omit to leave unchanged.'),
+ }),
+ zod.object({
+ tile_id: zod
+ .number()
+ .describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
+ name: zod
+ .string()
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoNameMax)
+ .nullish()
+ .describe(
+ 'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
+ ),
+ description: zod
+ .string()
+ .optional()
+ .describe('New markdown description for the widget. Omit to leave unchanged.'),
widget_type: zod.enum(['activity_events_list']),
config: zod
.object({
@@ -2912,8 +3064,8 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOneLimitMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOneLimitDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitDefault)
.describe('Maximum number of events to return.'),
eventName: zod
.union([zod.string().min(1), zod.null()])
@@ -2928,14 +3080,14 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
.string()
.min(1)
.max(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemKeyMax
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemKeyMax
),
label: zod
.union([
zod
.string()
.max(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemLabelOneMax
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemLabelOneMax
),
zod.null(),
])
@@ -2989,19 +3141,19 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
zod
.string()
.max(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneItemOneMax
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneItemOneMax
),
zod.number(),
zod.boolean(),
])
)
.max(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemValueOneMax
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemValueOneMax
),
zod
.string()
.max(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneItemValueTwoMax
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneItemValueTwoMax
),
zod.number(),
zod.boolean(),
@@ -3011,7 +3163,7 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
})
)
.max(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemOneConfigOnePropertiesOneMax
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOnePropertiesOneMax
),
zod.null(),
])
@@ -3027,7 +3179,7 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
.describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
name: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoNameMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeNameMax)
.nullish()
.describe(
'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
@@ -3122,22 +3274,22 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneLimitDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneLimitDefault)
.describe('Maximum number of issues to return.'),
orderBy: zod
.enum(['last_seen', 'first_seen', 'occurrences', 'users', 'sessions'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneOrderByDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneOrderByDefault)
.describe('Issue ranking column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneOrderDirectionDefault
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
status: zod
.enum(['archived', 'active', 'resolved', 'pending_release', 'suppressed', 'all'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemTwoConfigOneStatusDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneStatusDefault)
.describe('Issue status filter.'),
assignee: zod
.union([
@@ -3159,7 +3311,7 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
.describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
name: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeNameMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourNameMax)
.nullish()
.describe(
'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
@@ -3254,8 +3406,8 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneLimitMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneLimitDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneLimitDefault)
.describe('Maximum number of recordings to return.'),
orderBy: zod
.enum([
@@ -3266,12 +3418,12 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
'click_count',
'console_error_count',
])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneOrderByDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderByDefault)
.describe('Recording ranking column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemThreeConfigOneOrderDirectionDefault
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
savedFilterId: zod
@@ -3296,7 +3448,7 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
.describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
name: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourNameMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveNameMax)
.nullish()
.describe(
'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
@@ -3311,22 +3463,22 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneLimitMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneLimitDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneLimitDefault)
.describe('Maximum number of experiments to return.'),
orderBy: zod
.enum(['created_at', 'name', 'start_date'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderByDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneOrderByDefault)
.describe('Experiment list sort column.'),
orderDirection: zod
.enum(['ASC', 'DESC'])
.default(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneOrderDirectionDefault
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneOrderDirectionDefault
)
.describe('Sort direction for orderBy.'),
status: zod
.enum(['draft', 'running', 'paused', 'exposure_frozen', 'stopped', 'all'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFourConfigOneStatusDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveConfigOneStatusDefault)
.describe('Experiment status filter.'),
createdBy: zod
.union([zod.number(), zod.null()])
@@ -3342,7 +3494,7 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
.describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
name: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemFiveNameMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixNameMax)
.nullish()
.describe(
'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
@@ -3370,7 +3522,7 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
.describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
name: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixNameMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenNameMax)
.nullish()
.describe(
'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
@@ -3415,8 +3567,8 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSixConfigOneLimitDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitDefault)
.describe('Maximum number of recent responses to return.'),
})
.optional()
@@ -3428,7 +3580,7 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
.describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
name: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenNameMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightNameMax)
.nullish()
.describe(
'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
@@ -3466,12 +3618,12 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneLimitDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitDefault)
.describe('Maximum number of log lines to return.'),
orderBy: zod
.enum(['latest', 'earliest'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneOrderByDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneOrderByDefault)
.describe('Sort by newest (latest) or oldest (earliest) first.'),
severityLevels: zod
.array(zod.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal']))
@@ -3483,11 +3635,11 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
.describe('Only show logs from these services. Empty shows all services.'),
wrapLines: zod
.boolean()
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneWrapLinesDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneWrapLinesDefault)
.describe('Wrap long log lines instead of truncating them to a single row.'),
timezone: zod
.enum(['UTC', 'local'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemSevenConfigOneTimezoneDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneTimezoneDefault)
.describe("Render log timestamps in UTC or in each viewer's local timezone."),
savedViewId: zod
.union([zod.string(), zod.null()])
@@ -3505,7 +3657,7 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
.describe('ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.'),
name: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightNameMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineNameMax)
.nullish()
.describe(
'New display name for the widget. Empty string or null clears it; omit to leave unchanged.'
@@ -3520,12 +3672,12 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
limit: zod
.number()
.min(1)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneLimitDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneLimitMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneLimitDefault)
.describe('Maximum number of tickets to return.'),
status: zod
.enum(['new', 'open', 'pending', 'on_hold', 'resolved', 'all'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneStatusDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneStatusDefault)
.describe('Ticket status filter.'),
priorities: zod
.array(zod.enum(['low', 'medium', 'high', 'critical']))
@@ -3533,7 +3685,7 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
.describe('Only show tickets with these priorities. Empty shows all priorities.'),
channel: zod
.enum(['widget', 'email', 'slack', 'teams', 'github', 'all'])
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneChannelDefault)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneChannelDefault)
.describe('Ticket channel filter.'),
assignees: zod
.array(
@@ -3545,15 +3697,15 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
}),
])
)
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneAssigneesMax)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneAssigneesMax)
.optional()
.describe(
"Only show tickets assigned to these users or roles. 'me' means the requesting user and 'unassigned' means tickets without an assignment. Empty shows all assignees."
),
search: zod
.string()
- .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneSearchMax)
- .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneSearchDefault)
+ .max(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneSearchMax)
+ .default(dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneSearchDefault)
.describe(
'Search requester name or email, ticket subject, message text, or ticket number.'
),
@@ -3562,7 +3714,7 @@ export const DashboardsUpdateWidgetsBatchBody = () => zod
zod
.string()
.max(
- dashboardsUpdateWidgetsBatchBodyWidgetsItemEightConfigOneSavedViewIdOneMax
+ dashboardsUpdateWidgetsBatchBodyWidgetsItemNineConfigOneSavedViewIdOneMax
),
zod.null(),
])
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-update.json
index f1251c89e9a3..5b49fc15d307 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-update.json
@@ -261,6 +261,35 @@
"properties": {
"config": {
"anyOf": [
+ {
+ "properties": {
+ "notebookShortId": {
+ "anyOf": [
+ {
+ "maxLength": 128,
+ "minLength": 1,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Source notebook short ID."
+ },
+ "snapshotId": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Immutable notebook widget snapshot. Add one from a notebook widget's menu."
+ }
+ },
+ "type": "object"
+ },
{
"properties": {
"dateRange": {
@@ -1249,7 +1278,7 @@
"description": "Optional custom display name for the widget tile."
},
"widget_type": {
- "description": "Widget type identifier (cannot be changed on update).\n\n* `activity_events_list` - activity_events_list\n* `conversations_recent_tickets` - conversations_recent_tickets\n* `error_tracking_list` - error_tracking_list\n* `experiment_results` - experiment_results\n* `experiments_list` - experiments_list\n* `logs_list` - logs_list\n* `session_replay_list` - session_replay_list\n* `survey_results` - survey_results",
+ "description": "Widget type identifier (cannot be changed on update).\n\n* `activity_events_list` - activity_events_list\n* `conversations_recent_tickets` - conversations_recent_tickets\n* `error_tracking_list` - error_tracking_list\n* `experiment_results` - experiment_results\n* `experiments_list` - experiments_list\n* `logs_list` - logs_list\n* `notebook_widget` - notebook_widget\n* `session_replay_list` - session_replay_list\n* `survey_results` - survey_results",
"enum": [
"activity_events_list",
"conversations_recent_tickets",
@@ -1257,6 +1286,7 @@
"experiment_results",
"experiments_list",
"logs_list",
+ "notebook_widget",
"session_replay_list",
"survey_results"
],
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-add.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-add.json
index 181bd89be830..2d8bb7ac74af 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-add.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-add.json
@@ -6,9 +6,119 @@
"type": "number"
},
"widgets": {
- "description": "Widget tiles to add atomically. Supported widget_type values: activity_events_list, conversations_recent_tickets, error_tracking_list, experiment_results, experiments_list, logs_list, session_replay_list, survey_results. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).",
+ "description": "Widget tiles to add atomically. Supported widget_type values: activity_events_list, conversations_recent_tickets, error_tracking_list, experiment_results, experiments_list, logs_list, notebook_widget, session_replay_list, survey_results. Use dashboard-widget-catalog-list for per-type config_schema documentation. (1–10 per request).",
"items": {
"anyOf": [
+ {
+ "properties": {
+ "config": {
+ "description": "Configuration for the notebook widget widget.",
+ "properties": {
+ "notebookShortId": {
+ "anyOf": [
+ {
+ "maxLength": 128,
+ "minLength": 1,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Source notebook short ID."
+ },
+ "snapshotId": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Immutable notebook widget snapshot. Add one from a notebook widget's menu."
+ }
+ },
+ "type": "object"
+ },
+ "description": {
+ "description": "Optional markdown description shown when show_description is enabled.",
+ "type": "string"
+ },
+ "layouts": {
+ "description": "Optional react-grid-layout positions keyed by breakpoint (sm, xs).",
+ "properties": {
+ "sm": {
+ "description": "Layout for the standard (desktop) breakpoint. The grid is 12 columns wide.",
+ "properties": {
+ "h": {
+ "description": "Height in grid rows.",
+ "type": "number"
+ },
+ "w": {
+ "description": "Width in grid columns. The desktop grid is 12 columns wide.",
+ "type": "number"
+ },
+ "x": {
+ "description": "Column position in the dashboard grid (0-indexed).",
+ "type": "number"
+ },
+ "y": {
+ "description": "Row position in the dashboard grid (0-indexed).",
+ "type": "number"
+ }
+ },
+ "type": "object"
+ },
+ "xs": {
+ "description": "Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.",
+ "properties": {
+ "h": {
+ "description": "Height in grid rows.",
+ "type": "number"
+ },
+ "w": {
+ "description": "Width in grid columns. The desktop grid is 12 columns wide.",
+ "type": "number"
+ },
+ "x": {
+ "description": "Column position in the dashboard grid (0-indexed).",
+ "type": "number"
+ },
+ "y": {
+ "description": "Row position in the dashboard grid (0-indexed).",
+ "type": "number"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "name": {
+ "anyOf": [
+ {
+ "maxLength": 400,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Optional custom display name for the widget tile."
+ },
+ "show_description": {
+ "description": "Whether to show the description on the dashboard tile.",
+ "type": "boolean"
+ },
+ "widget_type": {
+ "enum": ["notebook_widget"],
+ "type": "string"
+ }
+ },
+ "required": ["widget_type", "config"],
+ "type": "object"
+ },
{
"properties": {
"config": {
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-update.json
index 63ae0b3862d3..9831922ba70e 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-update.json
@@ -9,6 +9,66 @@
"description": "Widget tiles to update atomically, each identified by its tile_id. config shape is per widget_type; see dashboard-widget-catalog-list for per-type config_schema (1–10 per request).",
"items": {
"anyOf": [
+ {
+ "properties": {
+ "config": {
+ "description": "New configuration for the notebook widget widget. Omit to leave unchanged.",
+ "properties": {
+ "notebookShortId": {
+ "anyOf": [
+ {
+ "maxLength": 128,
+ "minLength": 1,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Source notebook short ID."
+ },
+ "snapshotId": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Immutable notebook widget snapshot. Add one from a notebook widget's menu."
+ }
+ },
+ "type": "object"
+ },
+ "description": {
+ "description": "New markdown description for the widget. Omit to leave unchanged.",
+ "type": "string"
+ },
+ "name": {
+ "anyOf": [
+ {
+ "maxLength": 400,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "New display name for the widget. Empty string or null clears it; omit to leave unchanged."
+ },
+ "tile_id": {
+ "description": "ID of the widget tile to update. Use dashboard-get to look up widget tile IDs.",
+ "type": "number"
+ },
+ "widget_type": {
+ "enum": ["notebook_widget"],
+ "type": "string"
+ }
+ },
+ "required": ["tile_id", "widget_type"],
+ "type": "object"
+ },
{
"properties": {
"config": {
diff --git a/tach.toml b/tach.toml
index c224d5b158fd..e89fc3cedbf7 100644
--- a/tach.toml
+++ b/tach.toml
@@ -284,6 +284,7 @@ layer = "modules"
[[modules]]
path = "products.dashboards"
depends_on = [
+ "products.notebooks",
"ee",
"posthog",
"products.alerts",
@@ -647,6 +648,7 @@ depends_on = [
"ee",
"posthog",
"products.canvas",
+ "products.dashboards",
"products.product_analytics",
"products.tasks", "products.access_control",
]