Dashboards
Production - Dashboard CRUD, widget management, templates, cloning
The Dashboard system provides full CRUD operations for creating and managing BI dashboards. Each dashboard contains widgets arranged on a 12-column grid, with support for multiple data sources, chart types, and interactive filters.
12.4.2.1Dashboard API
Implemented in data-plane/ai-service/src/bi/api/dashboard_routes.py:
# Create dashboard
curl -X POST "http://localhost:8000/api/v1/bi/dashboards?tenant_id=acme-corp&user_id=user-123" \
-H "Content-Type: application/json" \
-d '{
"name": "Sales Overview Q4 2024",
"description": "Executive sales dashboard for Q4",
"visibility": "team",
"tags": ["sales", "quarterly", "executive"]
}'
# List dashboards
curl "http://localhost:8000/api/v1/bi/dashboards?tenant_id=acme-corp&visibility=team&limit=20"
# Get dashboard detail
curl "http://localhost:8000/api/v1/bi/dashboards/{dashboard_id}?tenant_id=acme-corp"
# Add widget
curl -X POST "http://localhost:8000/api/v1/bi/dashboards/{dashboard_id}/widgets?tenant_id=acme-corp" \
-H "Content-Type: application/json" \
-d '{
"name": "Revenue by Region",
"widget_type": "bar_chart",
"position": {"x": 0, "y": 0, "width": 6, "height": 4},
"data_source": {
"sql": "SELECT region, SUM(revenue) AS total FROM orders GROUP BY region",
"cache_ttl_seconds": 300
},
"config": {
"x_axis": "region",
"y_axis": "total",
"color_scheme": "blue",
"show_legend": true
}
}'
# Create from template
curl -X POST "http://localhost:8000/api/v1/bi/dashboards/templates/executive_overview?tenant_id=acme-corp&name=My+Dashboard"
# Clone dashboard
curl -X POST "http://localhost:8000/api/v1/bi/dashboards/{dashboard_id}/clone?tenant_id=acme-corp&new_name=Copy+of+Dashboard"Widget Types
| Type | Description |
|---|---|
bar_chart | Vertical or horizontal bar chart |
line_chart | Time series or trend line chart |
pie_chart | Pie or donut chart |
scatter_plot | Scatter plot with optional trend line |
table | Data table with sorting and filtering |
metric | Single KPI metric card |
heatmap | Color-coded matrix visualization |
area_chart | Stacked or layered area chart |