Skip to main content

Dashboard Module

The Dashboard Module (apps/backend/modules/dashboard) handles the lifecycle of Dashboards, which are containers for Widgets.

Data Model

A Dashboard is primarily a layout configuration stored in Postgres.

FieldTypeDescription
dashboardIDIntegerPrimary Key.
tenantIDIntegerScoped to a specific tenant.
dashboardConfigJSONStores the react-grid-layout configuration (positions, sizes).
creatorIDIntegerUser who created the dashboard.

Service API

cloneDashboardByID

Duplicates a dashboard and all its settings.

await dashboardService.cloneDashboardByID({
userID: 1,
tenantID: 1,
dashboardID: 10
});

Logic:

  1. Fetches source dashboard.
  2. Creates new record with Title (Copy).
  3. Copies dashboardConfig verbatim.
  4. Note: Does NOT clone the widgets inside. Widgets are referenced by ID in the layout config? Correction: In Jet Admin, dashboards contain a list of Widget IDs. If deep cloning is required, the logic would need to clone widgets too. Currently, it copies the config.

API Endpoints

MethodEndpointDescription
GET/api/dashboards/:tenantIDList all dashboards.
POST/api/dashboards/:tenantIDCreate new dashboard.
GET/api/dashboards/:tenantID/:dashboardIDGet specific dashboard.
PUT/api/dashboards/:tenantID/:dashboardIDUpdate layout/title.
POST/api/dashboards/:tenantID/:dashboardID/cloneClone dashboard.