opik icon indicating copy to clipboard operation
opik copied to clipboard

[OPIK-3213] [FE] Add Dashboard Infrastructure with Widget System

Open andriidudar opened this issue 1 month ago β€’ 9 comments

Details

This PR implements the core dashboard infrastructure for Opik, enabling users to create customizable dashboards with multiple widget types for monitoring project metrics and performance.

Backend Changes:

  • Added dashboardsEnabled feature toggle to ServiceTogglesConfig and configuration files
  • Minor update to DashboardDAO for proper entity handling

Frontend - Core Dashboard Infrastructure:

  • Implemented full CRUD operations for dashboards (list, create, read, update, delete, clone)
  • Added DashboardStore with Zustand for state management (648 lines)
  • Created comprehensive dashboard type definitions (types/dashboard.ts)
  • Implemented auto-save functionality with debouncing (useDashboardAutosave)
  • Added dashboard routing and navigation integration

Frontend - Dashboard Pages:

  • DashboardsPage: Full-featured list view with create, clone, delete operations
  • DashboardPage: Interactive dashboard view with section management and widget configuration
  • Added sidebar navigation entry for dashboards

Frontend - Widget System:

  • Implemented compound DashboardWidget component with reusable sub-components:
    • Header, Content, Actions (edit, delete, duplicate, move)
    • Empty state, Error state, Preview mode
    • Drag handle for grid layout
  • Created WidgetConfigDialog system for adding/editing widgets with live preview
  • Implemented widget registry pattern for extensibility

Frontend - Implemented Widgets:

  1. Text/Markdown Widget:

    • Markdown editor with syntax highlighting
    • Live markdown preview
    • Supports rich text formatting
  2. Project Metrics Widget:

    • 9 metric types (traces, threads, costs, tokens, guardrails, feedback scores)
    • Configurable chart types (line/bar)
    • Project selector (optional, falls back to dashboard project)
    • Local/global date range toggle with MetricDateRangeSelect
    • Comprehensive filter support for traces and threads
    • Reuses existing MetricContainerChart component with new chartOnly mode

Frontend - Dashboard Layout:

  • Integrated react-grid-layout for drag-and-drop widget positioning
  • Responsive grid system with breakpoints
  • Section-based organization with expand/collapse
  • Layout persistence and migrations support

Frontend - API Integration:

  • useDashboardsList - Fetch dashboards with pagination and search
  • useDashboardById - Fetch single dashboard
  • useDashboardCreateMutation - Create new dashboard
  • useDashboardUpdateMutation - Update dashboard state
  • useDashboardDeleteMutation - Delete dashboard

Supporting Changes:

  • Updated MetricContainerChart to support chartOnly prop for widget embedding
  • Added dashboard explainers and tooltips
  • Created dashboard utility functions (layout, migrations, search)
  • Added necessary CSS styles for grid layout
  • Updated package dependencies (react-grid-layout, etc.)
  • Fixed React Hooks linting issues (hooks order, referential stability)

Documentation:

  • Comprehensive implementation plan (1,576 lines)
  • High-level design document
  • MVP summary
  • Grid layout investigation
  • Next steps planning document

Change checklist

  • [x] User facing
  • [ ] Documentation update

Issues

  • OPIK-3213

Testing

Manual Testing Performed:

  • Dashboard CRUD operations (create, read, update, delete, clone)
  • Widget addition and configuration with live preview
  • Text/Markdown widget with markdown editing
  • Project Metrics widget with all 9 metric types
  • Chart type switching (line/bar)
  • Filter configuration for trace and thread metrics
  • Project selector functionality
  • Date range toggling (global/local)
  • Widget drag-and-drop and resizing
  • Section management (add, rename, delete, expand/collapse)
  • Auto-save functionality
  • Linting passes without errors
  • Type checking passes without errors
  • Responsive grid layout

Components Tested:

  • All dashboard pages load correctly
  • Widget preview updates in real-time during configuration
  • Filter UI matches existing patterns (AddEditRule dialog)
  • Metric charts render correctly with applied filters
  • Date range picker integration works as expected

Documentation

  • Added comprehensive planning documents in repository root
  • Implementation follows existing Opik patterns:
    • API hooks follow TanStack Query conventions
    • Component structure matches Opik frontend organization
    • State management uses Zustand like other features
    • Filter implementation reuses existing FiltersContent component
  • Widget system designed for extensibility (easy to add new widget types)
  • Dashboard configuration uses versioned schema for future migrations

andriidudar avatar Nov 26 '25 14:11 andriidudar

πŸ”„ Test environment deployment started

Building images for PR #4237...

You can monitor the build progress here.

github-actions[bot] avatar Nov 26 '25 14:11 github-actions[bot]

βœ… Test environment is now available!

Access Information

  • URL: https://pr-4237.dev.comet.com
  • Cluster: comet-ml-development
  • Namespace: pr-4237
  • Version: 1.9.32-4237-merge-542
  • Application logs: View in Grafana

The deployment has completed successfully and the version has been verified.

CometActions avatar Nov 26 '25 14:11 CometActions

Backend Tests Results

β€‡β€ˆ350 filesβ€„β€ƒβ€‡β€ˆ350 suites   55m 30s ⏱️ 5β€ˆ859 tests 5β€ˆ852 βœ…β€ƒ7 πŸ’€β€ƒ0 ❌ 5β€ˆ858 runsβ€Šβ€ƒ5β€ˆ851 βœ…β€ƒ7 πŸ’€β€ƒ0 ❌

Results for commit e91182c8.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Nov 26 '25 14:11 github-actions[bot]

πŸ”„ Test environment deployment started

Building images for PR #4237...

You can monitor the build progress here.

github-actions[bot] avatar Nov 27 '25 17:11 github-actions[bot]

βœ… Test environment is now available!

Access Information

  • URL: https://pr-4237.dev.comet.com
  • Cluster: comet-ml-development
  • Namespace: pr-4237
  • Version: 1.9.34-4237-merge-567
  • Application logs: View in Grafana

The deployment has completed successfully and the version has been verified.

CometActions avatar Nov 27 '25 17:11 CometActions

πŸ”„ Test environment deployment started

Building images for PR #4237...

You can monitor the build progress here.

github-actions[bot] avatar Nov 28 '25 15:11 github-actions[bot]

βœ… Test environment is now available!

Access Information

  • URL: https://pr-4237.dev.comet.com
  • Cluster: comet-ml-development
  • Namespace: pr-4237
  • Version: 1.9.34-4237-merge-575
  • Application logs: View in Grafana

The deployment has completed successfully and the version has been verified.

CometActions avatar Nov 28 '25 15:11 CometActions

πŸ”„ Test environment deployment started

Building images for PR #4237...

You can monitor the build progress here.

github-actions[bot] avatar Nov 28 '25 16:11 github-actions[bot]

βœ… Test environment is now available!

Access Information

  • URL: https://pr-4237.dev.comet.com
  • Cluster: comet-ml-development
  • Namespace: pr-4237
  • Version: 1.9.34-4237-merge-576
  • Application logs: View in Grafana

The deployment has completed successfully and the version has been verified.

CometActions avatar Nov 28 '25 16:11 CometActions

πŸ”„ Test environment deployment started

Building images for PR #4237...

You can monitor the build progress here.

github-actions[bot] avatar Dec 01 '25 13:12 github-actions[bot]

βœ… Test environment is now available!

Access Information

  • URL: https://pr-4237.dev.comet.com
  • Cluster: comet-ml-development
  • Namespace: pr-4237
  • Version: 1.9.34-4237-merge-602
  • Application logs: View in Grafana

The deployment has completed successfully and the version has been verified.

CometActions avatar Dec 01 '25 13:12 CometActions

πŸ”„ Test environment deployment started

Building images for PR #4237...

You can monitor the build progress here.

github-actions[bot] avatar Dec 01 '25 17:12 github-actions[bot]

βœ… Test environment is now available!

Access Information

  • URL: https://pr-4237.dev.comet.com
  • Cluster: comet-ml-development
  • Namespace: pr-4237
  • Version: 1.9.34-4237-merge-608
  • Application logs: View in Grafana

The deployment has completed successfully and the version has been verified.

CometActions avatar Dec 01 '25 17:12 CometActions

SDK E2E Tests Results

105 tests   104 βœ…β€ƒβ€ƒ5m 35s ⏱️   1 suites    0 πŸ’€   1 files      1 ❌

For more details on these failures, see this check.

Results for commit e91182c8.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Dec 01 '25 17:12 github-actions[bot]

πŸ”„ Test environment deployment started

Building images for PR #4237...

You can monitor the build progress here.

github-actions[bot] avatar Dec 02 '25 11:12 github-actions[bot]

βœ… Test environment is now available!

Access Information

  • URL: https://pr-4237.dev.comet.com
  • Cluster: comet-ml-development
  • Namespace: pr-4237
  • Version: 1.9.35-4237-merge-613
  • Application logs: View in Grafana

The deployment has completed successfully and the version has been verified.

CometActions avatar Dec 02 '25 11:12 CometActions