Skip to content

Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.

Feat(dashboards): add support for custom dashboard creation with folders, widgets, and layout management (#796)

Aman Agarwalbd7a26c42632
diff --git a/docs/latest/features/dashboards/auto-refresh-and-time-interval.mdx b/docs/latest/features/dashboards/auto-refresh-and-time-interval.mdx
new file mode 100644
index 00000000..7107b518
--- /dev/null
+++ b/docs/latest/features/dashboards/auto-refresh-and-time-interval.mdx
@@ -0,0 +1,84 @@
+---
+title: Auto Refresh & Time Interval
+description: Learn how to enable auto-refresh and set time intervals in OpenLIT dashboards to keep your data live and updated in real time.
+---
+
+You can configure OpenLIT dashboards to automatically refresh data at set intervals. This feature is essential for live monitoring dashboards, status boards, and any view that requires up-to-date metrics from ClickHouse.
+
+---
+
+## 🧠 Why Use Refresh Intervals?
+
+Refresh intervals allow you to:
+- Keep data fresh without manual reloads and automatically re-run queries behind the scenes
+- Power live dashboards for operations and support teams
+- Monitor real-time metrics
+
+---
+
+## 🛠️ How to Enable Auto-Refresh
+
+<video
+ controls
+ className="w-full aspect-video"
+ src="https://youtu.be/YCplfvm6_W0?si=p4b_OWJxnUs__N15"
+></video>
+
+Once set, the dashboard will automatically re-fetch data from ClickHouse at the selected interval.
+
+---
+
+## ⚙️ Available Refresh Rate
+
+| Interval | Use Case |
+|------------|-----------------------------------|
+| Never | Static dashboards |
+| 30 seconds | Live dashboards, production stats |
+| 1 minute | Standard monitoring (default) |
+| 5 minutes | Low-frequency updates |
+| 10 minutes | Less load on db |
+
+
+## ⚙️ Available Time Intervals
+
+| Range | Description | Example Use Case |
+| ------ | -------------------------------------- | ----------------------------------------- |
+| 24H | Last 24 hours from now | Real-time metrics, active users, API logs |
+| 7D | Last 7 calendar days | Weekly trends, retention, issue tracking |
+| 1M | Last 1 calendar month | Revenue analysis, product adoption |
+| 3M | Last 3 calendar months | Quarterly metrics, strategic reviews |
+| Custom | Select any start and end date manually | Audits, investigations, historical views |
+
+
+Snippet to make use of the time interval in the query:
+
+```sql
+WHERE event_time BETWEEN {{filter.timeLimit.start}} AND {{filter.timeLimit.end}}
+```
+
+
+---
+
+<Tip>
+Use shorter intervals only for optimized queries. Long-running queries + high refresh rates can overload your ClickHouse backend.
+</Tip>
+
+---
+
+## ✅ Best Practices
+
+- Use dynamic bindings like `{{filter.timeLimit.start}}`, `{{filter.timeLimit.end}}` to make your chart respond to dashboard time filters.
+- Avoid using `LIMIT 1000` or wide result sets on high-frequency updates
+- Use refresh intervals in combination with pinned dashboards for kiosk or ops setups
+
+---
+
+## 🔗 Related Guides
+
+- [Create Your First Folder →](/latest/features/dashboards/create-your-first-folder)
+- [Create Your First Dashboard →](/latest/features/dashboards/create-your-first-dashboard)
+- [Organize your dashboards →](/latest/features/dashboards/organize-your-dashboards)
+- [Pin Your Dashboard →](/latest/features/dashboards/pin-your-dashboard)
+- [Set as Main Dashboard →](/latest/features/dashboards/set-as-main-dashboard)
+- [Widgets →](/latest/features/dashboards/widgets/introduction)
+- [Filters & Dynamic bindings →](/latest/features/dashboards/use-filters-and-dynamic-bindings)
\ No newline at end of file
diff --git a/docs/latest/features/dashboards/create-your-first-dashboard.mdx b/docs/latest/features/dashboards/create-your-first-dashboard.mdx
new file mode 100644
index 00000000..d82d134b
--- /dev/null
+++ b/docs/latest/features/dashboards/create-your-first-dashboard.mdx
@@ -0,0 +1,38 @@
+---
+title: Create Your First Dashboard
+description: Learn how to create a dashboard in OpenLIT, configure its settings, and prepare it for widgets, queries, and visualization.
+---
+
+Dashboards in OpenLIT are where your visualizations come to life. You can add widgets, run SQL queries against ClickHouse, and build dynamic, data-driven interfaces for your team or application.
+
+---
+
+## How to create a dashboard
+
+<video
+ controls
+ className="w-full aspect-video"
+ src="https://youtu.be/Bq0d8vFvDX8?si=VAv9GAkDYp__kJSg"
+></video>
+
+---
+
+## 📂 Organizing Your Dashboard
+
+After creation, you can move the dashboard into a different folder using drag-and-drop or by editing its properties.
+
+> Need help creating folders? See [Creating Your First Folder →](/guides/create-folder)
+
+---
+
+## ✅ Next Steps
+
+Once your dashboard is ready, you're all set to:
+
+- [Create Your First Folder →](/latest/features/dashboards/create-your-first-folder)
+- [Organize your dashboards →](/latest/features/dashboards/organize-your-dashboards)
+- [Pin Your Dashboard →](/latest/features/dashboards/pin-your-dashboard)
+- [Set as Main Dashboard →](/latest/features/dashboards/set-as-main-dashboard)
+- [Widgets →](/latest/features/dashboards/widgets/introduction)
+- [Filters & Dynamic bindings →](/latest/features/dashboards/use-filters-and-dynamic-bindings)
+- [Refresh Rate →](/latest/features/dashboards/auto-refresh-and-time-interval)
diff --git a/docs/latest/features/dashboards/create-your-first-folder.mdx b/docs/latest/features/dashboards/create-your-first-folder.mdx
new file mode 100644
index 00000000..96ee8aec
--- /dev/null
+++ b/docs/latest/features/dashboards/create-your-first-folder.mdx
@@ -0,0 +1,34 @@
+---
+title: Creating Your First Folder
+slug: /guides/create-folder
+description: Folders in OpenLIT help you organize dashboards into logical collections—like by team, feature, environment, or product.
+---
+
+## 📂 Why Use Folders?
+
+- Group dashboards by function, project, or ownership
+- Nest folders to reflect organizational structure
+- Improve searchability and navigation
+
+---
+
+## 🛠️ How to create Folder
+<video
+ controls
+ className="w-full aspect-video"
+ src="https://youtu.be/bWg1FTj5-Hw?si=aJPrpj_M6UlDTviC"
+></video>
+
+<Tip>
+Once your folder is created, you can **drag and drop dashboards** into it directly from the dashboard list.
+</Tip>
+
+## ✅ Next Steps
+
+- [Create Your First Dashboard →](/latest/features/dashboards/create-your-first-dashboard)
+- [Organize your dashboards →](/latest/features/dashboards/organize-your-dashboards)
+- [Pin Your Dashboard →](/latest/features/dashboards/pin-your-dashboard)
+- [Set as Main Dashboard →](/latest/features/dashboards/set-as-main-dashboard)
+- [Widgets →](/latest/features/dashboards/widgets/introduction)
+- [Filters & Dynamic bindings →](/latest/features/dashboards/use-filters-and-dynamic-bindings)
+- [Refresh Rate →](/latest/features/dashboards/auto-refresh-and-time-interval)
diff --git a/docs/latest/features/dashboards/introduction.mdx b/docs/latest/features/dashboards/introduction.mdx
new file mode 100644
index 00000000..6ce293ef
--- /dev/null
+++ b/docs/latest/features/dashboards/introduction.mdx
@@ -0,0 +1,51 @@
+---
+title: Introduction
+description: Learn how to build powerful, customizable dashboards using OpenLIT. Explore widgets, folder structure, dynamic bindings, and data visualization powered by ClickHouse.
+---
+
+
+OpenLIT lets you build real-time, interactive dashboards backed by **ClickHouse**—designed for speed, flexibility, and developer control. Whether you're monitoring system performance, visualizing product analytics, or creating internal tools, OpenLIT makes it easy to create beautiful, custom dashboards with minimal setup.
+
+---
+
+## 🔧 What You Can Do
+
+- Create, organize, and manage dashboards across folders and dashboards
+- Visualize data using a wide range of **widgets** like:
+ - Area, Bar, Line, and Pie Charts
+ - Statistics and Tables
+ - Markdown blocks for rich text
+- Connect to your ClickHouse database with **direct SQL queries**
+- Use **dynamic bindings** to build responsive, filterable dashboards
+- Pin important dashboards or set a **main dashboard** as your home view
+
+---
+
+## 📦 Who It's For
+
+OpenLIT is built for:
+
+- **Engineers** building internal tools or observability dashboards
+- **Product teams** tracking key usage and adoption metrics
+- **Data analysts** visualizing trends and distributions in real-time
+- **Growth teams** monitoring conversions, funnels, and experiments
+
+<Tip>
+You can use the demo instance or connect your own ClickHouse database to get started quickly.
+</Tip>
+
+
+## 🔜 What’s Next?
+
+In the following guides, you’ll learn how to:
+
+- [Create Your First Folder →](/latest/features/dashboards/create-your-first-folder)
+- [Create Your First Dashboard →](/latest/features/dashboards/create-your-first-dashboard)
+- [Organize your dashboards →](/latest/features/dashboards/organize-your-dashboards)
+- [Pin Your Dashboard →](/latest/features/dashboards/pin-your-dashboard)
+- [Set as Main Dashboard →](/latest/features/dashboards/set-as-main-dashboard)
+- [Widgets →](/latest/features/dashboards/widgets/introduction)
+- [Filters & Dynamic bindings →](/latest/features/dashboards/use-filters-and-dynamic-bindings)
+- [Refresh Rate →](/latest/features/dashboards/auto-refresh-and-time-interval)
+
+Let’s dive in and build your first dashboard →
diff --git a/docs/latest/features/dashboards/organize-your-dashboards.mdx b/docs/latest/features/dashboards/organize-your-dashboards.mdx
new file mode 100644
index 00000000..cc75d278
--- /dev/null
+++ b/docs/latest/features/dashboards/organize-your-dashboards.mdx
@@ -0,0 +1,49 @@
+---
+title: Organize Your Dashboards
+description: Learn how to organize dashboards in OpenLIT using folders, boards, and drag-and-drop for better structure and navigation.
+---
+
+As your dashboard library grows, keeping things organized is key. OpenLIT provides an intuitive folder and board system, along with **drag-and-drop support** to keep your workspace clean and efficient.
+
+---
+
+## 📁 Use Folders and Dashboards
+
+Dashboards can be placed inside:
+- **Folders** – Great for grouping dashboards by team, project, or function.
+- **Dashboards** – Containers that hold folders or dashboards directly. These often represent high-level categories like “Product,” “Infra,” or “Finance.”
+
+You can nest dashboards inside folders and even folders inside other folders to reflect your organizational structure.
+
+---
+
+## 🖱️ How to Reorganize
+
+<video
+ controls
+ className="w-full aspect-video"
+ src="https://youtu.be/bHwVbJIA6_s?si=r-cDn5QmLm2ezFob"
+></video>
+
+---
+
+## ✨ Tips for Better Organization
+
+- Use consistent naming patterns: e.g., `Product > Retention`, `Infra > API Latency`
+- Pin frequently used dashboards for quick access
+- Set the most visited dashboard as your [Main Dashboard →](/guides/set-main-dashboard)
+
+<Tip>
+You can combine folders and boards for deeply nested structures like `Engineering > Backend > Metrics > Error Logs`.
+</Tip>
+
+
+## ✅ Related Guides
+
+- [Create Your First Folder →](/latest/features/dashboards/create-your-first-folder)
+- [Create Your First Dashboard →](/latest/features/dashboards/create-your-first-dashboard)
+- [Pin Your Dashboard →](/latest/features/dashboards/pin-your-dashboard)
+- [Set as Main Dashboard →](/latest/features/dashboards/set-as-main-dashboard)
+- [Widgets →](/latest/features/dashboards/widgets/introduction)
+- [Filters & Dynamic bindings →](/latest/features/dashboards/use-filters-and-dynamic-bindings)
+- [Refresh Rate →](/latest/features/dashboards/auto-refresh-and-time-interval)
diff --git a/docs/latest/features/dashboards/pin-your-dashboard.mdx b/docs/latest/features/dashboards/pin-your-dashboard.mdx
new file mode 100644
index 00000000..91903f8a
--- /dev/null
+++ b/docs/latest/features/dashboards/pin-your-dashboard.mdx
@@ -0,0 +1,48 @@
+---
+title: Pin a Dashboard
+description: Learn how to pin a dashboard in OpenLIT to keep key dashboards easily accessible at the top of your list.
+---
+
+Pinning dashboards allows you to keep your most important dashboards always accessible. Pinned dashboards appear at the top of your sidebar or dashboard list, so you can quickly jump to key metrics, live views, or frequently used dashboards.
+
+---
+
+## ⭐ Why Pin Dashboards?
+
+- Prioritize dashboards you use every day
+- Quickly access critical dashboards without searching
+- Personalize your workspace by surfacing what matters most
+
+---
+
+## 🛠️ How to pin a Dashboard
+<video
+ controls
+ className="w-full aspect-video"
+ src="https://youtu.be/SIQCU8eU5IQ?si=2u8YSBXtdMaAwh74"
+></video>
+
+---
+
+## 🔄 Unpinning a Dashboard
+
+To unpin a dashboard:
+
+1. Click the **⋮ menu** again on a pinned dashboard.
+2. Select **“Unpin Dashboard”**.
+
+The dashboard will return to its normal position in the folder/board structure.
+
+<Tip>
+You can pin multiple dashboards—perfect for surfacing daily dashboards, team-specific views, or in-progress monitoring.
+</Tip>
+
+## ✅ Related Guides
+
+- [Create Your First Folder →](/latest/features/dashboards/create-your-first-folder)
+- [Create Your First Dashboard →](/latest/features/dashboards/create-your-first-dashboard)
+- [Organize your dashboards →](/latest/features/dashboards/organize-your-dashboards)
+- [Set as Main Dashboard →](/latest/features/dashboards/set-as-main-dashboard)
+- [Widgets →](/latest/features/dashboards/widgets/introduction)
+- [Filters & Dynamic bindings →](/latest/features/dashboards/use-filters-and-dynamic-bindings)
+- [Refresh Rate →](/latest/features/dashboards/auto-refresh-and-time-interval)
diff --git a/docs/latest/features/dashboards/set-as-main-dashboard.mdx b/docs/latest/features/dashboards/set-as-main-dashboard.mdx
new file mode 100644
index 00000000..dcdf68cb
--- /dev/null
+++ b/docs/latest/features/dashboards/set-as-main-dashboard.mdx
@@ -0,0 +1,45 @@
+---
+title: Set a Main Dashboard
+description: Learn how to set a dashboard as your main (home) dashboard in OpenLIT for faster access to your most important views.
+---
+
+In OpenLIT, you can designate any dashboard as your **Main Dashboard**, which acts as your default landing page when you open the app. This is useful when you or your team rely on a specific dashboard daily.
+
+---
+
+## 🎯 Why Set a Main Dashboard?
+
+- Automatically open your most important dashboard on login
+- Reduce time navigating to critical views
+- Personalize your OpenLIT experience
+
+---
+
+## How to Set a Main Dashboard
+
+<video
+ controls
+ className="w-full aspect-video"
+ src="https://youtu.be/fJNom9ULRIs?si=d_Hzx3EO8Jq44g67"
+></video>
+
+Once set, this dashboard will load by default each time you access /home of OpenLIT.
+
+---
+
+## 🔄 Change or Remove Main Dashboard
+
+You can always change your main dashboard by repeating the steps on another dashboard.
+
+To remove the main dashboard setting entirely:
+- Go to any other dashboard and set it as main.
+
+## ✅ Related Guides
+
+- [Create Your First Folder →](/latest/features/dashboards/create-your-first-folder)
+- [Create Your First Dashboard →](/latest/features/dashboards/create-your-first-dashboard)
+- [Organize your dashboards →](/latest/features/dashboards/organize-your-dashboards)
+- [Pin Your Dashboard →](/latest/features/dashboards/pin-your-dashboard)
+- [Widgets →](/latest/features/dashboards/widgets/introduction)
+- [Filters & Dynamic bindings →](/latest/features/dashboards/use-filters-and-dynamic-bindings)
+- [Refresh Rate →](/latest/features/dashboards/auto-refresh-and-time-interval)
\ No newline at end of file
diff --git a/docs/latest/features/dashboards/use-filters-and-dynamic-bindings.mdx b/docs/latest/features/dashboards/use-filters-and-dynamic-bindings.mdx
new file mode 100644
index 00000000..88b6fccc
--- /dev/null
+++ b/docs/latest/features/dashboards/use-filters-and-dynamic-bindings.mdx
@@ -0,0 +1,84 @@
+---
+title: How to Use Filters & Dynamic Bindings
+description: Learn how to make OpenLIT dashboards interactive by using filters and mustache-style dynamic bindings inside ClickHouse queries.
+---
+
+OpenLIT makes dashboards interactive by letting you add filters and dynamically bind their values to ClickHouse queries. This enables you to create reusable dashboards that respond to user inputs like time range, environment, region, and more.
+
+---
+
+## 🧩 What Are Filters?
+
+**Filters** are interactive controls (e.g. date ranges) placed at the top of a dashboard. You can bind these filters to your widgets so their values get passed into SQL queries in real time.
+
+---
+
+## 🪄 What Are Dynamic Bindings?
+
+OpenLIT uses **mustache-style bindings** to inject filter values into your queries.
+
+### ✅ Format:
+```sql
+{{variable_name}}
+````
+
+At runtime, OpenLIT replaces each binding with the user-provided filter value.
+
+### Common Examples:
+
+* `{{filter.timeLimit.start}}` and `{{filter.timeLimit.end}}` — for date range filters
+
+---
+
+## 🛠️ How to Add and Use Filters
+
+<video
+ controls
+ className="w-full aspect-video"
+ src="https://youtu.be/J9TFEWmVczI?si=Z8kysxPuF9-mhJJD"
+></video>
+
+---
+
+## 🔍 SQL Example with Mustache Bindings
+
+```sql
+SELECT
+ toStartOfHour(event_time) AS time,
+ count() AS value
+FROM user_events
+WHERE event_time BETWEEN {{filter.timeLimit.start}} AND {{filter.timeLimit.end}}
+GROUP BY time
+ORDER BY time
+```
+
+In this example:
+
+* `{{filter.timeLimit.start}}` & `{{filter.timeLimit.end}}` are bound to a date range filter
+
+---
+
+## 🛠️ Supported Filter Types
+
+* **Date Range** → `{{filter.timeLimit.start}}`, `{{filter.timeLimit.end}}`
+* **(Coming soon)**: Dynamic filters etc
+
+---
+
+## ✅ Best Practices
+
+* Always use meaningful keys like `team_id`, `env`, or `region`
+* Use `coalesce({{param}}, 'default')` to provide fallback values in ClickHouse
+* Test your queries in the SQL editor with example values for clarity
+* Avoid hardcoded constraints—use bindings to keep dashboards flexible
+
+---
+
+## 🔗 Related Guides
+
+- [Create Your First Folder →](/latest/features/dashboards/create-your-first-folder)
+- [Create Your First Dashboard →](/latest/features/dashboards/create-your-first-dashboard)
+- [Organize your dashboards →](/latest/features/dashboards/organize-your-dashboards)
+- [Pin Your Dashboard →](/latest/features/dashboards/pin-your-dashboard)
+- [Widgets →](/latest/features/dashboards/widgets/introduction)
+- [Refresh Rate →](/latest/features/dashboards/auto-refresh-and-time-interval)
diff --git a/docs/latest/features/dashboards/widgets/area-chart-widget.mdx b/docs/latest/features/dashboards/widgets/area-chart-widget.mdx
new file mode 100644
index 00000000..24ffdd00
--- /dev/null
+++ b/docs/latest/features/dashboards/widgets/area-chart-widget.mdx
@@ -0,0 +1,89 @@
+---
+title: Area Chart Widget
+slug: /widgets/area-chart
+description: Learn how to use the Area Chart Widget in OpenLIT to visualize time-based trends using ClickHouse queries and dynamic parameters.
+---
+
+## 📌 When to Use
+
+Use the Area Chart when you want to:
+
+- Show trends over time
+- Emphasize volume or scale changes
+- Display multiple series stacked
+
+Area charts are particularly effective for metrics that accumulate or change gradually over time.
+
+---
+
+## 🛠️ How to Add an Area Chart
+
+<video
+ controls
+ className="w-full aspect-video"
+ src="https://youtu.be/4ciEi2LcVNk?si=mWIcLJszd0t5KV12"
+></video>
+
+---
+
+## 📊 Example:
+
+```sql
+WITH
+ parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,
+ parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,
+ dateDiff('day', start_time, end_time) AS days_diff,
+ dateDiff('year', start_time, end_time) AS years_diff,
+ multiIf(
+ years_diff >= 1, 'month',
+ days_diff <= 1, 'hour',
+ 'day'
+ ) AS date_granularity
+
+ SELECT
+ CAST(SUM(toInt64OrZero(SpanAttributes['gen_ai.usage.input_tokens'])) AS INTEGER) AS prompt_tokens,
+ CAST(SUM(toInt64OrZero(SpanAttributes['gen_ai.usage.output_tokens'])) AS INTEGER) AS completion_tokens,
+ formatDateTime(DATE_TRUNC(date_granularity, Timestamp), '%Y/%m/%d %R') AS request_time
+ FROM otel_traces
+ WHERE
+ SpanAttributes['gen_ai.operation.name'] != 'vectordb'
+ AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')
+ AND Timestamp >= start_time
+ AND Timestamp <= end_time
+ GROUP BY request_time
+ ORDER BY request_time;
+
+```
+
+---
+
+## ⚙️ Configuration Options
+
+Customize your Area Chart with the following options:
+
+* **X-Axis**: A path to label or the group by param
+* **Y-Axes**: An array of value path and color combination
+
+<Tip>
+Use dynamic bindings like `{{filter.timeLimit.start}}`, `{{filter.timeLimit.end}}` to make your chart respond to dashboard time filters.
+</Tip>
+
+---
+
+
+## ✅ Best Practices
+
+* Limit the number of series to keep the chart readable.
+* Apply consistent color palettes for related metrics.
+* Use filters (`{{filter.timeLimit.start}}`, `{{filter.timeLimit.end}}`) to enable dynamic dashboards
+
+---
+
+## 🔗 Related Guides
+
+* [Bar Chart Widget →](/latest/features/dashboards/widgets/bar-chart-widget)
+* [Line Chart Widget →](/latest/features/dashboards/widgets/line-chart-widget)
+* [Markdown Widget →](/latest/features/dashboards/widgets/markdown-widget)
+* [Pie Chart Widget →](/latest/features/dashboards/widgets/pie-chart-widget)
+* [Stat Widget →](/latest/features/dashboards/widgets/stat-widget)
+* [Table Widget →](/latest/features/dashboards/widgets/table-widget)
diff --git a/docs/latest/features/dashboards/widgets/bar-chart-widget.mdx b/docs/latest/features/dashboards/widgets/bar-chart-widget.mdx
new file mode 100644
index 00000000..f651e5cd
--- /dev/null
+++ b/docs/latest/features/dashboards/widgets/bar-chart-widget.mdx
@@ -0,0 +1,78 @@
+---
+title: Bar Chart Widget
+description: Learn how to use the Bar Chart Widget in OpenLIT to compare grouped data using ClickHouse queries and dynamic filters.
+---
+
+The **Bar Chart Widget** in OpenLIT is great for comparing categorical or grouped data—like errors by type, usage by region, or revenue by plan. You can customize the chart direction, stack behavior, and bind dynamic filters directly into your ClickHouse queries.
+
+---
+
+## 📌 Use Cases
+
+- Comparing usage across different platforms or regions
+- Visualizing grouped data like plan types, error categories, or product segments
+- Monitoring metrics over categories with filter support
+
+---
+
+## 🛠️ How to Add a Bar Chart
+
+<video
+ controls
+ className="w-full aspect-video"
+ src="https://youtu.be/7Y94KEZI2hM?si=SqncXERP2gLQkSqy"
+></video>
+
+Example:
+
+```sql
+WITH
+ parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,
+ parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,
+
+ SELECT
+ SpanAttributes['gen_ai.request.model'] AS model,
+ CAST(COUNT(SpanAttributes['gen_ai.request.model']) AS INTEGER) AS model_count
+ FROM
+ otel_traces
+ WHERE
+ SpanAttributes['gen_ai.operation.name'] != 'vectordb'
+ AND notEmpty(SpanAttributes['gen_ai.request.model'])
+ AND Timestamp >= start_time
+ AND Timestamp <= end_time
+ GROUP BY
+ model
+ ORDER BY
+ model_count DESC
+ LIMIT 3
+````
+
+---
+
+## ⚙️ Configuration Options
+
+* **Color palette**
+* **X/Y label & value paths**
+
+<Tip>
+Use dynamic bindings like `{{filter.timeLimit.start}}`, `{{filter.timeLimit.end}}` to make your chart respond to dashboard time filters.
+</Tip>
+
+---
+
+## ✅ Best Practices
+
+* Sort bars by descending value for clearer insights
+* Limit category count (e.g., top 10) to avoid clutter
+
+---
+
+## 🔗 Related Guides
+
+* [Area Chart Widget →](/latest/features/dashboards/widgets/area-chart-widget)
+* [Line Chart Widget →](/latest/features/dashboards/widgets/line-chart-widget)
+* [Markdown Widget →](/latest/features/dashboards/widgets/markdown-widget)
+* [Pie Chart Widget →](/latest/features/dashboards/widgets/pie-chart-widget)
+* [Stat Widget →](/latest/features/dashboards/widgets/stat-widget)
+* [Table Widget →](/latest/features/dashboards/widgets/table-widget)
+
diff --git a/docs/latest/features/dashboards/widgets/introduction.mdx b/docs/latest/features/dashboards/widgets/introduction.mdx
new file mode 100644
index 00000000..0c89995f
--- /dev/null
+++ b/docs/latest/features/dashboards/widgets/introduction.mdx
@@ -0,0 +1,48 @@
+---
+title: 'Getting Started with Widgets'
+---
+
+Widgets are the core building blocks of dashboards in OpenLIT. Each widget connects to a ClickHouse query, allowing you to visualize data in different formats—from charts to tables, counters, and text.
+You can configure styling, bind parameters (like time ranges or filters), and arrange widgets freely in your dashboard layout.
+Widgets can be:
+- Visual (e.g., charts)
+- Informational (e.g., stats, markdown)
+- Data-centric (e.g., tables)
+
+Here are the list of supported widgets :
+
+<CardGroup cols={2}>
+ <Card title="Area Chart Widget" href="/latest/features/dashboards/widgets/area-chart-widget" icon='chart-area'>
+ Visualize trends over time with smooth, layered charts. Great for metrics like usage, traffic, or revenue that change over time.
+ </Card>
+
+
+ <Card title="Bar Chart Widget" href="/latest/features/dashboards/widgets/bar-chart-widget" icon='chart-bar'>
+ Compare categories or segments side-by-side. Ideal for showing grouped metrics like errors by type or revenue by plan.
+ </Card>
+
+
+ <Card title="Line Chart Widget" href="/latest/features/dashboards/widgets/line-chart-widget" icon='chart-line'>
+ Plot time-series data with precision. Perfect for tracking latency, load, or other performance metrics over time.
+ </Card>
+
+
+ <Card title="Markdown Widget" href="/latest/features/dashboards/widgets/markdown-widget" icon='markdown'>
+ Add notes, context, or section headers using Markdown. Great for annotating dashboards or linking to documentation.
+ </Card>
+
+
+ <Card title="Pie Chart Widget" href="/latest/features/dashboards/widgets/pie-chart-widget" icon='chart-pie'>
+ Show proportions and segment distribution clearly. Useful for visualizing things like user roles, traffic sources, or error categories.
+ </Card>
+
+
+ <Card title="Stat Widget" href="/latest/features/dashboards/widgets/stat-widget" icon='arrow-up-1-9'>
+ Highlight key metrics like active users, revenue, or conversion rate. A fast and simple way to display KPIs.
+ </Card>
+
+
+ <Card title="Table Widget" href="/latest/features/dashboards/widgets/table-widget" icon='table'>
+ Display structured data in a paginated, sortable table. Perfect for audit logs, event tracking, or error views.
+ </Card>
+</CardGroup>
\ No newline at end of file
diff --git a/docs/latest/features/dashboards/widgets/line-chart-widget.mdx b/docs/latest/features/dashboards/widgets/line-chart-widget.mdx
new file mode 100644
index 00000000..d8c899cd
--- /dev/null
+++ b/docs/latest/features/dashboards/widgets/line-chart-widget.mdx
@@ -0,0 +1,80 @@
+---
+title: Line Chart Widget
+description: Learn how to use the Line Chart Widget in OpenLIT to plot precise time series metrics using ClickHouse queries and dynamic bindings.
+---
+
+The **Line Chart Widget** in OpenLIT helps you visualize changes in your metrics over time with sharp, precise lines. It’s ideal for tracking KPIs like API latency, CPU usage, conversion rate, or funnel performance.
+
+---
+
+## 📌 When to Use
+
+Use a Line Chart when you want to:
+
+- Monitor trends over time with a high degree of accuracy
+- Display sharp, distinct movements in your data
+- Compare multiple metrics on the same time scale
+
+---
+
+## 🛠️ How to Add a Line Chart
+
+<video
+ controls
+ className="w-full aspect-video"
+ src="https://youtu.be/O8vrdaGb8bw?si=faGXhNm0z05zWFMW"
+></video>
+
+Example:
+
+```sql
+WITH
+ parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,
+ parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,
+ dateDiff('day', start_time, end_time) AS days_diff,
+ dateDiff('year', start_time, end_time) AS years_diff,
+ multiIf(
+ years_diff >= 1, 'month',
+ days_diff <= 1, 'hour',
+ 'day'
+ ) AS date_granularity
+ SELECT
+ CAST(COUNT(*) AS INTEGER) AS total,
+ formatDateTime(DATE_TRUNC(date_granularity, Timestamp), '%Y/%m/%d %R') AS request_time
+ FROM otel_traces
+ WHERE
+ SpanAttributes['gen_ai.operation.name'] != 'vectordb'
+ AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')
+ AND Timestamp >= start_time AND Timestamp <= end_time
+ GROUP BY request_time
+ ORDER BY request_time
+````
+
+---
+
+## ⚙️ Customization Options
+
+* **Custom line colors
+* **X/Y label and value paths**
+
+<Tip>
+Use dynamic bindings like `{{filter.timeLimit.start}}`, `{{filter.timeLimit.end}}` to make your chart respond to dashboard time filters.
+</Tip>
+
+---
+
+## ✅ Best Practices
+
+* Use `GROUP BY` with consistent time buckets (e.g., minute, hour)
+* Order your results by time to ensure correct rendering
+
+---
+
+## 🔗 Related Guides
+
+* [Area Chart Widget →](/latest/features/dashboards/widgets/area-chart-widget)
+* [Bar Chart Widget →](/latest/features/dashboards/widgets/bar-chart-widget)
+* [Markdown Widget →](/latest/features/dashboards/widgets/markdown-widget)
+* [Pie Chart Widget →](/latest/features/dashboards/widgets/pie-chart-widget)
+* [Stat Widget →](/latest/features/dashboards/widgets/stat-widget)
+* [Table Widget →](/latest/features/dashboards/widgets/table-widget)
\ No newline at end of file
diff --git a/docs/latest/features/dashboards/widgets/markdown-widget.mdx b/docs/latest/features/dashboards/widgets/markdown-widget.mdx
new file mode 100644
index 00000000..b1d9c0ff
--- /dev/null
+++ b/docs/latest/features/dashboards/widgets/markdown-widget.mdx
@@ -0,0 +1,66 @@
+---
+title: Markdown Widget
+description: Learn how to use the Markdown Widget in OpenLIT to add rich text, annotations, and links to your dashboards.
+---
+
+The **Markdown Widget** lets you add formatted text, notes, links, and headings directly to your dashboards. It’s perfect for adding context, documentation, or separating sections visually.
+
+---
+
+## 📌 Use Cases
+
+- Add titles or descriptions to sections of your dashboard
+- Explain metrics or link to external documentation
+- Highlight goals, statuses, or next steps
+- Create visual separators between widgets
+
+---
+
+## 🛠️ How to Use
+
+<video
+ controls
+ className="w-full aspect-video"
+ src="https://youtu.be/vBUk6_Z9XLE?si=KPa0Jn2IpSfu4EUQ"
+></video>
+
+Example:
+
+````markdown
+### 🚀 User Growth Traces
+
+This section highlights new user signups, retention, and churn over the last 30 days.
+
+- Trace updated hourly
+- Based on `user_events` table in ClickHouse
+`````
+
+---
+
+## ✨ Supported Markdown Features
+
+* Headings (`#`, `##`, `###`)
+* Bold, italic, and strikethrough text
+* Lists and checkboxes
+* Code blocks and inline code
+* Hyperlinks and external references
+* Emojis 👍 🚀 ✅
+
+---
+
+## ✅ Best Practices
+
+* Keep notes concise and relevant to nearby widgets
+* Use emoji and headings to make sections scannable
+* Update text as data sources or queries change
+
+---
+
+## 🔗 Related Guides
+
+* [Area Chart Widget →](/latest/features/dashboards/widgets/area-chart-widget)
+* [Bar Chart Widget →](/latest/features/dashboards/widgets/bar-chart-widget)
+* [Line Chart Widget →](/latest/features/dashboards/widgets/line-chart-widget)
+* [Pie Chart Widget →](/latest/features/dashboards/widgets/pie-chart-widget)
+* [Stat Widget →](/latest/features/dashboards/widgets/stat-widget)
+* [Table Widget →](/latest/features/dashboards/widgets/table-widget)
diff --git a/docs/latest/features/dashboards/widgets/pie-chart-widget.mdx b/docs/latest/features/dashboards/widgets/pie-chart-widget.mdx
new file mode 100644
index 00000000..42427d5b
--- /dev/null
+++ b/docs/latest/features/dashboards/widgets/pie-chart-widget.mdx
@@ -0,0 +1,75 @@
+---
+title: Pie Chart Widget
+description: Learn how to use the Pie Chart Widget in OpenLIT to display proportions and segment distributions using ClickHouse data.
+---
+
+The **Pie Chart Widget** in OpenLIT is perfect for showing how values are distributed across categories. Use it to represent proportions such as traffic sources, user roles, or error types.
+
+---
+
+## 📌 Use Cases
+
+- Visualize category breakdowns
+- Show relative proportions of segments (e.g. users by role)
+- Highlight top contributors to a total value
+- Display simple summaries at a glance
+
+---
+
+## 🛠️ How to Add a Pie Chart
+
+<video
+ controls
+ className="w-full aspect-video"
+ src="https://youtu.be/vUEIXLiY2Kk?si=pErjULQGf5CxWCI7"
+></video>
+
+Example:
+
+```sql
+WITH
+ parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,
+ parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,
+
+ SELECT
+ DISTINCT ResourceAttributes['service.name'] as applicationName,
+ ROUND(SUM(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost'])), 5) AS cost
+ FROM otel_traces
+ WHERE
+ SpanAttributes['gen_ai.operation.name'] != 'vectordb'
+ AND notEmpty(SpanAttributes['gen_ai.usage.cost'])
+ AND notEmpty(ResourceAttributes['service.name'])
+ AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')
+ AND Timestamp >= start_time AND Timestamp <= end_time
+ GROUP BY applicationName;
+````
+
+---
+
+## ⚙️ Configuration Options
+
+* Customize **colors**
+* Add paths for **labels** & **values**
+
+<Tip>
+Use dynamic bindings like `{{filter.timeLimit.start}}`, `{{filter.timeLimit.end}}` to make your chart respond to dashboard time filters.
+</Tip>
+
+---
+
+## ✅ Best Practices
+
+* Aggregate less-important categories into an "Other" group in SQL
+* Use percent labels for quick at-a-glance insights
+* Match colors with your product or brand theme for consistency
+
+---
+
+## 🔗 Related Guides
+
+* [Area Chart Widget →](/latest/features/dashboards/widgets/area-chart-widget)
+* [Bar Chart Widget →](/latest/features/dashboards/widgets/bar-chart-widget)
+* [Line Chart Widget →](/latest/features/dashboards/widgets/line-chart-widget)
+* [Markdown Widget →](/latest/features/dashboards/widgets/markdown-widget)
+* [Stat Widget →](/latest/features/dashboards/widgets/stat-widget)
+* [Table Widget →](/latest/features/dashboards/widgets/table-widget)
diff --git a/docs/latest/features/dashboards/widgets/stat-widget.mdx b/docs/latest/features/dashboards/widgets/stat-widget.mdx
new file mode 100644
index 00000000..eacbe609
--- /dev/null
+++ b/docs/latest/features/dashboards/widgets/stat-widget.mdx
@@ -0,0 +1,91 @@
+---
+title: Statistics Widget
+description: Learn how to use the Statistics Widget in OpenLIT to display key metrics, KPIs, and summary values with real-time ClickHouse data.
+---
+
+The **Statistics Widget** (or stat card) is designed to highlight your most important metrics in a clean, bold format. It’s ideal for surfacing KPIs, real-time values, or summary statistics at a glance.
+
+---
+
+## 📌 Use Cases
+
+- Display total signups, revenue, or active users
+- Show conversion rates, success percentages, or API error counts
+- Track live values on operational dashboards
+
+---
+
+## 🛠️ How to Add a Stat Card
+
+<video
+ controls
+ className="w-full aspect-video"
+ src="https://youtu.be/_XY28a192Io?si=EvIim4ZS0yv1HiPN"
+></video>
+
+Example:
+
+```sql
+WITH
+ parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,
+ parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,
+ (end_time - start_time) AS duration,
+ (start_time - duration) AS prev_start_time,
+ (end_time - duration) AS prev_end_time\n\nSELECT
+ round(sumIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),
+ Timestamp >= start_time AND Timestamp <= end_time), 7) AS total_usage_cost,\n
+ round(sumIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),
+ Timestamp >= prev_start_time AND Timestamp <= prev_end_time), 7) AS total_usage_cost_previous,\n
+ round(
+ if(
+ sumIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),
+ Timestamp >= prev_start_time AND Timestamp <= prev_end_time) = 0,
+ sumIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),
+ Timestamp >= start_time AND Timestamp <= end_time) * 100.0,
+ (
+ sumIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),
+ Timestamp >= start_time AND Timestamp <= end_time)
+ -
+ sumIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),
+ Timestamp >= prev_start_time AND Timestamp <= prev_end_time)
+ )
+ /
+ sumIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),
+ Timestamp >= prev_start_time AND Timestamp <= prev_end_time) * 100.0
+ ), 4
+ ) AS rate\nFROM otel_traces\nWHERE
+ SpanAttributes['gen_ai.operation.name'] != 'vectordb'
+ AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')
+ AND Timestamp >= prev_start_time AND Timestamp <= end_time\n
+````
+
+---
+
+## ⚙️ Configuration Options
+
+* Set **prefix/suffix** (e.g. `$`, `%`, `ms`)
+* Choose **colors**
+* Add **trend indicators**
+
+<Tip>
+Use dynamic filters like `{{filter.timeLimit.start}}`, `{{filter.timeLimit.end}}` to make the stat card responsive to dashboard-level controls.
+</Tip>
+
+---
+
+## ✅ Best Practices
+
+* Combine stat cards with charts for more context
+* Use consistent units (e.g., %, \$, MB)
+* Avoid overloading the dashboard with too many KPIs—focus on what matters
+
+---
+
+## 🔗 Related Guides
+
+* [Area Chart Widget →](/latest/features/dashboards/widgets/area-chart-widget)
+* [Bar Chart Widget →](/latest/features/dashboards/widgets/bar-chart-widget)
+* [Line Chart Widget →](/latest/features/dashboards/widgets/line-chart-widget)
+* [Markdown Widget →](/latest/features/dashboards/widgets/markdown-widget)
+* [Pie Chart Widget →](/latest/features/dashboards/widgets/pie-chart-widget)
+* [Table Widget →](/latest/features/dashboards/widgets/table-widget)
\ No newline at end of file
diff --git a/docs/latest/features/dashboards/widgets/table-widget.mdx b/docs/latest/features/dashboards/widgets/table-widget.mdx
new file mode 100644
index 00000000..ae7e19a0
--- /dev/null
+++ b/docs/latest/features/dashboards/widgets/table-widget.mdx
@@ -0,0 +1,70 @@
+---
+title: Table Widget
+description: Learn how to use the Table Widget in OpenLIT to display structured data with sorting, scrolling, and pagination using ClickHouse queries.
+---
+
+The **Table Widget** in OpenLIT is designed to display raw or structured data in a readable, paginated table format. It's perfect for logs, event traces, audit trails, or any dataset you want to explore row by row.
+
+---
+
+## 📌 Use Cases
+
+- Displaying raw logs or error records
+- Viewing user activity, API calls, or event data
+- Showing detailed reports or audit trails
+- Exploring top rows of a complex query result
+
+---
+
+## 🛠️ How to Add a Table
+
+<video
+ controls
+ className="w-full aspect-video"
+ src="https://youtu.be/PsBBCKXlwsI?si=QS8WTwP7WUq3Mi2_"
+></video>
+
+Example:
+
+```sql
+SELECT
+ user_id,
+ action,
+ timestamp,
+ properties
+FROM user_events
+WHERE event_time BETWEEN {{filter.timeLimit.start}} AND {{filter.timeLimit.end}}
+ORDER BY timestamp DESC
+LIMIT 100
+````
+
+---
+
+## ⚙️ Features
+
+* **Horizontal and vertical scrolling**
+* Choose **colors theme**
+* **Dynamic bindings** for time ranges or filters
+
+<Tip>
+Use dynamic filters like `{{filter.timeLimit.start}}`, `{{filter.timeLimit.end}}` to make the stat card responsive to dashboard-level controls.
+</Tip>
+
+---
+
+## ✅ Best Practices
+
+* Use aliases for column names for readability (`AS user_email`, `AS created_at`)
+* Limit unnecessary columns—focus on actionable fields
+* Use `{{filter.timeLimit.start}}`, `{{filter.timeLimit.end}}` to make tables dynamic
+
+---
+
+## 🔗 Related Guides
+
+* [Area Chart Widget →](/latest/features/dashboards/widgets/area-chart-widget)
+* [Bar Chart Widget →](/latest/features/dashboards/widgets/bar-chart-widget)
+* [Line Chart Widget →](/latest/features/dashboards/widgets/line-chart-widget)
+* [Markdown Widget →](/latest/features/dashboards/widgets/markdown-widget)
+* [Pie Chart Widget →](/latest/features/dashboards/widgets/pie-chart-widget)
+* [Stat Widget →](/latest/features/dashboards/widgets/stat-widget)
\ No newline at end of file
diff --git a/docs/latest/features/overview.mdx b/docs/latest/features/overview.mdx
index d72b60be..f2863a95 100644
--- a/docs/latest/features/overview.mdx
+++ b/docs/latest/features/overview.mdx
@@ -19,6 +19,10 @@ title: 'Overview'
Calculate costs for custom and fine-tuned LLMs using your own pricing data.
</Card>
+ <Card title="Create your own Dashboard" href="/latest/features/dashboards/introduction" icon='square-poll-horizontal'>
+ Create your first dashboard, set it as default, and get ready to add real-time visualizations.
+ </Card>
+
<Card title="Prompt Hub" href="/latest/features/prompt-hub" icon='comments'>
Manage prompts centrally, fetch versions, and use variables for dynamic prompts.
</Card>
diff --git a/docs/mint.json b/docs/mint.json
index cacd2af0..4672a9ff 100644
--- a/docs/mint.json
+++ b/docs/mint.json
@@ -21,7 +21,7 @@
"url": "https://github.com/openlit/openlit"
},
"modeToggle": {
- "default": "light"
+ "default": "dark"
},
"feedback": {
"thumbsRating": true,
@@ -66,6 +66,33 @@
"latest/features/metrics",
"latest/features/gpu",
"latest/features/pricing",
+ {
+ "group": "Dashboards",
+ "pages": [
+ "latest/features/dashboards/introduction",
+ "latest/features/dashboards/create-your-first-folder",
+ "latest/features/dashboards/create-your-first-dashboard",
+ "latest/features/dashboards/organize-your-dashboards",
+ "latest/features/dashboards/pin-your-dashboard",
+ "latest/features/dashboards/set-as-main-dashboard",
+ {
+ "group": "Widgets",
+ "pages": [
+ "latest/features/dashboards/widgets/introduction",
+ "latest/features/dashboards/widgets/area-chart-widget",
+ "latest/features/dashboards/widgets/bar-chart-widget",
+ "latest/features/dashboards/widgets/line-chart-widget",
+ "latest/features/dashboards/widgets/markdown-widget",
+ "latest/features/dashboards/widgets/pie-chart-widget",
+ "latest/features/dashboards/widgets/stat-widget",
+ "latest/features/dashboards/widgets/table-widget"
+ ]
+ },
+ "latest/features/dashboards/use-filters-and-dynamic-bindings",
+ "latest/features/dashboards/auto-refresh-and-time-interval"
+ ],
+ "version": "latest"
+ },
"latest/features/prompt-hub",
"latest/features/vault",
"latest/features/guardrails",
diff --git a/src/client/package-lock.json b/src/client/package-lock.json
index 52699b50..bd6d4460 100644
--- a/src/client/package-lock.json
+++ b/src/client/package-lock.json
@@ -1,18 +1,18 @@
{
"name": "openlit",
- "version": "1.13.3",
+ "version": "1.14.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "openlit",
- "version": "1.13.3",
+ "version": "1.14.0",
"dependencies": {
"@anthropic-ai/sdk": "^0.21.1",
"@clickhouse/client": "^1.1.0",
"@dhmk/zustand-lens": "^4.0.0",
"@mistralai/mistralai": "^0.4.0",
- "@mui/material": "^5.15.21",
+ "@monaco-editor/react": "^4.7.0",
"@next-auth/prisma-adapter": "^1.0.7",
"@prisma/client": "^5.15.0",
"@radix-ui/react-accordion": "^1.2.1",
@@ -48,6 +48,7 @@
"js-tiktoken": "^1.0.12",
"lodash": "^4.17.21",
"lucide-react": "^0.366.0",
+ "mustache": "^4.2.0",
"next": "^14.2.4",
"next-auth": "^4.24.7",
"next-themes": "^0.3.0",
@@ -55,8 +56,11 @@
"posthog-js": "^1.176.0",
"posthog-node": "^4.2.1",
"react": "^18.3.1",
+ "react-beautiful-dnd": "^13.1.1",
"react-day-picker": "^8.10.1",
"react-dom": "^18.3.1",
+ "react-grid-layout": "^1.5.1",
+ "react-markdown": "^10.1.0",
"react-resizable-panels": "^2.0.19",
"react-syntax-highlighter": "^15.5.0",
"recharts": "^2.12.7",
@@ -69,9 +73,12 @@
},
"devDependencies": {
"@types/lodash": "^4.17.5",
+ "@types/mustache": "^4.2.6",
"@types/node": "^20.14.2",
"@types/react": "^18.3.3",
+ "@types/react-beautiful-dnd": "^13.1.8",
"@types/react-dom": "^18.3.0",
+ "@types/react-grid-layout": "^1.3.5",
"@types/react-syntax-highlighter": "^15.5.13",
"@types/sqlstring": "^2.3.2",
"autoprefixer": "^10.0.1",
@@ -1222,6 +1229,7 @@
"version": "11.11.0",
"resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.11.0.tgz",
"integrity": "sha512-P34z9ssTCBi3e9EI1ZsWpNHcfY1r09ZO0rZbRO2ob3ZQMnFI35jB536qoXbkdesr5EUhYi22anuEJuyxifaqAQ==",
+ "peer": true,
"dependencies": {
"@emotion/memoize": "^0.8.1",
"@emotion/sheet": "^1.2.2",
@@ -1248,7 +1256,8 @@
"node_modules/@emotion/memoize": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.1.tgz",
- "integrity": "sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA=="
+ "integrity": "sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA==",
+ "peer": true
},
"node_modules/@emotion/react": {
"version": "11.11.4",
@@ -1290,7 +1299,8 @@
"node_modules/@emotion/sheet": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.2.2.tgz",
- "integrity": "sha512-0QBtGvaqtWi+nx6doRwDdBIzhNdZrXUppvTM4dtZZWEGTXL/XE/yJxLMGlDT1Gt+UHH5IX1n+jkXyytE/av7OA=="
+ "integrity": "sha512-0QBtGvaqtWi+nx6doRwDdBIzhNdZrXUppvTM4dtZZWEGTXL/XE/yJxLMGlDT1Gt+UHH5IX1n+jkXyytE/av7OA==",
+ "peer": true
},
"node_modules/@emotion/styled": {
"version": "11.11.5",
@@ -1333,12 +1343,14 @@
"node_modules/@emotion/utils": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.2.1.tgz",
- "integrity": "sha512-Y2tGf3I+XVnajdItskUCn6LX+VUDmP6lTL4fcqsXAv43dnlbZiuW4MWQW38rW/BVWSE7Q/7+XQocmpnRYILUmg=="
+ "integrity": "sha512-Y2tGf3I+XVnajdItskUCn6LX+VUDmP6lTL4fcqsXAv43dnlbZiuW4MWQW38rW/BVWSE7Q/7+XQocmpnRYILUmg==",
+ "peer": true
},
"node_modules/@emotion/weak-memoize": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.3.1.tgz",
- "integrity": "sha512-EsBwpc7hBUJWAsNPBmJy4hxWx12v6bshQsldrVmjxJoc3isbxhOrF2IcCpaXxfvq03NwkI7sbsOLXbYuqF/8Ww=="
+ "integrity": "sha512-EsBwpc7hBUJWAsNPBmJy4hxWx12v6bshQsldrVmjxJoc3isbxhOrF2IcCpaXxfvq03NwkI7sbsOLXbYuqF/8Ww==",
+ "peer": true
},
"node_modules/@eslint-community/eslint-utils": {
"version": "4.4.0",
@@ -1572,10 +1584,32 @@
"node-fetch": "^2.6.7"
}
},
+ "node_modules/@monaco-editor/loader": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/@monaco-editor/loader/-/loader-1.5.0.tgz",
+ "integrity": "sha512-hKoGSM+7aAc7eRTRjpqAZucPmoNOC4UUbknb/VNoTkEIkCPhqV8LfbsgM1webRM7S/z21eHEx9Fkwx8Z/C/+Xw==",
+ "dependencies": {
+ "state-local": "^1.0.6"
+ }
+ },
+ "node_modules/@monaco-editor/react": {
+ "version": "4.7.0",
+ "resolved": "https://registry.npmjs.org/@monaco-editor/react/-/react-4.7.0.tgz",
+ "integrity": "sha512-cyzXQCtO47ydzxpQtCGSQGOC8Gk3ZUeBXFAxD+CWXYFo5OqZyZUonFl0DwUlTyAfRHntBfw2p3w4s9R6oe1eCA==",
+ "dependencies": {
+ "@monaco-editor/loader": "^1.5.0"
+ },
+ "peerDependencies": {
+ "monaco-editor": ">= 0.25.0 < 1",
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
+ }
+ },
"node_modules/@mui/base": {
"version": "5.0.0-beta.40",
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.40.tgz",
"integrity": "sha512-I/lGHztkCzvwlXpjD2+SNmvNQvB4227xBXhISPjEaJUXGImOQ9f3D2Yj/T3KasSI/h0MLWy74X0J6clhPmsRbQ==",
+ "peer": true,
"dependencies": {
"@babel/runtime": "^7.23.9",
"@floating-ui/react-dom": "^2.0.8",
@@ -1607,6 +1641,7 @@
"version": "5.15.21",
"resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.15.21.tgz",
"integrity": "sha512-dp9lXBaJZzJYeJfQY3Ow4Rb49QaCEdkl2KKYscdQHQm6bMJ+l4XPY3Cd9PCeeJTsHPIDJ60lzXbeRgs6sx/rpw==",
+ "peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mui-org"
@@ -1616,6 +1651,7 @@
"version": "5.15.21",
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.15.21.tgz",
"integrity": "sha512-nTyCcgduKwHqiuQ/B03EQUa+utSMzn2sQp0QAibsnYe4tvc3zkMbO0amKpl48vhABIY3IvT6w9615BFIgMt0YA==",
+ "peer": true,
"dependencies": {
"@babel/runtime": "^7.23.9",
"@mui/base": "5.0.0-beta.40",
@@ -1660,6 +1696,7 @@
"version": "5.15.20",
"resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.15.20.tgz",
"integrity": "sha512-BK8F94AIqSrnaPYXf2KAOjGZJgWfvqAVQ2gVR3EryvQFtuBnG6RwodxrCvd3B48VuMy6Wsk897+lQMUxJyk+6g==",
+ "peer": true,
"dependencies": {
"@babel/runtime": "^7.23.9",
"@mui/utils": "^5.15.20",
@@ -1686,6 +1723,7 @@
"version": "5.15.14",
"resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.15.14.tgz",
"integrity": "sha512-RILkuVD8gY6PvjZjqnWhz8fu68dVkqhM5+jYWfB5yhlSQKg+2rHkmEwm75XIeAqI3qwOndK6zELK5H6Zxn4NHw==",
+ "peer": true,
"dependencies": {
"@babel/runtime": "^7.23.9",
"@emotion/cache": "^11.11.0",
@@ -1717,6 +1755,7 @@
"version": "5.15.20",
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.15.20.tgz",
"integrity": "sha512-LoMq4IlAAhxzL2VNUDBTQxAb4chnBe8JvRINVNDiMtHE2PiPOoHlhOPutSxEbaL5mkECPVWSv6p8JEV+uykwIA==",
+ "peer": true,
"dependencies": {
"@babel/runtime": "^7.23.9",
"@mui/private-theming": "^5.15.20",
@@ -1756,6 +1795,7 @@
"version": "7.2.14",
"resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.14.tgz",
"integrity": "sha512-MZsBZ4q4HfzBsywtXgM1Ksj6HDThtiwmOKUXH1pKYISI9gAVXCNHNpo7TlGoGrBaYWZTdNoirIN7JsQcQUjmQQ==",
+ "peer": true,
"peerDependencies": {
"@types/react": "^17.0.0 || ^18.0.0"
},
@@ -1769,6 +1809,7 @@
"version": "5.15.20",
"resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.15.20.tgz",
"integrity": "sha512-mAbYx0sovrnpAu1zHc3MDIhPqL8RPVC5W5xcO1b7PiSCJPtckIZmBkp8hefamAvUiAV8gpfMOM6Zb+eSisbI2A==",
+ "peer": true,
"dependencies": {
"@babel/runtime": "^7.23.9",
"@types/prop-types": "^15.7.11",
@@ -2003,6 +2044,7 @@
"version": "2.11.8",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
"integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==",
+ "peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/popperjs"
@@ -4650,6 +4692,27 @@
"resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz",
"integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw=="
},
+ "node_modules/@types/debug": {
+ "version": "4.1.12",
+ "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
+ "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==",
+ "dependencies": {
+ "@types/ms": "*"
+ }
+ },
+ "node_modules/@types/estree": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz",
+ "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ=="
+ },
+ "node_modules/@types/estree-jsx": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz",
+ "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==",
+ "dependencies": {
+ "@types/estree": "*"
+ }
+ },
"node_modules/@types/hast": {
"version": "2.3.10",
"resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.10.tgz",
@@ -4658,6 +4721,15 @@
"@types/unist": "^2"
}
},
+ "node_modules/@types/hoist-non-react-statics": {
+ "version": "3.3.6",
+ "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.6.tgz",
+ "integrity": "sha512-lPByRJUer/iN/xa4qpyL0qmL11DqNW81iU/IG1S3uvRUq4oKagz8VCxZjiWkumgt66YT3vOdDgZ0o32sGKtCEw==",
+ "dependencies": {
+ "@types/react": "*",
+ "hoist-non-react-statics": "^3.3.0"
+ }
+ },
"node_modules/@types/json5": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
@@ -4670,6 +4742,25 @@
"integrity": "sha512-MBIOHVZqVqgfro1euRDWX7OO0fBVUUMrN6Pwm8LQsz8cWhEpihlvR70ENj3f40j58TNxZaWv2ndSkInykNBBJw==",
"dev": true
},
+ "node_modules/@types/mdast": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz",
+ "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==",
+ "dependencies": {
+ "@types/unist": "*"
+ }
+ },
+ "node_modules/@types/ms": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz",
+ "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA=="
+ },
+ "node_modules/@types/mustache": {
+ "version": "4.2.6",
+ "resolved": "https://registry.npmjs.org/@types/mustache/-/mustache-4.2.6.tgz",
+ "integrity": "sha512-t+8/QWTAhOFlrF1IVZqKnMRJi84EgkIK5Kh0p2JV4OLywUvCwJPFxbJAl7XAow7DVIHsF+xW9f1MVzg0L6Szjw==",
+ "dev": true
+ },
"node_modules/@types/node": {
"version": "20.14.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.2.tgz",
@@ -4707,6 +4798,15 @@
"csstype": "^3.0.2"
}
},
+ "node_modules/@types/react-beautiful-dnd": {
+ "version": "13.1.8",
+ "resolved": "https://registry.npmjs.org/@types/react-beautiful-dnd/-/react-beautiful-dnd-13.1.8.tgz",
+ "integrity": "sha512-E3TyFsro9pQuK4r8S/OL6G99eq7p8v29sX0PM7oT8Z+PJfZvSQTx4zTQbUJ+QZXioAF0e7TGBEcA1XhYhCweyQ==",
+ "dev": true,
+ "dependencies": {
+ "@types/react": "*"
+ }
+ },
"node_modules/@types/react-dom": {
"version": "18.3.0",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.0.tgz",
@@ -4716,6 +4816,26 @@
"@types/react": "*"
}
},
+ "node_modules/@types/react-grid-layout": {
+ "version": "1.3.5",
+ "resolved": "https://registry.npmjs.org/@types/react-grid-layout/-/react-grid-layout-1.3.5.tgz",
+ "integrity": "sha512-WH/po1gcEcoR6y857yAnPGug+ZhkF4PaTUxgAbwfeSH/QOgVSakKHBXoPGad/sEznmkiaK3pqHk+etdWisoeBQ==",
+ "dev": true,
+ "dependencies": {
+ "@types/react": "*"
+ }
+ },
+ "node_modules/@types/react-redux": {
+ "version": "7.1.34",
+ "resolved": "https://registry.npmjs.org/@types/react-redux/-/react-redux-7.1.34.tgz",
+ "integrity": "sha512-GdFaVjEbYv4Fthm2ZLvj1VSCedV7TqE5y1kNwnjSdBOTXuRSgowux6J8TAct15T3CKBr63UMk+2CO7ilRhyrAQ==",
+ "dependencies": {
+ "@types/hoist-non-react-statics": "^3.3.0",
+ "@types/react": "*",
+ "hoist-non-react-statics": "^3.3.0",
+ "redux": "^4.0.0"
+ }
+ },
"node_modules/@types/react-syntax-highlighter": {
"version": "15.5.13",
"resolved": "https://registry.npmjs.org/@types/react-syntax-highlighter/-/react-syntax-highlighter-15.5.13.tgz",
@@ -4729,6 +4849,7 @@
"version": "4.4.10",
"resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.10.tgz",
"integrity": "sha512-hT/+s0VQs2ojCX823m60m5f0sL5idt9SO6Tj6Dg+rdphGPIeJbJ6CxvBYkgkGKrYeDjvIpKTR38UzmtHJOGW3Q==",
+ "peer": true,
"dependencies": {
"@types/react": "*"
}
@@ -4874,8 +4995,7 @@
"node_modules/@ungap/structured-clone": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz",
- "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==",
- "dev": true
+ "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ=="
},
"node_modules/abort-controller": {
"version": "3.0.0",
@@ -5281,6 +5401,15 @@
"npm": ">=6"
}
},
+ "node_modules/bail": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz",
+ "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@@ -5469,6 +5598,15 @@
}
]
},
+ "node_modules/ccount": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz",
+ "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
@@ -5501,6 +5639,15 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/character-entities-html4": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz",
+ "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/character-entities-legacy": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz",
@@ -5757,6 +5904,14 @@
"node": ">= 8"
}
},
+ "node_modules/css-box-model": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/css-box-model/-/css-box-model-1.2.1.tgz",
+ "integrity": "sha512-a7Vr4Q/kd/aw96bnJG332W9V9LkJO69JRcaCYDUqjp6/z0w6VcZjgAcTbgFxEPfBgdnAwlh3iwu+hLopa+flJw==",
+ "dependencies": {
+ "tiny-invariant": "^1.0.6"
+ }
+ },
"node_modules/cssesc": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
@@ -5970,6 +6125,27 @@
"resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz",
"integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg=="
},
+ "node_modules/decode-named-character-reference": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.1.0.tgz",
+ "integrity": "sha512-Wy+JTSbFThEOXQIR2L6mxJvEs+veIzpmqD7ynWxMXGpnk3smkHQOp6forLdHsKpAMW9iJpaBBIxz285t1n1C3w==",
+ "dependencies": {
+ "character-entities": "^2.0.0"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/decode-named-character-reference/node_modules/character-entities": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz",
+ "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/deep-is": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
@@ -6021,7 +6197,6 @@
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
"integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
- "dev": true,
"engines": {
"node": ">=6"
}
@@ -6031,6 +6206,18 @@
"resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz",
"integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ=="
},
+ "node_modules/devlop": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz",
+ "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==",
+ "dependencies": {
+ "dequal": "^2.0.0"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/didyoumean": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
@@ -6809,6 +6996,15 @@
"node": ">=4.0"
}
},
+ "node_modules/estree-util-is-identifier-name": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz",
+ "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
"node_modules/esutils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
@@ -6839,6 +7035,11 @@
"node": ">=0.8.x"
}
},
+ "node_modules/extend": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
+ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
+ },
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
@@ -7428,6 +7629,92 @@
"url": "https://opencollective.com/unified"
}
},
+ "node_modules/hast-util-to-jsx-runtime": {
+ "version": "2.3.6",
+ "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz",
+ "integrity": "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==",
+ "dependencies": {
+ "@types/estree": "^1.0.0",
+ "@types/hast": "^3.0.0",
+ "@types/unist": "^3.0.0",
+ "comma-separated-tokens": "^2.0.0",
+ "devlop": "^1.0.0",
+ "estree-util-is-identifier-name": "^3.0.0",
+ "hast-util-whitespace": "^3.0.0",
+ "mdast-util-mdx-expression": "^2.0.0",
+ "mdast-util-mdx-jsx": "^3.0.0",
+ "mdast-util-mdxjs-esm": "^2.0.0",
+ "property-information": "^7.0.0",
+ "space-separated-tokens": "^2.0.0",
+ "style-to-js": "^1.0.0",
+ "unist-util-position": "^5.0.0",
+ "vfile-message": "^4.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/hast-util-to-jsx-runtime/node_modules/@types/hast": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
+ "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
+ "dependencies": {
+ "@types/unist": "*"
+ }
+ },
+ "node_modules/hast-util-to-jsx-runtime/node_modules/@types/unist": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
+ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="
+ },
+ "node_modules/hast-util-to-jsx-runtime/node_modules/comma-separated-tokens": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz",
+ "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/hast-util-to-jsx-runtime/node_modules/property-information": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz",
+ "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/hast-util-to-jsx-runtime/node_modules/space-separated-tokens": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz",
+ "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/hast-util-whitespace": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz",
+ "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==",
+ "dependencies": {
+ "@types/hast": "^3.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/hast-util-whitespace/node_modules/@types/hast": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
+ "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
+ "dependencies": {
+ "@types/unist": "*"
+ }
+ },
"node_modules/hastscript": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/hastscript/-/hastscript-6.0.0.tgz",
@@ -7456,7 +7743,6 @@
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
"integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
- "peer": true,
"dependencies": {
"react-is": "^16.7.0"
}
@@ -7464,8 +7750,16 @@
"node_modules/hoist-non-react-statics/node_modules/react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
- "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
- "peer": true
+ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
+ },
+ "node_modules/html-url-attributes": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz",
+ "integrity": "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
},
"node_modules/humanize-ms": {
"version": "1.2.1",
@@ -7544,6 +7838,11 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true
},
+ "node_modules/inline-style-parser": {
+ "version": "0.2.4",
+ "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.4.tgz",
+ "integrity": "sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q=="
+ },
"node_modules/internal-slot": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz",
@@ -7853,6 +8152,17 @@
"node": ">=8"
}
},
+ "node_modules/is-plain-obj": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz",
+ "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/is-regex": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz",
@@ -8210,6 +8520,15 @@
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
"dev": true
},
+ "node_modules/longest-streak": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz",
+ "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/loose-envify": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
@@ -8253,79 +8572,792 @@
"react": "^16.5.1 || ^17.0.0 || ^18.0.0"
}
},
- "node_modules/merge2": {
- "version": "1.4.1",
- "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
- "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
- "engines": {
- "node": ">= 8"
+ "node_modules/mdast-util-from-markdown": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz",
+ "integrity": "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==",
+ "dependencies": {
+ "@types/mdast": "^4.0.0",
+ "@types/unist": "^3.0.0",
+ "decode-named-character-reference": "^1.0.0",
+ "devlop": "^1.0.0",
+ "mdast-util-to-string": "^4.0.0",
+ "micromark": "^4.0.0",
+ "micromark-util-decode-numeric-character-reference": "^2.0.0",
+ "micromark-util-decode-string": "^2.0.0",
+ "micromark-util-normalize-identifier": "^2.0.0",
+ "micromark-util-symbol": "^2.0.0",
+ "micromark-util-types": "^2.0.0",
+ "unist-util-stringify-position": "^4.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
}
},
- "node_modules/micromatch": {
- "version": "4.0.7",
- "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz",
- "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==",
+ "node_modules/mdast-util-from-markdown/node_modules/@types/unist": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
+ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="
+ },
+ "node_modules/mdast-util-mdx-expression": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz",
+ "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==",
"dependencies": {
- "braces": "^3.0.3",
- "picomatch": "^2.3.1"
+ "@types/estree-jsx": "^1.0.0",
+ "@types/hast": "^3.0.0",
+ "@types/mdast": "^4.0.0",
+ "devlop": "^1.0.0",
+ "mdast-util-from-markdown": "^2.0.0",
+ "mdast-util-to-markdown": "^2.0.0"
},
- "engines": {
- "node": ">=8.6"
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
}
},
- "node_modules/mime-db": {
- "version": "1.52.0",
- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
- "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
- "engines": {
- "node": ">= 0.6"
+ "node_modules/mdast-util-mdx-expression/node_modules/@types/hast": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
+ "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
+ "dependencies": {
+ "@types/unist": "*"
}
},
- "node_modules/mime-types": {
- "version": "2.1.35",
- "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
- "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
- "dependencies": {
- "mime-db": "1.52.0"
+ "node_modules/mdast-util-mdx-jsx": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.0.tgz",
+ "integrity": "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==",
+ "dependencies": {
+ "@types/estree-jsx": "^1.0.0",
+ "@types/hast": "^3.0.0",
+ "@types/mdast": "^4.0.0",
+ "@types/unist": "^3.0.0",
+ "ccount": "^2.0.0",
+ "devlop": "^1.1.0",
+ "mdast-util-from-markdown": "^2.0.0",
+ "mdast-util-to-markdown": "^2.0.0",
+ "parse-entities": "^4.0.0",
+ "stringify-entities": "^4.0.0",
+ "unist-util-stringify-position": "^4.0.0",
+ "vfile-message": "^4.0.0"
},
- "engines": {
- "node": ">= 0.6"
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
}
},
- "node_modules/minimatch": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
- "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
- "dev": true,
+ "node_modules/mdast-util-mdx-jsx/node_modules/@types/hast": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
+ "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
"dependencies": {
- "brace-expansion": "^1.1.7"
- },
- "engines": {
- "node": "*"
+ "@types/unist": "*"
}
},
- "node_modules/minimist": {
- "version": "1.2.8",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
- "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
- "dev": true,
+ "node_modules/mdast-util-mdx-jsx/node_modules/@types/unist": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
+ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="
+ },
+ "node_modules/mdast-util-mdx-jsx/node_modules/character-entities-legacy": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz",
+ "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==",
"funding": {
- "url": "https://github.com/sponsors/ljharb"
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
}
},
- "node_modules/minipass": {
- "version": "7.1.2",
- "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
- "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
- "engines": {
- "node": ">=16 || 14 >=14.17"
+ "node_modules/mdast-util-mdx-jsx/node_modules/character-reference-invalid": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz",
+ "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/mdast-util-mdx-jsx/node_modules/is-alphabetical": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz",
+ "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/mdast-util-mdx-jsx/node_modules/is-alphanumerical": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz",
+ "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==",
+ "dependencies": {
+ "is-alphabetical": "^2.0.0",
+ "is-decimal": "^2.0.0"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/mdast-util-mdx-jsx/node_modules/is-decimal": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz",
+ "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/mdast-util-mdx-jsx/node_modules/is-hexadecimal": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz",
+ "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/mdast-util-mdx-jsx/node_modules/parse-entities": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz",
+ "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==",
+ "dependencies": {
+ "@types/unist": "^2.0.0",
+ "character-entities-legacy": "^3.0.0",
+ "character-reference-invalid": "^2.0.0",
+ "decode-named-character-reference": "^1.0.0",
+ "is-alphanumerical": "^2.0.0",
+ "is-decimal": "^2.0.0",
+ "is-hexadecimal": "^2.0.0"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/mdast-util-mdx-jsx/node_modules/parse-entities/node_modules/@types/unist": {
+ "version": "2.0.11",
+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz",
+ "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA=="
+ },
+ "node_modules/mdast-util-mdxjs-esm": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz",
+ "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==",
+ "dependencies": {
+ "@types/estree-jsx": "^1.0.0",
+ "@types/hast": "^3.0.0",
+ "@types/mdast": "^4.0.0",
+ "devlop": "^1.0.0",
+ "mdast-util-from-markdown": "^2.0.0",
+ "mdast-util-to-markdown": "^2.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/mdast-util-mdxjs-esm/node_modules/@types/hast": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
+ "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
+ "dependencies": {
+ "@types/unist": "*"
+ }
+ },
+ "node_modules/mdast-util-phrasing": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz",
+ "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==",
+ "dependencies": {
+ "@types/mdast": "^4.0.0",
+ "unist-util-is": "^6.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/mdast-util-to-hast": {
+ "version": "13.2.0",
+ "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz",
+ "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==",
+ "dependencies": {
+ "@types/hast": "^3.0.0",
+ "@types/mdast": "^4.0.0",
+ "@ungap/structured-clone": "^1.0.0",
+ "devlop": "^1.0.0",
+ "micromark-util-sanitize-uri": "^2.0.0",
+ "trim-lines": "^3.0.0",
+ "unist-util-position": "^5.0.0",
+ "unist-util-visit": "^5.0.0",
+ "vfile": "^6.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/mdast-util-to-hast/node_modules/@types/hast": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
+ "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
+ "dependencies": {
+ "@types/unist": "*"
+ }
+ },
+ "node_modules/mdast-util-to-markdown": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz",
+ "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==",
+ "dependencies": {
+ "@types/mdast": "^4.0.0",
+ "@types/unist": "^3.0.0",
+ "longest-streak": "^3.0.0",
+ "mdast-util-phrasing": "^4.0.0",
+ "mdast-util-to-string": "^4.0.0",
+ "micromark-util-classify-character": "^2.0.0",
+ "micromark-util-decode-string": "^2.0.0",
+ "unist-util-visit": "^5.0.0",
+ "zwitch": "^2.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/mdast-util-to-markdown/node_modules/@types/unist": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
+ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="
+ },
+ "node_modules/mdast-util-to-string": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz",
+ "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==",
+ "dependencies": {
+ "@types/mdast": "^4.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/memoize-one": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.2.1.tgz",
+ "integrity": "sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q=="
+ },
+ "node_modules/merge2": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/micromark": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz",
+ "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "@types/debug": "^4.0.0",
+ "debug": "^4.0.0",
+ "decode-named-character-reference": "^1.0.0",
+ "devlop": "^1.0.0",
+ "micromark-core-commonmark": "^2.0.0",
+ "micromark-factory-space": "^2.0.0",
+ "micromark-util-character": "^2.0.0",
+ "micromark-util-chunked": "^2.0.0",
+ "micromark-util-combine-extensions": "^2.0.0",
+ "micromark-util-decode-numeric-character-reference": "^2.0.0",
+ "micromark-util-encode": "^2.0.0",
+ "micromark-util-normalize-identifier": "^2.0.0",
+ "micromark-util-resolve-all": "^2.0.0",
+ "micromark-util-sanitize-uri": "^2.0.0",
+ "micromark-util-subtokenize": "^2.0.0",
+ "micromark-util-symbol": "^2.0.0",
+ "micromark-util-types": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-core-commonmark": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz",
+ "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "decode-named-character-reference": "^1.0.0",
+ "devlop": "^1.0.0",
+ "micromark-factory-destination": "^2.0.0",
+ "micromark-factory-label": "^2.0.0",
+ "micromark-factory-space": "^2.0.0",
+ "micromark-factory-title": "^2.0.0",
+ "micromark-factory-whitespace": "^2.0.0",
+ "micromark-util-character": "^2.0.0",
+ "micromark-util-chunked": "^2.0.0",
+ "micromark-util-classify-character": "^2.0.0",
+ "micromark-util-html-tag-name": "^2.0.0",
+ "micromark-util-normalize-identifier": "^2.0.0",
+ "micromark-util-resolve-all": "^2.0.0",
+ "micromark-util-subtokenize": "^2.0.0",
+ "micromark-util-symbol": "^2.0.0",
+ "micromark-util-types": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-factory-destination": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz",
+ "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "micromark-util-character": "^2.0.0",
+ "micromark-util-symbol": "^2.0.0",
+ "micromark-util-types": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-factory-label": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz",
+ "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "devlop": "^1.0.0",
+ "micromark-util-character": "^2.0.0",
+ "micromark-util-symbol": "^2.0.0",
+ "micromark-util-types": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-factory-space": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz",
+ "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "micromark-util-character": "^2.0.0",
+ "micromark-util-types": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-factory-title": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz",
+ "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "micromark-factory-space": "^2.0.0",
+ "micromark-util-character": "^2.0.0",
+ "micromark-util-symbol": "^2.0.0",
+ "micromark-util-types": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-factory-whitespace": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz",
+ "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "micromark-factory-space": "^2.0.0",
+ "micromark-util-character": "^2.0.0",
+ "micromark-util-symbol": "^2.0.0",
+ "micromark-util-types": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-util-character": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz",
+ "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "micromark-util-symbol": "^2.0.0",
+ "micromark-util-types": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-util-chunked": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz",
+ "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "micromark-util-symbol": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-util-classify-character": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz",
+ "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "micromark-util-character": "^2.0.0",
+ "micromark-util-symbol": "^2.0.0",
+ "micromark-util-types": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-util-combine-extensions": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz",
+ "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "micromark-util-chunked": "^2.0.0",
+ "micromark-util-types": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-util-decode-numeric-character-reference": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz",
+ "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "micromark-util-symbol": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-util-decode-string": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz",
+ "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "decode-named-character-reference": "^1.0.0",
+ "micromark-util-character": "^2.0.0",
+ "micromark-util-decode-numeric-character-reference": "^2.0.0",
+ "micromark-util-symbol": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-util-encode": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz",
+ "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ]
+ },
+ "node_modules/micromark-util-html-tag-name": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz",
+ "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ]
+ },
+ "node_modules/micromark-util-normalize-identifier": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz",
+ "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "micromark-util-symbol": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-util-resolve-all": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz",
+ "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "micromark-util-types": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-util-sanitize-uri": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz",
+ "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "micromark-util-character": "^2.0.0",
+ "micromark-util-encode": "^2.0.0",
+ "micromark-util-symbol": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-util-subtokenize": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz",
+ "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ],
+ "dependencies": {
+ "devlop": "^1.0.0",
+ "micromark-util-chunked": "^2.0.0",
+ "micromark-util-symbol": "^2.0.0",
+ "micromark-util-types": "^2.0.0"
+ }
+ },
+ "node_modules/micromark-util-symbol": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz",
+ "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ]
+ },
+ "node_modules/micromark-util-types": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz",
+ "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==",
+ "funding": [
+ {
+ "type": "GitHub Sponsors",
+ "url": "https://github.com/sponsors/unifiedjs"
+ },
+ {
+ "type": "OpenCollective",
+ "url": "https://opencollective.com/unified"
+ }
+ ]
+ },
+ "node_modules/micromatch": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz",
+ "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==",
+ "dependencies": {
+ "braces": "^3.0.3",
+ "picomatch": "^2.3.1"
+ },
+ "engines": {
+ "node": ">=8.6"
+ }
+ },
+ "node_modules/mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/minimatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+ "dev": true,
+ "dependencies": {
+ "brace-expansion": "^1.1.7"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/minimist": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
+ "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
+ "dev": true,
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/minipass": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
+ "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ }
+ },
+ "node_modules/monaco-editor": {
+ "version": "0.52.2",
+ "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.52.2.tgz",
+ "integrity": "sha512-GEQWEZmfkOGLdd3XK8ryrfWz3AIP8YymVXiPHEdewrUq7mh0qrKrfHLNCXcbB6sTnMLnOZ3ztSiKcciFUkIJwQ==",
+ "peer": true
+ },
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
+ "node_modules/mustache": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz",
+ "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==",
+ "bin": {
+ "mustache": "bin/mustache"
+ }
+ },
"node_modules/mz": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz",
@@ -9243,6 +10275,11 @@
}
]
},
+ "node_modules/raf-schd": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/raf-schd/-/raf-schd-4.0.3.tgz",
+ "integrity": "sha512-tQkJl2GRWh83ui2DiPTJz9wEiMN20syf+5oKfB03yYP7ioZcJwsIK8FjrtLwH1m7C7e+Tt2yYBlrOpdT+dyeIQ=="
+ },
"node_modules/react": {
"version": "18.3.1",
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
@@ -9254,6 +10291,25 @@
"node": ">=0.10.0"
}
},
+ "node_modules/react-beautiful-dnd": {
+ "version": "13.1.1",
+ "resolved": "https://registry.npmjs.org/react-beautiful-dnd/-/react-beautiful-dnd-13.1.1.tgz",
+ "integrity": "sha512-0Lvs4tq2VcrEjEgDXHjT98r+63drkKEgqyxdA7qD3mvKwga6a5SscbdLPO2IExotU1jW8L0Ksdl0Cj2AF67nPQ==",
+ "deprecated": "react-beautiful-dnd is now deprecated. Context and options: https://github.com/atlassian/react-beautiful-dnd/issues/2672",
+ "dependencies": {
+ "@babel/runtime": "^7.9.2",
+ "css-box-model": "^1.2.0",
+ "memoize-one": "^5.1.1",
+ "raf-schd": "^4.0.2",
+ "react-redux": "^7.2.0",
+ "redux": "^4.0.4",
+ "use-memo-one": "^1.1.1"
+ },
+ "peerDependencies": {
+ "react": "^16.8.5 || ^17.0.0 || ^18.0.0",
+ "react-dom": "^16.8.5 || ^17.0.0 || ^18.0.0"
+ }
+ },
"node_modules/react-day-picker": {
"version": "8.10.1",
"resolved": "https://registry.npmjs.org/react-day-picker/-/react-day-picker-8.10.1.tgz",
@@ -9279,10 +10335,117 @@
"react": "^18.3.1"
}
},
+ "node_modules/react-draggable": {
+ "version": "4.4.6",
+ "resolved": "https://registry.npmjs.org/react-draggable/-/react-draggable-4.4.6.tgz",
+ "integrity": "sha512-LtY5Xw1zTPqHkVmtM3X8MUOxNDOUhv/khTgBgrUvwaS064bwVvxT+q5El0uUFNx5IEPKXuRejr7UqLwBIg5pdw==",
+ "dependencies": {
+ "clsx": "^1.1.1",
+ "prop-types": "^15.8.1"
+ },
+ "peerDependencies": {
+ "react": ">= 16.3.0",
+ "react-dom": ">= 16.3.0"
+ }
+ },
+ "node_modules/react-draggable/node_modules/clsx": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz",
+ "integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/react-grid-layout": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/react-grid-layout/-/react-grid-layout-1.5.1.tgz",
+ "integrity": "sha512-4Fr+kKMk0+m1HL/BWfHxi/lRuaOmDNNKQDcu7m12+NEYcen20wIuZFo789u3qWCyvUsNUxCiyf0eKq4WiJSNYw==",
+ "dependencies": {
+ "clsx": "^2.0.0",
+ "fast-equals": "^4.0.3",
+ "prop-types": "^15.8.1",
+ "react-draggable": "^4.4.5",
+ "react-resizable": "^3.0.5",
+ "resize-observer-polyfill": "^1.5.1"
+ },
+ "peerDependencies": {
+ "react": ">= 16.3.0",
+ "react-dom": ">= 16.3.0"
+ }
+ },
+ "node_modules/react-grid-layout/node_modules/fast-equals": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-4.0.3.tgz",
+ "integrity": "sha512-G3BSX9cfKttjr+2o1O22tYMLq0DPluZnYtq1rXumE1SpL/F/SLIfHx08WYQoWSIpeMYf8sRbJ8++71+v6Pnxfg=="
+ },
"node_modules/react-is": {
"version": "18.3.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
- "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="
+ "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==",
+ "peer": true
+ },
+ "node_modules/react-markdown": {
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-10.1.0.tgz",
+ "integrity": "sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ==",
+ "dependencies": {
+ "@types/hast": "^3.0.0",
+ "@types/mdast": "^4.0.0",
+ "devlop": "^1.0.0",
+ "hast-util-to-jsx-runtime": "^2.0.0",
+ "html-url-attributes": "^3.0.0",
+ "mdast-util-to-hast": "^13.0.0",
+ "remark-parse": "^11.0.0",
+ "remark-rehype": "^11.0.0",
+ "unified": "^11.0.0",
+ "unist-util-visit": "^5.0.0",
+ "vfile": "^6.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ },
+ "peerDependencies": {
+ "@types/react": ">=18",
+ "react": ">=18"
+ }
+ },
+ "node_modules/react-markdown/node_modules/@types/hast": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
+ "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
+ "dependencies": {
+ "@types/unist": "*"
+ }
+ },
+ "node_modules/react-redux": {
+ "version": "7.2.9",
+ "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.2.9.tgz",
+ "integrity": "sha512-Gx4L3uM182jEEayZfRbI/G11ZpYdNAnBs70lFVMNdHJI76XYtR+7m0MN+eAs7UHBPhWXcnFPaS+9owSCJQHNpQ==",
+ "dependencies": {
+ "@babel/runtime": "^7.15.4",
+ "@types/react-redux": "^7.1.20",
+ "hoist-non-react-statics": "^3.3.2",
+ "loose-envify": "^1.4.0",
+ "prop-types": "^15.7.2",
+ "react-is": "^17.0.2"
+ },
+ "peerDependencies": {
+ "react": "^16.8.3 || ^17 || ^18"
+ },
+ "peerDependenciesMeta": {
+ "react-dom": {
+ "optional": true
+ },
+ "react-native": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/react-redux/node_modules/react-is": {
+ "version": "17.0.2",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
+ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="
},
"node_modules/react-remove-scroll": {
"version": "2.5.5",
@@ -9329,6 +10492,18 @@
}
}
},
+ "node_modules/react-resizable": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/react-resizable/-/react-resizable-3.0.5.tgz",
+ "integrity": "sha512-vKpeHhI5OZvYn82kXOs1bC8aOXktGU5AmKAgaZS4F5JPburCtbmDPqE7Pzp+1kN4+Wb81LlF33VpGwWwtXem+w==",
+ "dependencies": {
+ "prop-types": "15.x",
+ "react-draggable": "^4.0.3"
+ },
+ "peerDependencies": {
+ "react": ">= 16.3"
+ }
+ },
"node_modules/react-resizable-panels": {
"version": "2.0.19",
"resolved": "https://registry.npmjs.org/react-resizable-panels/-/react-resizable-panels-2.0.19.tgz",
@@ -9473,6 +10648,14 @@
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
},
+ "node_modules/redux": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz",
+ "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==",
+ "dependencies": {
+ "@babel/runtime": "^7.9.2"
+ }
+ },
"node_modules/reflect.getprototypeof": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.6.tgz",
@@ -9539,6 +10722,50 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/remark-parse": {
+ "version": "11.0.0",
+ "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz",
+ "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==",
+ "dependencies": {
+ "@types/mdast": "^4.0.0",
+ "mdast-util-from-markdown": "^2.0.0",
+ "micromark-util-types": "^2.0.0",
+ "unified": "^11.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/remark-rehype": {
+ "version": "11.1.2",
+ "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz",
+ "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==",
+ "dependencies": {
+ "@types/hast": "^3.0.0",
+ "@types/mdast": "^4.0.0",
+ "mdast-util-to-hast": "^13.0.0",
+ "unified": "^11.0.0",
+ "vfile": "^6.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/remark-rehype/node_modules/@types/hast": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",
+ "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==",
+ "dependencies": {
+ "@types/unist": "*"
+ }
+ },
+ "node_modules/resize-observer-polyfill": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz",
+ "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg=="
+ },
"node_modules/resolve": {
"version": "1.22.8",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
@@ -9849,6 +11076,11 @@
"node": ">= 0.6"
}
},
+ "node_modules/state-local": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/state-local/-/state-local-1.0.7.tgz",
+ "integrity": "sha512-HTEHMNieakEnoe33shBYcZ7NX83ACUjCu8c40iOGEZsngj9zRnkqS9j1pqQPXwobB0ZcVTk27REb7COQ0UR59w=="
+ },
"node_modules/streamsearch": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
@@ -10000,6 +11232,28 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/stringify-entities": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz",
+ "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==",
+ "dependencies": {
+ "character-entities-html4": "^2.0.0",
+ "character-entities-legacy": "^3.0.0"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/stringify-entities/node_modules/character-entities-legacy": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz",
+ "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
@@ -10049,6 +11303,22 @@
"resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz",
"integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA=="
},
+ "node_modules/style-to-js": {
+ "version": "1.1.16",
+ "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.16.tgz",
+ "integrity": "sha512-/Q6ld50hKYPH3d/r6nr117TZkHR0w0kGGIVfpG9N6D8NymRPM9RqCUv4pRpJ62E5DqOYx2AFpbZMyCPnjQCnOw==",
+ "dependencies": {
+ "style-to-object": "1.0.8"
+ }
+ },
+ "node_modules/style-to-object": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.8.tgz",
+ "integrity": "sha512-xT47I/Eo0rwJmaXC4oilDGDWLohVhR6o/xAQcPQN8q6QBuZVL8qMYL85kLmST5cPjAorwvqIA4qXTRQoYHaL6g==",
+ "dependencies": {
+ "inline-style-parser": "0.2.4"
+ }
+ },
"node_modules/styled-jsx": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz",
@@ -10074,7 +11344,8 @@
"node_modules/stylis": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.2.0.tgz",
- "integrity": "sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw=="
+ "integrity": "sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw==",
+ "peer": true
},
"node_modules/sucrase": {
"version": "3.35.0",
@@ -10258,6 +11529,24 @@
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
},
+ "node_modules/trim-lines": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz",
+ "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/trough": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz",
+ "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
"node_modules/ts-api-utils": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz",
@@ -10422,6 +11711,117 @@
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
},
+ "node_modules/unified": {
+ "version": "11.0.5",
+ "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz",
+ "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==",
+ "dependencies": {
+ "@types/unist": "^3.0.0",
+ "bail": "^2.0.0",
+ "devlop": "^1.0.0",
+ "extend": "^3.0.0",
+ "is-plain-obj": "^4.0.0",
+ "trough": "^2.0.0",
+ "vfile": "^6.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/unified/node_modules/@types/unist": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
+ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="
+ },
+ "node_modules/unist-util-is": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz",
+ "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==",
+ "dependencies": {
+ "@types/unist": "^3.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/unist-util-is/node_modules/@types/unist": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
+ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="
+ },
+ "node_modules/unist-util-position": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz",
+ "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==",
+ "dependencies": {
+ "@types/unist": "^3.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/unist-util-position/node_modules/@types/unist": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
+ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="
+ },
+ "node_modules/unist-util-stringify-position": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz",
+ "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==",
+ "dependencies": {
+ "@types/unist": "^3.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/unist-util-stringify-position/node_modules/@types/unist": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
+ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="
+ },
+ "node_modules/unist-util-visit": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz",
+ "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==",
+ "dependencies": {
+ "@types/unist": "^3.0.0",
+ "unist-util-is": "^6.0.0",
+ "unist-util-visit-parents": "^6.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/unist-util-visit-parents": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz",
+ "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==",
+ "dependencies": {
+ "@types/unist": "^3.0.0",
+ "unist-util-is": "^6.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/unist-util-visit-parents/node_modules/@types/unist": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
+ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="
+ },
+ "node_modules/unist-util-visit/node_modules/@types/unist": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
+ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="
+ },
"node_modules/update-browserslist-db": {
"version": "1.0.16",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz",
@@ -10486,6 +11886,14 @@
}
}
},
+ "node_modules/use-memo-one": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/use-memo-one/-/use-memo-one-1.1.3.tgz",
+ "integrity": "sha512-g66/K7ZQGYrI6dy8GLpVcMsBp4s17xNkYJVSMvTEevGy3nDxHOfE6z8BVE22+5G5x7t3+bhzrlTDB7ObrEE0cQ==",
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
"node_modules/use-sidecar": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/use-sidecar/-/use-sidecar-1.1.2.tgz",
@@ -10520,6 +11928,42 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
+ "node_modules/vfile": {
+ "version": "6.0.3",
+ "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz",
+ "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==",
+ "dependencies": {
+ "@types/unist": "^3.0.0",
+ "vfile-message": "^4.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/vfile-message": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz",
+ "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==",
+ "dependencies": {
+ "@types/unist": "^3.0.0",
+ "unist-util-stringify-position": "^4.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
+ "node_modules/vfile-message/node_modules/@types/unist": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
+ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="
+ },
+ "node_modules/vfile/node_modules/@types/unist": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
+ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="
+ },
"node_modules/victory-vendor": {
"version": "36.9.2",
"resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-36.9.2.tgz",
@@ -10853,6 +12297,15 @@
"optional": true
}
}
+ },
+ "node_modules/zwitch": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz",
+ "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
}
}
}
diff --git a/src/client/package.json b/src/client/package.json
index 07d07b89..23e54b50 100644
--- a/src/client/package.json
+++ b/src/client/package.json
@@ -1,6 +1,6 @@
{
"name": "openlit",
- "version": "1.13.3",
+ "version": "1.14.0",
"private": true,
"scripts": {
"dev": "next dev",
@@ -14,7 +14,7 @@
"@clickhouse/client": "^1.1.0",
"@dhmk/zustand-lens": "^4.0.0",
"@mistralai/mistralai": "^0.4.0",
- "@mui/material": "^5.15.21",
+ "@monaco-editor/react": "^4.7.0",
"@next-auth/prisma-adapter": "^1.0.7",
"@prisma/client": "^5.15.0",
"@radix-ui/react-accordion": "^1.2.1",
@@ -50,6 +50,7 @@
"js-tiktoken": "^1.0.12",
"lodash": "^4.17.21",
"lucide-react": "^0.366.0",
+ "mustache": "^4.2.0",
"next": "^14.2.4",
"next-auth": "^4.24.7",
"next-themes": "^0.3.0",
@@ -57,8 +58,11 @@
"posthog-js": "^1.176.0",
"posthog-node": "^4.2.1",
"react": "^18.3.1",
+ "react-beautiful-dnd": "^13.1.1",
"react-day-picker": "^8.10.1",
"react-dom": "^18.3.1",
+ "react-grid-layout": "^1.5.1",
+ "react-markdown": "^10.1.0",
"react-resizable-panels": "^2.0.19",
"react-syntax-highlighter": "^15.5.0",
"recharts": "^2.12.7",
@@ -71,9 +75,12 @@
},
"devDependencies": {
"@types/lodash": "^4.17.5",
+ "@types/mustache": "^4.2.6",
"@types/node": "^20.14.2",
"@types/react": "^18.3.3",
+ "@types/react-beautiful-dnd": "^13.1.8",
"@types/react-dom": "^18.3.0",
+ "@types/react-grid-layout": "^1.3.5",
"@types/react-syntax-highlighter": "^15.5.13",
"@types/sqlstring": "^2.3.2",
"autoprefixer": "^10.0.1",
diff --git a/src/client/src/app/(playground)/d/[id]/page.tsx b/src/client/src/app/(playground)/d/[id]/page.tsx
new file mode 100644
index 00000000..e2766e42
--- /dev/null
+++ b/src/client/src/app/(playground)/d/[id]/page.tsx
@@ -0,0 +1,196 @@
+"use client";
+
+import { useEffect, useMemo, useState } from "react";
+import Dashboard from "@/components/(playground)/manage-dashboard/board-creator";
+import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
+import { useParams } from "next/navigation";
+import { DashboardConfig, Widget } from "@/components/(playground)/manage-dashboard/board-creator/types";
+import getMessage from "@/constants/messages";
+import Loader from "@/components/common/loader";
+import Filter from "@/components/(playground)/filter";
+import { getFilterParamsForDashboard } from "@/helpers/client/filter";
+import { useFilters } from "@/selectors/filter";
+import { usePageHeader } from "@/selectors/page";
+import { usePostHog } from "posthog-js/react";
+import { Board } from "@/types/manage-dashboard";
+import { CLIENT_EVENTS } from "@/constants/events";
+
+export default function DashboardPage() {
+ const { details: filter } = useFilters();
+ const { fireRequest, error, isLoading } = useFetchWrapper();
+ const { fireRequest: fireRunQuery } = useFetchWrapper();
+ const { fireRequest: fireRequestWidget } = useFetchWrapper();
+ const { fireRequest: fireSaveLayout } = useFetchWrapper();
+ const params = useParams();
+ const boardId = params.id as string;
+ const [initialConfig, setInitialConfig] = useState<
+ DashboardConfig | undefined
+ >();
+ const { setHeader } = usePageHeader();
+ const posthog = usePostHog();
+
+ const handleHeaderUpdates = (details: Partial<Board>) => {
+ setHeader({
+ title: details.title || "",
+ description: details.description || "",
+ breadcrumbs: [],
+ });
+ };
+
+ const fetchBoardLayout = async () => {
+ try {
+ const { response, error } = await fireRequest({
+ requestType: "GET",
+ url: `/api/manage-dashboard/board/${boardId}/layout`,
+ });
+
+ if (error) {
+ throw new Error(error);
+ }
+
+ if (response?.data) {
+ setInitialConfig(response.data);
+ handleHeaderUpdates(response.data);
+ }
+ } catch (error) {
+ console.error("Failed to fetch board layout:", error);
+ }
+ };
+
+ useEffect(() => {
+ fetchBoardLayout();
+ }, [boardId, fireRequest]);
+
+ useEffect(() => {
+ if (initialConfig) {
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_VIEWED, {
+ title: initialConfig?.title,
+ widgets: initialConfig?.widgets?.length || 0,
+ });
+ }
+ }, [initialConfig, posthog]);
+
+ const runFilters = useMemo(() => {
+ return getFilterParamsForDashboard({
+ ...filter,
+ });
+ }, [filter]);
+
+ const runQuery = async (
+ widgetId: string,
+ params: Record<string, unknown>
+ ) => {
+ const data = await fireRunQuery({
+ requestType: "POST",
+ url: "/api/manage-dashboard/query/run",
+ // Add params of the dashboard & add a check for edit mode to send query or not through body
+ body: JSON.stringify({ widgetId, filter: runFilters, ...params }),
+ });
+
+ return data.response;
+ };
+
+ const handleSave = async (config: DashboardConfig) => {
+ try {
+ await fireSaveLayout({
+ requestType: "PUT",
+ url: `/api/manage-dashboard/board/${boardId}/layout`,
+ body: JSON.stringify(config),
+ failureCb: (error) => {
+ throw new Error(error);
+ },
+ });
+ } catch (error) {
+ console.error("Failed to save dashboard layout:", error);
+ throw error;
+ }
+ };
+
+ const handleWidgetCrud = async (updates: Partial<Widget>) => {
+ try {
+ if (updates.id) {
+ const { response, error } = await fireRequestWidget({
+ requestType: "PUT",
+ url: `/api/manage-dashboard/widget/${updates.id}`,
+ body: JSON.stringify(updates),
+ });
+
+ if (error) {
+ throw new Error(error);
+ }
+
+ return response.data;
+ } else {
+ const { response, error } = await fireRequestWidget({
+ requestType: "POST",
+ url: `/api/manage-dashboard/widget`,
+ body: JSON.stringify(updates),
+ });
+
+ if (error) {
+ throw new Error(error);
+ }
+
+ return response.data;
+ }
+ } catch (error) {
+ console.error("Failed to update widget:", error);
+ throw error;
+ }
+ };
+
+ const fetchExistingWidgets = async () => {
+ const { response, error } = await fireRequestWidget({
+ requestType: "GET",
+ url: "/api/manage-dashboard/widget",
+ });
+
+ if (error) {
+ throw new Error(error);
+ }
+
+ return response.data;
+ };
+
+ return (
+ <div className="flex flex-col items-center w-full justify-between h-full">
+ <div className="w-full h-full overflow-y-auto">
+ {
+ !isLoading && (error as Error) && (
+ <div className="flex flex-col items-center w-full justify-center h-full">
+ <p className="text-xl text-red-500">
+ {getMessage().ERROR_OCCURED}
+ </p>
+ <p className="text-sm text-stone-500 dark:text-stone-400">
+ {getMessage().ERROR_OCCURED_DESCRIPTION}
+ </p>
+ </div>
+ )
+ }
+ {
+ isLoading && (
+ <div className="flex flex-col items-center w-full justify-center h-full">
+ <Loader />
+ </div>
+ )
+ }
+ {initialConfig && (
+ <Dashboard
+ initialConfig={initialConfig}
+ runQuery={runQuery}
+ onSave={handleSave}
+ handleWidgetCrud={handleWidgetCrud}
+ fetchExistingWidgets={fetchExistingWidgets}
+ runFilters={runFilters}
+ headerComponent={(
+ <div className="flex shrink-0">
+ <Filter className="items-end" />
+ </div>
+ )}
+ handleBoardUpdates={handleHeaderUpdates}
+ />
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/src/client/src/app/(playground)/dashboards/dashboard/page.tsx b/src/client/src/app/(playground)/dashboards/dashboard/page.tsx
new file mode 100644
index 00000000..1a8b669c
--- /dev/null
+++ b/src/client/src/app/(playground)/dashboards/dashboard/page.tsx
@@ -0,0 +1,15 @@
+"use client";
+import Board from "@/components/(playground)/manage-dashboard/board";
+import { usePostHog } from "posthog-js/react";
+import { CLIENT_EVENTS } from "@/constants/events";
+import { useEffect } from "react";
+
+export default function BoardPage() {
+ const posthog = usePostHog();
+
+ useEffect(() => {
+ posthog?.capture(CLIENT_EVENTS.LIST_DASHBOARDS_PAGE_VISITED);
+ }, []);
+
+ return <Board />;
+}
diff --git a/src/client/src/app/(playground)/dashboards/explorer/page.tsx b/src/client/src/app/(playground)/dashboards/explorer/page.tsx
new file mode 100644
index 00000000..567b837f
--- /dev/null
+++ b/src/client/src/app/(playground)/dashboards/explorer/page.tsx
@@ -0,0 +1,15 @@
+"use client";
+
+import DashboardExplorer from "@/components/(playground)/manage-dashboard/explorer";
+import { usePostHog } from "posthog-js/react";
+import { CLIENT_EVENTS } from "@/constants/events";
+import { useEffect } from "react";
+
+export default function DashboardPage() {
+ const posthog = usePostHog();
+
+ useEffect(() => {
+ posthog?.capture(CLIENT_EVENTS.EXPLORE_DASHBOARDS_PAGE_VISITED);
+ }, []);
+ return <DashboardExplorer />;
+}
diff --git a/src/client/src/app/(playground)/dashboards/layout.tsx b/src/client/src/app/(playground)/dashboards/layout.tsx
new file mode 100644
index 00000000..964da988
--- /dev/null
+++ b/src/client/src/app/(playground)/dashboards/layout.tsx
@@ -0,0 +1,54 @@
+"use client";
+import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
+import Link from "next/link";
+import { usePathname } from "next/navigation";
+import { FolderIcon, LayoutDashboardIcon, ComponentIcon } from "lucide-react";
+import { useSetDashboardPageSearch } from "@/selectors/dashboards";
+
+export default function LayoutManageDashboard({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ const pathname = usePathname();
+ const setPageSearch = useSetDashboardPageSearch();
+ const resetSearch = () => {
+ setPageSearch("");
+ }
+
+ return (
+ <div className="flex flex-col w-full h-full gap-4">
+ {!pathname.includes("/dashboards/board/") && (
+ <div className="flex">
+ <Tabs defaultValue={pathname.split("/")[2] || "explorer"} className="">
+ <TabsList className="p-0 h-[30px] px-[1px]">
+ <TabsTrigger value="explorer" className="p-0 w-[100px] text-xs rounded-md">
+ <Link
+ className="py-1.5 w-full flex items-center justify-center gap-2 px-2"
+ href="/dashboards/explorer"
+ onClick={resetSearch}
+ >
+ <FolderIcon className="h-3 w-3" />
+ Explorer
+ </Link>
+ </TabsTrigger>
+ <TabsTrigger value="board" className="p-0 w-[100px] text-xs rounded-md">
+ <Link className="py-1.5 w-full flex items-center justify-center gap-2 px-2" href="/dashboards/dashboard" onClick={resetSearch}>
+ <LayoutDashboardIcon className="h-3 w-3" />
+ Dashboard
+ </Link>
+ </TabsTrigger>
+ <TabsTrigger value="widget" className="p-0 w-[100px] text-xs rounded-md">
+ <Link className="py-1.5 w-full flex items-center justify-center gap-2 px-2" href="/dashboards/widget" onClick={resetSearch}>
+ <ComponentIcon className="h-3 w-3" />
+ Widget
+ </Link>
+ </TabsTrigger>
+ </TabsList>
+ </Tabs>
+ </div>
+ )}
+ {children}
+ </div>
+ );
+}
diff --git a/src/client/src/app/(playground)/dashboards/page.tsx b/src/client/src/app/(playground)/dashboards/page.tsx
new file mode 100644
index 00000000..7d66b265
--- /dev/null
+++ b/src/client/src/app/(playground)/dashboards/page.tsx
@@ -0,0 +1,6 @@
+"use client";
+import Explorer from "./explorer/page";
+
+export default function DashboardPage() {
+ return <Explorer />;
+}
diff --git a/src/client/src/app/(playground)/dashboards/widget/page.tsx b/src/client/src/app/(playground)/dashboards/widget/page.tsx
new file mode 100644
index 00000000..734c046d
--- /dev/null
+++ b/src/client/src/app/(playground)/dashboards/widget/page.tsx
@@ -0,0 +1,14 @@
+"use client";
+import Widget from "@/components/(playground)/manage-dashboard/widget";
+import { usePostHog } from "posthog-js/react";
+import { CLIENT_EVENTS } from "@/constants/events";
+import { useEffect } from "react";
+
+export default function WidgetPage() {
+ const posthog = usePostHog();
+
+ useEffect(() => {
+ posthog?.capture(CLIENT_EVENTS.LIST_WIDGETS_PAGE_VISITED);
+ }, []);
+ return <Widget />;
+}
diff --git a/src/client/src/app/(playground)/home/page.tsx b/src/client/src/app/(playground)/home/page.tsx
new file mode 100644
index 00000000..ac878bf6
--- /dev/null
+++ b/src/client/src/app/(playground)/home/page.tsx
@@ -0,0 +1,163 @@
+"use client";
+import Filter from "@/components/(playground)/filter";
+import { useCallback, useEffect, useMemo, useState } from "react";
+import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
+import { useSearchParams } from "next/navigation";
+import Dashboard, { DashboardConfig } from "../../../components/(playground)/manage-dashboard/board-creator";
+import { Board } from "@/types/manage-dashboard";
+import Link from "next/link";
+import { Badge } from "@/components/ui/badge";
+import { useRootStore } from "@/store";
+import { getFilterDetails } from "@/selectors/filter";
+import { getFilterParamsForDashboard } from "@/helpers/client/filter";
+import Loader from "@/components/common/loader";
+import { usePageHeader } from "@/selectors/page";
+import { usePostHog } from "posthog-js/react";
+import { CLIENT_EVENTS } from "@/constants/events";
+import { toast } from "sonner";
+
+const BoardList = ({ dashboardId }: { dashboardId: string | null }) => {
+ const [boards, setBoards] = useState<Board[]>([]);
+ const { fireRequest } = useFetchWrapper();
+
+ const fetchBoards = useCallback(() => {
+ fireRequest({
+ url: "/api/manage-dashboard/board?home=true",
+ requestType: "GET",
+ successCb: (response) => {
+ if (response?.data) {
+ setBoards(response.data);
+ }
+ },
+ failureCb: (error) => {
+ setBoards([]);
+ },
+ });
+ }, [fireRequest]);
+
+ useEffect(() => {
+ fetchBoards();
+ }, [fetchBoards]);
+
+ if (boards.length === 0) {
+ return null;
+ }
+
+ return (
+ <div className="flex gap-2">
+ {boards.map((board) => {
+ if (dashboardId === board.id || (!dashboardId && board.isMainDashboard)) {
+ return null;
+ }
+ return (
+ <Link key={board.id} href={`?dashboardId=${board.id}`}>
+ <Badge>{board.title}</Badge>
+ </Link>
+ );
+ })}
+ </div>
+ );
+};
+
+export default function DashboardPage() {
+ const filter = useRootStore(getFilterDetails);
+ const { fireRequest, isLoading } = useFetchWrapper();
+ const { fireRequest: fireRunQuery } = useFetchWrapper();
+ const [initialConfig, setInitialConfig] = useState<
+ DashboardConfig | undefined
+ >();
+ const searchParams = useSearchParams();
+ const dashboardId = searchParams.get("dashboardId");
+ const { setHeader } = usePageHeader();
+ const posthog = usePostHog();
+
+ useEffect(() => {
+ const fetchBoardLayout = async () => {
+ try {
+ setInitialConfig(undefined);
+ const { response, error } = await fireRequest({
+ requestType: "GET",
+ url: `/api/manage-dashboard/board/${dashboardId ? dashboardId : "main"}/layout`,
+ });
+
+ if (error) {
+ throw new Error(error);
+ }
+
+ if (response?.data) {
+ setInitialConfig(response.data);
+ setHeader({
+ title: response.data?.title,
+ description: response.data?.description,
+ breadcrumbs: [],
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_VIEWED, {
+ id: response.data.id,
+ home: true,
+ mainDashboard: response.data.isMainDashboard,
+ });
+ }
+ } catch (error) {
+ toast.error("Failed to fetch board layout", {
+ id: "dashboard-page",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_VIEW_FAILURE, {
+ error: error?.toString(),
+ home: true,
+ mainDashboard: !dashboardId,
+ });
+ }
+ };
+
+ fetchBoardLayout();
+ }, [dashboardId, fireRequest]);
+
+ const runFilters = useMemo(() => {
+ return getFilterParamsForDashboard({
+ ...filter,
+ });
+ }, [filter]);
+
+ const runQuery = async (
+ widgetId: string,
+ params: Record<string, unknown>
+ ) => {
+ const data = await fireRunQuery({
+ requestType: "POST",
+ url: "/api/manage-dashboard/query/run",
+ // Add params of the dashboard & add a check for edit mode to send query or not through body
+ body: JSON.stringify({
+ widgetId,
+ filter: runFilters,
+ ...params,
+ }),
+ });
+
+ return data.response;
+ };
+
+ return (
+ <>
+ <div className="flex items-center w-full justify-between mb-4">
+ <Filter />
+ <BoardList dashboardId={dashboardId} />
+ </div>
+ {
+ isLoading ? (
+ <div className="flex items-center justify-center h-full w-full">
+ <Loader />
+ </div>
+ ) : null
+ }
+ {initialConfig ? (
+ <Dashboard
+ className="h-100 overflow-y-auto"
+ initialConfig={initialConfig}
+ readonly
+ runQuery={runQuery}
+ runFilters={runFilters}
+ />
+ ) : null}
+ </>
+ );
+}
diff --git a/src/client/src/app/(playground)/layout.tsx b/src/client/src/app/(playground)/layout.tsx
index cc5dbc23..b4c0b429 100644
--- a/src/client/src/app/(playground)/layout.tsx
+++ b/src/client/src/app/(playground)/layout.tsx
@@ -22,8 +22,12 @@ export default async function PlaygroundLayout({
<div className="flex flex-col grow w-full">
<Header />
<main className="flex flex-col grow flex-1 items-start p-4 sm:px-6 overflow-hidden">
- <ClickhouseConnectivityWrapper />
- {children}
+ {/* <div className="fixed inset-0 w-full h-full bg-cover bg-center bg-no-repeat z-[-1]" style={{
+ backgroundImage: "linear-gradient(344deg, #f89b29 5%, rgba(255,255,255,0) 72%)"
+ }} /> */}
+ <ClickhouseConnectivityWrapper>
+ {children}
+ </ClickhouseConnectivityWrapper>
</main>
</div>
</div>
diff --git a/src/client/src/app/api/evaluation/auto/route.ts b/src/client/src/app/api/evaluation/auto/route.ts
index b5bab9b5..8f07088c 100644
--- a/src/client/src/app/api/evaluation/auto/route.ts
+++ b/src/client/src/app/api/evaluation/auto/route.ts
@@ -1,23 +1,17 @@
import { SERVER_EVENTS } from "@/constants/events";
import { autoEvaluate } from "@/lib/platform/evaluation";
import PostHogServer from "@/lib/posthog";
-import { randomUUID } from "crypto";
import { NextRequest } from "next/server";
export async function POST(request: NextRequest) {
+ const startTimestamp = Date.now();
const formData = await request.json();
-
- const start = Date.now();
const result = await autoEvaluate(formData);
- const end = Date.now();
- PostHogServer.capture({
+ PostHogServer.fireEvent({
event: result.success
? SERVER_EVENTS.EVALUATION_AUTO_SUCCESS
: SERVER_EVENTS.EVALUATION_AUTO_FAILURE,
- distinctId: randomUUID(),
- properties: {
- responseTime: end - start,
- },
+ startTimestamp,
});
return Response.json(result);
}
diff --git a/src/client/src/app/api/manage-dashboard/board/[id]/layout/export/route.ts b/src/client/src/app/api/manage-dashboard/board/[id]/layout/export/route.ts
new file mode 100644
index 00000000..8eb1543b
--- /dev/null
+++ b/src/client/src/app/api/manage-dashboard/board/[id]/layout/export/route.ts
@@ -0,0 +1,31 @@
+import { SERVER_EVENTS } from "@/constants/events";
+import { getBoardLayout } from "@/lib/platform/manage-dashboard/board";
+import PostHogServer from "@/lib/posthog";
+import { NextRequest } from "next/server";
+
+// Export board layout
+export async function GET(
+ _: NextRequest,
+ { params: { id } }: { params: { id: string } }
+) {
+ const startTimestamp = Date.now();
+ const res = await getBoardLayout(id);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_LAYOUT_EXPORT_FAILURE : SERVER_EVENTS.DASHBOARD_LAYOUT_EXPORT_SUCCESS,
+ startTimestamp,
+ });
+ if (res.err) {
+ return new Response(JSON.stringify({ error: res.err }), {
+ status: 404,
+ headers: { "Content-Type": "application/json" },
+ });
+ }
+ const json = JSON.stringify(res.data, null, 2);
+ return new Response(json, {
+ status: 200,
+ headers: {
+ "Content-Type": "application/json",
+ "Content-Disposition": `attachment; filename=openlit-dashboard-${res.data!.title || res.data!.id}-layout.json`,
+ },
+ });
+}
diff --git a/src/client/src/app/api/manage-dashboard/board/[id]/layout/route.ts b/src/client/src/app/api/manage-dashboard/board/[id]/layout/route.ts
new file mode 100644
index 00000000..54569cb3
--- /dev/null
+++ b/src/client/src/app/api/manage-dashboard/board/[id]/layout/route.ts
@@ -0,0 +1,38 @@
+import { SERVER_EVENTS } from "@/constants/events";
+import {
+ getBoardLayout,
+ updateBoardLayout,
+} from "@/lib/platform/manage-dashboard/board";
+import PostHogServer from "@/lib/posthog";
+import { NextRequest } from "next/server";
+
+// Get board layout
+export async function GET(
+ _: NextRequest,
+ { params: { id } }: { params: { id: string } }
+) {
+ const startTimestamp = Date.now();
+ const res = await getBoardLayout(id);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_LAYOUT_GET_FAILURE : SERVER_EVENTS.DASHBOARD_LAYOUT_GET_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
+
+// Update board layout
+export async function PUT(
+ request: NextRequest,
+ { params }: { params: { id: string } }
+) {
+ const startTimestamp = Date.now();
+ const layoutConfig = await request.json();
+ const boardId = params.id;
+
+ const res = await updateBoardLayout(boardId, layoutConfig);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_LAYOUT_UPDATE_FAILURE : SERVER_EVENTS.DASHBOARD_LAYOUT_UPDATE_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
diff --git a/src/client/src/app/api/manage-dashboard/board/[id]/route.ts b/src/client/src/app/api/manage-dashboard/board/[id]/route.ts
new file mode 100644
index 00000000..6475abd4
--- /dev/null
+++ b/src/client/src/app/api/manage-dashboard/board/[id]/route.ts
@@ -0,0 +1,56 @@
+import { SERVER_EVENTS } from "@/constants/events";
+import { deleteBoard, getBoardById, setMainDashboard, updatePinnedBoard } from "@/lib/platform/manage-dashboard/board";
+import PostHogServer from "@/lib/posthog";
+import { NextRequest } from "next/server";
+
+export async function DELETE(
+ _: NextRequest,
+ { params: { id } }: { params: { id: string } }
+) {
+ const startTimestamp = Date.now();
+ const res = await deleteBoard(id);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_DELETE_FAILURE : SERVER_EVENTS.DASHBOARD_DELETE_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
+
+export async function GET(
+ _: NextRequest,
+ { params: { id } }: { params: { id: string } }
+) {
+ const res = await getBoardById(id);
+ return Response.json(res);
+}
+
+export async function PATCH(
+ request: NextRequest,
+ { params: { id } }: { params: { id: string } }
+) {
+ const startTimestamp = Date.now();
+ const body = await request.json();
+ if (body.setMain) {
+ const res = await setMainDashboard(id);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_TOGGLE_MAIN_FAILURE : SERVER_EVENTS.DASHBOARD_TOGGLE_MAIN_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+ }
+
+ if (body.updatePinned) {
+ const res = await updatePinnedBoard(id);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_TOGGLE_PINNED_FAILURE : SERVER_EVENTS.DASHBOARD_TOGGLE_PINNED_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+ }
+
+ PostHogServer.fireEvent({
+ event: SERVER_EVENTS.DASHBOARD_PATCH_FAILURE,
+ startTimestamp,
+ });
+ return Response.json({ err: "Invalid PATCH request" }, { status: 400 });
+}
diff --git a/src/client/src/app/api/manage-dashboard/board/layout/import/route.ts b/src/client/src/app/api/manage-dashboard/board/layout/import/route.ts
new file mode 100644
index 00000000..98a18c67
--- /dev/null
+++ b/src/client/src/app/api/manage-dashboard/board/layout/import/route.ts
@@ -0,0 +1,26 @@
+import { SERVER_EVENTS } from "@/constants/events";
+import { importBoardLayout } from "@/lib/platform/manage-dashboard/board";
+import PostHogServer from "@/lib/posthog";
+import { NextRequest } from "next/server";
+
+export async function POST(request: NextRequest) {
+ const startTimestamp = Date.now();
+ const data = await request.json();
+ const { err, data: boardData } = await importBoardLayout(data);
+ PostHogServer.fireEvent({
+ event: err ? SERVER_EVENTS.DASHBOARD_IMPORT_FAILURE : SERVER_EVENTS.DASHBOARD_IMPORT_SUCCESS,
+ startTimestamp,
+ });
+
+ if (err) {
+ return new Response(JSON.stringify({ error: err }), {
+ status: 400,
+ headers: { "Content-Type": "application/json" }
+ });
+ }
+
+ return new Response(JSON.stringify({ data: boardData }), {
+ status: 200,
+ headers: { "Content-Type": "application/json" }
+ });
+}
diff --git a/src/client/src/app/api/manage-dashboard/board/main/layout/route.ts b/src/client/src/app/api/manage-dashboard/board/main/layout/route.ts
new file mode 100644
index 00000000..6198dac5
--- /dev/null
+++ b/src/client/src/app/api/manage-dashboard/board/main/layout/route.ts
@@ -0,0 +1,14 @@
+import { SERVER_EVENTS } from "@/constants/events";
+import { getMainDashboard } from "@/lib/platform/manage-dashboard/board";
+import PostHogServer from "@/lib/posthog";
+import { NextRequest } from "next/server";
+
+export async function GET(_: NextRequest) {
+ const startTimestamp = Date.now();
+ const res = await getMainDashboard(true);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_GET_MAIN_FAILURE : SERVER_EVENTS.DASHBOARD_GET_MAIN_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
diff --git a/src/client/src/app/api/manage-dashboard/board/route.ts b/src/client/src/app/api/manage-dashboard/board/route.ts
new file mode 100644
index 00000000..011e3687
--- /dev/null
+++ b/src/client/src/app/api/manage-dashboard/board/route.ts
@@ -0,0 +1,47 @@
+import { SERVER_EVENTS } from "@/constants/events";
+import {
+ createBoard,
+ getBoards,
+ updateBoard,
+} from "@/lib/platform/manage-dashboard/board";
+import PostHogServer from "@/lib/posthog";
+import { Board } from "@/types/manage-dashboard";
+import { NextRequest } from "next/server";
+
+export async function POST(request: NextRequest) {
+ const startTimestamp = Date.now();
+ const board: Board = await request.json();
+
+ const res = await createBoard(board);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_CREATE_FAILURE : SERVER_EVENTS.DASHBOARD_CREATE_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
+
+export async function PUT(request: NextRequest) {
+ const startTimestamp = Date.now();
+ const board: Board & { updateParent?: boolean } = await request.json();
+ const res = await updateBoard(board);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_UPDATE_FAILURE : SERVER_EVENTS.DASHBOARD_UPDATE_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
+
+export async function GET(request: NextRequest) {
+ const startTimestamp = Date.now();
+ const isHome = request.nextUrl.searchParams.get("home") === "true";
+ const res = await getBoards(isHome);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_GET_FAILURE : SERVER_EVENTS.DASHBOARD_GET_SUCCESS,
+ startTimestamp,
+ properties: {
+ isHome,
+ totalBoards: (res.data as Board[])?.length || 0,
+ },
+ });
+ return Response.json(res);
+}
diff --git a/src/client/src/app/api/manage-dashboard/folder/[id]/route.ts b/src/client/src/app/api/manage-dashboard/folder/[id]/route.ts
new file mode 100644
index 00000000..24e456ee
--- /dev/null
+++ b/src/client/src/app/api/manage-dashboard/folder/[id]/route.ts
@@ -0,0 +1,25 @@
+import { SERVER_EVENTS } from "@/constants/events";
+import { deleteFolder, getFolderById } from "@/lib/platform/manage-dashboard/folder";
+import PostHogServer from "@/lib/posthog";
+import { NextRequest } from "next/server";
+
+export async function DELETE(
+ _: NextRequest,
+ { params: { id } }: { params: { id: string } }
+) {
+ const startTimestamp = Date.now();
+ const res = await deleteFolder(id);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.FOLDER_DELETE_FAILURE : SERVER_EVENTS.FOLDER_DELETE_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
+
+export async function GET(
+ _: NextRequest,
+ { params: { id } }: { params: { id: string } }
+) {
+ const res = await getFolderById(id);
+ return Response.json(res);
+}
diff --git a/src/client/src/app/api/manage-dashboard/folder/get-heirarchy/route.ts b/src/client/src/app/api/manage-dashboard/folder/get-heirarchy/route.ts
new file mode 100644
index 00000000..1d5bd00d
--- /dev/null
+++ b/src/client/src/app/api/manage-dashboard/folder/get-heirarchy/route.ts
@@ -0,0 +1,13 @@
+import { SERVER_EVENTS } from "@/constants/events";
+import { getHeirarchy } from "@/lib/platform/manage-dashboard/heirarchy";
+import PostHogServer from "@/lib/posthog";
+
+export async function GET() {
+ const startTimestamp = Date.now();
+ const res = await getHeirarchy();
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.FOLDER_GET_HEIRARCHY_FAILURE : SERVER_EVENTS.FOLDER_GET_HEIRARCHY_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
diff --git a/src/client/src/app/api/manage-dashboard/folder/route.ts b/src/client/src/app/api/manage-dashboard/folder/route.ts
new file mode 100644
index 00000000..13ed7c5c
--- /dev/null
+++ b/src/client/src/app/api/manage-dashboard/folder/route.ts
@@ -0,0 +1,46 @@
+import { SERVER_EVENTS } from "@/constants/events";
+import {
+ createFolder,
+ getFolders,
+ updateFolder,
+} from "@/lib/platform/manage-dashboard/folder";
+import PostHogServer from "@/lib/posthog";
+import { Folder } from "@/types/manage-dashboard";
+import { NextRequest } from "next/server";
+
+export async function POST(request: NextRequest) {
+ const startTimestamp = Date.now();
+ const folder: Folder = await request.json();
+
+ const res = await createFolder(folder);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.FOLDER_CREATE_FAILURE : SERVER_EVENTS.FOLDER_CREATE_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
+
+export async function PUT(request: NextRequest) {
+ const startTimestamp = Date.now();
+ const folder: Folder = await request.json();
+
+ const res = await updateFolder(folder);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.FOLDER_UPDATE_FAILURE : SERVER_EVENTS.FOLDER_UPDATE_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
+
+export async function GET() {
+ const startTimestamp = Date.now();
+ const res = await getFolders();
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.FOLDER_GET_FAILURE : SERVER_EVENTS.FOLDER_GET_SUCCESS,
+ startTimestamp,
+ properties: {
+ totalFolders: (res.data as Folder[])?.length || 0,
+ },
+ });
+ return Response.json(res);
+}
diff --git a/src/client/src/app/api/manage-dashboard/query/run/route.ts b/src/client/src/app/api/manage-dashboard/query/run/route.ts
new file mode 100644
index 00000000..f7165e82
--- /dev/null
+++ b/src/client/src/app/api/manage-dashboard/query/run/route.ts
@@ -0,0 +1,22 @@
+import { SERVER_EVENTS } from "@/constants/events";
+import { runWidgetQuery } from "@/lib/platform/manage-dashboard/widget";
+import PostHogServer from "@/lib/posthog";
+import { NextRequest } from "next/server";
+
+export async function POST(request: NextRequest) {
+ const {
+ widgetId,
+ userQuery,
+ filter,
+ } = await request.json();
+ const startTimestamp = Date.now();
+ const res = await runWidgetQuery(widgetId, {
+ userQuery,
+ filter,
+ });
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_QUERY_RUN_FAILURE : SERVER_EVENTS.DASHBOARD_QUERY_RUN_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
diff --git a/src/client/src/app/api/manage-dashboard/widget/[id]/route.ts b/src/client/src/app/api/manage-dashboard/widget/[id]/route.ts
new file mode 100644
index 00000000..c27dddb9
--- /dev/null
+++ b/src/client/src/app/api/manage-dashboard/widget/[id]/route.ts
@@ -0,0 +1,50 @@
+import { SERVER_EVENTS } from "@/constants/events";
+import {
+ deleteWidget,
+ getWidgetById,
+ updateWidget,
+} from "@/lib/platform/manage-dashboard/widget";
+import PostHogServer from "@/lib/posthog";
+import { Widget } from "@/types/manage-dashboard";
+import { NextRequest } from "next/server";
+
+// Delete widget
+export async function DELETE(
+ _: NextRequest,
+ { params: { id } }: { params: { id: string } }
+) {
+ const startTimestamp = Date.now();
+ const res = await deleteWidget(id);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_WIDGET_DELETE_FAILURE : SERVER_EVENTS.DASHBOARD_WIDGET_DELETE_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
+
+// Get widget by id
+export async function GET(
+ _: NextRequest,
+ { params: { id } }: { params: { id: string } }
+) {
+ const startTimestamp = Date.now();
+ const res = await getWidgetById(id);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_WIDGET_GET_FAILURE : SERVER_EVENTS.DASHBOARD_WIDGET_GET_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
+
+// Update widget
+export async function PUT(request: NextRequest) {
+ const startTimestamp = Date.now();
+ const widget: Widget = await request.json();
+
+ const res = await updateWidget(widget);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_WIDGET_UPDATE_FAILURE : SERVER_EVENTS.DASHBOARD_WIDGET_UPDATE_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
diff --git a/src/client/src/app/api/manage-dashboard/widget/route.ts b/src/client/src/app/api/manage-dashboard/widget/route.ts
new file mode 100644
index 00000000..2cf9d54f
--- /dev/null
+++ b/src/client/src/app/api/manage-dashboard/widget/route.ts
@@ -0,0 +1,26 @@
+import { SERVER_EVENTS } from "@/constants/events";
+import { createWidget, getWidgets } from "@/lib/platform/manage-dashboard/widget";
+import PostHogServer from "@/lib/posthog";
+import { Widget } from "@/types/manage-dashboard";
+import { NextRequest } from "next/server";
+
+export async function POST(request: NextRequest) {
+ const widget: Widget = await request.json();
+ const startTimestamp = Date.now();
+ const res = await createWidget(widget);
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_WIDGET_CREATE_FAILURE : SERVER_EVENTS.DASHBOARD_WIDGET_CREATE_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
+
+export async function GET() {
+ const startTimestamp = Date.now();
+ const res = await getWidgets();
+ PostHogServer.fireEvent({
+ event: res.err ? SERVER_EVENTS.DASHBOARD_WIDGET_LIST_FAILURE : SERVER_EVENTS.DASHBOARD_WIDGET_LIST_SUCCESS,
+ startTimestamp,
+ });
+ return Response.json(res);
+}
diff --git a/src/client/src/app/api/prompt/get-compiled/route.ts b/src/client/src/app/api/prompt/get-compiled/route.ts
index 012283b5..c8dfaa65 100644
--- a/src/client/src/app/api/prompt/get-compiled/route.ts
+++ b/src/client/src/app/api/prompt/get-compiled/route.ts
@@ -4,9 +4,9 @@ import { PromptCompiledInput } from "@/constants/prompts";
import { getCompiledPrompt } from "@/lib/platform/prompt/compiled";
import PostHogServer from "@/lib/posthog";
import asaw from "@/utils/asaw";
-import { randomUUID } from "crypto";
export async function POST(request: Request) {
+ const startTimestamp = Date.now();
const authorizationHeader = request.headers.get("Authorization") || "";
let apiKey: string = "";
if (authorizationHeader.startsWith("Bearer ")) {
@@ -18,7 +18,6 @@ export async function POST(request: Request) {
});
}
- const start = Date.now();
const formData = await request.json();
const promptInput: PromptCompiledInput = {
@@ -33,16 +32,14 @@ export async function POST(request: Request) {
};
const [err, res]: any = await asaw(getCompiledPrompt(promptInput));
- const end = Date.now();
- PostHogServer.capture({
+ PostHogServer.fireEvent({
event: err
? SERVER_EVENTS.PROMPT_SDK_FETCH_FAILURE
: SERVER_EVENTS.PROMPT_SDK_FETCH_SUCCESS,
- distinctId: randomUUID(),
properties: {
downloadSource: formData.source,
- responseTime: end - start,
},
+ startTimestamp,
});
return Response.json({
diff --git a/src/client/src/app/api/vault/get-secrets/route.ts b/src/client/src/app/api/vault/get-secrets/route.ts
index ad7bd539..c57cf688 100644
--- a/src/client/src/app/api/vault/get-secrets/route.ts
+++ b/src/client/src/app/api/vault/get-secrets/route.ts
@@ -4,9 +4,9 @@ import { SecretGetFiltersWithApiKey } from "@/types/vault";
import { getSecretsFromDatabaseId } from "@/lib/platform/vault";
import PostHogServer from "@/lib/posthog";
import asaw from "@/utils/asaw";
-import { randomUUID } from "crypto";
export async function POST(request: Request) {
+ const startTimestamp = Date.now();
const authorizationHeader = request.headers.get("Authorization") || "";
let apiKey: string = "";
if (authorizationHeader.startsWith("Bearer ")) {
@@ -18,8 +18,6 @@ export async function POST(request: Request) {
});
}
- const start = Date.now();
-
const formData = await request.json();
const filters: SecretGetFiltersWithApiKey = {
@@ -29,16 +27,14 @@ export async function POST(request: Request) {
};
const [err, data]: any = await asaw(getSecretsFromDatabaseId(filters));
- const end = Date.now();
- PostHogServer.capture({
+ PostHogServer.fireEvent({
event: err
? SERVER_EVENTS.VAULT_SECRET_SDK_FETCH_FAILURE
: SERVER_EVENTS.VAULT_SECRET_SDK_FETCH_SUCCESS,
- distinctId: randomUUID(),
properties: {
downloadSource: formData.source,
- responseTime: end - start,
},
+ startTimestamp,
});
return Response.json({
diff --git a/src/client/src/app/auth.ts b/src/client/src/app/auth.ts
index 59818ce1..e9bdef6d 100644
--- a/src/client/src/app/auth.ts
+++ b/src/client/src/app/auth.ts
@@ -9,6 +9,7 @@ import {
getUserByEmail,
updateUser,
doesPasswordMatches,
+ getUserById,
} from "@/lib/user";
const prisma = new PrismaClient();
@@ -26,6 +27,26 @@ export const authOptions = {
token.id = user.id;
}
+ // Validate that the user still exists in the database for existing tokens
+ // This prevents issues when starting with a fresh database but stale cookies
+ if (token?.id && !user) {
+ try {
+ const [, existingUser] = await asaw(
+ getUserById({ id: token.id as string })
+ );
+
+ // If user doesn't exist in database, invalidate the token
+ if (!existingUser) {
+ return null;
+ }
+ } catch (error) {
+ // If there's a database connection error during startup,
+ // allow the token to pass through to avoid blocking the app
+ // The error will be handled at the application level
+ console.error("Database error during JWT validation:", error);
+ }
+ }
+
return token;
},
signIn: async ({ user, account, profile }) => {
diff --git a/src/client/src/app/not-found.tsx b/src/client/src/app/not-found.tsx
index 25202b60..d42e9a5f 100644
--- a/src/client/src/app/not-found.tsx
+++ b/src/client/src/app/not-found.tsx
@@ -16,7 +16,7 @@ export default function NotFound() {
404 – Bug or Feature?
</h1>
<p className="text-stone-600">
- This page drifted outside our observability zone. Let's head back to reality.
+ This page drifted outside our observability zone. Let&apos;s head back to reality.
</p>
</div>
<div className="flex flex-col items-center justify-center space-y-4 text-center">
diff --git a/src/client/src/app/page.tsx b/src/client/src/app/page.tsx
index 547387c8..f7441f49 100644
--- a/src/client/src/app/page.tsx
+++ b/src/client/src/app/page.tsx
@@ -1,5 +1,5 @@
import { redirect } from "next/navigation";
export default async function Home() {
- redirect("/dashboard");
+ redirect("/home");
}
diff --git a/src/client/src/clickhouse/migrations/create-custom-dashboards-migration.ts b/src/client/src/clickhouse/migrations/create-custom-dashboards-migration.ts
new file mode 100644
index 00000000..f615f2c3
--- /dev/null
+++ b/src/client/src/clickhouse/migrations/create-custom-dashboards-migration.ts
@@ -0,0 +1,112 @@
+import migrationHelper from "./migration-helper";
+import CreateCustomDashboardsSeed from "../seed/dashboards";
+
+const MIGRATION_ID = "create-custom-dashboards-table";
+
+// Table names can be moved to a constants file if needed
+const CUSTOM_DASHBOARDS_BOARDS_TABLE = "openlit_board";
+const CUSTOM_DASHBOARDS_FOLDERS_TABLE = "openlit_folder";
+const CUSTOM_DASHBOARDS_WIDGETS_TABLE = "openlit_widget";
+const CUSTOM_DASHBOARDS_BOARD_WIDGETS_TABLE = "openlit_board_widget";
+
+export default async function CreateCustomDashboardsMigration(databaseConfigId?: string) {
+ const queries = [
+ `
+ CREATE TABLE IF NOT EXISTS ${CUSTOM_DASHBOARDS_FOLDERS_TABLE} (
+ id UUID DEFAULT generateUUIDv4(), -- Unique ID for each folder
+ title String, -- Folder title
+ description String, -- Folder description
+ parent_id Nullable(UUID), -- Parent folder ID, null for root folders
+ created_at DateTime DEFAULT now(), -- Creation timestamp
+ updated_at DateTime DEFAULT now(), -- Last update timestamp
+ tags String DEFAULT '[]', -- Tags for the folder
+
+ INDEX id_index (id) TYPE bloom_filter GRANULARITY 1,
+ INDEX parent_id_index (parent_id) TYPE bloom_filter GRANULARITY 1,
+ INDEX title_index (title) TYPE tokenbf_v1(32768, 3, 0) GRANULARITY 1,
+ INDEX created_at_index (created_at) TYPE minmax GRANULARITY 1,
+ INDEX updated_at_index (updated_at) TYPE minmax GRANULARITY 1,
+
+ PRIMARY KEY id
+ ) ENGINE = MergeTree()
+ ORDER BY (id, title, created_at)
+ `,
+ `
+ CREATE TABLE IF NOT EXISTS ${CUSTOM_DASHBOARDS_BOARDS_TABLE} (
+ id UUID DEFAULT generateUUIDv4(), -- Unique ID for each board
+ title String, -- Board title
+ description String, -- Board description
+ parent_id Nullable(UUID), -- Parent folder ID
+ is_main_dashboard Boolean, -- Flag for main dashboard
+ created_at DateTime DEFAULT now(), -- Creation timestamp
+ updated_at DateTime DEFAULT now(), -- Last update timestamp
+ is_pinned Boolean DEFAULT false, -- Flag for pinned boards
+ tags String DEFAULT '[]', -- Tags for the board
+
+ INDEX id_index (id) TYPE bloom_filter GRANULARITY 1,
+ INDEX parent_id_index (parent_id) TYPE bloom_filter GRANULARITY 1,
+ INDEX title_index (title) TYPE tokenbf_v1(32768, 3, 0) GRANULARITY 1,
+ INDEX main_dashboard_index (is_main_dashboard) TYPE set(2) GRANULARITY 1,
+ INDEX pinned_index (is_pinned) TYPE set(2) GRANULARITY 1,
+ INDEX created_at_index (created_at) TYPE minmax GRANULARITY 1,
+ INDEX updated_at_index (updated_at) TYPE minmax GRANULARITY 1,
+
+ PRIMARY KEY id
+ ) ENGINE = MergeTree()
+ ORDER BY (id, created_at);
+ `,
+ `
+ CREATE TABLE IF NOT EXISTS ${CUSTOM_DASHBOARDS_WIDGETS_TABLE} (
+ id UUID DEFAULT generateUUIDv4(), -- Unique ID for each widget
+ title String, -- Widget title
+ description String, -- Widget description
+ widget_type String, -- Type of widget
+ properties String, -- JSON string of widget properties
+ config String, -- JSON string of config (query string, respect the filters flag etc)
+ created_at DateTime DEFAULT now(), -- Creation timestamp
+ updated_at DateTime DEFAULT now(), -- Last update timestamp
+
+ INDEX id_index (id) TYPE bloom_filter GRANULARITY 1,
+ INDEX widget_type_index (widget_type) TYPE bloom_filter GRANULARITY 1,
+ INDEX title_index (title) TYPE tokenbf_v1(32768, 3, 0) GRANULARITY 1,
+ INDEX created_at_index (created_at) TYPE minmax GRANULARITY 1,
+ INDEX updated_at_index (updated_at) TYPE minmax GRANULARITY 1,
+
+ PRIMARY KEY id
+ ) ENGINE = MergeTree()
+ ORDER BY (id, created_at)
+ `,
+ `
+ CREATE TABLE IF NOT EXISTS ${CUSTOM_DASHBOARDS_BOARD_WIDGETS_TABLE} (
+ id UUID DEFAULT generateUUIDv4(), -- Unique ID for board widget mapping
+ board_id UUID, -- Reference to board
+ widget_id UUID, -- Reference to widget
+ position String DEFAULT '{}', -- JSON string of position (x, y, w, h)
+ created_at DateTime DEFAULT now(), -- Creation timestamp
+ updated_at DateTime DEFAULT now(), -- Last update timestamp
+
+ INDEX id_index (id) TYPE bloom_filter GRANULARITY 1,
+ INDEX board_widget_index (board_id, widget_id) TYPE bloom_filter GRANULARITY 1,
+ INDEX board_id_index (board_id) TYPE bloom_filter GRANULARITY 1,
+ INDEX widget_id_index (widget_id) TYPE bloom_filter GRANULARITY 1,
+ INDEX created_at_index (created_at) TYPE minmax GRANULARITY 1,
+ INDEX updated_at_index (updated_at) TYPE minmax GRANULARITY 1,
+
+ PRIMARY KEY id
+ ) ENGINE = MergeTree()
+ ORDER BY (id, board_id, widget_id, created_at);
+ `
+ ];
+
+ const { migrationExist, queriesRun } = await migrationHelper({
+ clickhouseMigrationId: MIGRATION_ID,
+ databaseConfigId,
+ queries,
+ });
+
+ if (!migrationExist) {
+ await CreateCustomDashboardsSeed(databaseConfigId);
+ }
+
+ return { migrationExist, queriesRun };
+}
diff --git a/src/client/src/clickhouse/migrations/create-evaluation-migration.ts b/src/client/src/clickhouse/migrations/create-evaluation-migration.ts
index 891918c0..cdbe4beb 100644
--- a/src/client/src/clickhouse/migrations/create-evaluation-migration.ts
+++ b/src/client/src/clickhouse/migrations/create-evaluation-migration.ts
@@ -1,7 +1,7 @@
import { OPENLIT_EVALUATION_TABLE_NAME } from "@/lib/platform/evaluation/table-details";
import migrationHelper from "./migration-helper";
-const MIGRATION_ID = "create-evaluation-table";
+const MIGRATION_ID = "create-evaluation-table-2";
export default async function CreateEvaluationMigration(
databaseConfigId?: string
diff --git a/src/client/src/clickhouse/migrations/index.ts b/src/client/src/clickhouse/migrations/index.ts
index 2109b411..547eb4a6 100644
--- a/src/client/src/clickhouse/migrations/index.ts
+++ b/src/client/src/clickhouse/migrations/index.ts
@@ -2,10 +2,13 @@ import CreateEvaluationMigration from "./create-evaluation-migration";
import CreateCronLogMigration from "./create-cron-log-migration";
import CreatePromptMigration from "./create-prompt-migration";
import CreateVaultMigration from "./create-vault-migration";
-
+import CreateCustomDashboardsMigration from "./create-custom-dashboards-migration";
export default async function migrations(databaseConfigId?: string) {
- await CreatePromptMigration(databaseConfigId);
- await CreateVaultMigration(databaseConfigId);
- await CreateEvaluationMigration(databaseConfigId);
- await CreateCronLogMigration(databaseConfigId);
+ return Promise.all([
+ CreatePromptMigration(databaseConfigId),
+ CreateVaultMigration(databaseConfigId),
+ CreateEvaluationMigration(databaseConfigId),
+ CreateCronLogMigration(databaseConfigId),
+ CreateCustomDashboardsMigration(databaseConfigId),
+ ]);
}
diff --git a/src/client/src/clickhouse/migrations/migration-helper.ts b/src/client/src/clickhouse/migrations/migration-helper.ts
index 4ce6a5cb..935be474 100644
--- a/src/client/src/clickhouse/migrations/migration-helper.ts
+++ b/src/client/src/clickhouse/migrations/migration-helper.ts
@@ -34,8 +34,8 @@ export default async function migrationHelper({
})
);
- if (migrationExist === 1) {
- return;
+ if (migrationExist?.id) {
+ return { migrationExist: true, queriesRun: false };
}
const queriesRun = await Promise.all(
@@ -56,7 +56,7 @@ export default async function migrationHelper({
);
if (queriesRun.filter(({ err }) => !err).length === queries.length) {
- return await asaw(
+ await asaw(
prisma.clickhouseMigrations.create({
data: {
databaseConfigId: dbConfig.id,
@@ -64,5 +64,9 @@ export default async function migrationHelper({
},
})
);
+
+ return { migrationExist: false, queriesRun: true };
}
+
+ return { migrationExist: false, queriesRun: false };
}
diff --git a/src/client/src/clickhouse/seed-data/openlit-dashboard-GPU-dashboard-layout.json b/src/client/src/clickhouse/seed-data/openlit-dashboard-GPU-dashboard-layout.json
new file mode 100644
index 00000000..73890fda
--- /dev/null
+++ b/src/client/src/clickhouse/seed-data/openlit-dashboard-GPU-dashboard-layout.json
@@ -0,0 +1,264 @@
+{
+ "id": "70072a30-a88c-4eb5-8058-a5dca6536b8d",
+ "title": "GPU dashboard",
+ "description": "The dashboard helps detect GPU performance bottlenecks, thermal or power inefficiencies, and optimize resource utilization across your infrastructure.",
+ "parentId": null,
+ "isMainDashboard": false,
+ "isPinned": true,
+ "createdAt": "2025-06-27 05:46:43",
+ "updatedAt": "2025-06-27 05:46:43",
+ "widgets": {
+ "953b08e7-5158-4806-b52e-8b58880b0cfd": {
+ "id": "953b08e7-5158-4806-b52e-8b58880b0cfd",
+ "title": "Power (Watt)",
+ "description": "Visualization to identify the Power over time",
+ "type": "AREA_CHART",
+ "properties": {
+ "xAxis": "request_time",
+ "yAxes": [
+ {
+ "key": "power_draw",
+ "color": "#F36C06"
+ },
+ {
+ "key": "power_limit",
+ "color": "#10b981"
+ }
+ ]
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n dateDiff('day', start_time, end_time) AS days_diff,\n dateDiff('year', start_time, end_time) AS years_diff,\n multiIf(\n years_diff >= 1, 'month',\n days_diff <= 1, 'hour',\n 'day'\n ) AS date_granularity\n\nSELECT\n MAX(power_draw) AS power_draw,\n MAX(power_limit) AS power_limit,\n request_time\nFROM (\n SELECT\n ROUND(AVG(IF(MetricName = 'gpu.power.draw', Value, NULL)), 2) AS power_draw,\n ROUND(AVG(IF(MetricName = 'gpu.power.limit', Value, NULL)), 2) AS power_limit,\n formatDateTime(DATE_TRUNC(date_granularity, TimeUnix), '%Y/%m/%d %R') AS request_time\n FROM otel_metrics_gauge\n WHERE\n MetricName IN ('gpu.power.draw', 'gpu.power.limit')\n AND TimeUnix >= start_time AND TimeUnix <= end_time\n GROUP BY request_time\n)\nGROUP BY request_time\nORDER BY request_time\n"
+ },
+ "createdAt": "2025-06-27 07:13:12",
+ "updatedAt": "2025-06-27 07:13:59"
+ },
+ "bab582ed-c163-4614-bec5-1b99d1157740": {
+ "id": "bab582ed-c163-4614-bec5-1b99d1157740",
+ "title": "Memory (MB)",
+ "description": "Visualization to identify the Memory in (MB) over time",
+ "type": "AREA_CHART",
+ "properties": {
+ "xAxis": "request_time",
+ "yAxes": [
+ {
+ "key": "memory_available",
+ "color": "#10b981"
+ },
+ {
+ "key": "memory_used",
+ "color": "#f59e0b"
+ },
+ {
+ "key": "memory_total",
+ "color": "#F36C06"
+ }
+ ]
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n dateDiff('day', start_time, end_time) AS days_diff,\n dateDiff('year', start_time, end_time) AS years_diff,\n multiIf(\n years_diff >= 1, 'month',\n days_diff <= 1, 'hour',\n 'day'\n ) AS date_granularity\n\nSELECT\n MAX(memory_available) AS memory_available,\n MAX(memory_total) AS memory_total,\n MAX(memory_used) AS memory_used,\n MAX(memory_free) AS memory_free,\n request_time\nFROM (\n SELECT\n SUM(IF(MetricName = 'gpu.memory.available', Value, 0)) AS memory_available,\n SUM(IF(MetricName = 'gpu.memory.total', Value, 0)) AS memory_total,\n SUM(IF(MetricName = 'gpu.memory.used', Value, 0)) AS memory_used,\n SUM(IF(MetricName = 'gpu.memory.free', Value, 0)) AS memory_free,\n formatDateTime(DATE_TRUNC(date_granularity, TimeUnix), '%Y/%m/%d %R') AS request_time\n FROM otel_metrics_gauge\n WHERE\n MetricName IN (\n 'gpu.memory.available',\n 'gpu.memory.total',\n 'gpu.memory.used',\n 'gpu.memory.free'\n )\n AND TimeUnix >= start_time AND TimeUnix <= end_time\n GROUP BY request_time\n)\nGROUP BY request_time\nORDER BY request_time\n"
+ },
+ "createdAt": "2025-06-27 07:10:26",
+ "updatedAt": "2025-06-27 07:12:29"
+ },
+ "8cd8b0f1-7661-4a0e-ada8-a7718d86700c": {
+ "id": "8cd8b0f1-7661-4a0e-ada8-a7718d86700c",
+ "title": "Avg Utilization Percentage (%)",
+ "description": "Visualization to identify the Avg Utilization Percentage over time",
+ "type": "AREA_CHART",
+ "properties": {
+ "xAxis": "request_time",
+ "yAxes": [
+ {
+ "key": "utilization",
+ "color": "#F36C06"
+ },
+ {
+ "key": "enc_utilization",
+ "color": "#0ea5e9"
+ },
+ {
+ "key": "dec_utilization",
+ "color": "#10b981"
+ }
+ ]
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n dateDiff('day', start_time, end_time) AS days_diff,\n dateDiff('year', start_time, end_time) AS years_diff,\n -- Apply JS logic in SQL: if ≥1 year → month, ≤1 day → hour, else → day\n multiIf(\n years_diff >= 1, 'month',\n days_diff <= 1, 'hour',\n 'day'\n ) AS date_granularity\n\nSELECT\n MAX(utilization) AS utilization,\n MAX(enc_utilization) AS enc_utilization,\n MAX(dec_utilization) AS dec_utilization,\n request_time\nFROM (\n SELECT\n ROUND(AVG(IF(MetricName = 'gpu.utilization', Value, NULL)), 2) AS utilization,\n ROUND(AVG(IF(MetricName = 'gpu.enc.utilization', Value, NULL)), 2) AS enc_utilization,\n ROUND(AVG(IF(MetricName = 'gpu.dec.utilization', Value, NULL)), 2) AS dec_utilization,\n formatDateTime(DATE_TRUNC(date_granularity, TimeUnix), '%Y/%m/%d %H:%i') AS request_time\n FROM otel_metrics_gauge\n WHERE\n MetricName IN (\n 'gpu.utilization',\n 'gpu.enc.utilization',\n 'gpu.dec.utilization'\n )\n AND TimeUnix >= start_time AND TimeUnix <= end_time\n GROUP BY request_time\n)\nGROUP BY request_time\nORDER BY request_time\n"
+ },
+ "createdAt": "2025-06-27 06:56:44",
+ "updatedAt": "2025-06-27 07:01:30"
+ },
+ "0952942c-dd5a-484b-8449-224aef6264a8": {
+ "id": "0952942c-dd5a-484b-8449-224aef6264a8",
+ "title": "Avg power draw",
+ "description": "This defines average power drawn within the time period selected",
+ "type": "STAT_CARD",
+ "properties": {
+ "color": "#F36C06",
+ "value": "0.power_draw",
+ "suffix": "W",
+ "trend": "0.rate",
+ "trendSuffix": "%"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n round(avgIf(Value,\n TimeUnix >= start_time AND TimeUnix <= end_time AND MetricName = 'gpu.power.draw'\n ), 2) AS power_draw,\n\n round(avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.power.draw'\n ), 2) AS power_draw_previous,\n\n round(\n if(\n avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.power.draw'\n ) = 0,\n avgIf(Value,\n TimeUnix >= start_time AND TimeUnix <= end_time AND MetricName = 'gpu.power.draw'\n ) * 100.0,\n (\n avgIf(Value,\n TimeUnix >= start_time AND TimeUnix <= end_time AND MetricName = 'gpu.power.draw'\n ) -\n avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.power.draw'\n )\n )\n /\n avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.power.draw'\n ) * 100.0\n ), 2\n ) AS rate\nFROM otel_metrics_gauge\nWHERE\n MetricName = 'gpu.power.draw'\n AND TimeUnix >= prev_start_time AND TimeUnix <= end_time\n"
+ },
+ "createdAt": "2025-06-27 06:48:22",
+ "updatedAt": "2025-06-27 06:51:58"
+ },
+ "c1e14dcc-d345-4201-9468-54cb73356dd4": {
+ "id": "c1e14dcc-d345-4201-9468-54cb73356dd4",
+ "title": "Avg Temperature (°C)",
+ "description": "Visualization to identify the Average Temperature over time",
+ "type": "LINE_CHART",
+ "properties": {
+ "color": "#F36C06",
+ "xAxis": "request_time",
+ "yAxis": "temperature"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n dateDiff('day', start_time, end_time) AS days_diff,\n dateDiff('year', start_time, end_time) AS years_diff,\n multiIf(\n years_diff >= 1, 'month',\n days_diff <= 1, 'hour',\n 'day'\n ) AS date_granularity\n\nSELECT\n ROUND(AVG(Value), 2) AS temperature,\n formatDateTime(DATE_TRUNC(date_granularity, TimeUnix), '%Y/%m/%d %R') AS request_time\nFROM otel_metrics_gauge\nWHERE\n MetricName = 'gpu.temperature'\n AND TimeUnix >= start_time AND TimeUnix <= end_time\nGROUP BY\n request_time\nORDER BY\n request_time\n"
+ },
+ "createdAt": "2025-06-27 07:01:46",
+ "updatedAt": "2025-06-27 07:08:44"
+ },
+ "fefb9f0e-5ee5-497a-b4e0-4e95a79c08c7": {
+ "id": "fefb9f0e-5ee5-497a-b4e0-4e95a79c08c7",
+ "title": "Fan Speed (0 - 100)",
+ "description": "Visualization to identify the Fan Speed over time",
+ "type": "LINE_CHART",
+ "properties": {
+ "color": "#F36C06",
+ "xAxis": "request_time",
+ "yAxis": "fan_speed"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n dateDiff('day', start_time, end_time) AS days_diff,\n dateDiff('year', start_time, end_time) AS years_diff,\n multiIf(\n years_diff >= 1, 'month',\n days_diff <= 1, 'hour',\n 'day'\n ) AS date_granularity\n\nSELECT\n ROUND(AVG(Value), 2) AS fan_speed,\n formatDateTime(DATE_TRUNC(date_granularity, TimeUnix), '%Y/%m/%d %R') AS request_time\nFROM otel_metrics_gauge\nWHERE\n MetricName = 'gpu.fan_speed'\n AND TimeUnix >= start_time AND TimeUnix <= end_time\nGROUP BY request_time\nORDER BY request_time\n"
+ },
+ "createdAt": "2025-06-27 07:14:29",
+ "updatedAt": "2025-06-27 07:15:24"
+ },
+ "74c4fc4b-c062-468d-b35b-8b7ea3aa0cbf": {
+ "id": "74c4fc4b-c062-468d-b35b-8b7ea3aa0cbf",
+ "title": "Average memory used",
+ "description": "This defines average memory used within the time period selected",
+ "type": "STAT_CARD",
+ "properties": {
+ "color": "#F36C06",
+ "suffix": "MB",
+ "trendSuffix": "%",
+ "trend": "0.rate",
+ "value": "0.memory_used"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n round(avgIf(Value,\n TimeUnix >= start_time AND TimeUnix <= end_time AND MetricName = 'gpu.memory.used'\n ), 2) AS memory_used,\n\n round(avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.memory.used'\n ), 2) AS memory_used_previous,\n\n round(\n if(\n avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.memory.used'\n ) = 0,\n avgIf(Value,\n TimeUnix >= start_time AND TimeUnix <= end_time AND MetricName = 'gpu.memory.used'\n ) * 100.0,\n (\n avgIf(Value,\n TimeUnix >= start_time AND TimeUnix <= end_time AND MetricName = 'gpu.memory.used'\n ) -\n avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.memory.used'\n )\n )\n /\n avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.memory.used'\n ) * 100.0\n ), 2\n ) AS rate\nFROM otel_metrics_gauge\nWHERE\n MetricName = 'gpu.memory.used'\n AND TimeUnix >= prev_start_time AND TimeUnix <= end_time\n"
+ },
+ "createdAt": "2025-06-27 06:49:58",
+ "updatedAt": "2025-06-27 06:51:32"
+ },
+ "17dda542-b991-455b-b92c-2a3ae74381ea": {
+ "id": "17dda542-b991-455b-b92c-2a3ae74381ea",
+ "title": "Avg utilization percentage",
+ "description": "This defines average utilization percentage within the time period selected",
+ "type": "STAT_CARD",
+ "properties": {
+ "color": "#F36C06",
+ "value": "0.utilization",
+ "trend": "0.rate",
+ "trendSuffix": "%",
+ "suffix": "%"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n round(avgIf(Value,\n TimeUnix >= start_time AND TimeUnix <= end_time AND MetricName = 'gpu.utilization'\n ), 2) AS utilization,\n\n round(avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.utilization'\n ), 2) AS utilization_previous,\n\n round(\n if(\n avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.utilization'\n ) = 0,\n avgIf(Value,\n TimeUnix >= start_time AND TimeUnix <= end_time AND MetricName = 'gpu.utilization'\n ) * 100.0,\n (\n avgIf(Value,\n TimeUnix >= start_time AND TimeUnix <= end_time AND MetricName = 'gpu.utilization'\n ) -\n avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.utilization'\n )\n ) /\n avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.utilization'\n ) * 100.0\n ), 2\n ) AS rate\nFROM otel_metrics_gauge\nWHERE\n MetricName = 'gpu.utilization'\n AND TimeUnix >= prev_start_time AND TimeUnix <= end_time\n"
+ },
+ "createdAt": "2025-06-27 06:06:03",
+ "updatedAt": "2025-06-27 06:30:44"
+ },
+ "903d54ac-f41b-4e0c-9c3f-aaa1543c77bc": {
+ "id": "903d54ac-f41b-4e0c-9c3f-aaa1543c77bc",
+ "title": "Avg temperature",
+ "description": "This defines average temperature within the time period selected",
+ "type": "STAT_CARD",
+ "properties": {
+ "color": "#F36C06",
+ "value": "0.temperature",
+ "suffix": "°C",
+ "trend": "rate",
+ "trendSuffix": "%"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n round(avgIf(Value,\n TimeUnix >= start_time AND TimeUnix <= end_time AND MetricName = 'gpu.temperature'\n ), 2) AS temperature,\n\n round(avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.temperature'\n ), 2) AS temperature_previous,\n\n round(\n if(\n avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.temperature'\n ) = 0,\n avgIf(Value,\n TimeUnix >= start_time AND TimeUnix <= end_time AND MetricName = 'gpu.temperature'\n ) * 100.0,\n (\n avgIf(Value,\n TimeUnix >= start_time AND TimeUnix <= end_time AND MetricName = 'gpu.temperature'\n ) -\n avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.temperature'\n )\n )\n /\n avgIf(Value,\n TimeUnix >= prev_start_time AND TimeUnix <= prev_end_time AND MetricName = 'gpu.temperature'\n ) * 100.0\n ), 2\n ) AS rate\nFROM otel_metrics_gauge\nWHERE\n MetricName = 'gpu.temperature'\n AND TimeUnix >= prev_start_time AND TimeUnix <= end_time\n"
+ },
+ "createdAt": "2025-06-27 06:45:31",
+ "updatedAt": "2025-06-27 06:47:46"
+ }
+ },
+ "tags": "[\"gpu\"]",
+ "layouts": {
+ "lg": [
+ {
+ "i": "953b08e7-5158-4806-b52e-8b58880b0cfd",
+ "x": 2,
+ "y": 3,
+ "w": 2,
+ "h": 2
+ },
+ {
+ "i": "bab582ed-c163-4614-bec5-1b99d1157740",
+ "x": 0,
+ "y": 3,
+ "w": 2,
+ "h": 2
+ },
+ {
+ "i": "8cd8b0f1-7661-4a0e-ada8-a7718d86700c",
+ "x": 0,
+ "y": 1,
+ "w": 2,
+ "h": 2
+ },
+ {
+ "i": "0952942c-dd5a-484b-8449-224aef6264a8",
+ "x": 2,
+ "y": 0,
+ "w": 1,
+ "h": 1
+ },
+ {
+ "i": "c1e14dcc-d345-4201-9468-54cb73356dd4",
+ "x": 2,
+ "y": 1,
+ "w": 2,
+ "h": 2
+ },
+ {
+ "i": "fefb9f0e-5ee5-497a-b4e0-4e95a79c08c7",
+ "x": 0,
+ "y": 5,
+ "w": 2,
+ "h": 2
+ },
+ {
+ "i": "74c4fc4b-c062-468d-b35b-8b7ea3aa0cbf",
+ "x": 3,
+ "y": 0,
+ "w": 1,
+ "h": 1
+ },
+ {
+ "i": "17dda542-b991-455b-b92c-2a3ae74381ea",
+ "x": 0,
+ "y": 0,
+ "w": 1,
+ "h": 1
+ },
+ {
+ "i": "903d54ac-f41b-4e0c-9c3f-aaa1543c77bc",
+ "x": 1,
+ "y": 0,
+ "w": 1,
+ "h": 1
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/src/client/src/clickhouse/seed-data/openlit-dashboard-LLM-dashboard-layout.json b/src/client/src/clickhouse/seed-data/openlit-dashboard-LLM-dashboard-layout.json
new file mode 100644
index 00000000..230bf1af
--- /dev/null
+++ b/src/client/src/clickhouse/seed-data/openlit-dashboard-LLM-dashboard-layout.json
@@ -0,0 +1,454 @@
+{
+ "id": "f36c60be-5133-4727-b6f8-8999f0692943",
+ "title": "LLM dashboard",
+ "description": "The LLM dashboard helps monitor usage patterns, detect anomalies, and optimize performance and cost across large language model workloads.",
+ "parentId": null,
+ "isMainDashboard": true,
+ "isPinned": false,
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17",
+ "widgets": {
+ "3a680898-76da-4932-9499-ac8f13b0324d": {
+ "id": "3a680898-76da-4932-9499-ac8f13b0324d",
+ "title": "Total hallucination detected",
+ "description": "This defines the total hallucination detected all in all for requests for the time period selected",
+ "type": "STAT_CARD",
+ "properties": {
+ "value": "0.total_evaluation_detected",
+ "color": "#F36C06",
+ "trend": "0.rate",
+ "trendSuffix": "%"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= end_time\n AND evaluationData.evaluation = 'Hallucination'\n AND evaluationData.verdict = 'yes'\n ) AS total_evaluation_detected,\n\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= prev_start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= prev_end_time\n AND evaluationData.evaluation = 'Hallucination'\n AND evaluationData.verdict = 'yes'\n ) AS previous_total_evaluation_detected,\n\n round(\n if(\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= prev_start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= prev_end_time\n AND evaluationData.evaluation = 'Hallucination'\n AND evaluationData.verdict = 'yes'\n ) = 0,\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= end_time\n AND evaluationData.evaluation = 'Hallucination'\n AND evaluationData.verdict = 'yes'\n ) * 100.0,\n (\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= end_time\n AND evaluationData.evaluation = 'Hallucination'\n AND evaluationData.verdict = 'yes'\n ) -\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= prev_start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= prev_end_time\n AND evaluationData.evaluation = 'Hallucination'\n AND evaluationData.verdict = 'yes'\n )\n ) /\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= prev_start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= prev_end_time\n AND evaluationData.evaluation = 'Hallucination'\n AND evaluationData.verdict = 'yes'\n ) * 100.0\n ), 4\n ) AS rate\nFROM openlit_evaluation\nARRAY JOIN evaluationData\nWHERE\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= prev_start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= end_time\n"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "e9b4e3de-0975-4082-912a-fc10ab22f401": {
+ "id": "e9b4e3de-0975-4082-912a-fc10ab22f401",
+ "title": "Top models",
+ "description": "Top 3 models within the time period selected",
+ "type": "BAR_CHART",
+ "properties": {
+ "xAxis": "model",
+ "yAxis": "model_count",
+ "color": "#F36C06"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time\n\t\nSELECT\n\t\t\tSpanAttributes['gen_ai.request.model'] AS model,\n\t\t\tCAST(COUNT(SpanAttributes['gen_ai.request.model']) AS INTEGER) AS model_count\n\t\tFROM\n\t\t\totel_traces\n\t\tWHERE \n\t\tSpanAttributes['gen_ai.operation.name'] != 'vectordb'\n\t\tAND notEmpty(SpanAttributes['gen_ai.request.model'])\n\t\tAND Timestamp >= start_time\n AND Timestamp <= end_time\n\t\tGROUP BY\n\t\t\tmodel\n\t\tORDER BY\n\t\t\tmodel_count DESC\n\t\tLIMIT 3"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "52b30e07-4fba-4954-8599-8fa73b5f804d": {
+ "id": "52b30e07-4fba-4954-8599-8fa73b5f804d",
+ "title": "Avg completion tokens / request",
+ "description": "This determines the average completion (output) tokens being used by per request within the time frame.",
+ "type": "STAT_CARD",
+ "properties": {
+ "value": "0.completion_tokens",
+ "color": "#F36C06",
+ "trend": "0.rate",
+ "trendSuffix": "%"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n round(avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.output_tokens']),\n Timestamp >= start_time AND Timestamp <= end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.output_tokens'])), 5) AS completion_tokens,\n\n round(avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.output_tokens']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.output_tokens'])), 5) AS completion_tokens_previous,\n\n round(\n if(\n avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.output_tokens']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.output_tokens'])) = 0,\n avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.output_tokens']),\n Timestamp >= start_time AND Timestamp <= end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.output_tokens'])) * 100.0,\n (\n avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.output_tokens']),\n Timestamp >= start_time AND Timestamp <= end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.output_tokens']))\n -\n avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.output_tokens']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.output_tokens']))\n )\n /\n avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.output_tokens']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.output_tokens'])) * 100.0\n ), 4\n ) AS rate\nFROM otel_traces\nWHERE\n SpanAttributes['gen_ai.operation.name'] != 'vectordb'\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= prev_start_time AND Timestamp <= end_time\n"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "33432121-0999-4cdd-94d6-db8c64b32852": {
+ "id": "33432121-0999-4cdd-94d6-db8c64b32852",
+ "title": "Generation by provider",
+ "description": "This has generation by provider based on the time period selected",
+ "type": "PIE_CHART",
+ "properties": {
+ "labelPath": "provider",
+ "valuePath": "count",
+ "color": "#F36C06"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time\n\nSELECT \n SpanAttributes['gen_ai.system'] AS provider,\n CAST(COUNT(*) AS INTEGER) AS count\n FROM\n otel_traces\n WHERE \n SpanAttributes['gen_ai.operation.name'] != 'vectordb'\n AND notEmpty(SpanAttributes['gen_ai.system'])\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= start_time\n AND Timestamp <= end_time\n GROUP BY provider;"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "7963675c-db19-4937-8c16-01b047339b8f": {
+ "id": "7963675c-db19-4937-8c16-01b047339b8f",
+ "title": "Tokens Usage",
+ "description": "This determines the tokens being used by request per day within the time frame.",
+ "type": "AREA_CHART",
+ "properties": {
+ "xAxis": "request_time",
+ "yAxis": "total_tokens",
+ "yAxes": [
+ {
+ "key": "prompt_tokens",
+ "color": "#10b981"
+ },
+ {
+ "key": "completion_tokens",
+ "color": "#F36C06"
+ }
+ ]
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n dateDiff('day', start_time, end_time) AS days_diff,\n dateDiff('year', start_time, end_time) AS years_diff,\n multiIf(\n years_diff >= 1, 'month',\n days_diff <= 1, 'hour',\n 'day'\n ) AS date_granularity\n\n\tSELECT\n\t\tCAST(SUM(toInt64OrZero(SpanAttributes['gen_ai.usage.total_tokens'])) AS INTEGER) AS total_tokens,\n\t\tCAST(SUM(toInt64OrZero(SpanAttributes['gen_ai.usage.input_tokens'])) AS INTEGER) AS prompt_tokens,\n\t\tCAST(SUM(toInt64OrZero(SpanAttributes['gen_ai.usage.output_tokens'])) AS INTEGER) AS completion_tokens,\n\t\tformatDateTime(DATE_TRUNC(date_granularity, Timestamp), '%Y/%m/%d %R') AS request_time\n\t\tFROM otel_traces \n\t\tWHERE \n\t\tSpanAttributes['gen_ai.operation.name'] != 'vectordb'\n\t\tAND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n\t\tAND Timestamp >= start_time\n AND Timestamp <= end_time\n\t\tGROUP BY request_time\n\t\tORDER BY request_time;"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "0b6e684f-69e5-48fe-8438-34722939e5ca": {
+ "id": "0b6e684f-69e5-48fe-8438-34722939e5ca",
+ "title": "Requests per time",
+ "description": "Line chart to identify the Requests per time",
+ "type": "LINE_CHART",
+ "properties": {
+ "yAxis": "total",
+ "xAxis": "request_time",
+ "color": "#F36C06"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n dateDiff('day', start_time, end_time) AS days_diff,\n dateDiff('year', start_time, end_time) AS years_diff,\n multiIf(\n years_diff >= 1, 'month',\n days_diff <= 1, 'hour',\n 'day'\n ) AS date_granularity\n\nSELECT\n CAST(COUNT(*) AS INTEGER) AS total,\n formatDateTime(DATE_TRUNC(date_granularity, Timestamp), '%Y/%m/%d %R') AS request_time\nFROM otel_traces\nWHERE\n SpanAttributes['gen_ai.operation.name'] != 'vectordb'\n\t\tAND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= start_time AND Timestamp <= end_time\nGROUP BY request_time\nORDER BY request_time"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "e1d85a1b-e911-48ae-adf2-abf4b9b3dddc": {
+ "id": "e1d85a1b-e911-48ae-adf2-abf4b9b3dddc",
+ "title": "Cost by application",
+ "description": "This has cost by application based on the time period selected",
+ "type": "PIE_CHART",
+ "properties": {
+ "labelPath": "applicationName",
+ "valuePath": "cost",
+ "color": "#F36C06"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time\n\nSELECT \n\t\t\tDISTINCT ResourceAttributes['service.name'] as applicationName, \n\t\t\tROUND(SUM(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost'])), 5) AS cost\n\t\tFROM otel_traces \n\t\tWHERE \n SpanAttributes['gen_ai.operation.name'] != 'vectordb'\n AND notEmpty(SpanAttributes['gen_ai.usage.cost']) \n AND notEmpty(ResourceAttributes['service.name'])\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n\t\tAND Timestamp >= start_time\n AND Timestamp <= end_time\n\t\tGROUP BY applicationName;"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "691426c4-3166-44fd-8af5-e07a8df5e1eb": {
+ "id": "691426c4-3166-44fd-8af5-e07a8df5e1eb",
+ "title": "Models per time",
+ "description": "New Widget Description",
+ "type": "LINE_CHART",
+ "properties": {
+ "yAxis": "total_model_count",
+ "xAxis": "request_time",
+ "color": "#F36C06"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n dateDiff('day', start_time, end_time) AS days_diff,\n dateDiff('year', start_time, end_time) AS years_diff,\n multiIf(\n years_diff >= 1, 'month',\n days_diff <= 1, 'hour',\n 'day'\n ) AS date_granularity\n\nSELECT \n ARRAY_AGG(model) AS models,\n ARRAY_AGG(model_count) AS model_counts,\n CAST(SUM(model_count) AS INTEGER) AS total_model_count,\n request_time\nFROM (\n SELECT\n SpanAttributes['gen_ai.request.model'] AS model,\n COUNT(*) AS model_count,\n formatDateTime(DATE_TRUNC(date_granularity, Timestamp), '%Y/%m/%d %R') AS request_time\n FROM otel_traces\n WHERE\n Timestamp >= start_time AND Timestamp <= end_time\n AND SpanAttributes['gen_ai.operation.name'] != 'vectordb'\n AND notEmpty(SpanAttributes['gen_ai.request.model'])\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n GROUP BY\n model, request_time\n) AS sub\nGROUP BY\n request_time\nORDER BY\n request_time\n"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "433e3791-a8ca-4c9e-b95c-39acfe38baa8": {
+ "id": "433e3791-a8ca-4c9e-b95c-39acfe38baa8",
+ "title": "Total costs",
+ "description": "This defines the total cost for the time period selected",
+ "type": "STAT_CARD",
+ "properties": {
+ "suffix": "",
+ "prefix": "$",
+ "value": "0.total_usage_cost",
+ "color": "#F36C06",
+ "trend": "0.rate",
+ "trendSuffix": "%"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n round(sumIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),\n Timestamp >= start_time AND Timestamp <= end_time), 7) AS total_usage_cost,\n\n round(sumIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time), 7) AS total_usage_cost_previous,\n\n round(\n if(\n sumIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time) = 0,\n sumIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),\n Timestamp >= start_time AND Timestamp <= end_time) * 100.0,\n (\n sumIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),\n Timestamp >= start_time AND Timestamp <= end_time)\n -\n sumIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time)\n )\n /\n sumIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time) * 100.0\n ), 4\n ) AS rate\nFROM otel_traces\nWHERE\n SpanAttributes['gen_ai.operation.name'] != 'vectordb'\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= prev_start_time AND Timestamp <= end_time\n"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "e83f15d1-4f9b-47f3-a31a-9cc6a274f713": {
+ "id": "e83f15d1-4f9b-47f3-a31a-9cc6a274f713",
+ "title": "Total bias detected",
+ "description": "This defines the total bias detected all in all for requests for the time period selected",
+ "type": "STAT_CARD",
+ "properties": {
+ "value": "0.total_evaluation_detected",
+ "color": "#F36C06",
+ "trend": "0.rate",
+ "trendSuffix": "%"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= end_time\n AND evaluationData.evaluation = 'Bias'\n AND evaluationData.verdict = 'yes'\n ) AS total_evaluation_detected,\n\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= prev_start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= prev_end_time\n AND evaluationData.evaluation = 'Bias'\n AND evaluationData.verdict = 'yes'\n ) AS previous_total_evaluation_detected,\n\n round(\n if(\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= prev_start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= prev_end_time\n AND evaluationData.evaluation = 'Bias'\n AND evaluationData.verdict = 'yes'\n ) = 0,\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= end_time\n AND evaluationData.evaluation = 'Bias'\n AND evaluationData.verdict = 'yes'\n ) * 100.0,\n (\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= end_time\n AND evaluationData.evaluation = 'Bias'\n AND evaluationData.verdict = 'yes'\n ) -\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= prev_start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= prev_end_time\n AND evaluationData.evaluation = 'Bias'\n AND evaluationData.verdict = 'yes'\n )\n ) /\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= prev_start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= prev_end_time\n AND evaluationData.evaluation = 'Bias'\n AND evaluationData.verdict = 'yes'\n ) * 100.0\n ), 4\n ) AS rate\nFROM openlit_evaluation\nARRAY JOIN evaluationData\nWHERE\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= prev_start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= end_time\n"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "20de3eb9-86aa-483e-9adc-536961e99ec2": {
+ "id": "20de3eb9-86aa-483e-9adc-536961e99ec2",
+ "title": "Avg prompt tokens / request",
+ "description": "This determines the average prompt (input) tokens being used by per request within the time frame.",
+ "type": "STAT_CARD",
+ "properties": {
+ "value": "0.prompt_tokens",
+ "color": "#F36C06",
+ "trend": "0.rate",
+ "trendSuffix": "%"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n round(avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.input_tokens']),\n Timestamp >= start_time AND Timestamp <= end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.input_tokens'])), 5) AS prompt_tokens,\n\n round(avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.input_tokens']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.input_tokens'])), 5) AS prompt_tokens_previous,\n\n round(\n if(\n avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.input_tokens']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.input_tokens'])) = 0,\n avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.input_tokens']),\n Timestamp >= start_time AND Timestamp <= end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.input_tokens'])) * 100.0,\n (\n avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.input_tokens']),\n Timestamp >= start_time AND Timestamp <= end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.input_tokens']))\n -\n avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.input_tokens']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.input_tokens']))\n )\n /\n avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.input_tokens']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.input_tokens'])) * 100.0\n ), 4\n ) AS rate\nFROM otel_traces\nWHERE\n SpanAttributes['gen_ai.operation.name'] != 'vectordb'\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= prev_start_time AND Timestamp <= end_time\n"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "b9f59cec-f76d-4f49-a4ea-472392645818": {
+ "id": "b9f59cec-f76d-4f49-a4ea-472392645818",
+ "title": "Total toxicity detected",
+ "description": "This defines the total toxicity detected all in all for requests for the time period selected",
+ "type": "STAT_CARD",
+ "properties": {
+ "value": "0.total_evaluation_detected",
+ "color": "#F36C06",
+ "trend": "0.rate",
+ "trendSuffix": "%"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= end_time\n AND evaluationData.evaluation = 'Toxicity'\n AND evaluationData.verdict = 'yes'\n ) AS total_evaluation_detected,\n\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= prev_start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= prev_end_time\n AND evaluationData.evaluation = 'Toxicity'\n AND evaluationData.verdict = 'yes'\n ) AS previous_total_evaluation_detected,\n\n round(\n if(\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= prev_start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= prev_end_time\n AND evaluationData.evaluation = 'Toxicity'\n AND evaluationData.verdict = 'yes'\n ) = 0,\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= end_time\n AND evaluationData.evaluation = 'Toxicity'\n AND evaluationData.verdict = 'yes'\n ) * 100.0,\n (\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= end_time\n AND evaluationData.evaluation = 'Toxicity'\n AND evaluationData.verdict = 'yes'\n ) -\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= prev_start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= prev_end_time\n AND evaluationData.evaluation = 'Toxicity'\n AND evaluationData.verdict = 'yes'\n )\n ) /\n countDistinctIf(\n span_id,\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= prev_start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= prev_end_time\n AND evaluationData.evaluation = 'Toxicity'\n AND evaluationData.verdict = 'yes'\n ) * 100.0\n ), 4\n ) AS rate\nFROM openlit_evaluation\nARRAY JOIN evaluationData\nWHERE\n parseDateTimeBestEffort(meta['traceTimeStamp']) >= prev_start_time\n AND parseDateTimeBestEffort(meta['traceTimeStamp']) <= end_time\n"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "b00a0be3-08c3-42e2-9eba-62b1f9bf5bed": {
+ "id": "b00a0be3-08c3-42e2-9eba-62b1f9bf5bed",
+ "title": "Avg Tokens / Request",
+ "description": "This determines the average tokens being used by per request within the time frame.",
+ "type": "STAT_CARD",
+ "properties": {
+ "value": "0.total_tokens",
+ "color": "#F36C06",
+ "trend": "0.rate",
+ "trendSuffix": "%"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n round(avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.total_tokens']), \n Timestamp >= start_time AND Timestamp <= end_time \n AND notEmpty(SpanAttributes['gen_ai.usage.total_tokens'])), 4) AS total_tokens,\n\n round(avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.total_tokens']), \n Timestamp >= prev_start_time AND Timestamp <= prev_end_time \n AND notEmpty(SpanAttributes['gen_ai.usage.total_tokens'])), 4) AS total_tokens_previous,\n\n round(\n if(\n avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.total_tokens']), \n Timestamp >= prev_start_time AND Timestamp <= prev_end_time \n AND notEmpty(SpanAttributes['gen_ai.usage.total_tokens'])) = 0,\n avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.total_tokens']), \n Timestamp >= start_time AND Timestamp <= end_time \n AND notEmpty(SpanAttributes['gen_ai.usage.total_tokens'])) * 100.0,\n (\n avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.total_tokens']), \n Timestamp >= start_time AND Timestamp <= end_time \n AND notEmpty(SpanAttributes['gen_ai.usage.total_tokens']))\n -\n avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.total_tokens']), \n Timestamp >= prev_start_time AND Timestamp <= prev_end_time \n AND notEmpty(SpanAttributes['gen_ai.usage.total_tokens']))\n )\n /\n avgIf(toInt32OrZero(SpanAttributes['gen_ai.usage.total_tokens']), \n Timestamp >= prev_start_time AND Timestamp <= prev_end_time \n AND notEmpty(SpanAttributes['gen_ai.usage.total_tokens'])) * 100.0\n ), 4\n ) AS rate\nFROM otel_traces\nWHERE\n SpanAttributes['gen_ai.operation.name'] != 'vectordb'\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= prev_start_time AND Timestamp <= end_time\n"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "8241708c-9546-489f-a5c7-31b91b97d233": {
+ "id": "8241708c-9546-489f-a5c7-31b91b97d233",
+ "title": "Cost by Environment",
+ "description": "This has cost by environment based on the time period selected",
+ "type": "PIE_CHART",
+ "properties": {
+ "labelPath": "environment",
+ "valuePath": "cost",
+ "color": "#F36C06"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time\n\nSELECT \n\t\t\tDISTINCT ResourceAttributes['deployment.environment'] as environment, \n\t\t\tSUM(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost'])) AS cost\n\t\tFROM otel_traces \n\t\tWHERE \n SpanAttributes['gen_ai.operation.name'] != 'vectordb'\n AND notEmpty(SpanAttributes['gen_ai.usage.cost']) \n AND notEmpty(ResourceAttributes['deployment.environment'])\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n\t\tAND Timestamp >= start_time\n AND Timestamp <= end_time\n\t\tGROUP BY environment;"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "f079e045-0cea-4283-a4a0-bdea0ad00fce": {
+ "id": "f079e045-0cea-4283-a4a0-bdea0ad00fce",
+ "title": "Avg cost per request",
+ "description": "This defines the average cost for the time period selected",
+ "type": "STAT_CARD",
+ "properties": {
+ "value": "0.avg_usage_cost",
+ "prefix": "$",
+ "color": "#F36C06",
+ "trend": "0.rate",
+ "trendSuffix": "%"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n round(avgIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),\n Timestamp >= start_time AND Timestamp <= end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.cost'])), 7) AS avg_usage_cost,\n\n round(avgIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.cost'])), 7) AS avg_usage_cost_previous,\n\n round(\n if(\n avgIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.cost'])) = 0,\n avgIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),\n Timestamp >= start_time AND Timestamp <= end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.cost'])) * 100.0,\n (\n avgIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),\n Timestamp >= start_time AND Timestamp <= end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.cost']))\n -\n avgIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.cost']))\n )\n /\n avgIf(toFloat64OrZero(SpanAttributes['gen_ai.usage.cost']),\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time\n AND notEmpty(SpanAttributes['gen_ai.usage.cost'])) * 100.0\n ), 4\n ) AS rate\nFROM otel_traces\nWHERE\n SpanAttributes['gen_ai.operation.name'] != 'vectordb'\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= prev_start_time AND Timestamp <= end_time\n"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "e5cb3f7a-6e48-470f-9a8b-ff9d1b1af804": {
+ "id": "e5cb3f7a-6e48-470f-9a8b-ff9d1b1af804",
+ "title": "Generation by categories",
+ "description": "This has generation by categories based on the time period selected",
+ "type": "PIE_CHART",
+ "properties": {
+ "labelPath": "category",
+ "valuePath": "count",
+ "color": "#F36C06"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time\n\nSELECT\n SpanAttributes['gen_ai.operation.name'] AS category,\n CAST(COUNT(*) AS INTEGER) AS count\nFROM otel_traces\nWHERE\n SpanAttributes['gen_ai.operation.name'] != 'vectordb'\n AND notEmpty(SpanAttributes['gen_ai.operation.name'])\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= start_time\n AND Timestamp <= end_time\nGROUP BY category"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "527f0805-e039-4441-b2ec-4009d648f285": {
+ "id": "527f0805-e039-4441-b2ec-4009d648f285",
+ "title": "Total Requests",
+ "description": "This defines total number of request within the time period selected",
+ "type": "STAT_CARD",
+ "properties": {
+ "value": "0.total_request",
+ "color": "#F36C06",
+ "trend": "0.rate",
+ "trendSuffix": "%"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n CAST(countIf(\n Timestamp >= start_time AND Timestamp <= end_time\n ) AS INTEGER) AS total_request,\n\n CAST(countIf(\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time\n ) AS INTEGER) AS total_request_previous,\n\n round(\n if(countIf(Timestamp >= prev_start_time AND Timestamp <= prev_end_time) = 0, \n (countIf(Timestamp >= start_time AND Timestamp <= end_time) * 100.0), \n ((countIf(Timestamp >= start_time AND Timestamp <= end_time) - countIf(Timestamp >= prev_start_time AND Timestamp <= prev_end_time)) \n / countIf(Timestamp >= prev_start_time AND Timestamp <= prev_end_time))*100.0\n ), 4\n ) AS rate\n\nFROM otel_traces\nWHERE\n SpanAttributes['gen_ai.operation.name'] != 'vectordb'\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= prev_start_time AND Timestamp <= end_time;"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ },
+ "233325ea-7f74-4464-8168-f56105836870": {
+ "id": "233325ea-7f74-4464-8168-f56105836870",
+ "title": "Average Request Duration",
+ "description": "This defines the average request duration for the time period selected",
+ "type": "STAT_CARD",
+ "properties": {
+ "value": "0.average_duration",
+ "suffix": "s",
+ "color": "#F36C06",
+ "trend": "0.rate",
+ "trendSuffix": "%"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n round(multiply(\n avgIf(Duration, Timestamp >= start_time AND Timestamp <= end_time),\n 10e-10\n ), 4) AS average_duration,\n\n round(multiply(\n avgIf(Duration, Timestamp >= prev_start_time AND Timestamp <= prev_end_time),\n 10e-10\n ), 4) AS average_duration_previous,\n\n round(\n if(\n avgIf(Duration, Timestamp >= prev_start_time AND Timestamp <= prev_end_time) = 0,\n avgIf(Duration, Timestamp >= start_time AND Timestamp <= end_time) * 100.0,\n (\n avgIf(Duration, Timestamp >= start_time AND Timestamp <= end_time) -\n avgIf(Duration, Timestamp >= prev_start_time AND Timestamp <= prev_end_time)\n ) / avgIf(Duration, Timestamp >= prev_start_time AND Timestamp <= prev_end_time) * 100.0\n ), 4\n ) AS rate\nFROM otel_traces\nWHERE\n SpanAttributes['gen_ai.operation.name'] != 'vectordb'\n AND isFinite(Duration)\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= prev_start_time AND Timestamp <= end_time\n"
+ },
+ "createdAt": "2025-06-16 07:39:17",
+ "updatedAt": "2025-06-16 07:39:17"
+ }
+ },
+ "tags": "[\"llm\"]",
+ "layouts": {
+ "lg": [
+ {
+ "i": "3a680898-76da-4932-9499-ac8f13b0324d",
+ "x": 1,
+ "y": 1,
+ "w": 1,
+ "h": 1
+ },
+ {
+ "i": "e9b4e3de-0975-4082-912a-fc10ab22f401",
+ "x": 0,
+ "y": 8,
+ "w": 2,
+ "h": 2
+ },
+ {
+ "i": "52b30e07-4fba-4954-8599-8fa73b5f804d",
+ "x": 0,
+ "y": 7,
+ "w": 1,
+ "h": 1
+ },
+ {
+ "i": "33432121-0999-4cdd-94d6-db8c64b32852",
+ "x": 1,
+ "y": 4,
+ "w": 1,
+ "h": 2
+ },
+ {
+ "i": "7963675c-db19-4937-8c16-01b047339b8f",
+ "x": 1,
+ "y": 6,
+ "w": 3,
+ "h": 2
+ },
+ {
+ "i": "0b6e684f-69e5-48fe-8438-34722939e5ca",
+ "x": 0,
+ "y": 2,
+ "w": 4,
+ "h": 2
+ },
+ {
+ "i": "e1d85a1b-e911-48ae-adf2-abf4b9b3dddc",
+ "x": 3,
+ "y": 4,
+ "w": 1,
+ "h": 2
+ },
+ {
+ "i": "691426c4-3166-44fd-8af5-e07a8df5e1eb",
+ "x": 2,
+ "y": 8,
+ "w": 2,
+ "h": 2
+ },
+ {
+ "i": "433e3791-a8ca-4c9e-b95c-39acfe38baa8",
+ "x": 3,
+ "y": 0,
+ "w": 1,
+ "h": 1
+ },
+ {
+ "i": "e83f15d1-4f9b-47f3-a31a-9cc6a274f713",
+ "x": 2,
+ "y": 1,
+ "w": 1,
+ "h": 1
+ },
+ {
+ "i": "20de3eb9-86aa-483e-9adc-536961e99ec2",
+ "x": 0,
+ "y": 6,
+ "w": 1,
+ "h": 1
+ },
+ {
+ "i": "b9f59cec-f76d-4f49-a4ea-472392645818",
+ "x": 3,
+ "y": 1,
+ "w": 1,
+ "h": 1
+ },
+ {
+ "i": "b00a0be3-08c3-42e2-9eba-62b1f9bf5bed",
+ "x": 2,
+ "y": 0,
+ "w": 1,
+ "h": 1
+ },
+ {
+ "i": "8241708c-9546-489f-a5c7-31b91b97d233",
+ "x": 2,
+ "y": 4,
+ "w": 1,
+ "h": 2
+ },
+ {
+ "i": "f079e045-0cea-4283-a4a0-bdea0ad00fce",
+ "x": 0,
+ "y": 1,
+ "w": 1,
+ "h": 1
+ },
+ {
+ "i": "e5cb3f7a-6e48-470f-9a8b-ff9d1b1af804",
+ "x": 0,
+ "y": 4,
+ "w": 1,
+ "h": 2
+ },
+ {
+ "i": "527f0805-e039-4441-b2ec-4009d648f285",
+ "x": 0,
+ "y": 0,
+ "w": 1,
+ "h": 1
+ },
+ {
+ "i": "233325ea-7f74-4464-8168-f56105836870",
+ "x": 1,
+ "y": 0,
+ "w": 1,
+ "h": 1
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/src/client/src/clickhouse/seed-data/openlit-dashboard-Vector-DB-layout.json b/src/client/src/clickhouse/seed-data/openlit-dashboard-Vector-DB-layout.json
new file mode 100644
index 00000000..7573de98
--- /dev/null
+++ b/src/client/src/clickhouse/seed-data/openlit-dashboard-Vector-DB-layout.json
@@ -0,0 +1,158 @@
+{
+ "id": "4b153228-45fb-46d9-88c9-5a2aa3674251",
+ "title": "Vector DB",
+ "description": "The vector DB dashboard helps track query performance, memory usage, and index efficiency to optimize similarity search and ensure reliable vector database operations.",
+ "parentId": null,
+ "isMainDashboard": false,
+ "isPinned": true,
+ "createdAt": "2025-06-25 08:41:39",
+ "updatedAt": "2025-06-25 08:41:39",
+ "widgets": {
+ "af3786ef-5dd8-4b6c-929b-99005b27a784": {
+ "id": "af3786ef-5dd8-4b6c-929b-99005b27a784",
+ "title": "Generation by environment",
+ "description": "This defines total number of request grouped by environment name",
+ "type": "PIE_CHART",
+ "properties": {
+ "labelPath": "environment",
+ "valuePath": "count",
+ "color": "#F36C06"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time\n\nSELECT \n ResourceAttributes['deployment.environment'] AS environment,\n CAST(COUNT(*) AS INTEGER) AS count\n FROM\n otel_traces\n WHERE \n SpanAttributes['gen_ai.operation.name'] == 'vectordb'\n AND notEmpty(ResourceAttributes['deployment.environment'])\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= start_time\n AND Timestamp <= end_time\n GROUP BY environment;"
+ },
+ "createdAt": "2025-06-25 09:19:04",
+ "updatedAt": "2025-06-25 09:20:21"
+ },
+ "c7d531ef-3752-45a5-aa24-4b6de0f63be4": {
+ "id": "c7d531ef-3752-45a5-aa24-4b6de0f63be4",
+ "title": "Generation by system",
+ "description": "This defines total number of request grouped by system name",
+ "type": "PIE_CHART",
+ "properties": {
+ "labelPath": "system",
+ "valuePath": "count",
+ "color": "#F36C06"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time\n\nSELECT \n SpanAttributes['db.system.name'] AS system,\n CAST(COUNT(*) AS INTEGER) AS count\n FROM\n otel_traces\n WHERE \n SpanAttributes['gen_ai.operation.name'] == 'vectordb'\n AND notEmpty(SpanAttributes['db.system.name'])\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= start_time\n AND Timestamp <= end_time\n GROUP BY system;"
+ },
+ "createdAt": "2025-06-25 09:27:20",
+ "updatedAt": "2025-06-25 09:29:03"
+ },
+ "2c324137-3795-4268-ab8a-831a2977826c": {
+ "id": "2c324137-3795-4268-ab8a-831a2977826c",
+ "title": "Average Request Duration",
+ "description": "This defines the average request duration for the time period selected",
+ "type": "STAT_CARD",
+ "properties": {
+ "value": "0.average_duration",
+ "trend": "0.rate",
+ "trendSuffix": "%",
+ "color": "#F36C06",
+ "suffix": "s"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n round(multiply(\n avgIf(Duration, Timestamp >= start_time AND Timestamp <= end_time),\n 10e-10\n ), 4) AS average_duration,\n\n round(multiply(\n avgIf(Duration, Timestamp >= prev_start_time AND Timestamp <= prev_end_time),\n 10e-10\n ), 4) AS average_duration_previous,\n\n round(\n if(\n avgIf(Duration, Timestamp >= prev_start_time AND Timestamp <= prev_end_time) = 0,\n avgIf(Duration, Timestamp >= start_time AND Timestamp <= end_time) * 100.0,\n (\n avgIf(Duration, Timestamp >= start_time AND Timestamp <= end_time) -\n avgIf(Duration, Timestamp >= prev_start_time AND Timestamp <= prev_end_time)\n ) / avgIf(Duration, Timestamp >= prev_start_time AND Timestamp <= prev_end_time) * 100.0\n ), 4\n ) AS rate\nFROM otel_traces\nWHERE\n SpanAttributes['gen_ai.operation.name'] == 'vectordb'\n AND isFinite(Duration)\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= prev_start_time AND Timestamp <= end_time\n"
+ },
+ "createdAt": "2025-06-25 08:44:30",
+ "updatedAt": "2025-06-25 10:19:12"
+ },
+ "1459ede3-8584-4ce6-93c7-a6b713ee487c": {
+ "id": "1459ede3-8584-4ce6-93c7-a6b713ee487c",
+ "title": "Total Requests",
+ "description": "This defines total number of request within the time period selected",
+ "type": "STAT_CARD",
+ "properties": {
+ "value": "0.total_request",
+ "trend": "0.rate",
+ "trendSuffix": "%",
+ "color": "#F36C06"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time,\n (end_time - start_time) AS duration,\n (start_time - duration) AS prev_start_time,\n (end_time - duration) AS prev_end_time\n\nSELECT\n CAST(countIf(\n Timestamp >= start_time AND Timestamp <= end_time\n ) AS INTEGER) AS total_request,\n\n CAST(countIf(\n Timestamp >= prev_start_time AND Timestamp <= prev_end_time\n ) AS INTEGER) AS total_request_previous,\n\n round(\n if(countIf(Timestamp >= prev_start_time AND Timestamp <= prev_end_time) = 0, \n (countIf(Timestamp >= start_time AND Timestamp <= end_time) * 100.0), \n ((countIf(Timestamp >= start_time AND Timestamp <= end_time) - countIf(Timestamp >= prev_start_time AND Timestamp <= prev_end_time)) \n / countIf(Timestamp >= prev_start_time AND Timestamp <= prev_end_time))*100.0\n ), 4\n ) AS rate\n\nFROM otel_traces\nWHERE\n SpanAttributes['gen_ai.operation.name'] == 'vectordb'\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= prev_start_time AND Timestamp <= end_time;"
+ },
+ "createdAt": "2025-06-25 08:42:46",
+ "updatedAt": "2025-06-25 08:43:33"
+ },
+ "cbfc156a-ded5-4fa9-868a-25a93baf1e36": {
+ "id": "cbfc156a-ded5-4fa9-868a-25a93baf1e36",
+ "title": "Generation by application",
+ "description": "This defines total number of request grouped by application name",
+ "type": "PIE_CHART",
+ "properties": {
+ "labelPath": "applicationName",
+ "valuePath": "count",
+ "color": "#F36C06"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time\n\nSELECT \n ResourceAttributes['service.name'] AS applicationName,\n CAST(COUNT(*) AS INTEGER) AS count\n FROM\n otel_traces\n WHERE \n SpanAttributes['gen_ai.operation.name'] == 'vectordb'\n AND notEmpty(ResourceAttributes['service.name'])\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= start_time\n AND Timestamp <= end_time\n GROUP BY applicationName;"
+ },
+ "createdAt": "2025-06-25 09:16:51",
+ "updatedAt": "2025-06-25 09:20:13"
+ },
+ "2ef979cb-1380-4f40-8c8f-227f700c23c9": {
+ "id": "2ef979cb-1380-4f40-8c8f-227f700c23c9",
+ "title": "Generation by Operation",
+ "description": "This defines total number of request grouped by operation name",
+ "type": "BAR_CHART",
+ "properties": {
+ "xAxis": "operation",
+ "yAxis": "count",
+ "color": "#F36C06"
+ },
+ "config": {
+ "query": "WITH\n parseDateTimeBestEffort('{{filter.timeLimit.start}}') AS start_time,\n parseDateTimeBestEffort('{{filter.timeLimit.end}}') AS end_time\n\nSELECT \n SpanAttributes['db.operation.name'] AS operation,\n CAST(COUNT(*) AS INTEGER) AS count\n FROM\n otel_traces\n WHERE \n SpanAttributes['gen_ai.operation.name'] == 'vectordb'\n AND notEmpty(SpanAttributes['db.operation.name'])\n AND StatusCode IN ('STATUS_CODE_OK', 'STATUS_CODE_UNSET', 'Ok', 'Unset')\n AND Timestamp >= start_time\n AND Timestamp <= end_time\n GROUP BY operation;"
+ },
+ "createdAt": "2025-06-25 09:20:58",
+ "updatedAt": "2025-06-25 09:26:39"
+ }
+ },
+ "tags": "[\"vector-db\"]",
+ "layouts": {
+ "lg": [
+ {
+ "i": "af3786ef-5dd8-4b6c-929b-99005b27a784",
+ "x": 3,
+ "y": 0,
+ "w": 1,
+ "h": 2
+ },
+ {
+ "i": "c7d531ef-3752-45a5-aa24-4b6de0f63be4",
+ "x": 1,
+ "y": 0,
+ "w": 1,
+ "h": 2
+ },
+ {
+ "i": "2c324137-3795-4268-ab8a-831a2977826c",
+ "x": 0,
+ "y": 1,
+ "w": 1,
+ "h": 1
+ },
+ {
+ "i": "1459ede3-8584-4ce6-93c7-a6b713ee487c",
+ "x": 0,
+ "y": 0,
+ "w": 1,
+ "h": 1
+ },
+ {
+ "i": "cbfc156a-ded5-4fa9-868a-25a93baf1e36",
+ "x": 2,
+ "y": 0,
+ "w": 1,
+ "h": 2
+ },
+ {
+ "i": "2ef979cb-1380-4f40-8c8f-227f700c23c9",
+ "x": 0,
+ "y": 2,
+ "w": 4,
+ "h": 2
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/src/client/src/clickhouse/seed/dashboards.ts b/src/client/src/clickhouse/seed/dashboards.ts
new file mode 100644
index 00000000..17f755d2
--- /dev/null
+++ b/src/client/src/clickhouse/seed/dashboards.ts
@@ -0,0 +1,43 @@
+import { importBoardLayout, isBoardTableEmpty } from "@/lib/platform/manage-dashboard/board";
+import llmDashboard from "../seed-data/openlit-dashboard-LLM-dashboard-layout.json";
+import vectorDbDashboard from "../seed-data/openlit-dashboard-Vector-DB-layout.json";
+import gpuDashboard from "../seed-data/openlit-dashboard-GPU-dashboard-layout.json";
+
+export default async function CreateCustomDashboardsSeed(databaseConfigId?: string) {
+ console.log(
+ `********* Seeding Dashboards *********`
+ );
+
+ const { data: isBoardTableEmptyData, err: isBoardTableEmptyErr } = await isBoardTableEmpty(databaseConfigId);
+
+ if (isBoardTableEmptyErr) {
+ console.log(
+ `********* Error checking if board table is empty *********`
+ );
+ console.log(isBoardTableEmptyErr);
+ return;
+ }
+
+ if (isBoardTableEmptyData) {
+ console.log(
+ `********* Board Table is not empty hence skipping seeding *********`
+ );
+ return;
+ }
+
+ const { err: llmDashboardErr } = await importBoardLayout(llmDashboard, databaseConfigId);
+ const { err: vectorDbDashboardErr } = await importBoardLayout(vectorDbDashboard, databaseConfigId);
+ const { err: gpuDashboardErr } = await importBoardLayout(gpuDashboard, databaseConfigId);
+
+ if (llmDashboardErr || vectorDbDashboardErr || gpuDashboardErr) {
+ console.log(
+ `********* Seeding Dashboards Failed *********`
+ );
+ console.log(llmDashboardErr, vectorDbDashboardErr, gpuDashboardErr);
+ return;
+ }
+
+ console.log(
+ `********* Seeding Dashboards Completed *********`
+ );
+}
\ No newline at end of file
diff --git a/src/client/src/components/(playground)/clickhouse-connectivity-wrapper.tsx b/src/client/src/components/(playground)/clickhouse-connectivity-wrapper.tsx
index b07c0ade..c3d61592 100644
--- a/src/client/src/components/(playground)/clickhouse-connectivity-wrapper.tsx
+++ b/src/client/src/components/(playground)/clickhouse-connectivity-wrapper.tsx
@@ -6,16 +6,11 @@ import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useEffect } from "react";
+import Loader from "../common/loader";
-const ALLOWED_CONNECTIVITY_ALERT = [
- "/dashboard",
- "/requests",
- "/exceptions",
- "/prompt-hub",
- "/vault",
-];
+const ALLOWED_CONNECTIVITY_ALERT = /^\/home$|^\/dashboard$|^\/requests$|^\/exceptions$|^\/d\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$|^\/prompt-hub$|^\/vault$|^\/dashboards/;
-export default function ClickhouseConnectivityWrapper() {
+export default function ClickhouseConnectivityWrapper({ children }: { children: React.ReactNode }) {
const pingDetails = useRootStore(getPingDetails);
const pathname = usePathname();
@@ -23,7 +18,11 @@ export default function ClickhouseConnectivityWrapper() {
if (pingDetails.status === "pending") pingActiveDatabaseConfig();
}, []);
- if (pingDetails.error && ALLOWED_CONNECTIVITY_ALERT.includes(pathname)) {
+ if (!ALLOWED_CONNECTIVITY_ALERT.test(pathname)) {
+ return children;
+ }
+
+ if (pingDetails.error) {
return (
<div className="p-4 mb-4 text-red-800 border border-red-300 rounded-md bg-red-50 dark:bg-red-950 dark:text-red-400 dark:border-red-800 w-full">
<div className="flex">
@@ -35,6 +34,9 @@ export default function ClickhouseConnectivityWrapper() {
Sorry about that! Please visit settings page to configure your
active clickhouse database.
</div>
+ <div className="mb-2 text-sm text-red-500">
+ {pingDetails.error}
+ </div>
<Link
href="/settings/database-config"
className="inline-flex my-2 border rounded md py-2 px-4 text-center bg-primary cursor-pointer text-white hover:bg-stone-950 outline-none self-start text-sm"
@@ -54,5 +56,17 @@ export default function ClickhouseConnectivityWrapper() {
);
}
+ if (pingDetails.status === "pending") {
+ return (
+ <div className="flex items-center justify-center h-full w-full bg-white dark:bg-black">
+ <Loader />
+ </div>
+ );
+ }
+
+ if (pingDetails.status === "success") {
+ return children;
+ }
+
return null;
}
diff --git a/src/client/src/components/(playground)/filter/refresh-rate.tsx b/src/client/src/components/(playground)/filter/refresh-rate.tsx
index 5699a815..84f059b5 100644
--- a/src/client/src/components/(playground)/filter/refresh-rate.tsx
+++ b/src/client/src/components/(playground)/filter/refresh-rate.tsx
@@ -21,11 +21,8 @@ import { CLIENT_EVENTS } from "@/constants/events";
const REFRESH_RATE_EVENT = "refresh-rate";
-const PAGES_ENABLED_FOR_REFRESH_RATE = [
- "/dashboard",
- "/requests",
- "/exceptions",
-];
+const PAGES_ENABLED_FOR_REFRESH_RATE =
+ /^\/home$|^\/dashboard$|^\/requests$|^\/exceptions$|^\/d\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
const refreshTimes = {
[REFRESH_RATE_TYPE["30s"]]: 30 * 1000,
@@ -85,7 +82,7 @@ const RefreshRate = () => {
};
const isRefreshRateEnabled =
- PAGES_ENABLED_FOR_REFRESH_RATE.includes(pathname);
+ PAGES_ENABLED_FOR_REFRESH_RATE.test(pathname);
useEffect(() => {
if (isRefreshRateEnabled) {
diff --git a/src/client/src/components/(playground)/header.tsx b/src/client/src/components/(playground)/header.tsx
index 0152400d..2fa6156a 100644
--- a/src/client/src/components/(playground)/header.tsx
+++ b/src/client/src/components/(playground)/header.tsx
@@ -18,6 +18,8 @@ import Link from "next/link";
import RefreshRate from "./filter/refresh-rate";
import { usePostHog } from "posthog-js/react";
import { useEffect } from "react";
+import { usePageHeader } from "@/selectors/page";
+import DescriptionTooltip from "../common/description-tooltip";
const ThemeToggleSwitch = () => {
const { toggleTheme } = useTheme();
@@ -34,6 +36,10 @@ const ThemeToggleSwitch = () => {
);
};
+const DashboardTitleMap = {
+ "d": "Dashboard",
+};
+
export default function Header() {
const posthog = usePostHog();
const pathname = usePathname();
@@ -51,11 +57,25 @@ export default function Header() {
}
}, [user]);
+ const { header, setHeader } = usePageHeader();
+
+
+ useEffect(() => {
+ const titleKey = pathname.substring(1).replaceAll("-", " ").split("/")[0];
+ setHeader({
+ title: DashboardTitleMap[titleKey as keyof typeof DashboardTitleMap] || titleKey,
+ breadcrumbs: [],
+ });
+ }, [pathname, setHeader]);
+
return (
<header className="flex h-[57px] items-center gap-1 border-b dark:border-stone-800 px-4 sm:px-6">
- <h1 className="flex flex-1 text-xl font-semibold capitalize dark:text-white">
- {pathname.substring(1).replaceAll("-", " ").split("/")[0]}
- </h1>
+ <div className="flex items-center gap-2 grow">
+ <h1 className="text-xl font-semibold capitalize dark:text-white">{header.title}</h1>
+ {header.description && (
+ <DescriptionTooltip description={header.description} className="ml-2 h-4 w-4 text-stone-900 dark:text-stone-300" />
+ )}
+ </div>
<DatabaseConfigSwitch />
<RefreshRate />
<DropdownMenu>
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/components/code-editor.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/components/code-editor.tsx
new file mode 100644
index 00000000..fa04d021
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/components/code-editor.tsx
@@ -0,0 +1,170 @@
+"use client";
+
+import type React from "react";
+import { useRef, useEffect } from "react";
+import Editor from "@monaco-editor/react";
+import type { EditorProps } from "../types";
+import { CLICKHOUSE_LANGUAGE_CONFIG } from "../constants";
+
+const CodeEditor: React.FC<EditorProps> = ({
+ value,
+ onChange,
+ language = "sql",
+ height = "100%",
+ fullScreen = false,
+}) => {
+ const editorRef = useRef<any>(null);
+ const completionProviderRef = useRef<any>(null);
+
+ // Handle Monaco Editor mount
+ const handleEditorDidMount = (editor: any) => {
+ editorRef.current = editor;
+ };
+
+ // Cleanup completion provider on unmount
+ useEffect(() => {
+ return () => {
+ if (completionProviderRef.current) {
+ completionProviderRef.current.dispose();
+ completionProviderRef.current = null;
+ }
+ };
+ }, []);
+
+ // Mustache binding suggestions for autocomplete
+ const mustacheCompletionItems = [
+ {
+ label: "filter.timeLimit.start",
+ kind: "Property",
+ insertText: "filter.timeLimit.start",
+ documentation: "Start date of the time filter"
+ },
+ {
+ label: "filter.timeLimit.end",
+ kind: "Property",
+ insertText: "filter.timeLimit.end",
+ documentation: "End date of the time filter"
+ },
+ ];
+
+ return (
+ <Editor
+ height={height}
+ defaultLanguage={language}
+ value={value}
+ onChange={onChange}
+ onMount={handleEditorDidMount}
+ options={{
+ minimap: { enabled: fullScreen },
+ scrollBeyondLastLine: false,
+ fontSize: 14,
+ wordWrap: "on",
+ automaticLayout: true,
+ }}
+ beforeMount={(monaco) => {
+ // Register ClickHouse SQL language
+ if (language === "clickhouse-sql") {
+ monaco.languages.register({ id: "clickhouse-sql" });
+ monaco.languages.setMonarchTokensProvider(
+ "clickhouse-sql",
+ CLICKHOUSE_LANGUAGE_CONFIG.loader().language as any
+ );
+ monaco.editor.defineTheme("clickhouse-dark", {
+ base: "vs-dark",
+ inherit: true,
+ rules: [
+ { token: "keyword", foreground: "569CD6", fontStyle: "bold" },
+ { token: "operator", foreground: "D4D4D4" },
+ { token: "string", foreground: "CE9178" },
+ { token: "number", foreground: "B5CEA8" },
+ { token: "comment", foreground: "6A9955", fontStyle: "italic" },
+ { token: "predefined", foreground: "DCDCAA" },
+ ],
+ colors: {
+ "editor.background": "#1E1E1E",
+ },
+ });
+ monaco.editor.setTheme("clickhouse-dark");
+ }
+
+ // Dispose previous completion provider if it exists
+ if (completionProviderRef.current) {
+ completionProviderRef.current.dispose();
+ }
+
+ // Register mustache binding completion provider for all languages
+ completionProviderRef.current = monaco.languages.registerCompletionItemProvider(language, {
+ provideCompletionItems: (model, position) => {
+ const textUntilPosition = model.getValueInRange({
+ startLineNumber: position.lineNumber,
+ startColumn: 1,
+ endLineNumber: position.lineNumber,
+ endColumn: position.column,
+ });
+
+ const textAfterPosition = model.getValueInRange({
+ startLineNumber: position.lineNumber,
+ startColumn: position.column,
+ endLineNumber: position.lineNumber,
+ endColumn: model.getLineMaxColumn(position.lineNumber),
+ });
+
+ // Check if we're inside mustache braces {{}}
+ const mustacheMatch = textUntilPosition.match(/\{\{([^}]*)$/);
+ if (!mustacheMatch) {
+ return { suggestions: [] };
+ }
+
+ // Get the existing text inside mustache braces
+ const existingText = mustacheMatch[1];
+
+ // Check if closing braces already exist after cursor
+ const hasClosingBraces = textAfterPosition.startsWith('}}');
+
+ const word = model.getWordUntilPosition(position);
+ const range = {
+ startLineNumber: position.lineNumber,
+ endLineNumber: position.lineNumber,
+ startColumn: word.startColumn,
+ endColumn: word.endColumn,
+ };
+
+ return {
+ suggestions: mustacheCompletionItems.map(item => {
+ // Calculate what part of the suggestion is already typed
+ let insertText = item.insertText;
+
+ // If there's existing text, check if the suggestion starts with it
+ if (existingText.trim()) {
+ const existingTrimmed = existingText.trim();
+ if (item.insertText.startsWith(existingTrimmed)) {
+ // Only insert the remaining part
+ insertText = item.insertText.substring(existingTrimmed.length);
+ }
+ }
+
+ // Add closing braces if needed
+ if (!hasClosingBraces) {
+ insertText += '}}';
+ }
+
+ return {
+ label: item.label,
+ kind: monaco.languages.CompletionItemKind[item.kind as keyof typeof monaco.languages.CompletionItemKind],
+ insertText: insertText,
+ documentation: item.documentation,
+ range: range,
+ // Add snippet formatting to handle cursor positioning
+ insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
+ };
+ })
+ };
+ },
+ triggerCharacters: ['{', '.'],
+ });
+ }}
+ />
+ );
+};
+
+export default CodeEditor;
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/components/color-selector.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/components/color-selector.tsx
new file mode 100644
index 00000000..f73ad678
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/components/color-selector.tsx
@@ -0,0 +1,67 @@
+"use client";
+
+import { cn } from "@/lib/utils";
+import { Check } from "lucide-react";
+import { ColorTheme } from "../types";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
+import { Button } from "@/components/ui/button";
+import { SELECTOR_COLORS } from "../constants";
+
+interface ColorSelectorProps {
+ value?: ColorTheme;
+ onChange?: (color: ColorTheme) => void;
+ className?: string;
+}
+
+export const ColorSelector: React.FC<ColorSelectorProps> = ({
+ value,
+ onChange,
+ className,
+}) => {
+ const selectedColor = SELECTOR_COLORS.find(color => color.value === value) || SELECTOR_COLORS[0];
+
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ variant="outline"
+ className={cn("w-[120px] h-9 px-3 flex items-center gap-2", className)}
+ >
+ <div
+ className="h-5 w-5 rounded-full"
+ style={{ backgroundColor: selectedColor.value }}
+ />
+ <span className="text-sm">{selectedColor.name}</span>
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="start" className="p-4">
+ <div className="flex gap-4 flex-wrap min-w-[180px]">
+ {SELECTOR_COLORS.map((color) => (
+ <button
+ key={color.value}
+ className={cn(
+ "h-8 w-8 rounded-full transition-transform hover:scale-110 focus:outline-none focus:ring-2 focus:ring-stone-950 focus:ring-offset-2 dark:focus:ring-stone-300",
+ "flex items-center justify-center",
+ {
+ "ring-2 ring-offset-2 ring-stone-950 dark:ring-stone-300": value === color.value,
+ }
+ )}
+ style={{ backgroundColor: color.value }}
+ onClick={() => onChange?.(color.value)}
+ type="button"
+ title={color.name}
+ >
+ {value === color.value && (
+ <Check className="h-4 w-4 text-white" />
+ )}
+ </button>
+ ))}
+ </div>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
+};
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/components/edit-widget-sheet.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/components/edit-widget-sheet.tsx
new file mode 100644
index 00000000..145ff12c
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/components/edit-widget-sheet.tsx
@@ -0,0 +1,686 @@
+"use client";
+
+import React, { useEffect } from "react";
+import {
+ BarChartWidget,
+ PieChartWidget,
+ StatCardWidget,
+ WidgetType,
+ MarkdownWidget,
+ ChartWidget,
+ LineChartWidget,
+ AreaChartWidget,
+ ColorTheme,
+} from "../types";
+import { useEditWidget } from "../hooks/useEditWidget";
+import { Trash2, Info } from "lucide-react";
+import CodeEditor from "./code-editor";
+
+import {
+ Sheet,
+ SheetContent,
+ SheetHeader,
+ SheetTitle,
+ SheetDescription,
+ SheetFooter,
+} from "@/components/ui/sheet";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Label } from "@/components/ui/label";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
+import { Textarea } from "@/components/ui/textarea";
+import { useDashboard } from "../context/dashboard-context";
+import QueryDebugger from "./query-debugger";
+import { ColorSelector } from "./color-selector";
+import MarkdownWidgetComponent from "../widgets/markdown-widget";
+import { Tooltip, TooltipTrigger, TooltipPortal, TooltipContent } from "@/components/ui/tooltip";
+import { DEFAULT_PRIMARY_COLOR, SUPPORTED_WIDGETS } from "../constants";
+
+interface NonMarkdownConfig {
+ query: string;
+}
+
+interface MarkdownConfig {
+ content: string;
+ showPreview?: boolean;
+ colorTheme?: ColorTheme;
+}
+
+interface EditWidgetSheetProps {
+ editorLanguage?: string;
+}
+
+export const EditWidgetSheet: React.FC<EditWidgetSheetProps> = ({
+ editorLanguage = "clickhouse-sql",
+}) => {
+ const {
+ currentTab,
+ setCurrentTab,
+ isFullscreenEditor,
+ currentWidget,
+ closeEditSheet,
+ updateWidget,
+ updateWidgetProperties,
+ runQuery,
+ } = useEditWidget();
+
+ const { handleWidgetCrud, loadWidgetData } = useDashboard();
+ const [queryResult, setQueryResult] = React.useState<any>(null);
+ const [queryError, setQueryError] = React.useState<string | null>(null);
+ const [isQueryLoading, setIsQueryLoading] = React.useState(false);
+
+ // if (!currentWidget) return null;
+
+ const handleEditorChange = (value: string | undefined) => {
+ if (!currentWidget) return;
+
+ if (currentWidget.type === WidgetType.MARKDOWN) {
+ updateWidget(currentWidget.id, {
+ config: {
+ ...(currentWidget as MarkdownWidget).config,
+ content: value || '',
+ },
+ });
+ } else {
+ const config: NonMarkdownConfig = {
+ ...currentWidget.config,
+ query: value || '',
+ };
+ updateWidget(currentWidget.id, { config });
+ }
+ };
+
+ const handleMarkdownChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
+ if (!currentWidget) return;
+
+ updateWidget(currentWidget.id, {
+ config: {
+ ...(currentWidget as MarkdownWidget).config,
+ content: e.target.value,
+ },
+ });
+ };
+
+ const handleRunQuery = async () => {
+ if (currentWidget?.type !== WidgetType.MARKDOWN && currentWidget?.config && 'query' in currentWidget.config) {
+ setIsQueryLoading(true);
+ setQueryError(null);
+ try {
+ const result = await runQuery(currentWidget.id, {
+ userQuery: (currentWidget.config as NonMarkdownConfig).query,
+ });
+ setQueryResult(result.data);
+ setQueryError(result.err);
+ } catch (error) {
+ setQueryError(
+ error instanceof Error
+ ? error.message
+ : "An error occurred while running the query"
+ );
+ } finally {
+ setIsQueryLoading(false);
+ }
+ }
+ };
+
+ const handleSave = async () => {
+ if (currentWidget && handleWidgetCrud) {
+ try {
+ await handleWidgetCrud(currentWidget);
+ loadWidgetData(currentWidget.id);
+ closeEditSheet();
+ } catch (error) {
+ console.error("Failed to save widget:", error);
+ }
+ } else {
+ closeEditSheet();
+ }
+ };
+
+ useEffect(() => {
+ if (currentWidget?.id) {
+ setCurrentTab("general");
+ setQueryResult(null);
+ setQueryError(null);
+ setIsQueryLoading(false);
+ }
+ }, [currentWidget?.id]);
+
+ return (
+ <Sheet
+ open={!!currentWidget}
+ onOpenChange={(open) => {
+ if (!open) {
+ closeEditSheet();
+ }
+ }}
+ >
+ <SheetContent
+ className={`${isFullscreenEditor
+ ? "w-full max-w-full h-full p-0"
+ : "sm:max-w-md md:max-w-lg flex flex-col h-full"
+ } bg-white dark:bg-stone-950 border-stone-200 dark:border-stone-800`}
+ >
+ <div className="flex flex-col h-full">
+ <SheetHeader>
+ <SheetTitle className="text-stone-900 dark:text-white flex items-center gap-2">
+ <p className="text-lg font-semibold">{currentWidget?.title}</p>
+ {currentWidget?.description && (
+ <Tooltip delayDuration={0}>
+ <TooltipTrigger asChild>
+ <Info className="h-3 w-3" />
+ </TooltipTrigger>
+ <TooltipPortal>
+
+ <TooltipContent>{currentWidget.description}</TooltipContent>
+ </TooltipPortal>
+ </Tooltip>
+ )}
+ </SheetTitle>
+ <SheetDescription className="text-stone-600 dark:text-stone-300">
+ Configure your widget
+ </SheetDescription>
+ </SheetHeader>
+
+ {currentWidget && (
+ <div className="flex-1 py-4 relative overflow-hidden">
+ <Tabs value={currentTab} onValueChange={setCurrentTab} className="flex flex-col h-full w-full">
+ <TabsList className="grid w-full grid-cols-3 bg-stone-200 dark:bg-stone-900 sticky top-0 z-10">
+ <TabsTrigger
+ value="general"
+ className="data-[state=active]:bg-primary data-[state=active]:text-stone-50 text-stone-900 dark:text-white"
+ >
+ General
+ </TabsTrigger>
+ <TabsTrigger
+ value="query"
+ className="data-[state=active]:bg-primary data-[state=active]:text-stone-50 text-stone-900 dark:text-white"
+ >
+ {currentWidget.type === WidgetType.MARKDOWN ? "Markdown" : "Query"}
+ </TabsTrigger>
+ <TabsTrigger
+ value="appearance"
+ className="data-[state=active]:bg-primary data-[state=active]:text-stone-50 text-stone-900 dark:text-white"
+ >
+ Appearance
+ </TabsTrigger>
+ </TabsList>
+
+ {/* General Tab */}
+ <TabsContent value="general" className="space-y-4 mt-4 overflow-y-auto flex flex-col overflow-y-auto">
+ <div className="space-y-2">
+ <Label htmlFor="title" className="text-stone-900 dark:text-white">Widget Title</Label>
+ <Input
+ id="title"
+ value={currentWidget.title}
+ onChange={(e) =>
+ updateWidget(currentWidget.id, {
+ title: e.target.value,
+ })
+ }
+ className="bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700 dark:text-white"
+ />
+ </div>
+
+ <div className="space-y-2">
+ <Label htmlFor="type" className="text-stone-900 dark:text-white">Widget Type</Label>
+ <Select
+ value={currentWidget.type}
+ onValueChange={(value) =>
+ updateWidget(currentWidget.id, {
+ type: value as WidgetType,
+ })
+ }
+ >
+ <SelectTrigger className="bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700 dark:text-white">
+ <SelectValue placeholder="Select widget type" />
+ </SelectTrigger>
+ <SelectContent className="bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700">
+ {
+ Object.entries(SUPPORTED_WIDGETS).map(([type, widget]) => (
+ <SelectItem key={type} value={type} className="dark:text-white">
+ <div className="flex items-center gap-2">
+ <widget.icon className="h-4 w-4" />
+ <span>{widget.name}</span>
+ </div>
+ </SelectItem>
+ ))
+ }
+ </SelectContent>
+ </Select>
+ </div>
+
+ <div className="space-y-2">
+ <Label htmlFor="description" className="text-stone-900 dark:text-white">Description</Label>
+ <Textarea
+ id="description"
+ value={currentWidget.description}
+ onChange={(e) =>
+ updateWidget(currentWidget.id, {
+ description: e.target.value,
+ })
+ }
+ placeholder="Describe what this widget shows"
+ className="bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700 dark:text-white"
+ />
+ </div>
+
+ {/* Stat Card specific fields */}
+ {currentWidget.type === WidgetType.STAT_CARD && (
+ <div className="space-y-4">
+ <div className="grid grid-cols-3 gap-4">
+ <div className="space-y-2">
+ <Label htmlFor="prefix" className="text-stone-900 dark:text-white">Prefix</Label>
+ <Input
+ id="prefix"
+ value={(currentWidget as StatCardWidget).properties.prefix}
+ onChange={(e) =>
+ updateWidgetProperties(currentWidget.id, {
+ prefix: e.target.value,
+ })
+ }
+ placeholder="$"
+ className="bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700 dark:text-white"
+ />
+ </div>
+ <div className="space-y-2">
+ <Label htmlFor="value" className="text-stone-900 dark:text-white">Value Path</Label>
+ <Input
+ id="value"
+ value={(currentWidget as StatCardWidget).properties.value}
+ onChange={(e) =>
+ updateWidget(currentWidget.id, {
+ properties: {
+ ...currentWidget.properties,
+ value: e.target.value,
+ },
+ })
+ }
+ placeholder="1,234"
+ className="bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700 dark:text-white"
+ />
+ </div>
+ <div className="space-y-2">
+ <Label htmlFor="suffix" className="text-stone-900 dark:text-white">Suffix</Label>
+ <Input
+ id="suffix"
+ value={(currentWidget as StatCardWidget).properties.suffix}
+ onChange={(e) =>
+ updateWidgetProperties(currentWidget.id, {
+ suffix: e.target.value,
+ })
+ }
+ placeholder="%"
+ className="bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700 dark:text-white"
+ />
+ </div>
+ </div>
+
+ <div className="grid grid-cols-3 gap-4">
+ <div className="space-y-2">
+ <Label htmlFor="trendPrefix" className="text-stone-900 dark:text-white">Trend Prefix</Label>
+ <Input
+ id="trendPrefix"
+ value={(currentWidget as StatCardWidget).properties.trendPrefix}
+ onChange={(e) =>
+ updateWidgetProperties(currentWidget.id, {
+ trendPrefix: e.target.value,
+ })
+ }
+ placeholder="$"
+ className="bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700 dark:text-white"
+ />
+ </div>
+ <div className="space-y-2">
+ <Label htmlFor="trend" className="text-stone-900 dark:text-white">Trend Path</Label>
+ <Input
+ id="trend"
+ value={(currentWidget as StatCardWidget).properties.trend}
+ onChange={(e) =>
+ updateWidgetProperties(currentWidget.id, {
+ trend: e.target.value,
+ })
+ }
+ placeholder="12%"
+ className="bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700 dark:text-white"
+ />
+ </div>
+ <div className="space-y-2">
+ <Label htmlFor="trendSuffix" className="text-stone-900 dark:text-white">Trend Suffix</Label>
+ <Input
+ id="trendSuffix"
+ value={(currentWidget as StatCardWidget).properties.trendSuffix}
+ onChange={(e) =>
+ updateWidgetProperties(currentWidget.id, {
+ trendSuffix: e.target.value,
+ })
+ }
+ placeholder="%"
+ className="bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700 dark:text-white"
+ />
+ </div>
+ </div>
+ </div>
+ )}
+
+ {/* Chart specific fields */}
+ {(currentWidget.type === WidgetType.BAR_CHART ||
+ currentWidget.type === WidgetType.LINE_CHART ||
+ currentWidget.type === WidgetType.AREA_CHART) && (
+ <div className="space-y-4">
+ <div className="space-y-2">
+ <Label htmlFor="xAxis" className="text-stone-900 dark:text-white">X Axis</Label>
+ <Input
+ id="xAxis"
+ value={
+ (currentWidget as BarChartWidget | LineChartWidget | AreaChartWidget).properties.xAxis
+ }
+ onChange={(e) =>
+ updateWidgetProperties(currentWidget.id, {
+ xAxis: e.target.value,
+ })
+ }
+ placeholder="date, category, etc."
+ className="bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700 dark:text-white"
+ />
+ </div>
+ {currentWidget.type !== WidgetType.AREA_CHART && (
+ <div className="space-y-2">
+ <Label htmlFor="yAxis" className="text-stone-900 dark:text-white">Y Axis</Label>
+ <Input
+ id="yAxis"
+ value={
+ (currentWidget as BarChartWidget | LineChartWidget).properties.yAxis
+ }
+ onChange={(e) =>
+ updateWidgetProperties(currentWidget.id, {
+ yAxis: e.target.value,
+ })
+ }
+ placeholder="value, count, etc."
+ className="bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700 dark:text-white"
+ />
+ </div>
+ )}
+ {currentWidget.type === WidgetType.AREA_CHART && (
+ <div className="space-y-2">
+ <div className="flex items-center justify-between">
+ <Label className="text-stone-900 dark:text-white">Y Axes</Label>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() =>
+ updateWidgetProperties(currentWidget.id, {
+ yAxes: [
+ ...(currentWidget as AreaChartWidget).properties.yAxes || [],
+ {
+ key: "",
+ color: DEFAULT_PRIMARY_COLOR,
+ },
+ ],
+ })
+ }
+ className="border-stone-200 dark:border-stone-700 hover:bg-stone-100 dark:hover:bg-stone-800"
+ >
+ Add Y Axis
+ </Button>
+ </div>
+ <div className="space-y-4">
+ {(currentWidget as AreaChartWidget).properties.yAxes?.map(
+ (yAxis, index) => (
+ <div key={index} className="flex items-end gap-2">
+ <div className="flex-1">
+ <Label htmlFor={`yAxis-${index}`} className="text-stone-900 dark:text-white">
+ Y Axis {index + 1}
+ </Label>
+ <Input
+ id={`yAxis-${index}`}
+ value={yAxis.key}
+ onChange={(e) => {
+ const newYAxes = [
+ ...(currentWidget as AreaChartWidget).properties.yAxes,
+ ];
+ newYAxes[index] = {
+ ...newYAxes[index],
+ key: e.target.value,
+ };
+ updateWidgetProperties(currentWidget.id, {
+ yAxes: newYAxes,
+ });
+ }}
+ placeholder="value, count, etc."
+ className="bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700 dark:text-white"
+ />
+ </div>
+ <div className="w-32">
+ <Label htmlFor={`yAxis-${index}-color`} className="text-stone-900 dark:text-white">
+ Color
+ </Label>
+ <ColorSelector
+ value={yAxis.color}
+ onChange={(value) => {
+ const newYAxes = [
+ ...(currentWidget as AreaChartWidget).properties.yAxes,
+ ];
+ newYAxes[index] = {
+ ...newYAxes[index],
+ color: value,
+ };
+ updateWidgetProperties(currentWidget.id, {
+ yAxes: newYAxes,
+ });
+ }}
+ />
+ </div>
+ <Button
+ variant="ghost"
+ size="icon"
+ className="h-10 w-10 hover:bg-stone-100 dark:hover:bg-stone-800 text-stone-600 dark:text-stone-400"
+ onClick={() => {
+ const newYAxes = [
+ ...(currentWidget as AreaChartWidget).properties.yAxes,
+ ];
+ newYAxes.splice(index, 1);
+ updateWidgetProperties(currentWidget.id, {
+ yAxes: newYAxes,
+ });
+ }}
+ >
+ <Trash2 className="h-4 w-4" />
+ </Button>
+ </div>
+ )
+ )}
+ </div>
+ </div>
+ )}
+ </div>
+ )}
+
+ {currentWidget.type === WidgetType.PIE_CHART && (
+ <div className="space-y-4">
+ <div className="grid grid-cols-3 gap-4">
+ <div className="space-y-2">
+ <Label htmlFor="labelPath" className="text-stone-900 dark:text-white">Label Path</Label>
+ <Input
+ id="labelPath"
+ value={
+ (currentWidget as PieChartWidget).properties
+ .labelPath
+ }
+ onChange={(e) =>
+ updateWidgetProperties(currentWidget.id, {
+ labelPath: e.target.value,
+ })
+ }
+ placeholder="$"
+ className="bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700 dark:text-white"
+ />
+ </div>
+ <div className="space-y-2">
+ <Label htmlFor="value" className="text-stone-900 dark:text-white">Value Path</Label>
+ <Input
+ id="value"
+ value={
+ (currentWidget as PieChartWidget).properties
+ .valuePath
+ }
+ onChange={(e) =>
+ updateWidget(
+ (currentWidget as PieChartWidget).id,
+ {
+ properties: {
+ ...(currentWidget as PieChartWidget)
+ .properties,
+ valuePath: e.target.value,
+ },
+ }
+ )
+ }
+ placeholder="1,234"
+ className="bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700 dark:text-white"
+ />
+ </div>
+ </div>
+ </div>
+ )}
+ </TabsContent>
+
+ {/* Config Tab */}
+ <TabsContent value="query" className="space-y-4 mt-4 overflow-y-auto flex-col overflow-y-auto">
+ {currentWidget.type !== WidgetType.MARKDOWN ? (
+ <>
+ <div className="space-y-2">
+ <div className="flex justify-between items-center">
+ <Label htmlFor="query" className="text-stone-900 dark:text-white">Query</Label>
+ </div>
+ <div className="border rounded-md h-[calc(100vh-400px)] bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700">
+ <CodeEditor
+ value={currentWidget.config && 'query' in currentWidget.config ? (currentWidget.config as NonMarkdownConfig).query : ""}
+ onChange={handleEditorChange}
+ language={editorLanguage}
+ />
+ </div>
+ </div>
+
+ <div className="flex justify-end">
+ <Button
+ size="sm"
+ onClick={handleRunQuery}
+ className="bg-primary hover:bg-primary/90 text-white"
+ >
+ Run Query
+ </Button>
+ </div>
+ </>
+ ) : (
+ <div className="space-y-4">
+ <div className="space-y-2">
+ <Label htmlFor="content" className="text-stone-900 dark:text-white">Markdown Content</Label>
+ <Tabs defaultValue="write" className="w-full">
+ <TabsList className="grid w-full grid-cols-2 bg-stone-100 dark:bg-stone-900">
+ <TabsTrigger
+ value="write"
+ className="data-[state=active]:bg-primary data-[state=active]:text-primary-foreground dark:text-white"
+ >
+ Write
+ </TabsTrigger>
+ <TabsTrigger
+ value="preview"
+ className="data-[state=active]:bg-primary data-[state=active]:text-primary-foreground dark:text-white"
+ >
+ Preview
+ </TabsTrigger>
+ </TabsList>
+ <TabsContent value="write" className="mt-2">
+ <Textarea
+ id="content"
+ value={currentWidget.config && 'content' in currentWidget.config ? (currentWidget.config as MarkdownConfig).content : ""}
+ onChange={handleMarkdownChange}
+ placeholder="Write your markdown content here..."
+ className="min-h-[400px] font-mono bg-white dark:bg-stone-900 border-stone-200 dark:border-stone-700 dark:text-white dark:placeholder:text-stone-400"
+ />
+ </TabsContent>
+ <TabsContent value="preview" className="mt-2">
+ <div className="min-h-[400px] p-4 bg-white dark:bg-stone-900 border border-stone-200 dark:border-stone-700 rounded-md overflow-y-auto">
+ <MarkdownWidgetComponent widget={currentWidget as MarkdownWidget} />
+ </div>
+ </TabsContent>
+ </Tabs>
+ </div>
+ </div>
+ )}
+ </TabsContent>
+
+ {/* Appearance Tab */}
+ <TabsContent value="appearance" className="space-y-4 mt-4 overflow-y-auto flex-col overflow-y-auto">
+ {(currentWidget.type === WidgetType.STAT_CARD ||
+ currentWidget.type === WidgetType.BAR_CHART ||
+ currentWidget.type === WidgetType.LINE_CHART ||
+ currentWidget.type === WidgetType.PIE_CHART ||
+ currentWidget.type === WidgetType.TABLE ||
+ currentWidget.type === WidgetType.MARKDOWN) && (
+ <div className="space-y-2">
+ <Label htmlFor="color" className="text-stone-900 dark:text-white">Color Theme</Label>
+ <ColorSelector
+ value={currentWidget.properties.color}
+ onChange={(value) =>
+ updateWidgetProperties(currentWidget.id, {
+ color: value,
+ })
+ }
+ />
+ </div>
+ )}
+ {
+ currentWidget.type === WidgetType.AREA_CHART && (
+ <div className="space-y-2 text-stone-500 dark:text-stone-400">
+ No appearance options for area chart
+ </div>
+ )
+ }
+ </TabsContent>
+ </Tabs>
+ </div>
+ )}
+
+ <SheetFooter className="flex-shrink-0 border-t border-stone-200 dark:border-stone-800 bg-white/95 dark:bg-stone-950/95 backdrop-blur supports-[backdrop-filter]:bg-white/60 dark:supports-[backdrop-filter]:bg-stone-950/60 pt-4">
+ <div className="flex justify-between w-full">
+ <Button
+ variant="outline"
+ onClick={closeEditSheet}
+ className="px-8 border-stone-200 dark:border-stone-700 hover:bg-stone-100 dark:hover:bg-stone-800 dark:text-white"
+ >
+ Cancel
+ </Button>
+ <Button
+ onClick={handleSave}
+ className="px-8 bg-primary dark:bg-primary hover:bg-primary/90 dark:hover:bg-primary/90 text-white dark:text-white"
+ >
+ Save Changes
+ </Button>
+ </div>
+ </SheetFooter>
+ </div>
+ {
+ currentTab === "query" && currentWidget?.type !== WidgetType.MARKDOWN && (
+ <QueryDebugger
+ data={queryResult}
+ error={queryError || undefined}
+ isLoading={isQueryLoading}
+ />
+ )
+ }
+ </SheetContent>
+ </Sheet>
+ );
+};
+
+export default EditWidgetSheet;
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/components/index.ts b/src/client/src/components/(playground)/manage-dashboard/board-creator/components/index.ts
new file mode 100644
index 00000000..0afc41ef
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/components/index.ts
@@ -0,0 +1,3 @@
+export { default as CodeEditor } from "./code-editor"
+export * from "./edit-widget-sheet"
+
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/components/query-debugger.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/components/query-debugger.tsx
new file mode 100644
index 00000000..885bbae6
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/components/query-debugger.tsx
@@ -0,0 +1,85 @@
+"use client";
+
+import React, { useEffect, useState } from "react";
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+} from "@/components/ui/accordion";
+import { Alert, AlertDescription } from "@/components/ui/alert";
+import { ScrollArea } from "@/components/ui/scroll-area";
+import { AlertCircle, CheckCircle2, Terminal } from "lucide-react";
+
+interface QueryDebuggerProps {
+ data?: any;
+ error?: string;
+ isLoading?: boolean;
+}
+
+const QueryDebugger: React.FC<QueryDebuggerProps> = ({
+ data,
+ error,
+ isLoading,
+}) => {
+ const [accordionValue, setAccordionValue] = useState("");
+
+ useEffect(() => {
+ if (!isLoading) {
+ setAccordionValue("debug");
+ }
+ }, [isLoading]);
+
+ return (
+ <div className="absolute left-0 top-0 -translate-x-full flex h-full bg-stone-100 dark:bg-stone-900 border border-stone-200 border-t-0 dark:border-stone-900 border-r-0 text-stone-800 dark:text-stone-300">
+ <Accordion type="single" collapsible className="flex" value={accordionValue}>
+ <AccordionItem value="debug" className="border-0 flex">
+ <AccordionTrigger className="flex flex-col items-center gap-2 px-2 py-4 hover:no-underline hover:bg-muted/80 [&[data-state=open]]:bg-muted [&[data-state=open]>svg]:rotate-90 [&[data-state=closed]>svg]:rotate-[-90deg] border-r border-stone-200 dark:border-stone-700" onClick={() => setAccordionValue(accordionValue === "debug" ? "" : "debug")}>
+ <div className="flex flex-col items-center gap-2">
+ {error ? (
+ <AlertCircle className="h-4 w-4 text-error" />
+ ) : data ? (
+ <CheckCircle2 className="h-4 w-4 text-success" />
+ ) : (
+ <Terminal className="h-4 w-4 text-muted-foreground" />
+ )}
+ <span className="text-sm font-medium [writing-mode:vertical-lr] rotate-180 transform">Query Debug Console</span>
+ {isLoading && (
+ <span className="text-xs text-muted-foreground [writing-mode:vertical-lr] rotate-180 animate-pulse">
+ Running...
+ </span>
+ )}
+ </div>
+ </AccordionTrigger>
+ <AccordionContent className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down transition-all h-full">
+ <ScrollArea className="h-full w-[400px] bg-background p-4">
+ {isLoading ? (
+ <div className="flex items-center justify-center h-full">
+ <span className="text-sm text-muted-foreground">
+ Running query...
+ </span>
+ </div>
+ ) : error ? (
+ <Alert variant="destructive">
+ <AlertDescription>{error}</AlertDescription>
+ </Alert>
+ ) : data ? (
+ <pre className="text-sm whitespace-pre-wrap">
+ {JSON.stringify(data, null, 2)}
+ </pre>
+ ) : (
+ <div className="flex items-center justify-center h-full">
+ <span className="text-sm text-muted-foreground">
+ No query results to display
+ </span>
+ </div>
+ )}
+ </ScrollArea>
+ </AccordionContent>
+ </AccordionItem>
+ </Accordion>
+ </div>
+ );
+};
+
+export default QueryDebugger;
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/components/widget-selection-modal.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/components/widget-selection-modal.tsx
new file mode 100644
index 00000000..49e1d0a4
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/components/widget-selection-modal.tsx
@@ -0,0 +1,104 @@
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+ DialogDescription,
+ DialogFooter,
+ DialogClose,
+} from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
+import { Widget, WidgetType } from "../types";
+import { useState } from "react";
+import { SUPPORTED_WIDGETS } from "../constants";
+
+export default function WidgetSelectionModal({
+ open,
+ onClose,
+ widgets,
+ onSelect,
+ onCreateNew,
+}: {
+ open: boolean;
+ onClose: () => void;
+ widgets: Widget[];
+ onSelect: (widget: Widget) => void;
+ onCreateNew: (widgetType: WidgetType) => void;
+}) {
+ const [createNewWidget, setCreateNewWidget] = useState<boolean>(false);
+
+ const handleCreateNew = () => {
+ setCreateNewWidget(true);
+ };
+
+ const handleWidgetSelect = (widgetType: WidgetType) => {
+ setCreateNewWidget(false);
+ onCreateNew(widgetType);
+ };
+
+ return (
+ <Dialog open={open} onOpenChange={(v) => !v && onClose()}>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>Select a Widget</DialogTitle>
+ <DialogDescription>
+ Choose an existing widget to add, or create a new one.
+ </DialogDescription>
+ </DialogHeader>
+ <div className="max-h-64 overflow-y-auto my-4">
+ {
+ createNewWidget ? (
+ <div className="grid grid-cols-2 gap-2 text-center text-stone-500">
+ {
+ Object.entries(SUPPORTED_WIDGETS).map(([type, widget]) => (
+ <Button key={type} variant="outline" className="w-full justify-start" onClick={() => handleWidgetSelect(type as WidgetType)}>
+ <div className="flex items-center gap-2">
+ <widget.icon className="h-4 w-4" />
+ <span className="font-semibold mr-2">{widget.name}</span>
+ </div>
+ </Button>
+ ))
+ }
+ </div>
+ ) : (
+ widgets.length === 0 ? (
+ <div className="text-center text-stone-500">No widgets found.</div>
+ ) : (
+ <ul className="space-y-2">
+ {widgets.map((w) => (
+ <li key={w.id}>
+ <Button
+ variant="outline"
+ className="w-full justify-start"
+ onClick={() => onSelect(w)}
+ >
+ <span className="font-semibold mr-2">{w.title}</span>
+ <span className="text-xs text-stone-500">({w.type})</span>
+ </Button>
+ </li>
+ ))}
+ </ul>
+ )
+ )
+ }
+ </div>
+ <DialogFooter className="flex justify-between gap-2">
+ {
+ createNewWidget ? (
+ <Button onClick={() => setCreateNewWidget(false)} variant="default">
+ Back to Widgets
+ </Button>
+ ) : (
+ <Button onClick={handleCreateNew} variant="default">
+ + Create New Widget
+ </Button>
+ )
+ }
+ <DialogClose asChild>
+ <Button variant="ghost" className="bg-stone-200 hover:bg-stone-300 dark:bg-stone-800 dark:hover:bg-stone-700 dark:text-white">Cancel</Button>
+ </DialogClose>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+}
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/constants.ts b/src/client/src/components/(playground)/manage-dashboard/board-creator/constants.ts
new file mode 100644
index 00000000..24d355ea
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/constants.ts
@@ -0,0 +1,255 @@
+import { ColorTheme, Widget, WidgetType } from "./types"
+import { Activity, BarChart3, LineChart, PieChart, Database, AreaChart, FileText, LucideIcon } from "lucide-react"
+
+export const DEFAULT_PRIMARY_COLOR = "#F36C06" as ColorTheme;
+
+export const SELECTOR_COLORS = [
+ { name: "Primary", value: DEFAULT_PRIMARY_COLOR },
+ { name: "Blue", value: "#0ea5e9" as ColorTheme },
+ { name: "Green", value: "#10b981" as ColorTheme },
+ { name: "Purple", value: "#8b5cf6" as ColorTheme },
+ { name: "Red", value: "#ef4444" as ColorTheme },
+ { name: "Yellow", value: "#f59e0b" as ColorTheme },
+ { name: "Pink", value: "#ec4899" as ColorTheme },
+ { name: "Gray", value: "#6b7280" as ColorTheme },
+] as const;
+
+// ClickHouse SQL language configuration for Monaco Editor
+export const CLICKHOUSE_LANGUAGE_CONFIG = {
+ id: "clickhouse-sql",
+ extensions: [".sql"],
+ aliases: ["ClickHouse SQL", "clickhouse-sql"],
+ mimetypes: ["application/sql"],
+ loader: () => ({
+ language: {
+ defaultToken: "",
+ tokenPostfix: ".sql",
+ ignoreCase: true,
+ brackets: [
+ { open: "[", close: "]", token: "delimiter.square" },
+ { open: "(", close: ")", token: "delimiter.parenthesis" },
+ ],
+ keywords: [
+ "SELECT",
+ "FROM",
+ "WHERE",
+ "AND",
+ "OR",
+ "GROUP",
+ "BY",
+ "ORDER",
+ "HAVING",
+ "LIMIT",
+ "OFFSET",
+ "INSERT",
+ "INTO",
+ "VALUES",
+ "UPDATE",
+ "DELETE",
+ "SET",
+ // ... (truncated for brevity)
+ ],
+ operators: [
+ "+",
+ "-",
+ "*",
+ "/",
+ "%",
+ "=",
+ ">",
+ "<",
+ ">=",
+ "<=",
+ "<>",
+ "!=",
+ "<=>",
+ "AND",
+ "OR",
+ "NOT",
+ "LIKE",
+ "IN",
+ "IS",
+ "BETWEEN",
+ "REGEXP",
+ ],
+ builtinFunctions: [
+ "count",
+ "sum",
+ "min",
+ "max",
+ "avg",
+ "any",
+ "anyHeavy",
+ "anyLast",
+ // ... (truncated for brevity)
+ ],
+ builtinVariables: ["database", "table", "default_kind"],
+ pseudoColumns: [],
+ tokenizer: {
+ root: [
+ { include: "@comments" },
+ { include: "@whitespace" },
+ { include: "@numbers" },
+ { include: "@strings" },
+ { include: "@complexIdentifiers" },
+ { include: "@scopes" },
+ [/[;,.]/, "delimiter"],
+ [/[()]/, "@brackets"],
+ [
+ /[\w@#$]+/,
+ {
+ cases: {
+ "@keywords": "keyword",
+ "@operators": "operator",
+ "@builtinFunctions": "predefined",
+ "@builtinVariables": "predefined",
+ "@default": "identifier",
+ },
+ },
+ ],
+ [/[<>=!%&+\-*/|~^]/, "operator"],
+ ],
+ whitespace: [[/\s+/, "white"]],
+ comments: [
+ [/--+.*/, "comment"],
+ [/\/\*/, { token: "comment.quote", next: "@comment" }],
+ ],
+ comment: [
+ [/[^*/]+/, "comment"],
+ [/\*\//, { token: "comment.quote", next: "@pop" }],
+ [/./, "comment"],
+ ],
+ numbers: [
+ [/0[xX][0-9a-fA-F]*/, "number"],
+ [/[$][+-]*\d*(\.\d*)?/, "number"],
+ [/((\d+(\.\d*)?)|(\.\d+))([eE][-+]?\d+)?/, "number"],
+ ],
+ strings: [
+ [/'/, { token: "string", next: "@string" }],
+ [/"/, { token: "string.double", next: "@stringDouble" }],
+ ],
+ string: [
+ [/[^']+/, "string"],
+ [/''/, "string"],
+ [/'/, { token: "string", next: "@pop" }],
+ ],
+ stringDouble: [
+ [/[^"]+/, "string.double"],
+ [/""/, "string.double"],
+ [/"/, { token: "string.double", next: "@pop" }],
+ ],
+ complexIdentifiers: [[/`/, { token: "identifier.quote", next: "@quotedIdentifier" }]],
+ quotedIdentifier: [
+ [/[^`]+/, "identifier"],
+ [/``/, "identifier"],
+ [/`/, { token: "identifier.quote", next: "@pop" }],
+ ],
+ scopes: [],
+ },
+ },
+ }),
+}
+
+export const SUPPORTED_WIDGETS: Record<WidgetType, {
+ name: string;
+ description: string;
+ icon: LucideIcon;
+ initialProperties: Partial<Widget>;
+}> = {
+ [WidgetType.STAT_CARD]: {
+ name: "Stat Card",
+ description: "A stat card widget",
+ icon: Activity,
+ initialProperties: {
+ title: "New Stat Card Widget",
+ description: "New Widget Description",
+ type: WidgetType.STAT_CARD,
+ properties: {
+ color: DEFAULT_PRIMARY_COLOR,
+ },
+ config: {},
+ }
+ },
+ [WidgetType.BAR_CHART]: {
+ name: "Bar Chart",
+ description: "A bar chart widget",
+ icon: BarChart3,
+ initialProperties: {
+ title: "New Bar Chart Widget",
+ description: "New Widget Description",
+ type: WidgetType.BAR_CHART,
+ properties: {
+ color: DEFAULT_PRIMARY_COLOR,
+ },
+ config: {},
+ }
+ },
+ [WidgetType.LINE_CHART]: {
+ name: "Line Chart",
+ description: "A line chart widget",
+ icon: LineChart,
+ initialProperties: {
+ title: "New Line ChartWidget",
+ description: "New Widget Description",
+ type: WidgetType.LINE_CHART,
+ properties: {
+ color: DEFAULT_PRIMARY_COLOR,
+ },
+ config: {},
+ }
+ },
+ [WidgetType.PIE_CHART]: {
+ name: "Pie Chart",
+ description: "A pie chart widget",
+ icon: PieChart,
+ initialProperties: {
+ title: "New Pie Chart Widget",
+ description: "New Widget Description",
+ type: WidgetType.PIE_CHART,
+ properties: {
+ color: DEFAULT_PRIMARY_COLOR,
+ },
+ config: {},
+ }
+ },
+ [WidgetType.TABLE]: {
+ name: "Table",
+ description: "A table widget",
+ icon: Database,
+ initialProperties: {
+ title: "New Table Widget",
+ description: "New Widget Description",
+ type: WidgetType.TABLE,
+ properties: {
+ color: DEFAULT_PRIMARY_COLOR,
+ },
+ config: {},
+ }
+ },
+ [WidgetType.AREA_CHART]: {
+ name: "Area Chart",
+ description: "An area chart widget",
+ icon: AreaChart,
+ initialProperties: {
+ title: "New Area Chart Widget",
+ description: "New Widget Description",
+ type: WidgetType.AREA_CHART,
+ properties: {},
+ config: {},
+ }
+ },
+ [WidgetType.MARKDOWN]: {
+ name: "Markdown",
+ description: "A markdown widget",
+ icon: FileText,
+ initialProperties: {
+ title: "New Markdown Widget",
+ description: "New Widget Description",
+ type: WidgetType.MARKDOWN,
+ properties: {
+ color: DEFAULT_PRIMARY_COLOR,
+ },
+ config: {},
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/context/dashboard-context.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/context/dashboard-context.tsx
new file mode 100644
index 00000000..9cf2b76d
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/context/dashboard-context.tsx
@@ -0,0 +1,315 @@
+"use client";
+
+import type React from "react";
+import { createContext, useContext, useState, type ReactNode } from "react";
+import {
+ type WidgetsRecord,
+ type DashboardConfig,
+ type Widget,
+ WidgetType,
+ StatCardWidget,
+ TableWidget,
+ PieChartWidget,
+ LineChartWidget,
+ BarChartWidget,
+} from "../types";
+import { SUPPORTED_WIDGETS } from "../constants";
+import { Board } from "@/types/manage-dashboard";
+import { usePostHog } from "posthog-js/react";
+import { CLIENT_EVENTS } from "@/constants/events";
+
+interface DashboardContextType {
+ details: Partial<Board>;
+ setDetails: (details: Partial<Board>) => void;
+ layouts: any;
+ setLayouts: (layouts: any) => void;
+ widgets: WidgetsRecord;
+ setWidgets: (widgets: WidgetsRecord) => void;
+ editingWidget: string | null;
+ setEditingWidget: (id: string | null) => void;
+ isEditing: boolean;
+ setIsEditing: (editing: boolean) => void;
+ updateWidget: (widgetId: string, updates: Partial<Widget>) => void;
+ updateWidgetProperties: (
+ widgetId: string,
+ properties: Record<string, any>
+ ) => void;
+ addWidget: (widget?: Partial<Widget>) => Promise<any>;
+ removeWidget: (widgetId: string) => void;
+ getDashboardConfig: () => DashboardConfig;
+ runQuery: (
+ widgetId: string,
+ params: Record<string, unknown>
+ ) => Promise<{ data: any; err: string | null }>;
+ handleWidgetCrud?: (updates: Partial<Widget>) => Promise<Widget>;
+ widgetData: Record<string, any>;
+ updateWidgetData: (widgetId: string, data: any) => void;
+ clearWidgetData: (widgetId: string) => void;
+ loadWidgetData: (widgetId: string) => Promise<void>;
+ fetchExistingWidgets?: () => Promise<Widget[]>;
+}
+
+export const DashboardContext = createContext<DashboardContextType | undefined>(
+ undefined
+);
+
+interface DashboardProviderProps {
+ children: ReactNode;
+ initialConfig?: DashboardConfig;
+ onSave?: (config: DashboardConfig) => void;
+ handleWidgetCrud?: (updates: Partial<Widget>) => Promise<Widget>;
+ runQuery?: (
+ widgetId: string,
+ params: Record<string, unknown>
+ ) => Promise<{ data: any; err: string | null }>;
+ fetchExistingWidgets?: () => Promise<Widget[]>;
+}
+
+export const DashboardProvider: React.FC<DashboardProviderProps> = ({
+ children,
+ initialConfig,
+ onSave,
+ handleWidgetCrud,
+ runQuery,
+ fetchExistingWidgets,
+}) => {
+ const [details, setDetails] = useState<Partial<Board>>({
+ id: initialConfig?.id || "",
+ title: initialConfig?.title || "",
+ description: initialConfig?.description || "",
+ tags: initialConfig?.tags || "",
+ });
+ const [layouts, setLayouts] = useState(initialConfig?.layouts || { lg: [] });
+ const [widgets, setWidgets] = useState<WidgetsRecord>(
+ initialConfig?.widgets || {}
+ );
+ const [widgetData, setWidgetData] = useState<Record<string, any>>({});
+ const [editingWidget, setEditingWidget] = useState<string | null>(null);
+ const [isEditing, setIsEditing] = useState(false);
+ const posthog = usePostHog();
+
+ // Load widget data
+ const loadWidgetData = async (widgetId: string) => {
+ const widget = widgets[widgetId] as StatCardWidget | BarChartWidget | LineChartWidget | PieChartWidget | TableWidget;
+ if (widget.type === WidgetType.MARKDOWN || !widget?.config?.query) return;
+
+ try {
+ if (runQuery) {
+ const { data } = await runQuery(widgetId, {});
+ updateWidgetData(widgetId, data);
+ }
+ } catch (error) {
+ console.error(`Failed to load data for widget ${widgetId}:`, error);
+ }
+ };
+
+ // Update widget data
+ const updateWidgetData = (widgetId: string, data: any) => {
+ setWidgetData((prev) => ({
+ ...prev,
+ [widgetId]: data,
+ }));
+ };
+
+ // Clear widget data
+ const clearWidgetData = (widgetId: string) => {
+ setWidgetData((prev) => {
+ const newData = { ...prev };
+ delete newData[widgetId];
+ return newData;
+ });
+ };
+
+ // Update a widget
+ const updateWidget = (widgetId: string, updates: Partial<Widget>) => {
+ setWidgets((prev) => ({
+ ...prev,
+ [widgetId]: {
+ ...prev[widgetId],
+ ...updates,
+ } as Widget,
+ }));
+ };
+
+ // Update widget properties
+ const updateWidgetProperties = (
+ widgetId: string,
+ properties: Record<string, any>
+ ) => {
+ setWidgets((prev) => {
+ const widget = prev[widgetId];
+ if (!widget) return prev;
+
+ const updatedWidget = {
+ ...widget,
+ properties: {
+ ...(widget.properties || {}),
+ ...properties,
+ },
+ } as Widget;
+
+ return {
+ ...prev,
+ [widgetId]: updatedWidget,
+ };
+ });
+ };
+
+ // Add a new widget
+ const addWidget = async (existingWidget?: Partial<Widget>) => {
+ const newWidgetId = `widget-${Object.keys(widgets).length + 1
+ }-${Date.now()}`;
+
+ let newWidget: Partial<Widget>;
+
+ if (existingWidget?.id) {
+ newWidget = existingWidget;
+ } else {
+ try {
+ newWidget =
+ existingWidget?.type ?
+ SUPPORTED_WIDGETS[existingWidget.type as WidgetType].initialProperties :
+ SUPPORTED_WIDGETS[WidgetType.STAT_CARD].initialProperties;
+ if (handleWidgetCrud) {
+ newWidget = await handleWidgetCrud(newWidget);
+ } else {
+ newWidget.id = newWidgetId;
+ }
+
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_WIDGET_ADDED, {
+ id: newWidget.id,
+ type: newWidget.type,
+ title: newWidget.title,
+ });
+ } catch (error) {
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_WIDGET_ADD_FAILURE, {
+ type: existingWidget?.type,
+ title: existingWidget?.title,
+ error: error?.toString(),
+ });
+ return;
+ }
+ }
+
+ if (newWidget.id) {
+ // Add to layouts
+ setLayouts((prev: any) => {
+ return {
+ ...prev,
+ lg: [
+ ...prev.lg,
+ { i: newWidget.id, x: 0, y: Number.POSITIVE_INFINITY, w: 2, h: 2 },
+ ],
+ };
+ });
+
+ // Add widget data with defaults
+ setWidgets((prev) => ({
+ ...prev,
+ [newWidget.id!]: newWidget as Widget,
+ }));
+
+ // Set this widget as the editing widget and enable editing mode
+ setEditingWidget(newWidgetId);
+ setIsEditing(true);
+
+ // Scroll the widget into view after a short delay to ensure the widget is rendered
+ setTimeout(() => {
+ const widgetElement = document.querySelector(
+ `[data-widget-id="${newWidget.id}"]`
+ );
+ if (widgetElement) {
+ widgetElement.scrollIntoView({ behavior: "smooth", block: "center" });
+ }
+ setEditingWidget(newWidget.id!);
+ }, 100);
+
+ return newWidgetId;
+ }
+ };
+
+ // Remove a widget
+ const removeWidget = (widgetId: string) => {
+ // Remove from layouts
+ setLayouts((prev: any) => {
+ return {
+ ...prev,
+ lg: prev.lg.filter((item: any) => item.i !== widgetId),
+ };
+ });
+
+ // Remove widget data
+ setWidgets((prev) => {
+ const newWidgets = { ...prev };
+ delete newWidgets[widgetId];
+ return newWidgets;
+ });
+
+ // Clear widget data
+ clearWidgetData(widgetId);
+ };
+
+ // Get the current dashboard configuration
+ const getDashboardConfig = (): DashboardConfig => {
+ return {
+ id: initialConfig?.id || "",
+ title: initialConfig?.title || "",
+ description: initialConfig?.description || "",
+ tags: initialConfig?.tags || "",
+ layouts,
+ widgets,
+ };
+ };
+
+ const handleRunQuery = (widgetId: string, params: Record<string, unknown>) => {
+ if (runQuery) {
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_WIDGET_RUN_QUERY, {
+ id: widgetId,
+ type: widgets[widgetId]?.type,
+ title: widgets[widgetId]?.title,
+ });
+ return runQuery(widgetId, params);
+ }
+
+ return Promise.resolve({ data: [], err: null });
+ };
+
+ const contextValue: DashboardContextType = {
+ details,
+ setDetails,
+ layouts,
+ setLayouts,
+ widgets,
+ setWidgets,
+ editingWidget,
+ setEditingWidget,
+ isEditing,
+ setIsEditing,
+ updateWidget,
+ updateWidgetProperties,
+ addWidget,
+ removeWidget,
+ getDashboardConfig,
+ runQuery: handleRunQuery,
+ handleWidgetCrud,
+ widgetData,
+ updateWidgetData,
+ clearWidgetData,
+ loadWidgetData,
+ fetchExistingWidgets,
+ };
+
+ return (
+ <DashboardContext.Provider value={contextValue}>
+ {children}
+ </DashboardContext.Provider>
+ );
+};
+
+export const useDashboard = () => {
+ const context = useContext(DashboardContext);
+ if (!context) {
+ throw new Error("useDashboard must be used within a DashboardProvider");
+ }
+ return context;
+};
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/context/index.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/context/index.tsx
new file mode 100644
index 00000000..8140f34d
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/context/index.tsx
@@ -0,0 +1 @@
+export * from "./dashboard-context";
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/dashboard-view.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/dashboard-view.tsx
new file mode 100644
index 00000000..0a5d2a5a
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/dashboard-view.tsx
@@ -0,0 +1,343 @@
+"use client";
+
+import React, { useCallback } from "react";
+import { Responsive, WidthProvider } from "react-grid-layout";
+import "react-grid-layout/css/styles.css";
+import "react-resizable/css/styles.css";
+import { Edit, Save, Plus, LucideIcon, Download } from "lucide-react";
+import { Button } from "@/components/ui/button";
+import type { DashboardProps, Widget, WidgetType } from "./types";
+import { DashboardProvider, useDashboard } from "./context/dashboard-context";
+import WidgetRenderer from "./widgets/widget-renderer";
+import dynamic from "next/dynamic";
+import createMessage from "@/constants/messages";
+const EditWidgetSheet = dynamic(() => import("./components/edit-widget-sheet"));
+const WidgetSelectionModal = dynamic(
+ () => import("./components/widget-selection-modal")
+);
+
+import { useEditWidget } from "./hooks/useEditWidget";
+
+import DescriptionTooltip from "../../../common/description-tooltip";
+import UpsertResourceDialog from "../common/upsert-resource-dialog";
+import { EditResource, useUpsertResource } from "./hooks/useUpsertResource";
+import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
+import { toast } from "sonner";
+import { jsonParse, jsonStringify } from "@/utils/json";
+import { Board } from "@/types/manage-dashboard";
+import { exportBoardLayout } from "./utils/api";
+
+// Empty state component
+const EmptyState = ({ onAddWidget }: { onAddWidget: () => void }) => (
+ <div className="flex flex-col items-center justify-center h-[70vh] text-center px-4">
+ <div className="w-full max-w-md space-y-6">
+ <div className="p-6 rounded-lg border-2 border-dashed border-gray-300 dark:border-gray-700">
+ <div className="w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-4">
+ <Plus className="h-6 w-6 text-primary" />
+ </div>
+ <h3 className="text-lg font-semibold mb-2 text-stone-900 dark:text-stone-300">{createMessage().NO_WIDGETS_YET}</h3>
+ <p className="text-sm text-stone-500 dark:text-stone-400 mb-4">
+ {createMessage().NO_WIDGETS_YET_DESCRIPTION}
+ </p>
+ <Button onClick={onAddWidget} className="gap-2">
+ <Plus className="h-4 w-4" /> {createMessage().NO_WIDGETS_YET_ACTION_BUTTON}
+ </Button>
+ </div>
+ </div>
+ </div>
+);
+
+const ActionButtons = ({ onClick, label, icon }: { onClick: () => void, label: string, icon: LucideIcon }) => {
+ const Icon = icon;
+ return (
+ <Button variant="secondary" onClick={onClick} className="flex gap-2 h-auto border-none py-1.5 bg-stone-200 dark:bg-stone-800 hover:bg-stone-300 dark:hover:bg-stone-700 text-stone-700 dark:text-stone-300">
+ <Icon className="h-3 w-3" />
+ <span className="text-sm">{label}</span>
+ </Button>
+ );
+};
+
+// Responsive grid layout with automatic width calculation
+const ResponsiveGridLayout = WidthProvider(Responsive);
+
+const DashboardContent: React.FC<Omit<DashboardProps, "initialConfig">> = ({
+ onSave,
+ readonly = false,
+ className,
+ editorLanguage = "clickhouse-sql",
+ breakpoints = { lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 },
+ cols = { lg: 4, md: 4, sm: 2, xs: 1, xxs: 1 },
+ rowHeight = 150,
+ renderTitle = false,
+ runFilters,
+ headerComponent,
+ handleBoardUpdates,
+}) => {
+ const {
+ details,
+ setDetails,
+ layouts,
+ setLayouts,
+ widgets,
+ isEditing,
+ setIsEditing,
+ getDashboardConfig,
+ addWidget,
+ fetchExistingWidgets,
+ removeWidget,
+ } = useDashboard();
+
+ const { openEditSheet } = useEditWidget();
+
+ // Modal state
+ const [showWidgetModal, setShowWidgetModal] = React.useState(false);
+ const [existingWidgets, setExistingWidgets] = React.useState<Widget[]>([]);
+ const { fireRequest: updateBoardRequest } = useFetchWrapper();
+
+ const editItem = useCallback(
+ ({
+ itemId,
+ newTitle,
+ newDescription,
+ newTags = [],
+ }: EditResource) => {
+
+ // Toast loading state
+ toast.loading(`Updating ...`, {
+ id: "manage-dashboard-explorer",
+ });
+
+ // Create payload
+ const payload = {
+ id: itemId,
+ title: newTitle,
+ description: newDescription,
+ tags: newTags,
+ updatedParent: false,
+ };
+
+ updateBoardRequest({
+ url: "/api/manage-dashboard/board",
+ requestType: "PUT",
+ body: jsonStringify(payload),
+ successCb: (response) => {
+ toast.success("Board updated successfully", {
+ id: "manage-dashboard-explorer",
+ });
+ if (response.data?.[0] satisfies Partial<Board>) {
+ setDetails(response.data[0]);
+ handleBoardUpdates?.(response.data[0]);
+ }
+ },
+ failureCb: (error) => {
+ toast.error(`Failed to update board: ${error || "Unknown error"}`, {
+ id: "manage-dashboard-explorer",
+ });
+ },
+ });
+
+ // Close dialog
+ setDialogState((prev) => ({
+ ...prev,
+ isOpen: false,
+ editingItemId: null,
+ }));
+ },
+ [updateBoardRequest]
+ );
+
+
+ const { dialogState, setDialogState, handleDialogCancel, handleDialogSave } = useUpsertResource({
+ editItem,
+ });
+
+ // Wrap addWidget to handle modal logic
+ const handleAddWidget = async () => {
+ if (fetchExistingWidgets) {
+ const widgets = await fetchExistingWidgets();
+ setExistingWidgets(widgets);
+ setShowWidgetModal(true);
+ } else {
+ addWidget();
+ }
+ };
+
+ const handleSelectWidget = (widget: Widget) => {
+ setShowWidgetModal(false);
+ addWidget(widget);
+ };
+
+ const handleCreateNew = (widgetType: WidgetType) => {
+ setShowWidgetModal(false);
+ addWidget({
+ type: widgetType,
+ });
+ };
+
+ // Handle layout changes
+ const handleLayoutChange = (layout: any, layouts: any) => {
+ setLayouts(layouts);
+ };
+
+ // Handle save
+ const handleSave = () => {
+ if (onSave) {
+ onSave(getDashboardConfig());
+ }
+ setIsEditing(false);
+ };
+
+ const openEditDialog = useCallback(
+ (item: Partial<Board>) => {
+ setDialogState({
+ isOpen: true,
+ mode: "edit",
+ itemTitle: item.title || "",
+ itemDescription: item.description || "",
+ itemTags: item.tags ? jsonParse(item.tags) : [],
+ itemType: "board",
+ currentPath: null,
+ editingItemId: item.id!,
+ });
+ },
+ []
+ );
+
+ return (
+ <div className={`w-full ${className ?? ""}`}>
+ {(renderTitle || !readonly || headerComponent) && (
+ <div className="flex items-center mb-6">
+ {renderTitle && (
+ <div className="flex items-center gap-2 text-stone-900 dark:text-stone-300">
+ <h1 className="text-2xl font-bold">{details.title}</h1>
+ {details.description && (
+ <DescriptionTooltip description={details.description} className="ml-2 h-4 w-4" />
+ )}
+ </div>
+ )}
+ {headerComponent}
+ <div className="flex-1" />
+ {!readonly && (
+ <div className="flex gap-2">
+ <ActionButtons
+ onClick={() => openEditDialog({
+ id: details.id!,
+ title: details.title!,
+ description: details.description!,
+ tags: details.tags!,
+ })}
+ icon={Plus}
+ label={"Update Board details"}
+ />
+ <ActionButtons
+ onClick={() => (isEditing ? handleSave() : setIsEditing(true))}
+ icon={isEditing ? Save : Edit}
+ label={isEditing ? "Save Layout" : "Edit Layout"}
+ />
+ {isEditing && (
+ <ActionButtons
+ onClick={handleAddWidget}
+ icon={Plus}
+ label={"Add Widget"}
+ />
+ )}
+ {
+ !isEditing && (
+ <ActionButtons
+ onClick={() => exportBoardLayout(details.id!)}
+ icon={Download}
+ label={"Export Layout"}
+ />
+ )
+ }
+ </div>
+ )}
+ </div>
+ )}
+
+ <ResponsiveGridLayout
+ className="layout"
+ layouts={layouts}
+ breakpoints={breakpoints}
+ cols={cols}
+ rowHeight={rowHeight}
+ onLayoutChange={handleLayoutChange}
+ isDraggable={isEditing && !readonly}
+ isResizable={isEditing && !readonly}
+ margin={[16, 16]}
+ containerPadding={[0, 0]}
+ >
+ {
+ layouts.lg.map((item: any) => {
+ const widget = widgets[item.i];
+ if (!widget) return null;
+
+ return (
+ <div key={item.i} className="bg-background">
+ <WidgetRenderer
+ widget={widget}
+ isEditing={isEditing && !readonly}
+ onEdit={openEditSheet}
+ onRemove={(widgetId) => {
+ // Implementation of removeWidget is in the DashboardContext
+ removeWidget(widgetId);
+ }}
+ runFilters={runFilters}
+ />
+ </div>
+ );
+ })
+ }
+ </ResponsiveGridLayout>
+ {
+ !readonly && (
+ <>
+ {layouts.lg.length === 0 && (
+ <div style={{ width: '100%' }}>
+ <EmptyState onAddWidget={() => { setIsEditing(true); handleAddWidget() }} />
+ </div>
+ )}
+ <EditWidgetSheet editorLanguage={editorLanguage} />
+ <WidgetSelectionModal
+ open={showWidgetModal}
+ onClose={() => setShowWidgetModal(false)}
+ widgets={existingWidgets}
+ onSelect={handleSelectWidget}
+ onCreateNew={handleCreateNew}
+ />
+ <UpsertResourceDialog
+ isOpen={dialogState.isOpen}
+ onOpenChange={(open) =>
+ setDialogState((prev) => ({ ...prev, isOpen: open }))
+ }
+ mode={dialogState.mode}
+ initialItemTitle={dialogState.itemTitle}
+ initialItemDescription={dialogState.itemDescription}
+ initialItemType={dialogState.itemType}
+ initialItemTags={dialogState.itemTags}
+ onSave={handleDialogSave}
+ onCancel={handleDialogCancel}
+ />
+ </>
+ )
+ }
+ </div>
+ );
+};
+
+// Main Dashboard component with provider
+const Dashboard: React.FC<DashboardProps> = ({ initialConfig, ...props }) => {
+ return (
+ <DashboardProvider
+ initialConfig={initialConfig}
+ onSave={props.onSave}
+ runQuery={props.runQuery}
+ handleWidgetCrud={props.handleWidgetCrud}
+ fetchExistingWidgets={props.fetchExistingWidgets}
+ >
+ <DashboardContent {...props} />
+ </DashboardProvider>
+ );
+};
+
+export default Dashboard;
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/hooks/index.ts b/src/client/src/components/(playground)/manage-dashboard/board-creator/hooks/index.ts
new file mode 100644
index 00000000..5798986b
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/hooks/index.ts
@@ -0,0 +1 @@
+export * from "./useEditWidget"
\ No newline at end of file
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/hooks/useEditWidget.ts b/src/client/src/components/(playground)/manage-dashboard/board-creator/hooks/useEditWidget.ts
new file mode 100644
index 00000000..b3209382
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/hooks/useEditWidget.ts
@@ -0,0 +1,50 @@
+"use client";
+
+import { useState } from "react";
+import { useDashboard } from "../context/dashboard-context";
+
+export const useEditWidget = () => {
+ const {
+ editingWidget,
+ setEditingWidget,
+ widgets,
+ updateWidget,
+ updateWidgetProperties,
+ runQuery,
+ } = useDashboard();
+ const [currentTab, setCurrentTab] = useState("general");
+ const [isFullscreenEditor, setIsFullscreenEditor] = useState(false);
+
+ // Current widget being edited
+ const currentWidget = editingWidget ? widgets[editingWidget] : null;
+
+ // Open the edit sheet for a widget
+ const openEditSheet = (widgetId: string) => {
+ setEditingWidget(widgetId);
+ setCurrentTab("general");
+ };
+
+ // Close the edit sheet
+ const closeEditSheet = () => {
+ setEditingWidget(null);
+ setIsFullscreenEditor(false);
+ };
+
+ // Toggle fullscreen editor
+ const toggleFullscreenEditor = () => {
+ setIsFullscreenEditor(!isFullscreenEditor);
+ };
+
+ return {
+ currentTab,
+ setCurrentTab,
+ isFullscreenEditor,
+ currentWidget,
+ openEditSheet,
+ closeEditSheet,
+ toggleFullscreenEditor,
+ updateWidget,
+ updateWidgetProperties,
+ runQuery,
+ };
+};
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/hooks/useUpsertResource.ts b/src/client/src/components/(playground)/manage-dashboard/board-creator/hooks/useUpsertResource.ts
new file mode 100644
index 00000000..2ead87da
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/hooks/useUpsertResource.ts
@@ -0,0 +1,87 @@
+import { DashboardItemType } from "@/types/manage-dashboard";
+import { useCallback, useState } from "react";
+
+export type AddResource = {
+ title: string;
+ description: string;
+ type: DashboardItemType;
+ tags: string[];
+ parentPath: string[] | null;
+}
+
+export type EditResource = {
+ itemId: string,
+ newTitle: string,
+ newDescription: string,
+ newTags: string[];
+ parentPath: string[] | null;
+}
+
+type DialogState = {
+ isOpen: boolean;
+ mode: "add" | "edit";
+ itemTitle: string;
+ itemDescription: string;
+ itemType: DashboardItemType;
+ itemTags: string[];
+ currentPath: string[] | null;
+ editingItemId: string | null;
+};
+
+export const useUpsertResource = ({
+ addItem,
+ editItem,
+}: {
+ addItem?: (item: AddResource) => void;
+ editItem: (item: EditResource) => void;
+}) => {
+ const [dialogState, setDialogState] = useState<DialogState>({
+ isOpen: false,
+ mode: "add" as "add" | "edit",
+ itemTitle: "",
+ itemDescription: "",
+ itemTags: [],
+ itemType: "board" as DashboardItemType,
+ currentPath: [] as string[],
+ editingItemId: null as string | null,
+ });
+
+ const handleDialogSave = useCallback(
+ (title: string, description: string, type: DashboardItemType, tags: string[]) => {
+ const { mode, currentPath, editingItemId } = dialogState;
+
+ if (mode === "add") {
+ addItem?.({
+ title,
+ description,
+ type,
+ tags,
+ parentPath: currentPath,
+ });
+ } else if (editingItemId) {
+ editItem({
+ itemId: editingItemId,
+ newTitle: title,
+ newDescription: description,
+ newTags: tags,
+ parentPath: currentPath,
+ });
+ }
+ },
+ [addItem, dialogState, editItem]
+ );
+
+ const handleDialogCancel = useCallback(() => {
+ setDialogState((prev) => ({
+ ...prev,
+ isOpen: false,
+ }));
+ }, []);
+
+ return {
+ dialogState,
+ setDialogState,
+ handleDialogSave,
+ handleDialogCancel,
+ };
+};
\ No newline at end of file
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/index.ts b/src/client/src/components/(playground)/manage-dashboard/board-creator/index.ts
new file mode 100644
index 00000000..94af7f61
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/index.ts
@@ -0,0 +1,11 @@
+// Main package entry point
+export * from "./types";
+export * from "./constants";
+export * from "./components";
+export * from "./hooks";
+export * from "./utils";
+export * from "./context";
+export * from "./widgets";
+
+// Export the main Dashboard component as default
+export { default } from "./dashboard-view";
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/types.ts b/src/client/src/components/(playground)/manage-dashboard/board-creator/types.ts
new file mode 100644
index 00000000..200f944e
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/types.ts
@@ -0,0 +1,168 @@
+import type { ReactNode } from "react";
+import type { Layouts } from "react-grid-layout";
+import { Board } from "@/types/manage-dashboard";
+
+// Widget Types
+export enum WidgetType {
+ STAT_CARD = "STAT_CARD",
+ BAR_CHART = "BAR_CHART",
+ LINE_CHART = "LINE_CHART",
+ PIE_CHART = "PIE_CHART",
+ TABLE = "TABLE",
+ AREA_CHART = "AREA_CHART",
+ MARKDOWN = "MARKDOWN",
+}
+
+type RGB = `rgb(${number}, ${number}, ${number})`;
+type RGBA = `rgba(${number}, ${number}, ${number}, ${number})`;
+type HEX = `#${string}`;
+
+// Color Themes
+export type ColorTheme = RGB | RGBA | HEX;
+
+// Base Widget Interface
+export interface BaseWidgetProps {
+ id: string;
+ title: string;
+ type: WidgetType;
+ description?: string;
+ config?: Record<string, any>;
+ properties: Record<string, any>;
+}
+
+// Specific Widget Interfaces
+export interface StatCardWidget extends BaseWidgetProps {
+ properties: {
+ prefix?: string;
+ suffix?: string;
+ value?: string;
+ color?: ColorTheme;
+ trend?: string;
+ trendSuffix?: string;
+ trendPrefix?: string;
+ textSize?: "small" | "medium" | "large";
+ autoRefresh?: boolean;
+ };
+}
+
+export interface ChartWidget extends BaseWidgetProps {
+ properties: {
+ color: ColorTheme;
+ showLegend?: boolean;
+ autoRefresh?: boolean;
+ };
+}
+
+export interface BarChartWidget extends ChartWidget {
+ properties: ChartWidget["properties"] & {
+ xAxis: string;
+ yAxis: string;
+ };
+}
+
+export interface LineChartWidget extends ChartWidget {
+ properties: ChartWidget["properties"] & {
+ xAxis: string;
+ yAxis: string;
+ };
+}
+
+export interface PieChartWidget extends ChartWidget {
+ properties: ChartWidget["properties"] & {
+ labelPath: string;
+ valuePath: string;
+ };
+}
+
+export interface TableWidget extends BaseWidgetProps {
+ properties: {
+ color: ColorTheme;
+ autoRefresh?: boolean;
+ };
+}
+
+export interface AreaChartWidget extends ChartWidget {
+ properties: ChartWidget["properties"] & {
+ xAxis: string;
+ yAxes: {
+ key: string;
+ color: ColorTheme;
+ }[];
+ stackId?: string;
+ };
+}
+
+export interface MarkdownWidget extends BaseWidgetProps {
+ config: {
+ content: string;
+ showPreview?: boolean;
+ };
+ properties: {
+ color: ColorTheme;
+ };
+}
+
+// Combined Widget Type
+export type Widget =
+ | StatCardWidget
+ | BarChartWidget
+ | LineChartWidget
+ | PieChartWidget
+ | TableWidget
+ | AreaChartWidget
+ | MarkdownWidget;
+
+// Widgets Record - maps widget IDs to widget objects
+export type WidgetsRecord = Record<string, Widget>;
+
+// Dashboard Configuration
+export interface DashboardConfig {
+ id: string;
+ title: string;
+ description: string;
+ tags?: string;
+ layouts: Layouts;
+ widgets: WidgetsRecord;
+}
+
+// Dashboard Props
+export interface DashboardProps {
+ initialConfig?: DashboardConfig;
+ onSave?: (config: DashboardConfig) => void;
+ readonly?: boolean;
+ className?: string;
+ renderCustomWidget?: (widget: Widget) => ReactNode;
+ editorLanguage?: string;
+ customTheme?: any;
+ breakpoints?: { [key: string]: number };
+ cols?: { [key: string]: number };
+ rowHeight?: number;
+ runQuery?: (
+ widgetId: string,
+ params: Record<string, unknown>
+ ) => Promise<{ data: any; err: string | null }>;
+ handleWidgetCrud?: (updates: Partial<Widget>) => Promise<Widget>;
+ fetchExistingWidgets?: () => Promise<Widget[]>;
+ renderTitle?: boolean;
+ runFilters?: unknown;
+ headerComponent?: ReactNode;
+ handleBoardUpdates?: (details: Partial<Board>) => void;
+}
+
+// Widget Renderer Props
+export interface WidgetRendererProps {
+ widget: Widget;
+ isEditing: boolean;
+ onEdit: (widgetId: string) => void;
+ onRemove: (widgetId: string) => void;
+ runFilters?: unknown;
+}
+
+// Editor Props
+export interface EditorProps {
+ value: string;
+ onChange: (value: string | undefined) => void;
+ language?: string;
+ height?: string;
+ fullScreen?: boolean;
+}
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/utils/api.ts b/src/client/src/components/(playground)/manage-dashboard/board-creator/utils/api.ts
new file mode 100644
index 00000000..2fbe5da4
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/utils/api.ts
@@ -0,0 +1,3 @@
+export const exportBoardLayout = (id: string) => {
+ window.location.href = `/api/manage-dashboard/board/${id}/layout/export`;
+};
\ No newline at end of file
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/utils/formatters.ts b/src/client/src/components/(playground)/manage-dashboard/board-creator/utils/formatters.ts
new file mode 100644
index 00000000..810335e3
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/utils/formatters.ts
@@ -0,0 +1,39 @@
+/**
+ * Formats a number as currency
+ * @param value Number to format
+ * @param locale Locale to use for formatting
+ * @param currency Currency code
+ * @returns Formatted currency string
+ */
+export const formatCurrency = (value: number, locale = "en-US", currency = "USD"): string => {
+ return new Intl.NumberFormat(locale, {
+ style: "currency",
+ currency,
+ minimumFractionDigits: 2,
+ }).format(value)
+}
+
+/**
+ * Formats a percentage
+ * @param value Number to format as percentage
+ * @param locale Locale to use for formatting
+ * @param digits Number of decimal places
+ * @returns Formatted percentage string
+ */
+export const formatPercentage = (value: number, locale = "en-US", digits = 1): string => {
+ return new Intl.NumberFormat(locale, {
+ style: "percent",
+ minimumFractionDigits: digits,
+ maximumFractionDigits: digits,
+ }).format(value / 100)
+}
+
+/**
+ * Title cases a string (e.g. "hello_world" -> "Hello World")
+ * @param str String to transform
+ * @returns Title cased string
+ */
+export const toTitleCase = (str: string): string => {
+ return str.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase())
+}
+
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/utils/index.ts b/src/client/src/components/(playground)/manage-dashboard/board-creator/utils/index.ts
new file mode 100644
index 00000000..89cacdb4
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/utils/index.ts
@@ -0,0 +1 @@
+export * from "./formatters"
\ No newline at end of file
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/area-chart-widget.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/area-chart-widget.tsx
new file mode 100644
index 00000000..77646e87
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/area-chart-widget.tsx
@@ -0,0 +1,98 @@
+import React from "react";
+import {
+ AreaChart,
+ Area,
+ XAxis,
+ YAxis,
+ CartesianGrid,
+ Tooltip,
+ ResponsiveContainer,
+} from "recharts";
+import type { AreaChartWidget } from "../types";
+
+interface AreaChartProps {
+ widget: AreaChartWidget;
+ data?: any[];
+}
+
+const AreaChartWidgetComponent: React.FC<AreaChartProps> = ({
+ widget,
+ data,
+}) => {
+ return (
+ <div className="flex flex-col h-full">
+ <ResponsiveContainer width="100%" height="100%">
+
+ <AreaChart
+ width={500}
+ height={400}
+ data={data || []}
+ margin={{
+ top: 10,
+ right: 30,
+ left: 0,
+ bottom: 0,
+ }}
+ >
+ <CartesianGrid strokeDasharray="3 3" stroke="currentColor" strokeOpacity={0.15} />
+ <XAxis
+ dataKey={widget.properties.xAxis}
+ className="text-xs stroke-stone-300"
+ stroke="currentColor"
+ />
+ <YAxis
+ className="text-xs stroke-stone-300"
+ stroke="currentColor"
+ domain={[0, "dataMax + 15"]}
+ />
+ <Tooltip
+ cursor={{ fill: 'transparent' }}
+ labelClassName="text-xs text-stone-900 dark:text-stone-300"
+ wrapperClassName="bg-stone-200 dark:bg-stone-800 rounded-md"
+ contentStyle={{
+ backgroundColor: '', border: 'none', boxShadow: 'none',
+ fontWeight: 'bold'
+ }}
+ />
+ <defs>
+ {widget.properties.yAxes?.map((yAxis, index) => (
+ <linearGradient
+ key={yAxis.key}
+ id={yAxis.key}
+ x1="0"
+ y1="0"
+ x2="0"
+ y2="1"
+ >
+ <stop
+ offset="5%"
+ stopColor={yAxis.color}
+ stopOpacity={0.8}
+ />
+ <stop
+ offset="95%"
+ stopColor={yAxis.color}
+ stopOpacity={0.1}
+ />
+ </linearGradient>
+ ))}
+ </defs>
+ {widget.properties.yAxes?.map((yAxis, index) => (
+ <Area
+ key={yAxis.key}
+ type="natural"
+ dataKey={yAxis.key}
+ stackId={widget.properties.stackId}
+ stroke={yAxis.color}
+ name={yAxis.key}
+ fill={`url(#${yAxis.key})`}
+ fillOpacity={0.4}
+ />
+ ))}
+ </AreaChart>
+ </ResponsiveContainer>
+ </div>
+ );
+};
+
+export default AreaChartWidgetComponent;
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/bar-chart-widget.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/bar-chart-widget.tsx
new file mode 100644
index 00000000..5c5ba978
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/bar-chart-widget.tsx
@@ -0,0 +1,69 @@
+import type React from "react";
+import {
+ BarChart,
+ Bar,
+ XAxis,
+ YAxis,
+ CartesianGrid,
+ ResponsiveContainer,
+ Tooltip,
+} from "recharts";
+import type { BarChartWidget } from "../types";
+
+interface BarChartProps {
+ widget: BarChartWidget;
+ data?: any[];
+}
+
+const BarChartWidgetComponent: React.FC<BarChartProps> = ({ widget, data }) => {
+ const updatedData = data?.map((item) => {
+ const yValue = parseFloat(item[widget.properties.yAxis]);
+ return {
+ ...item,
+ [widget.properties.xAxis]: item[widget.properties.xAxis],
+ [widget.properties.yAxis]: isNaN(yValue) ? 0 : yValue,
+ };
+ }) || [];
+
+ // return null;
+ return (
+ <div className="flex flex-col h-full relative">
+ <ResponsiveContainer width="100%" height="100%">
+ <BarChart
+ data={updatedData || []}
+ margin={{
+ top: 20,
+ right: 10,
+ left: 0,
+ bottom: 5,
+ }}
+ >
+ <CartesianGrid strokeDasharray="3 3" stroke="currentColor" strokeOpacity={0.15} />
+ <XAxis
+ dataKey={widget.properties.xAxis}
+ className="text-xs stroke-stone-300"
+ stroke="currentColor"
+ />
+ <YAxis
+ dataKey={widget.properties.yAxis}
+ domain={[0, "dataMax + 15"]}
+ className="text-xs stroke-stone-300"
+ stroke="currentColor"
+ />
+ <Tooltip
+ cursor={{ fill: 'transparent' }}
+ labelClassName="text-xs text-stone-900 dark:text-stone-300"
+ wrapperClassName="bg-stone-200 dark:bg-stone-800 rounded-md"
+ contentStyle={{
+ backgroundColor: '', border: 'none', boxShadow: 'none',
+ fontWeight: 'bold'
+ }}
+ />
+ <Bar dataKey={widget.properties.yAxis} fill={widget.properties.color} />
+ </BarChart>
+ </ResponsiveContainer>
+ </div>
+ );
+};
+
+export default BarChartWidgetComponent;
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/index.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/index.tsx
new file mode 100644
index 00000000..80647ccc
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/index.tsx
@@ -0,0 +1,7 @@
+export * from "./widget-renderer";
+export * from "./stat-card-widget";
+export * from "./bar-chart-widget";
+export * from "./line-chart-widget";
+export * from "./pie-chart-widget";
+export * from "./table-widget";
+export * from "./area-chart-widget";
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/line-chart-widget.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/line-chart-widget.tsx
new file mode 100644
index 00000000..c167c3d4
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/line-chart-widget.tsx
@@ -0,0 +1,73 @@
+import type React from "react";
+import {
+ LineChart,
+ Line,
+ XAxis,
+ YAxis,
+ CartesianGrid,
+ ResponsiveContainer,
+ Tooltip,
+} from "recharts";
+import type { LineChartWidget } from "../types";
+
+interface LineChartProps {
+ widget: LineChartWidget;
+ data?: any[];
+}
+
+const LineChartWidgetComponent: React.FC<LineChartProps> = ({
+ widget,
+ data,
+}) => {
+ const updatedData = data?.map((item) => ({
+ ...item,
+ [widget.properties.xAxis]: item[widget.properties.xAxis],
+ [widget.properties.yAxis]: parseFloat(item[widget.properties.yAxis]),
+ })) || [];
+
+ return (
+ <div className="flex flex-col h-full relative">
+ <ResponsiveContainer width="100%" height="100%">
+ <LineChart
+ data={updatedData}
+ margin={{
+ top: 5,
+ right: 30,
+ left: 20,
+ bottom: 5,
+ }}
+ >
+ <CartesianGrid strokeDasharray="3 3" stroke="currentColor" strokeOpacity={0.15} />
+ <XAxis
+ dataKey={widget.properties.xAxis}
+ className="text-xs stroke-stone-300"
+ stroke="currentColor"
+ />
+ <YAxis
+ dataKey={widget.properties.yAxis}
+ className="text-xs stroke-stone-300"
+ stroke="currentColor"
+ domain={[0, "dataMax + 15"]}
+ />
+ <Tooltip
+ cursor={{ fill: 'transparent' }}
+ labelClassName="text-xs text-stone-900 dark:text-stone-300"
+ wrapperClassName="bg-stone-200 dark:bg-stone-800 rounded-md"
+ contentStyle={{
+ backgroundColor: '', border: 'none', boxShadow: 'none',
+ fontWeight: 'bold'
+ }}
+ />
+ <Line
+ type="monotone"
+ dataKey={widget.properties.yAxis}
+ stroke={widget.properties.color}
+ strokeWidth={3}
+ />
+ </LineChart>
+ </ResponsiveContainer>
+ </div>
+ );
+};
+
+export default LineChartWidgetComponent;
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/markdown-widget.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/markdown-widget.tsx
new file mode 100644
index 00000000..33a0d5d2
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/markdown-widget.tsx
@@ -0,0 +1,41 @@
+import React from "react";
+import { type MarkdownWidget, type ColorTheme } from "../types";
+import ReactMarkdown from "react-markdown";
+import { cn } from "@/lib/utils";
+import "./markdown.css";
+
+interface MarkdownWidgetProps {
+ widget: MarkdownWidget;
+ data?: any;
+}
+
+const MarkdownWidget: React.FC<MarkdownWidgetProps> = ({ widget }) => {
+ const colorTheme = widget.properties.color || '#0ea5e9' as ColorTheme; // Default to blue if no theme selected
+
+ return (
+ <div
+ className={cn(
+ "w-full h-full overflow-auto prose dark:prose-invert max-w-none",
+ "prose-headings:font-semibold",
+ "prose-h1:text-3xl prose-h2:text-2xl prose-h3:text-xl",
+ "prose-a:no-underline hover:prose-a:underline",
+ "prose-code:rounded prose-code:px-1",
+ "prose-blockquote:border-l-4 prose-blockquote:pl-4",
+ "prose-img:rounded-lg"
+ )}
+ style={{
+ '--theme-color': colorTheme,
+ '--theme-color-light': colorTheme.startsWith('#')
+ ? `${colorTheme}33`
+ : colorTheme.replace(')', ', 0.2)'),
+ '--theme-color-medium': colorTheme.startsWith('#')
+ ? `${colorTheme}66`
+ : colorTheme.replace(')', ', 0.4)'),
+ } as React.CSSProperties}
+ >
+ <ReactMarkdown>{widget.config?.content || ''}</ReactMarkdown>
+ </div>
+ );
+};
+
+export default MarkdownWidget;
\ No newline at end of file
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/markdown.css b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/markdown.css
new file mode 100644
index 00000000..5bf71e3f
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/markdown.css
@@ -0,0 +1,117 @@
+/* Custom Markdown Styling */
+.prose {
+ color: rgb(28, 28, 28);
+}
+
+.dark .prose {
+ color: rgb(250, 250, 250);
+}
+
+.prose a {
+ color: var(--theme-color);
+ text-decoration: none;
+}
+
+.prose a:hover {
+ text-decoration: underline;
+}
+
+.prose strong {
+ color: var(--theme-color);
+ font-weight: 600;
+}
+
+.prose h1,
+.prose h2,
+.prose h3,
+.prose h4,
+.prose h5,
+.prose h6 {
+ color: var(--theme-color);
+ margin-top: 2em;
+ margin-bottom: 1em;
+}
+
+.prose h1:first-child,
+.prose h2:first-child,
+.prose h3:first-child,
+.prose h4:first-child,
+.prose h5:first-child,
+.prose h6:first-child {
+ margin-top: 0;
+}
+
+.prose blockquote {
+ border-left-color: var(--theme-color);
+ background-color: var(--theme-color-light);
+ margin: 1.5em 0;
+ padding: 1em;
+ border-radius: 0.375rem;
+}
+
+.prose code {
+ color: var(--theme-color);
+ font-weight: 500;
+}
+
+.prose pre {
+ background-color: rgb(241, 241, 241);
+ border: 1px solid rgb(229, 229, 229);
+ border-radius: 0.375rem;
+ padding: 1em;
+ overflow-x: auto;
+}
+
+.dark .prose pre {
+ background-color: rgb(28, 28, 28);
+ border-color: rgb(64, 64, 64);
+}
+
+.prose ul {
+ list-style-type: disc;
+ padding-left: 1.5em;
+}
+
+.prose ol {
+ list-style-type: decimal;
+ padding-left: 1.5em;
+}
+
+.prose li {
+ margin: 0.5em 0;
+}
+
+.prose img {
+ max-width: 100%;
+ height: auto;
+ border-radius: 0.375rem;
+ margin: 1.5em 0;
+}
+
+.prose hr {
+ border: none;
+ border-top: 2px solid var(--theme-color-medium);
+ margin: 2em 0;
+}
+
+.prose table {
+ width: 100%;
+ border-collapse: collapse;
+ margin: 1.5em 0;
+}
+
+.prose th {
+ background-color: var(--theme-color-light);
+ border: 1px solid var(--theme-color-medium);
+ padding: 0.75em;
+ text-align: left;
+}
+
+.prose td {
+ border: 1px solid var(--theme-color-medium);
+ padding: 0.75em;
+}
+
+.prose tr:nth-child(even) {
+ background-color: var(--theme-color-light);
+}
\ No newline at end of file
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/pie-chart-widget.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/pie-chart-widget.tsx
new file mode 100644
index 00000000..319ff224
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/pie-chart-widget.tsx
@@ -0,0 +1,106 @@
+import type React from "react";
+import { PieChart, Pie, ResponsiveContainer, Sector } from "recharts";
+import type { PieChartWidget } from "../types";
+import { useMemo, useState } from "react";
+
+interface PieChartProps {
+ widget: PieChartWidget;
+ data?: any[];
+}
+
+const renderActiveShape = (props: any) => {
+ const {
+ cx,
+ cy,
+ innerRadius,
+ outerRadius,
+ startAngle,
+ endAngle,
+ payload,
+ percent,
+ fill,
+ } = props;
+
+ return (
+ <g>
+ <text
+ x={cx}
+ y={cy - 10}
+ dy={8}
+ textAnchor="middle"
+ fill={fill}
+ >
+ {payload.name}
+ </text>
+ <Sector
+ cx={cx}
+ cy={cy}
+ innerRadius={innerRadius}
+ outerRadius={outerRadius}
+ startAngle={startAngle}
+ endAngle={endAngle}
+ fill={fill}
+ />
+ <Sector
+ cx={cx}
+ cy={cy}
+ startAngle={startAngle}
+ endAngle={endAngle}
+ innerRadius={outerRadius + 6}
+ outerRadius={outerRadius + 10}
+ fill={fill}
+ />
+ <text
+ x={cx}
+ y={cy + 10}
+ dy={8}
+ textAnchor="middle"
+ fill={fill}
+ >
+ {`(${(percent * 100).toFixed(2)}%)`}
+ </text>
+ </g>
+ );
+};
+
+const PieChartWidgetComponent: React.FC<PieChartProps> = ({ widget, data }) => {
+ const [activeIndex, setActiveIndex] = useState<number>(0);
+ const onPieEnter = (_: any, index: number) => {
+ setActiveIndex(index);
+ };
+
+ const { labelPath, valuePath } = widget.properties;
+
+ const updatedData = useMemo(
+ () =>
+ (data as { [key: string]: any }[] || []).map((item) => ({
+ name: item[labelPath],
+ value: item[valuePath],
+ })),
+ [data]
+ );
+
+ return (
+ <div className="flex flex-col h-full">
+ <ResponsiveContainer width="100%" height="100%">
+ <PieChart width={100} height={100}>
+ <Pie
+ activeIndex={activeIndex}
+ activeShape={renderActiveShape}
+ data={updatedData}
+ cx="50%"
+ cy="50%"
+ innerRadius={60}
+ outerRadius={80}
+ className="fill-stone-800 dark:fill-stone-600"
+ fill={widget.properties.color}
+ dataKey={"value"}
+ onMouseEnter={onPieEnter}
+ />
+ </PieChart>
+ </ResponsiveContainer>
+ </div>
+ );
+};
+
+export default PieChartWidgetComponent;
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/stat-card-widget.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/stat-card-widget.tsx
new file mode 100644
index 00000000..79e36762
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/stat-card-widget.tsx
@@ -0,0 +1,53 @@
+import React from "react";
+import type { StatCardWidget } from "../types";
+import { TrendingDown } from "lucide-react";
+import { TrendingUp } from "lucide-react";
+import { isNil } from "lodash";
+
+interface StatCardProps {
+ widget: StatCardWidget;
+ data?: any;
+}
+
+const StatCardWidget: React.FC<StatCardProps> = ({ widget, data }) => {
+ let value = "";
+ let trend: number = 0;
+
+ try {
+ value = (widget.properties.value || "")
+ .split(".")
+ .reduce((acc: any, curr: string) => acc?.[curr], data);
+ value = (value || 0).toString();
+ trend = (widget.properties.trend || "")
+ .split(".")
+ .reduce((acc: any, curr: string) => acc?.[curr], data);
+ trend = isNil(trend) ? trend : parseFloat(trend?.toString() || "0");
+ } catch (error) {
+ console.error(error);
+ }
+
+ return (
+ <div className="flex flex-col justify-center items-center h-full">
+ <div className={`text-3xl font-bold`} style={{ color: widget.properties.color }}>
+ {widget.properties.prefix}
+ {value}
+ {widget.properties.suffix}
+ </div>
+ {!isNil(trend) && (
+ <div
+ className={`flex items-center gap-1 text-sm mt-2 ${trend > 0
+ ? "text-green-500"
+ : "text-red-500"
+ }`}
+ >
+ {widget.properties.trendPrefix}
+ {Math.abs(trend)}
+ {widget.properties.trendSuffix}
+ {trend > 0 ? <TrendingUp className="w-4 h-4" /> : <TrendingDown className="w-4 h-4" />}
+ </div>
+ )}
+ </div>
+ );
+};
+
+export default StatCardWidget;
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/table-widget.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/table-widget.tsx
new file mode 100644
index 00000000..8fc95fde
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/table-widget.tsx
@@ -0,0 +1,100 @@
+import type React from "react";
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from "@/components/ui/table";
+import type { ColorTheme, TableWidget } from "../types";
+
+interface TableWidgetProps {
+ widget: TableWidget;
+ data?: any[];
+}
+
+const TableWidgetComponent: React.FC<TableWidgetProps> = ({ widget, data }) => {
+ if (!data || data.length === 0) {
+ return (
+ <div className="flex justify-center items-center h-full text-muted-foreground">
+ No data available
+ </div>
+ );
+ }
+
+ const columns = Object.keys(data[0]).map((key) => ({
+ header: key.charAt(0).toUpperCase() + key.slice(1),
+ cell: (row: any) => typeof row[key] === "object" ? JSON.stringify(row[key]) : row[key],
+ className: "border-r last:border-r-0",
+ }));
+
+ const backgroundColor = `${widget.properties.color}20`;
+ const borderColor = `${widget.properties.color}50`;
+
+ return (
+ <div className="flex flex-col h-full overflow-auto border rounded-lg"
+ style={{
+ borderColor,
+ }}>
+ <Table>
+ <TableHeader className="sticky top-0 z-10"
+ style={{
+ backgroundColor,
+ }}>
+ <TableRow
+ className="border-b"
+ style={{
+ borderColor,
+ }}
+ >
+ {columns.map((column, index) => (
+ <TableHead
+ key={index}
+ className="px-4 py-2 font-semibold border-r last:border-r-0 h-auto"
+ style={{
+ color: widget.properties.color as ColorTheme,
+ borderColor,
+ }}
+ >
+ {column.header}
+ </TableHead>
+ ))}
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {data.length === 0 ? (
+ <TableRow>
+ <TableCell colSpan={columns.length} className="text-center text-stone-500 dark:text-stone-400">
+ No results.
+ </TableCell>
+ </TableRow>
+ ) : (
+ data.map((row, rowIndex) => (
+ <TableRow
+ key={rowIndex}
+ className="border-b last:border-b-0 hover:bg-stone-50/50 dark:hover:bg-stone-800/50"
+ >
+ {columns.map((column, colIndex) => {
+ return (
+ <TableCell
+ key={`${rowIndex}-${colIndex}`}
+ className="border-r last:border-r-0 px-4 py-2 text-stone-600 dark:text-stone-300"
+ style={{
+ borderColor,
+ }}
+ >
+ {column.cell(row)}
+ </TableCell>
+ );
+ })}
+ </TableRow>
+ ))
+ )}
+ </TableBody>
+ </Table>
+ </div>
+ );
+};
+
+export default TableWidgetComponent;
diff --git a/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/widget-renderer.tsx b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/widget-renderer.tsx
new file mode 100644
index 00000000..4b975537
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board-creator/widgets/widget-renderer.tsx
@@ -0,0 +1,108 @@
+import React, { useMemo, memo, useEffect } from "react";
+import { Edit, Trash } from "lucide-react";
+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
+import { WidgetType, type WidgetRendererProps } from "../types";
+import { SUPPORTED_WIDGETS } from "../constants";
+import StatCardWidget from "./stat-card-widget";
+import BarChartWidget from "./bar-chart-widget";
+import LineChartWidget from "./line-chart-widget";
+import PieChartWidget from "./pie-chart-widget";
+import TableWidget from "./table-widget";
+import AreaChartWidget from "./area-chart-widget";
+import MarkdownWidget from "./markdown-widget";
+import { useDashboard } from "../context/dashboard-context";
+import DescriptionTooltip from "../../../../common/description-tooltip";
+
+const WidgetRenderer: React.FC<WidgetRendererProps> = ({
+ widget,
+ isEditing,
+ onEdit,
+ onRemove,
+ runFilters,
+}) => {
+ const { widgetData, loadWidgetData } = useDashboard();
+
+ // Load data when not in edit mode
+ useEffect(() => {
+ // @ts-ignore TODO: fix this
+ if (widget?.config?.query) {
+ loadWidgetData(widget.id);
+ }
+ }, [runFilters]);
+
+ // Get widget type icon
+ const WidgetTypeIcon = () => {
+ const IconComponent =
+ SUPPORTED_WIDGETS[widget.type as keyof typeof SUPPORTED_WIDGETS]?.icon;
+ return <IconComponent className="h-4 w-4" />;
+ };
+
+ const widgetEvaluatedData = widgetData[widget.id];
+
+ const WidgetComponent = useMemo(() => {
+ switch (widget.type) {
+ case WidgetType.STAT_CARD:
+ return StatCardWidget;
+ case WidgetType.BAR_CHART:
+ return BarChartWidget;
+ case WidgetType.LINE_CHART:
+ return LineChartWidget;
+ case WidgetType.PIE_CHART:
+ return PieChartWidget;
+ case WidgetType.TABLE:
+ return TableWidget;
+ case WidgetType.AREA_CHART:
+ return AreaChartWidget;
+ case WidgetType.MARKDOWN:
+ return MarkdownWidget;
+ default:
+ return null;
+ }
+ }, [widget]);
+
+ return (
+ <Card className="h-full flex flex-col" data-widget-id={widget.id}>
+ <CardHeader className="pb-2 flex flex-row items-center justify-between space-y-0">
+ <div className="flex items-center gap-2">
+ <WidgetTypeIcon />
+ <CardTitle className="tracking-tight text-sm font-medium text-stone-950 dark:text-white">{widget.title}</CardTitle>
+ {widget.description && (
+ <DescriptionTooltip description={widget.description} />
+ )}
+ </div>
+ {isEditing && (
+ <div
+ className="flex gap-1 z-10"
+ // This makes the div and its children non-draggable
+ onMouseDown={(e) => {
+ e.stopPropagation();
+ }}
+ onTouchStart={(e) => {
+ e.stopPropagation();
+ }}
+ >
+ <div
+ className="cursor-pointer p-1 rounded-md hover:bg-muted"
+ onClick={() => onEdit(widget.id)}
+ >
+ <Edit className="h-4 w-4" />
+ </div>
+ <div
+ className="cursor-pointer p-1 rounded-md hover:bg-muted"
+ onClick={() => onRemove(widget.id)}
+ >
+ <Trash className="h-4 w-4" />
+ </div>
+ </div>
+ )}
+ </CardHeader>
+ <CardContent className="flex-grow overflow-auto">
+ {WidgetComponent && (
+ <WidgetComponent data={widgetEvaluatedData} widget={widget as any} />
+ )}
+ </CardContent>
+ </Card>
+ );
+};
+
+export default memo(WidgetRenderer);
diff --git a/src/client/src/components/(playground)/manage-dashboard/board/index.tsx b/src/client/src/components/(playground)/manage-dashboard/board/index.tsx
new file mode 100644
index 00000000..e1cf93fb
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/board/index.tsx
@@ -0,0 +1,123 @@
+import { useState, useEffect, useCallback } from "react";
+import { LayoutDashboardIcon, Clock, ComponentIcon, PinIcon } from "lucide-react";
+import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
+import { Badge } from "@/components/ui/badge";
+import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
+import { toast } from "sonner";
+import { Board } from "@/types/manage-dashboard";
+import { jsonParse } from "@/utils/json";
+import { useRouter } from "next/navigation";
+import Header from "../common/header";
+import { useDashboardPageSearch } from "@/selectors/dashboards";
+import EmptyState from "../common/empty-state";
+import getMessage from "@/constants/messages";
+
+function formatDate(dateString: string) {
+ const date = new Date(dateString);
+ return date.toLocaleDateString(undefined, {
+ year: "numeric",
+ month: "short",
+ day: "numeric",
+ });
+}
+
+export default function BoardList() {
+ const [boards, setBoards] = useState<Board[]>([]);
+ const pageSearch = useDashboardPageSearch();
+ const { fireRequest, isLoading } = useFetchWrapper();
+ const router = useRouter();
+ const fetchBoards = useCallback(() => {
+ fireRequest({
+ url: "/api/manage-dashboard/board",
+ requestType: "GET",
+ successCb: (response) => {
+ if (response?.data) {
+ setBoards(response.data);
+ }
+ },
+ failureCb: (error) => {
+ toast.error("Failed to load boards");
+ console.error("Error loading boards:", error);
+ },
+ });
+ }, [fireRequest]);
+
+ useEffect(() => {
+ fetchBoards();
+ }, [fetchBoards]);
+
+ const navigateToBoard = useCallback((boardId: string) => {
+ router.push(`/d/${boardId}`);
+ }, []);
+
+ const filteredBoards = boards.filter((board) => {
+ return board.title.toLowerCase().includes(pageSearch.toLowerCase());
+ });
+
+ return (
+ <div className="flex flex-col gap-3 grow overflow-y-hidden">
+ <Header title="Dashboard" />
+ <div className="grow rounded-sm overflow-y-auto">
+ {isLoading ? (
+ <div className="flex justify-center items-center py-8">
+ <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
+ </div>
+ ) : filteredBoards.length === 0 ? (
+ <EmptyState
+ title={pageSearch ? getMessage().NO_DASHBOARDS_YET_SEARCH_TITLE : getMessage().NO_DASHBOARDS_YET}
+ description={pageSearch ? getMessage().NO_DASHBOARDS_YET_SEARCH_DESCRIPTION : getMessage().NO_DASHBOARDS_YET_DESCRIPTION}
+ />
+ ) : (
+ <div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
+ {filteredBoards.map((board) => (
+ <Card
+ key={board.id}
+ className="group hover:shadow-lg transition-all duration-200 cursor-pointer border border-stone-200 dark:border-stone-800 hover:border-stone-300 dark:hover:border-stone-700"
+ onClick={() => navigateToBoard(board.id)}
+ >
+ <CardHeader className="pb-3">
+ <CardTitle className="flex gap-2 items-center text-lg font-semibold text-stone-900 dark:text-stone-300 group-hover:text-stone-600 dark:group-hover:text-stone-200 transition-colors">
+ <LayoutDashboardIcon className="h-5 w-5 text-stone-500 dark:text-stone-400 group-hover:text-stone-600 dark:group-hover:text-stone-300 transition-colors" />
+ <span className="grow shrink-0">{board.title}</span>
+ <div className="flex items-end justify-between">
+ {board.isMainDashboard && (
+ <Badge className="text-xs" variant="secondary">
+ Main Dashboard
+ </Badge>
+ )}
+ {board.isPinned && (
+ <Badge className="text-xs" variant="secondary">
+ <PinIcon className="h-3 w-3" />
+ </Badge>
+ )}
+ </div>
+ </CardTitle>
+ </CardHeader>
+ <CardContent className="space-y-4">
+ <p className="text-sm text-gray-600 line-clamp-2 shrink-0 h-[40px]">
+ {board.description}
+ </p>
+ <div className="flex items-center gap-2">
+ {jsonParse(board.tags)?.map?.((tag: string) => (
+ <Badge key={tag}>{tag}</Badge>
+ ))}
+ </div>
+ <div className="flex items-center justify-between text-sm text-gray-500">
+ <div className="flex items-center gap-1 text-xs text-gray-400">
+ <Clock className="h-3 w-3" />
+ <span>Updated {formatDate(board.updatedAt)}</span>
+ </div>
+ <div className="flex items-center gap-1">
+ <ComponentIcon className="h-3 w-3" />
+ <span>{board.totalWidgets ?? 0} widgets</span>
+ </div>
+ </div>
+ </CardContent>
+ </Card>
+ ))}
+ </div>
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/src/client/src/components/(playground)/manage-dashboard/common/empty-state.tsx b/src/client/src/components/(playground)/manage-dashboard/common/empty-state.tsx
new file mode 100644
index 00000000..c92e20a1
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/common/empty-state.tsx
@@ -0,0 +1,21 @@
+import { LayoutDashboard } from "lucide-react";
+
+export default function EmptyState({ title, description, children }: { title: string, description: string, children?: React.ReactNode }) {
+
+ return (
+ <div className="flex flex-col items-center justify-center h-[70vh] text-center px-4">
+ <div className="flex flex-col items-center justify-center p-6 rounded-lg border-2 border-dashed border-gray-300 dark:border-gray-700 w-full max-w-md space-y-6">
+ <div className="w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-4">
+ <LayoutDashboard className="h-6 w-6 text-primary" />
+ </div>
+ <h3 className="text-lg font-semibold mb-2 text-stone-900 dark:text-stone-300">
+ {title}
+ </h3>
+ <p className="text-sm text-stone-500 dark:text-stone-400 mb-4">
+ {description}
+ </p>
+ {children}
+ </div>
+ </div>
+ );
+}
\ No newline at end of file
diff --git a/src/client/src/components/(playground)/manage-dashboard/common/header.tsx b/src/client/src/components/(playground)/manage-dashboard/common/header.tsx
new file mode 100644
index 00000000..a33da7a5
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/common/header.tsx
@@ -0,0 +1,11 @@
+import Search from "./search";
+
+export default function Header({ title, children }: { title: string, children?: React.ReactNode }) {
+ return <div className="flex justify-between items-center text-stone-700 dark:text-stone-300 gap-2">
+ <h3 className="font-medium">{title}</h3>
+ <div className="flex gap-2">
+ <Search />
+ {children}
+ </div>
+ </div>;
+}
\ No newline at end of file
diff --git a/src/client/src/components/(playground)/manage-dashboard/common/search.tsx b/src/client/src/components/(playground)/manage-dashboard/common/search.tsx
new file mode 100644
index 00000000..84f7313c
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/common/search.tsx
@@ -0,0 +1,15 @@
+import { Input } from "@/components/ui/input";
+import { useSetDashboardPageSearch } from "@/selectors/dashboards";
+import { useDashboardPageSearch } from "@/selectors/dashboards";
+
+export default function Search() {
+ const pageSearch = useDashboardPageSearch();
+ const setPageSearch = useSetDashboardPageSearch();
+
+ return <Input
+ placeholder="Search"
+ value={pageSearch}
+ onChange={(e) => setPageSearch(e.target.value)}
+ className="w-[400px]"
+ />;
+}
\ No newline at end of file
diff --git a/src/client/src/components/(playground)/manage-dashboard/common/upsert-resource-dialog.tsx b/src/client/src/components/(playground)/manage-dashboard/common/upsert-resource-dialog.tsx
new file mode 100644
index 00000000..80fa1a8c
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/common/upsert-resource-dialog.tsx
@@ -0,0 +1,137 @@
+import { DialogTitle } from "@/components/ui/dialog";
+import { DialogHeader } from "@/components/ui/dialog";
+import { DialogContent } from "@/components/ui/dialog";
+import { FieldProps, FormBuilderEvent } from "@/types/form";
+import { DashboardItemType } from "@/types/manage-dashboard";
+import { useCallback } from "react";
+import { Dialog } from "@/components/ui/dialog";
+import FormBuilder from "@/components/common/form-builder";
+import { toast } from "sonner";
+import getMessage from "@/constants/messages";
+
+export default function UpsertResourceDialog({
+ isOpen,
+ onOpenChange,
+ mode,
+ initialItemTitle = "",
+ initialItemDescription = "",
+ initialItemType = "board",
+ initialItemTags = [],
+ onSave,
+}: {
+ isOpen: boolean;
+ onOpenChange: (open: boolean) => void;
+ mode: "add" | "edit";
+ initialItemTitle?: string;
+ initialItemDescription?: string;
+ initialItemType?: DashboardItemType;
+ initialItemTags?: string[];
+ onSave: (title: string, description: string, type: DashboardItemType, tags: string[]) => void;
+ onCancel: () => void;
+}) {
+ const handleSubmit: FormBuilderEvent = useCallback(
+ (event, formdata) => {
+ event.preventDefault();
+
+ // Validate that title is not empty
+ if (!formdata.title || formdata.title.trim() === '') {
+ toast.error('Please enter a title. Title cannot be empty.');
+ return;
+ }
+
+ onSave(
+ formdata.title.trim(),
+ formdata.description,
+ formdata.type as DashboardItemType,
+ formdata.tags
+ );
+ },
+ [onSave]
+ );
+
+ // Define form fields
+ const formFields: FieldProps[] = [
+ {
+ label: "Name",
+ description: "Enter a name for your resource",
+ inputKey: "item-title",
+ fieldType: "INPUT",
+ fieldTypeProps: {
+ type: "text",
+ name: "title",
+ placeholder: "Enter name",
+ defaultValue: initialItemTitle,
+ },
+ },
+ {
+ label: "Description",
+ description: "Enter a description for your resource",
+ inputKey: "item-description",
+ fieldType: "TEXTAREA",
+ fieldTypeProps: {
+ type: "text",
+ name: "description",
+ placeholder: "Enter description",
+ defaultValue: initialItemDescription,
+ },
+ },
+ {
+ label: "Tags",
+ inputKey: `item-tags`,
+ fieldType: "TAGSINPUT",
+ fieldTypeProps: {
+ name: "tags",
+ placeholder: "Add tags",
+ defaultValue: initialItemTags,
+ },
+ },
+ ];
+
+ // Add type selection field only for add mode
+ if (mode === "add") {
+ formFields.push({
+ label: "Type",
+ inputKey: "item-type",
+ fieldType: "RADIOGROUP",
+ fieldTypeProps: {
+ name: "type",
+ placeholder: "Select type",
+ defaultValue: initialItemType,
+ options: [
+ {
+ title: "Folder",
+ subText: "Container for dashboards and other folders",
+ value: "folder",
+ description: "Create a new folder to organize your dashboards",
+ },
+ {
+ title: "Dashboard",
+ subText: "Dashboard with widgets",
+ value: "board",
+ description: "Create a new dashboard",
+ },
+ ],
+ },
+ });
+ }
+
+ return (
+ <Dialog open={isOpen} onOpenChange={onOpenChange}>
+ <DialogContent className="max-h-[85%] overflow-hidden flex flex-col gap-8">
+ <DialogHeader>
+ <DialogTitle>
+ {mode === "add" ? getMessage().ADD_DASHBOARD_OR_FOLDER : getMessage().EDIT_DASHBOARD_OR_FOLDER}
+ </DialogTitle>
+ </DialogHeader>
+ <div className="flex items-start overflow-y-auto flex-1">
+ <FormBuilder
+ alignment="vertical"
+ fields={formFields}
+ onSubmit={handleSubmit}
+ submitButtonText={mode === "add" ? "Add" : "Save"}
+ />
+ </div>
+ </DialogContent>
+ </Dialog>
+ );
+}
diff --git a/src/client/src/components/(playground)/manage-dashboard/explorer/import-layout-modal.tsx b/src/client/src/components/(playground)/manage-dashboard/explorer/import-layout-modal.tsx
new file mode 100644
index 00000000..1eaf2084
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/explorer/import-layout-modal.tsx
@@ -0,0 +1,150 @@
+import { useState, useRef } from "react";
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
+import { Upload } from "lucide-react";
+import { toast } from "sonner";
+
+export default function ImportLayoutModal({
+ open,
+ onClose,
+ onImport,
+}: {
+ open: boolean;
+ onClose: () => void;
+ onImport: (data: any) => Promise<{ err: string; data: string }>;
+}) {
+ const [isLoading, setIsLoading] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const fileInputRef = useRef<HTMLInputElement>(null);
+
+ const handleFileChange = async (event: React.ChangeEvent<HTMLInputElement>) => {
+ const file = event.target.files?.[0];
+ if (!file) return;
+
+ try {
+ setIsLoading(true);
+ setError(null);
+ toast.loading("Reading layout file...", { id: "import-layout" });
+
+ // Validate file type
+ if (!file.name.endsWith('.json')) {
+ throw new Error("Please upload a JSON file");
+ }
+
+ const text = await file.text();
+ toast.loading("Parsing JSON data...", { id: "import-layout" });
+ const data = JSON.parse(text);
+
+ toast.loading("Importing layout...", { id: "import-layout" });
+ const result = await onImport(data);
+
+ if (result.err) {
+ throw new Error(result.err);
+ }
+
+ toast.success("Layout imported successfully!", { id: "import-layout" });
+ onClose();
+ } catch (err) {
+ const errorMessage = err instanceof Error ? err.message : "Failed to import layout";
+ setError(errorMessage);
+ toast.error(errorMessage, { id: "import-layout" });
+ } finally {
+ setIsLoading(false);
+ if (fileInputRef.current) {
+ fileInputRef.current.value = '';
+ }
+ }
+ };
+
+ const handleDragOver = (e: React.DragEvent) => {
+ e.preventDefault();
+ e.stopPropagation();
+ };
+
+ const handleDrop = async (e: React.DragEvent) => {
+ e.preventDefault();
+ e.stopPropagation();
+
+ const file = e.dataTransfer.files?.[0];
+ if (!file) return;
+
+ try {
+ setIsLoading(true);
+ setError(null);
+ toast.loading("Reading layout file...", { id: "import-layout" });
+
+ // Validate file type
+ if (!file.name.endsWith('.json')) {
+ throw new Error("Please upload a JSON file");
+ }
+
+ const text = await file.text();
+ toast.loading("Parsing JSON data...", { id: "import-layout" });
+ const data = JSON.parse(text);
+
+ toast.loading("Importing layout...", { id: "import-layout" });
+ const result = await onImport(data);
+
+ if (result.err) {
+ throw new Error(result.err);
+ }
+
+ toast.success("Layout imported successfully!", { id: "import-layout" });
+ onClose();
+ } catch (err) {
+ const errorMessage = err instanceof Error ? err.message : "Failed to import layout";
+ setError(errorMessage);
+ toast.error(errorMessage, { id: "import-layout" });
+ } finally {
+ setIsLoading(false);
+ }
+ };
+
+ return (
+ <Dialog open={open} onOpenChange={onClose}>
+ <DialogContent className="sm:max-w-[425px]">
+ <DialogHeader>
+ <DialogTitle>Import Board Layout</DialogTitle>
+ </DialogHeader>
+ <div
+ className={`
+ p-8 border-2 border-dashed rounded-lg text-center cursor-pointer
+ transition-colors hover:border-primary hover:bg-primary/5
+ ${isLoading ? "opacity-50 cursor-not-allowed" : ""}
+ `}
+ onClick={() => fileInputRef.current?.click()}
+ onDragOver={handleDragOver}
+ onDrop={handleDrop}
+ >
+ <input
+ ref={fileInputRef}
+ type="file"
+ accept=".json"
+ onChange={handleFileChange}
+ className="hidden"
+ />
+ <Upload className="w-8 h-8 mx-auto mb-4 text-stone-700 dark:text-stone-300" />
+ <div className="space-y-2 text-stone-700 dark:text-stone-300">
+ <p>Drag & drop a layout file here, or click to select</p>
+ <p className="text-sm text-muted-foreground">
+ Only .json files are supported
+ </p>
+ </div>
+ </div>
+ {error && (
+ <p className="text-sm text-destructive mt-2">{error}</p>
+ )}
+ <div className="flex justify-end gap-2">
+ <Button variant="outline" onClick={onClose} disabled={isLoading}>
+ Cancel
+ </Button>
+ </div>
+ </DialogContent>
+ </Dialog>
+ );
+}
\ No newline at end of file
diff --git a/src/client/src/components/(playground)/manage-dashboard/explorer/index.tsx b/src/client/src/components/(playground)/manage-dashboard/explorer/index.tsx
new file mode 100644
index 00000000..ad42ebe1
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/explorer/index.tsx
@@ -0,0 +1,747 @@
+import { Droppable, DroppableProps } from "react-beautiful-dnd";
+import { DashboardItemType } from "@/types/manage-dashboard";
+import { DashboardHeirarchy } from "@/types/manage-dashboard";
+import { DropResult } from "react-beautiful-dnd";
+import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
+import { useCallback, useEffect, useState } from "react";
+import { DragDropContext } from "react-beautiful-dnd";
+import { toast } from "sonner";
+import EmptyState from "../common/empty-state";
+import ExplorerItemRow from "./item-row";
+import UpsertResourceDialog from "../common/upsert-resource-dialog";
+import { jsonParse, jsonStringify } from "@/utils/json";
+import { useRouter } from "next/navigation";
+import RootActions from "./root-actions";
+import Header from "../common/header";
+import getMessage from "@/constants/messages";
+import { Button } from "@/components/ui/button";
+import { usePageHeader } from "@/selectors/page";
+import { AddResource, EditResource, useUpsertResource } from "../board-creator/hooks/useUpsertResource";
+import { exportBoardLayout } from "../board-creator/utils/api";
+import { usePostHog } from "posthog-js/react";
+import { CLIENT_EVENTS } from "@/constants/events";
+
+// React 18 StrictMode compatibility fix for react-beautiful-dnd
+const StrictModeDroppable = ({ children, ...props }: DroppableProps) => {
+ const [enabled, setEnabled] = useState(false);
+
+ useEffect(() => {
+ const animation = requestAnimationFrame(() => setEnabled(true));
+ return () => {
+ cancelAnimationFrame(animation);
+ setEnabled(false);
+ };
+ }, []);
+
+ if (!enabled) {
+ return null;
+ }
+
+ return <Droppable {...props}>{children}</Droppable>;
+};
+
+export default function DashboardExplorer() {
+ const [items, setItems] = useState<DashboardHeirarchy[]>([]);
+ const [isLoading, setIsLoading] = useState(true);
+
+ const { fireRequest: fetchHierarchy } = useFetchWrapper();
+ const { fireRequest: createFolderRequest } = useFetchWrapper();
+ const { fireRequest: createBoardRequest } = useFetchWrapper();
+ const { fireRequest: updateFolderRequest } = useFetchWrapper();
+ const { fireRequest: updateBoardRequest } = useFetchWrapper();
+ const { fireRequest: deleteFolderRequest } = useFetchWrapper();
+ const { fireRequest: deleteBoardRequest } = useFetchWrapper();
+ const { fireRequest: setMainDashboardRequest } = useFetchWrapper();
+ const { fireRequest: importBoardLayoutRequest } = useFetchWrapper();
+ const { setHeader } = usePageHeader();
+ const posthog = usePostHog();
+
+ const router = useRouter();
+ // Fetch hierarchy data on component mount
+ useEffect(() => {
+ loadHierarchy();
+ }, []);
+
+ // Load hierarchy data from API
+ const loadHierarchy = useCallback(() => {
+ setIsLoading(true);
+ fetchHierarchy({
+ url: "/api/manage-dashboard/folder/get-heirarchy",
+ requestType: "GET",
+ successCb: (response) => {
+ if (response?.data) {
+ setItems(response.data);
+ setHeader({
+ title: "Dashboards",
+ breadcrumbs: [],
+ });
+ }
+ setIsLoading(false);
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_EXPLORER_LOADED, {
+ count: response?.data?.length || 0,
+ });
+ },
+ failureCb: (error) => {
+ toast.error("Failed to load dashboard hierarchy");
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_EXPLORER_LOAD_FAILURE, {
+ error: error?.toString(),
+ });
+ setIsLoading(false);
+ },
+ });
+ }, [fetchHierarchy]);
+
+ // Add a new item
+ const addItem = useCallback(
+ ({
+ title,
+ description,
+ type,
+ tags = [],
+ parentPath = [],
+ }: AddResource) => {
+
+ // Create payload
+ const payload = {
+ title,
+ description,
+ parentId: parentPath && parentPath.length > 0 ? parentPath[parentPath.length - 1] : null,
+ tags: tags,
+ };
+
+ // Toast loading state
+ toast.loading(`Creating ${type}...`, { id: "manage-dashboard-explorer" });
+
+ if (type === "folder") {
+ createFolderRequest({
+ url: "/api/manage-dashboard/folder",
+ requestType: "POST",
+ body: jsonStringify(payload),
+ successCb: (response) => {
+ toast.success("Folder created successfully", {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_FOLDER_CREATED, {
+ id: response.data.id,
+ title: response.data.title,
+ });
+ loadHierarchy(); // Reload hierarchy after successful creation
+ },
+ failureCb: (error) => {
+ toast.error(
+ `Failed to create folder: ${error || "Unknown error"}`,
+ { id: "manage-dashboard-explorer" }
+ );
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_FOLDER_CREATE_FAILURE, {
+ error: error?.toString(),
+ });
+ },
+ });
+ } else {
+ createBoardRequest({
+ url: "/api/manage-dashboard/board",
+ requestType: "POST",
+ body: jsonStringify(payload),
+ successCb: (response) => {
+ toast.success("Board created successfully", {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_CREATED, {
+ id: response.data.id,
+ title: response.data.title,
+ });
+ router.push(`/d/${response.data.id}`);
+ },
+ failureCb: (error) => {
+ toast.error(`Failed to create board: ${error || "Unknown error"}`, {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_CREATE_FAILURE, {
+ error: error?.toString(),
+ });
+ },
+ });
+ }
+
+ // Close dialog
+ setDialogState((prev) => ({
+ ...prev,
+ isOpen: false,
+ }));
+ },
+ [createFolderRequest, createBoardRequest, loadHierarchy]
+ );
+
+ // Edit an item
+ const editItem = useCallback(
+ ({
+ itemId,
+ newTitle,
+ newDescription,
+ newTags = [],
+ parentPath = [],
+ }: EditResource) => {
+ // Find the item to determine its type
+ const findItem = (
+ items: DashboardHeirarchy[],
+ id: string
+ ): DashboardHeirarchy | null => {
+ for (const item of items) {
+ if (item.id === id) return item;
+ if (item.children) {
+ const found = findItem(item.children, id);
+ if (found) return found;
+ }
+ }
+ return null;
+ };
+
+ const item = findItem(items, itemId);
+ if (!item) {
+ toast.error("Item not found", { id: "manage-dashboard-explorer" });
+ return;
+ }
+
+ // Toast loading state
+ toast.loading(`Updating ${item.type}...`, {
+ id: "manage-dashboard-explorer",
+ });
+
+ // Create payload
+ const payload = {
+ id: itemId,
+ title: newTitle,
+ description: newDescription,
+ parentId: parentPath && parentPath.length > 0 ? parentPath[parentPath.length - 1] : null,
+ tags: newTags,
+ updatedParent: false,
+ };
+
+ if (item.type === "folder") {
+ updateFolderRequest({
+ url: "/api/manage-dashboard/folder",
+ requestType: "PUT",
+ body: jsonStringify(payload),
+ successCb: (response) => {
+ toast.success("Folder updated successfully", {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_FOLDER_UPDATED, {
+ id: response.data.id,
+ title: response.data.title,
+ });
+ loadHierarchy(); // Reload hierarchy after successful update
+ },
+ failureCb: (error) => {
+ toast.error(
+ `Failed to update folder: ${error || "Unknown error"}`,
+ { id: "manage-dashboard-explorer" }
+ );
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_FOLDER_UPDATE_FAILURE, {
+ error: error?.toString(),
+ });
+ },
+ });
+ } else {
+ updateBoardRequest({
+ url: "/api/manage-dashboard/board",
+ requestType: "PUT",
+ body: jsonStringify(payload),
+ successCb: (response) => {
+ toast.success("Board updated successfully", {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_UPDATED, {
+ id: response.data.id,
+ title: response.data.title,
+ });
+ loadHierarchy(); // Reload hierarchy after successful update
+ },
+ failureCb: (error) => {
+ toast.error(`Failed to update board: ${error || "Unknown error"}`, {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_UPDATE_FAILURE, {
+ error: error?.toString(),
+ });
+ },
+ });
+ }
+
+ // Close dialog
+ setDialogState((prev) => ({
+ ...prev,
+ isOpen: false,
+ editingItemId: null,
+ }));
+ },
+ [items, updateFolderRequest, updateBoardRequest, loadHierarchy]
+ );
+
+ const { dialogState, setDialogState, handleDialogSave, handleDialogCancel } = useUpsertResource({
+ addItem,
+ editItem,
+ });
+
+ // Delete an item
+ const deleteItem = useCallback(
+ (itemId: string) => {
+ // Find the item to determine its type
+ const findItem = (
+ items: DashboardHeirarchy[],
+ id: string
+ ): DashboardHeirarchy | null => {
+ for (const item of items) {
+ if (item.id === id) return item;
+ if (item.children) {
+ const found = findItem(item.children, id);
+ if (found) return found;
+ }
+ }
+ return null;
+ };
+
+ const item = findItem(items, itemId);
+ if (!item) {
+ toast.error("Item not found", { id: "manage-dashboard-explorer" });
+ return;
+ }
+
+ // Confirm deletion
+ if (
+ !window.confirm(
+ `Are you sure you want to delete this ${item.type}? This action cannot be undone.`
+ )
+ ) {
+ return;
+ }
+
+ // Toast loading state
+ toast.loading(`Deleting ${item.type}...`, {
+ id: "manage-dashboard-explorer",
+ });
+
+ if (item.type === "folder") {
+ deleteFolderRequest({
+ url: `/api/manage-dashboard/folder/${itemId}`,
+ requestType: "DELETE",
+ successCb: (response) => {
+ toast.success("Folder deleted successfully", {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_FOLDER_DELETED, {
+ id: response.data.id,
+ title: response.data.title,
+ });
+ loadHierarchy(); // Reload hierarchy after successful deletion
+ },
+ failureCb: (error) => {
+ toast.error(
+ `Failed to delete folder: ${error || "Unknown error"}`,
+ { id: "manage-dashboard-explorer" }
+ );
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_FOLDER_DELETE_FAILURE, {
+ error: error?.toString(),
+ });
+ },
+ });
+ } else {
+ deleteBoardRequest({
+ url: `/api/manage-dashboard/board/${itemId}`,
+ requestType: "DELETE",
+ successCb: (response) => {
+ toast.success("Board deleted successfully", {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_DELETED, {
+ id: response.data.id,
+ title: response.data.title,
+ });
+ loadHierarchy(); // Reload hierarchy after successful deletion
+ },
+ failureCb: (error) => {
+ toast.error(`Failed to delete board: ${error || "Unknown error"}`, {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_DELETE_FAILURE, {
+ error: error?.toString(),
+ });
+ },
+ });
+ }
+ },
+ [items, deleteFolderRequest, deleteBoardRequest, loadHierarchy]
+ );
+
+ const handleSetMainDashboard = useCallback(
+ (boardId: string) => {
+ setMainDashboardRequest({
+ requestType: "PATCH",
+ url: `/api/manage-dashboard/board/${boardId}`,
+ body: jsonStringify({ setMain: true }),
+ successCb: () => {
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_SET_MAIN_DASHBOARD, {
+ id: boardId,
+ });
+ loadHierarchy();
+ },
+ failureCb: (error) => {
+ toast.error("Failed to set as main dashboard", {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_SET_MAIN_DASHBOARD_FAILURE, {
+ error: error?.toString(),
+ });
+ },
+ });
+ },
+ [loadHierarchy, setMainDashboardRequest]
+ );
+
+ const handleUpdatePinnedBoard = useCallback(
+ (boardId: string) => {
+ setMainDashboardRequest({
+ requestType: "PATCH",
+ url: `/api/manage-dashboard/board/${boardId}`,
+ body: jsonStringify({ updatePinned: true }),
+ successCb: () => {
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_TOGGLE_PINNED, {
+ id: boardId,
+ });
+ loadHierarchy();
+ },
+ failureCb: (error) => {
+ toast.error("Failed to update pinned board", {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_TOGGLE_PINNED_FAILURE, {
+ error: error?.toString(),
+ });
+ },
+ });
+ },
+ [loadHierarchy, setMainDashboardRequest]
+ );
+
+ const importBoardLayout = useCallback((data: any) => {
+ return importBoardLayoutRequest({
+ requestType: "POST",
+ url: `/api/manage-dashboard/board/layout/import`,
+ body: jsonStringify(data),
+ successCb: (response) => {
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_IMPORT_SUCCESS, {
+ id: response.data.id,
+ });
+ router.push(`/d/${response.data.id}`);
+ },
+ failureCb: (error) => {
+ toast.error("Failed to import board layout", {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_IMPORT_FAILURE, {
+ error: error?.toString(),
+ });
+ },
+ });
+ }, [importBoardLayoutRequest, loadHierarchy]);
+
+ // Open dialog for adding a new item
+ const openAddDialog = useCallback((path: string[] = []) => {
+ setDialogState({
+ isOpen: true,
+ mode: "add",
+ itemTitle: "",
+ itemDescription: "",
+ itemTags: [],
+ itemType: "board",
+ currentPath: path,
+ editingItemId: null,
+ });
+ }, []);
+
+ // Open dialog for editing an item
+ const openEditDialog = useCallback(
+ (item: DashboardHeirarchy, path: string[] = []) => {
+ setDialogState({
+ isOpen: true,
+ mode: "edit",
+ itemTitle: item.title,
+ itemDescription: item.description,
+ itemTags: item.tags ? jsonParse(item.tags) : [],
+ itemType: item.type,
+ currentPath: path,
+ editingItemId: item.id,
+ });
+ },
+ []
+ );
+
+ // Navigate to a board
+ const navigateToBoard = useCallback((boardId: string) => {
+ router.push(`/d/${boardId}`);
+ }, []);
+
+ // Handle drag end
+ const handleDragEnd = useCallback(
+ (result: DropResult) => {
+ const { source, destination, draggableId } = result;
+
+ // Dropped outside the list
+ if (!destination) return;
+
+ // Dropped in the same position
+ if (
+ source.droppableId === destination.droppableId &&
+ source.index === destination.index
+ ) {
+ return;
+ }
+
+ // Update UI immediately for better UX
+ setItems((prevItems) => {
+ const clonedItems = JSON.parse(jsonStringify(prevItems));
+
+ // Helper function to find an item and its parent array by ID
+ const findItemAndParent = (
+ items: DashboardHeirarchy[],
+ itemId: string,
+ path: string[] = []
+ ): {
+ item: DashboardHeirarchy | null;
+ parent: DashboardHeirarchy[] | null;
+ itemPath: string[];
+ } => {
+ for (let i = 0; i < items.length; i++) {
+ if (items[i].id === itemId) {
+ return { item: items[i], parent: items, itemPath: path };
+ }
+
+ if (items[i].type === "folder" && items[i].children) {
+ const result = findItemAndParent(
+ items[i].children || [],
+ itemId,
+ [...path, items[i].id]
+ );
+ if (result.item) {
+ return result;
+ }
+ }
+ }
+
+ return { item: null, parent: null, itemPath: [] };
+ };
+
+ // Helper function to find a parent folder by droppable ID
+ const findParentByDroppableId = (
+ items: DashboardHeirarchy[],
+ droppableId: string
+ ): { parent: DashboardHeirarchy[] | null; parentId: string | null } => {
+ if (droppableId === "root") {
+ return { parent: clonedItems, parentId: null };
+ }
+
+ // Extract folder ID from droppable ID (format: "folder-id")
+ const folderId = droppableId.replace("folder-", "");
+
+ const { item } = findItemAndParent(items, folderId);
+ return {
+ parent: item && item.children ? item.children : null,
+ parentId: folderId,
+ };
+ };
+
+ // Find the item being dragged and its parent array
+ const { item: draggedItem, parent: sourceParent } = findItemAndParent(
+ clonedItems,
+ draggableId
+ );
+
+ if (!draggedItem || !sourceParent) return clonedItems;
+
+ // Remove the item from its source
+ sourceParent.splice(sourceParent.indexOf(draggedItem), 1);
+
+ // Find the destination parent array
+ const { parent: destinationParent, parentId: newParentId } =
+ findParentByDroppableId(clonedItems, destination.droppableId);
+
+ if (!destinationParent) return clonedItems;
+
+ // Update the parentId of the dragged item
+ draggedItem.parentId = newParentId;
+
+ // Insert the item at the destination
+ destinationParent.splice(destination.index, 0, draggedItem);
+
+ return clonedItems;
+ });
+
+ // Send update to backend
+ const getNewParentId = (droppableId: string) => {
+ if (droppableId === "root") return null;
+ return droppableId.replace("folder-", "");
+ };
+
+ // Find the item to determine its type
+ const findItem = (
+ items: DashboardHeirarchy[],
+ id: string
+ ): DashboardHeirarchy | null => {
+ for (const item of items) {
+ if (item.id === id) return item;
+ if (item.children) {
+ const found = findItem(item.children, id);
+ if (found) return found;
+ }
+ }
+ return null;
+ };
+
+ const item = findItem(items, draggableId);
+ if (!item) return;
+
+ const newParentId = getNewParentId(destination.droppableId);
+
+ // Create payload
+ const payload = {
+ id: draggableId,
+ title: item.title,
+ description: item.description,
+ parentId: newParentId,
+ updateParent: true,
+ };
+
+ // Toast loading state
+ toast.loading(`Updating ${item.type}...`, {
+ id: "manage-dashboard-explorer",
+ });
+
+ if (item.type === "folder") {
+ updateFolderRequest({
+ url: "/api/manage-dashboard/folder",
+ requestType: "PUT",
+ body: jsonStringify(payload),
+ successCb: (response) => {
+ toast.success("Folder moved successfully", {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_FOLDER_UPDATED, {
+ id: response.data.id,
+ title: response.data.title,
+ reorder: true,
+ });
+ loadHierarchy(); // Reload hierarchy to ensure consistency
+ },
+ failureCb: (error) => {
+ toast.error(`Failed to move folder: ${error || "Unknown error"}`, {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_FOLDER_UPDATE_FAILURE, {
+ error: error?.toString(),
+ reorder: true,
+ });
+ loadHierarchy(); // Reload hierarchy to reset UI
+ },
+ });
+ } else {
+ updateBoardRequest({
+ url: "/api/manage-dashboard/board",
+ requestType: "PUT",
+ body: jsonStringify(payload),
+ successCb: (response) => {
+ toast.success("Board moved successfully", {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_UPDATED, {
+ id: response.data.id,
+ title: response.data.title,
+ reorder: true,
+ });
+ loadHierarchy(); // Reload hierarchy to ensure consistency
+ },
+ failureCb: (error) => {
+ toast.error(`Failed to move board: ${error || "Unknown error"}`, {
+ id: "manage-dashboard-explorer",
+ });
+ posthog?.capture(CLIENT_EVENTS.DASHBOARD_UPDATE_FAILURE, {
+ error: error?.toString(),
+ reorder: true,
+ });
+ loadHierarchy(); // Reload hierarchy to reset UI
+ },
+ });
+ }
+ },
+ [items, updateFolderRequest, updateBoardRequest, loadHierarchy]
+ );
+
+
+ return (
+ <div className="flex flex-col gap-2 grow overflow-y-hidden">
+ <Header title="Explorer">
+ <RootActions openAddDialog={openAddDialog} importBoardLayout={importBoardLayout} />
+ </Header>
+ <div className="grow bg-stone-100 dark:bg-stone-900 rounded-sm p-2 overflow-y-auto">
+ {isLoading ? (
+ <div className="flex justify-center items-center py-8 h-full">
+ <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
+ </div>
+ ) : items.length === 0 ? (
+ <EmptyState
+ title={getMessage().NO_DASHBOARDS_YET}
+ description={getMessage().NO_DASHBOARDS_YET_DESCRIPTION}
+ >
+ <Button onClick={() => openAddDialog()}>{getMessage().NO_DASHBOARDS_YET_ACTION_BUTTON}</Button>
+ </EmptyState>
+ ) : (
+ <DragDropContext onDragEnd={handleDragEnd}>
+ <StrictModeDroppable droppableId="root" type="explorer-item">
+ {(provided, snapshot) => (
+ <div
+ ref={provided.innerRef}
+ {...provided.droppableProps}
+ className={`${snapshot.isDraggingOver
+ ? "bg-stone-200 dark:bg-stone-800 border-2 border-dashed border-stone-300 dark:border-stone-600 rounded-md"
+ : ""
+ }`}
+ >
+ {items.map((item, index) => (
+ <ExplorerItemRow
+ key={item.id}
+ item={item}
+ path={[]}
+ index={index}
+ onNavigate={navigateToBoard}
+ onAddClick={openAddDialog}
+ onEditClick={openEditDialog}
+ onDeleteClick={deleteItem}
+ exportBoardLayout={exportBoardLayout}
+ setMainDashboard={handleSetMainDashboard}
+ updatePinnedBoard={handleUpdatePinnedBoard}
+ importBoardLayout={importBoardLayout}
+ />
+ ))}
+ {provided.placeholder}
+ </div>
+ )}
+ </StrictModeDroppable>
+ </DragDropContext>
+ )}
+ </div>
+
+ <UpsertResourceDialog
+ isOpen={dialogState.isOpen}
+ onOpenChange={(open) =>
+ setDialogState((prev) => ({ ...prev, isOpen: open }))
+ }
+ mode={dialogState.mode}
+ initialItemTitle={dialogState.itemTitle}
+ initialItemDescription={dialogState.itemDescription}
+ initialItemType={dialogState.itemType}
+ initialItemTags={dialogState.itemTags}
+ onSave={handleDialogSave}
+ onCancel={handleDialogCancel}
+ />
+ </div>
+ );
+}
diff --git a/src/client/src/components/(playground)/manage-dashboard/explorer/item-actions.tsx b/src/client/src/components/(playground)/manage-dashboard/explorer/item-actions.tsx
new file mode 100644
index 00000000..53e8bd81
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/explorer/item-actions.tsx
@@ -0,0 +1,137 @@
+import { DashboardHeirarchy } from "@/types/manage-dashboard";
+import { useCallback, useState } from "react";
+import { Button } from "@/components/ui/button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
+import { Plus, MoreHorizontal, Edit, Trash2, Download, Upload, PinIcon } from "lucide-react";
+import ImportLayoutModal from "./import-layout-modal";
+
+export default function ItemActions({
+ item,
+ path,
+ onAddClick,
+ onEditClick,
+ onDeleteClick,
+ exportBoardLayout,
+ setMainDashboard,
+ updatePinnedBoard,
+ importBoardLayout,
+}: {
+ item: DashboardHeirarchy;
+ path: string[];
+ onAddClick: (path: string[]) => void;
+ onEditClick: (item: DashboardHeirarchy, path: string[]) => void;
+ onDeleteClick: (id: string, path: string[]) => void;
+ exportBoardLayout: (id: string) => void;
+ setMainDashboard: (id: string) => void;
+ updatePinnedBoard: (id: string) => void;
+ importBoardLayout: (data: any) => Promise<unknown>;
+}) {
+ const [isImportModalOpen, setIsImportModalOpen] = useState(false);
+
+ const handleAddClick = useCallback(
+ (e: React.MouseEvent) => {
+ e.stopPropagation(); // Prevent event from bubbling up
+ onAddClick([...path, item.id]);
+ },
+ [item.id, path, onAddClick]
+ );
+
+ const handleEditClick = useCallback(
+ (e: React.MouseEvent) => {
+ e.stopPropagation(); // Prevent event from bubbling up
+ onEditClick(item, path);
+ },
+ [item, path, onEditClick]
+ );
+
+ const handleDeleteClick = useCallback(
+ (e: React.MouseEvent) => {
+ e.stopPropagation(); // Prevent event from bubbling up
+ onDeleteClick(item.id, path);
+ },
+ [item.id, path, onDeleteClick]
+ );
+
+ const handleDownloadClick = useCallback(
+ (e: React.MouseEvent) => {
+ e.stopPropagation();
+ exportBoardLayout(item.id);
+ },
+ [item.id, exportBoardLayout]
+ );
+
+ return (
+ <div
+ className="flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity text-stone-500 dark:text-stone-400"
+ onClick={(e) => e.stopPropagation()}
+ >
+ {item.type === "folder" && (
+ <Button
+ variant="ghost"
+ size="icon"
+ className="h-8 w-8"
+ onClick={handleAddClick}
+ >
+ <Plus className="h-4 w-4" />
+ </Button>
+ )}
+
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="ghost" size="icon" className="h-8 w-8 self-center">
+ <MoreHorizontal className="h-4 w-4" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem onClick={handleEditClick}>
+ <Edit className="h-4 w-4 mr-2" />
+ Edit details
+ </DropdownMenuItem>
+ {item.type === "board" ? (
+ <>
+ <DropdownMenuItem onClick={handleDownloadClick}>
+ <Download className="h-4 w-4 mr-2" />
+ Export Layout
+ </DropdownMenuItem>
+ {
+ !item.isMainDashboard && (
+ <DropdownMenuItem onClick={() => setMainDashboard(item.id)}>
+ <Download className="h-4 w-4 mr-2" />
+ Set as Main Dashboard
+ </DropdownMenuItem>
+ )
+ }
+ <DropdownMenuItem onClick={() => updatePinnedBoard(item.id)}>
+ <PinIcon className="h-4 w-4 mr-2" />
+ {item.isPinned ? "Unpin" : "Pin"}
+ </DropdownMenuItem>
+ </>
+ ) : (
+ <DropdownMenuItem onClick={() => setIsImportModalOpen(true)}>
+ <Upload className="h-4 w-4 mr-2" />
+ Import Layout
+ </DropdownMenuItem>
+ )}
+ <DropdownMenuItem
+ className="text-destructive focus:text-destructive"
+ onClick={handleDeleteClick}
+ >
+ <Trash2 className="h-4 w-4 mr-2" />
+ Delete
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+
+ <ImportLayoutModal
+ open={isImportModalOpen}
+ onClose={() => setIsImportModalOpen(false)}
+ onImport={importBoardLayout as any}
+ />
+ </div>
+ );
+}
diff --git a/src/client/src/components/(playground)/manage-dashboard/explorer/item-icon.tsx b/src/client/src/components/(playground)/manage-dashboard/explorer/item-icon.tsx
new file mode 100644
index 00000000..e0e881ac
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/explorer/item-icon.tsx
@@ -0,0 +1,19 @@
+import { DashboardItemType } from "@/types/manage-dashboard";
+import { Folder, FolderOpen, LayoutDashboardIcon } from "lucide-react";
+
+export default function ItemIcon({
+ type,
+ open,
+}: {
+ type: DashboardItemType;
+ open?: boolean;
+}) {
+ if (type === "folder") {
+ return open ? (
+ <FolderOpen className="h-4 w-4" />
+ ) : (
+ <Folder className="h-4 w-4" />
+ );
+ }
+ return <LayoutDashboardIcon className="h-4 w-4" />;
+}
diff --git a/src/client/src/components/(playground)/manage-dashboard/explorer/item-row.tsx b/src/client/src/components/(playground)/manage-dashboard/explorer/item-row.tsx
new file mode 100644
index 00000000..7d9faaf6
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/explorer/item-row.tsx
@@ -0,0 +1,188 @@
+import { DashboardHeirarchy } from "@/types/manage-dashboard";
+import { GripVertical, ChevronRight, ChevronDown, PinIcon, HomeIcon } from "lucide-react";
+import { useCallback, useState } from "react";
+import { Draggable, Droppable } from "react-beautiful-dnd";
+import ItemIcon from "./item-icon";
+import ItemActions from "./item-actions";
+import { Badge } from "@/components/ui/badge";
+import { jsonParse } from "@/utils/json";
+import { useDashboardPageSearch } from "@/selectors/dashboards";
+
+export default function ExplorerItemRow({
+ item,
+ path,
+ index,
+ onNavigate,
+ onAddClick,
+ onEditClick,
+ onDeleteClick,
+ exportBoardLayout,
+ setMainDashboard,
+ updatePinnedBoard,
+ importBoardLayout,
+}: {
+ item: DashboardHeirarchy;
+ path: string[];
+ index: number;
+ onNavigate: (id: string) => void;
+ onAddClick: (path: string[]) => void;
+ onEditClick: (item: DashboardHeirarchy, path: string[]) => void;
+ onDeleteClick: (id: string, path: string[]) => void;
+ exportBoardLayout: (id: string) => void;
+ setMainDashboard: (id: string) => void;
+ updatePinnedBoard: (id: string) => void;
+ importBoardLayout: (data: any) => Promise<unknown>;
+}) {
+ const [open, setOpen] = useState(false);
+ const pageSearch = useDashboardPageSearch();
+
+ const handleItemClick = useCallback(() => {
+ if (item.type === "board") {
+ onNavigate(item.id);
+ }
+ }, [item.id, item.type, onNavigate]);
+
+ const handleToggleFolder = useCallback((e: React.MouseEvent) => {
+ e.stopPropagation();
+ setOpen((prev) => !prev);
+ }, []);
+
+ const handleImportBoardLayout = useCallback((data: any) => {
+ data.parentId = item.id;
+ return importBoardLayout(data);
+ }, [importBoardLayout]);
+
+ const tags = item.tags ? jsonParse(item.tags) : [];
+
+ const isSearchMatchTitle = item.title.toLowerCase().includes(pageSearch.toLowerCase());
+ const isSearchMatchTags = typeof tags === "string" ? tags.toLowerCase().includes(pageSearch.toLowerCase()) : tags?.some?.((tag: string) => tag.toLowerCase().includes(pageSearch.toLowerCase()));
+ const isSearchMatch = isSearchMatchTitle || isSearchMatchTags;
+
+ if (!isSearchMatch && item.type !== "folder") {
+ return null;
+ }
+
+ return (
+ <Draggable draggableId={item.id} index={index}>
+ {(provided, snapshot) => (
+ <div
+ ref={provided.innerRef}
+ {...provided.draggableProps}
+ className="my-2"
+ >
+ <div className={`${snapshot.isDragging ? "opacity-50" : ""}`}>
+ <div className="flex items-center justify-between group py-1 px-2 rounded-sm hover:bg-stone-200/50 dark:hover:bg-stone-700/50 group-hover bg-transparent dark:bg-transparent">
+ <div className="flex items-center gap-2 flex-1">
+ <div
+ {...provided.dragHandleProps}
+ className="cursor-grab group-hover:opacity-100 dark:group-hover:opacity-100 opacity-20"
+ onClick={(e) => e.stopPropagation()}
+ >
+ <GripVertical className="h-4 w-4 text-stone-500 dark:text-stone-400" />
+ </div>
+ {item.type === "folder" && (
+ <button
+ onClick={handleToggleFolder}
+ className="flex items-center justify-center p-0.5 rounded hover:bg-stone-200 dark:hover:bg-stone-600 transition-colors"
+ aria-label={open ? "Collapse folder" : "Expand folder"}
+ >
+ {open ? (
+ <ChevronDown className="h-4 w-4 text-stone-500 dark:text-stone-400" />
+ ) : (
+ <ChevronRight className="h-4 w-4 text-stone-500 dark:text-stone-400" />
+ )}
+ </button>
+ )}
+ <div
+ className="flex items-center gap-2 cursor-pointer flex-1 text-stone-800 dark:text-stone-200"
+ onClick={handleItemClick}
+ >
+ <ItemIcon
+ type={item.type}
+ open={item.type === "folder" ? open : undefined}
+ />
+ <span>{item.title}</span>
+ {item.type === "board" && item.isMainDashboard && (
+ <Badge className="text-xs" variant="secondary" title="Main Dashboard">
+ <HomeIcon className="h-3 w-3" />
+ </Badge>
+ )}
+ {item.type === "board" && item.isPinned && (
+ <Badge className="text-xs" variant="secondary">
+ <PinIcon className="h-3 w-3" />
+ </Badge>
+ )}
+ {tags && tags.length > 0 && (
+ <div className="flex items-center gap-2 ml-4">
+ {tags?.map?.((tag: string) => (
+ <Badge key={tag}>{tag}</Badge>
+ ))}
+ </div>
+ )}
+ </div>
+ </div>
+
+ <ItemActions
+ item={item}
+ path={path}
+ onAddClick={onAddClick}
+ onEditClick={onEditClick}
+ onDeleteClick={onDeleteClick}
+ exportBoardLayout={exportBoardLayout}
+ setMainDashboard={setMainDashboard}
+ updatePinnedBoard={updatePinnedBoard}
+ importBoardLayout={handleImportBoardLayout}
+ />
+ </div>
+
+ {item.type === "folder" && (
+ <Droppable droppableId={`folder-${item.id}`} type="explorer-item">
+ {(droppableProvided, dropSnapshot) => {
+ return (
+ <div
+ ref={droppableProvided.innerRef}
+ {...droppableProvided.droppableProps}
+ className={`
+ min-h-1
+ ${item.children?.length ? "pl-4" : ""}
+ ${dropSnapshot.isDraggingOver
+ ? "bg-stone-100 dark:bg-stone-700 border-2 border-dashed border-stone-300 dark:border-stone-600 rounded-md py-2 mx-2"
+ : !item.children?.length
+ ? "py-2 mx-2 border-2 border-dashed border-stone-300 dark:border-stone-600/50 rounded-md"
+ : ""
+ }
+ `}
+ >
+ {open && item.children?.map((child, childIndex) => (
+ <ExplorerItemRow
+ key={child.id}
+ item={child}
+ path={[...path, item.id]}
+ index={childIndex}
+ onNavigate={onNavigate}
+ onAddClick={onAddClick}
+ onEditClick={onEditClick}
+ onDeleteClick={onDeleteClick}
+ exportBoardLayout={exportBoardLayout}
+ setMainDashboard={setMainDashboard}
+ updatePinnedBoard={updatePinnedBoard}
+ importBoardLayout={importBoardLayout}
+ />
+ ))}
+ {droppableProvided.placeholder}
+ {dropSnapshot.isDraggingOver && (
+ <div className="text-sm text-stone-500 dark:text-stone-400 text-center">
+ Drop items here
+ </div>
+ )}
+ </div>
+ )}
+ }
+ </Droppable>
+ )}
+ </div>
+ </div>
+ )}
+ </Draggable>
+ );
+}
diff --git a/src/client/src/components/(playground)/manage-dashboard/explorer/root-actions.tsx b/src/client/src/components/(playground)/manage-dashboard/explorer/root-actions.tsx
new file mode 100644
index 00000000..00d1989f
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/explorer/root-actions.tsx
@@ -0,0 +1,46 @@
+import { Button } from "@/components/ui/button";
+import {
+ DropdownMenuTrigger,
+ DropdownMenuItem,
+ DropdownMenu,
+ DropdownMenuContent
+} from "@/components/ui/dropdown-menu";
+import {
+ MoreHorizontal, Plus, Upload
+} from "lucide-react";
+import { useState } from "react";
+import ImportLayoutModal from "./import-layout-modal";
+
+export default function RootActions({ openAddDialog, importBoardLayout }: {
+ openAddDialog: () => void,
+ importBoardLayout: (data: any) => Promise<unknown>
+}) {
+ const [isImportModalOpen, setIsImportModalOpen] = useState(false);
+
+ return (
+ <div className="flex gap-2">
+ <Button variant="outline" className="bg-primary hover:bg-primary/90 text-white hover:text-white dark:text-white dark:hover:text-white dark:bg-primary dark:hover:bg-primary/90" onClick={() => openAddDialog()}>
+ <Plus className="h-4 w-4 mr-2" />
+ Add
+ </Button>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="ghost" size="icon" className="h-8 w-8 self-center">
+ <MoreHorizontal className="h-4 w-4" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem onClick={() => setIsImportModalOpen(true)}>
+ <Upload className="h-4 w-4 mr-2" />
+ Import Layout
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ <ImportLayoutModal
+ open={isImportModalOpen}
+ onClose={() => setIsImportModalOpen(false)}
+ onImport={importBoardLayout as any}
+ />
+ </div>
+ );
+}
\ No newline at end of file
diff --git a/src/client/src/components/(playground)/manage-dashboard/widget/index.tsx b/src/client/src/components/(playground)/manage-dashboard/widget/index.tsx
new file mode 100644
index 00000000..6c1ab42e
--- /dev/null
+++ b/src/client/src/components/(playground)/manage-dashboard/widget/index.tsx
@@ -0,0 +1,179 @@
+import React, { useCallback, useEffect, useState } from "react";
+import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
+import { Badge } from "@/components/ui/badge";
+import { Button } from "@/components/ui/button";
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogFooter,
+ DialogTitle,
+ DialogDescription,
+} from "@/components/ui/dialog";
+
+// Icon mapping for widget types
+import {
+ BarChart,
+ LineChart,
+ PieChart,
+ Table,
+ AreaChart,
+ Gauge,
+ Clock,
+ LayoutDashboardIcon,
+} from "lucide-react";
+import useFetchWrapper from "@/utils/hooks/useFetchWrapper";
+import { toast } from "sonner";
+import { Widget } from "@/types/manage-dashboard";
+import Header from "../common/header";
+import { useDashboardPageSearch } from "@/selectors/dashboards";
+import EmptyState from "../common/empty-state";
+import getMessage from "@/constants/messages";
+
+const widgetTypeToIcon = {
+ STAT_CARD: Gauge,
+ BAR_CHART: BarChart,
+ LINE_CHART: LineChart,
+ PIE_CHART: PieChart,
+ TABLE: Table,
+ AREA_CHART: AreaChart,
+};
+
+function formatDate(dateString: string) {
+ const date = new Date(dateString);
+ return date.toLocaleDateString(undefined, {
+ year: "numeric",
+ month: "short",
+ day: "numeric",
+ });
+}
+
+const WidgetListPage = () => {
+ const [widgets, setWidgets] = useState<Widget[]>([]);
+ const [deleteDialog, setDeleteDialog] = useState<null | {
+ id: string;
+ title: string;
+ }>(null);
+ const [deleting, setDeleting] = useState(false);
+ const { fireRequest, isLoading } = useFetchWrapper();
+ const pageSearch = useDashboardPageSearch();
+ const fetchWidgets = useCallback(() => {
+ fireRequest({
+ url: "/api/manage-dashboard/widget",
+ requestType: "GET",
+ successCb: (response) => {
+ if (response?.data) {
+ setWidgets(response.data);
+ }
+ },
+ failureCb: (error) => {
+ toast.error("Failed to load widgets");
+ console.error("Error loading widgets:", error);
+ },
+ });
+ }, [fireRequest]);
+
+ useEffect(() => {
+ fetchWidgets();
+ }, [fetchWidgets]);
+
+ const handleDelete = async (id: string) => {
+ setDeleting(true);
+ // await deleteWidget(id);
+ setWidgets((prev) => prev.filter((w) => w.id !== id));
+ setDeleting(false);
+ setDeleteDialog(null);
+ };
+
+ const filteredWidgets = widgets.filter((widget) => {
+ return widget.title.toLowerCase().includes(pageSearch.toLowerCase());
+ });
+
+ return (
+ <div className="flex flex-col gap-3 grow overflow-y-hidden">
+ <Header title="Widgets" />
+
+ {isLoading ? (
+ <div className="flex justify-center items-center grow">
+ <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
+ </div>
+ ) : filteredWidgets.length === 0 ? (
+ <EmptyState
+ title={pageSearch ? getMessage().NO_WIDGETS_YET_SEARCH_TITLE : getMessage().NO_WIDGETS_YET}
+ description={pageSearch ? getMessage().NO_WIDGETS_YET_SEARCH_DESCRIPTION : getMessage().NO_WIDGETS_YET_DESCRIPTION}
+ />
+ ) : (
+ <div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 h-full overflow-y-auto">
+ {filteredWidgets.map((widget) => {
+ const IconComponent =
+ widgetTypeToIcon[
+ String(widget.type) as keyof typeof widgetTypeToIcon
+ ] || Gauge;
+ return (
+ <Card
+ key={widget.id}
+ className="group hover:shadow-lg transition-all duration-200 cursor-pointer border border-stone-200 dark:border-stone-800 hover:border-stone-300 dark:hover:border-stone-700"
+ >
+ <CardHeader className="pb-3">
+ <CardTitle className="flex gap-2 items-center text-lg font-semibold text-stone-900 dark:text-stone-300 group-hover:text-stone-600 dark:group-hover:text-stone-200 transition-colors">
+ <div className="flex items-start justify-between">
+ <IconComponent className="h-5 w-5 text-stone-500 dark:text-stone-400 group-hover:text-stone-600 dark:group-hover:text-stone-300 transition-colors" />
+ <Badge className="text-xs ml-2" variant="secondary">
+ {widget.type}
+ </Badge>
+ </div>
+ {widget.title}
+ </CardTitle>
+ </CardHeader>
+ <CardContent className="space-y-4">
+ <p className="text-sm text-gray-600 dark:text-gray-400 line-clamp-2 shrink-0 h-[40px]">
+ {widget.description}
+ </p>
+ <div className="flex items-center justify-between text-sm text-gray-500">
+ <div className="flex items-center gap-1 text-xs text-gray-400">
+ <Clock className="h-3 w-3" />
+ <span>Updated {formatDate(widget.updatedAt)}</span>
+ </div>
+ <div className="flex items-center gap-1">
+ <LayoutDashboardIcon className="h-3 w-3" />
+ <span>{widget.totalBoards ?? 0} Dashboard(s)</span>
+ </div>
+ </div>
+ </CardContent>
+ </Card>
+ );
+ })}
+ </div>
+ )}
+ <Dialog open={!!deleteDialog} onOpenChange={(open) => !open && setDeleteDialog(null)}>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>Delete Widget</DialogTitle>
+ <DialogDescription>
+ Are you sure you want to delete widget &quot;{deleteDialog?.title}&quot;? This
+ action cannot be undone.
+ </DialogDescription>
+ </DialogHeader>
+ <DialogFooter>
+ <Button variant="secondary" onClick={() => setDeleteDialog(null)} disabled={deleting}>
+ Cancel
+ </Button>
+ <Button
+ variant="destructive"
+ onClick={() => handleDelete(deleteDialog!.id)}
+ disabled={deleting}
+ >
+ {deleting ? (
+ <div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white"></div>
+ ) : (
+ "Delete"
+ )}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ </div>
+ );
+};
+
+export default WidgetListPage;
diff --git a/src/client/src/components/(playground)/route-breadcrumbs.tsx b/src/client/src/components/(playground)/route-breadcrumbs.tsx
index 4ef5b685..c2269ea0 100644
--- a/src/client/src/components/(playground)/route-breadcrumbs.tsx
+++ b/src/client/src/components/(playground)/route-breadcrumbs.tsx
@@ -17,17 +17,24 @@ const PATH_TO_TITLE_MAP = {
"/vault": "Vault",
"/openground": "Openground",
"/settings": "Settings",
+ "/dashboards": "Dashboards",
+ "/dashboards/board": "Board",
+ "/dashboards/explorer": "Explorer",
+ "/dashboards/widget": "Widget",
};
export default function RouteBreadcrumbs() {
const params = usePathname();
const paths = params.split("/");
+ const pathArray: string[] = [];
+
return (
<Breadcrumb className="grow">
<BreadcrumbList>
{paths.length > 1
? paths.map((path, index) => {
- const pathField = `/${path}`;
+ if (path !== "") pathArray.push(path);
+ const pathField = `/${pathArray.join("/")}`;
if (index === paths.length - 1) {
return (
<BreadcrumbItem key={pathField}>
diff --git a/src/client/src/components/(playground)/sidebar.tsx b/src/client/src/components/(playground)/sidebar.tsx
index bb44aa44..2bc59175 100644
--- a/src/client/src/components/(playground)/sidebar.tsx
+++ b/src/client/src/components/(playground)/sidebar.tsx
@@ -13,12 +13,13 @@ import {
BookKey,
BookText,
Component,
- FileJson2,
+ Home,
LayoutDashboard,
MonitorPlay,
SettingsIcon,
ShieldAlert,
SquarePlay,
+ TextQuote
} from "lucide-react";
import VersionInfo from "./version-Info";
@@ -34,13 +35,23 @@ type SidebarItemProps = {
const ICON_CLASSES = "flex-shrink-0 size-5";
const SIDEBAR_ITEMS: SidebarItemProps[] = [
+ {
+ icon: <Home className={ICON_CLASSES} />,
+ text: "Home",
+ link: "/home",
+ },
{
icon: <LayoutDashboard className={ICON_CLASSES} />,
- text: "Dashboard",
- link: "/dashboard",
+ text: "Dashboards",
+ link: "/dashboards",
},
+ // {
+ // icon: <LayoutDashboard className={ICON_CLASSES} />,
+ // text: "Dashboard",
+ // link: "/dashboard",
+ // },
{
- icon: <FileJson2 className={ICON_CLASSES} />,
+ icon: <TextQuote className={ICON_CLASSES} />,
text: "Requests",
link: "/requests",
},
@@ -85,16 +96,41 @@ const SIDEBAR_BOTTOM_ITEMS: SidebarItemProps[] = [
},
];
+const getIfSidebarItemActive = (pathname: string, item: SidebarItemProps) => {
+ switch (item.link) {
+ case "/home":
+ return pathname.startsWith("/home");
+ case "/dashboards":
+ return pathname.startsWith("/dashboards") || pathname.startsWith("/d/");
+ case "/dashboard":
+ return pathname.startsWith("/dashboard") && !pathname.startsWith("/dashboards");
+ case "/requests":
+ return pathname.startsWith("/requests");
+ case "/exceptions":
+ return pathname.startsWith("/exceptions");
+ case "/prompt-hub":
+ return pathname.startsWith("/prompt-hub");
+ case "/vault":
+ return pathname.startsWith("/vault");
+ case "/openground":
+ return pathname.startsWith("/openground");
+ case "/settings":
+ return pathname.startsWith("/settings");
+ default:
+ return pathname.startsWith(item.link || "");
+ }
+};
+
const SidebarItem = (props: SidebarItemProps) => {
return (
<Tooltip>
<TooltipTrigger asChild>
{!props.target && props.link ? (
<Link
- className={`${props.className || ""} ${buttonVariants({
+ className={`${buttonVariants({
variant: "ghost",
size: "icon",
- })}`}
+ })} ${props.className || ""}`}
href={props.link}
aria-label={props.text}
>
@@ -103,12 +139,11 @@ const SidebarItem = (props: SidebarItemProps) => {
) : (
<a
href={props.link}
- className={`flex items-center p-2 ${
- props.className || ""
- } ${buttonVariants({
+ className={`flex items-center p-2 ${buttonVariants({
variant: "ghost",
size: "icon",
- })}`}
+ })} ${props.className || ""
+ }`}
onClick={props.onClick}
target={props.target}
>
@@ -147,11 +182,10 @@ export default function Sidebar() {
{SIDEBAR_ITEMS.map((item, index) => (
<SidebarItem
key={`sidebar-top-${index}`}
- className={`${
- pathname.startsWith(item.link || "")
- ? "text-white bg-primary dark:bg-primary dark:text-white"
- : "text-stone-600 dark:text-white"
- }`}
+ className={`${getIfSidebarItemActive(pathname, item)
+ ? "text-white bg-primary dark:bg-primary dark:text-white hover:bg-primary/80 dark:hover:bg-primary/80 hover:text-white"
+ : "text-stone-600 dark:text-white hover:bg-stone-700 dark:hover:bg-stone-600 hover:text-white"
+ }`}
{...item}
/>
))}
@@ -160,11 +194,10 @@ export default function Sidebar() {
{SIDEBAR_BOTTOM_ITEMS.map((item, index) => (
<SidebarItem
key={`sidebar-bottom-${index}`}
- className={`${
- pathname.startsWith(item.link || "")
- ? "text-white bg-primary dark:bg-primary dark:text-white"
- : "text-stone-600 dark:text-white"
- }`}
+ className={`${getIfSidebarItemActive(pathname, item)
+ ? "text-white bg-primary dark:bg-primary dark:text-white hover:bg-primary/80 dark:hover:bg-primary/80 hover:text-white"
+ : "text-stone-600 dark:text-white hover:bg-stone-700 dark:hover:bg-stone-600 hover:text-white"
+ }`}
{...item}
/>
))}
diff --git a/src/client/src/components/common/description-tooltip.tsx b/src/client/src/components/common/description-tooltip.tsx
new file mode 100644
index 00000000..3914b564
--- /dev/null
+++ b/src/client/src/components/common/description-tooltip.tsx
@@ -0,0 +1,15 @@
+import { Info } from "lucide-react";
+import { Tooltip, TooltipTrigger, TooltipPortal, TooltipContent } from "@/components/ui/tooltip";
+
+export default function DescriptionTooltip({ description, className }: { description: string, className?: string }) {
+ return (
+ <Tooltip delayDuration={0}>
+ <TooltipTrigger asChild>
+ <Info className={`h-3 w-3 cursor-pointer ${className}`} />
+ </TooltipTrigger>
+ <TooltipPortal>
+ <TooltipContent className="max-w-xs whitespace-pre-wrap">{description}</TooltipContent>
+ </TooltipPortal>
+ </Tooltip>
+ );
+};
\ No newline at end of file
diff --git a/src/client/src/components/common/form-field.tsx b/src/client/src/components/common/form-field.tsx
index 9bafd3fb..4be66795 100644
--- a/src/client/src/components/common/form-field.tsx
+++ b/src/client/src/components/common/form-field.tsx
@@ -13,7 +13,12 @@ import { PlusIcon, XIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import { CustomSelect } from "@/components/ui/custom-select";
-import { CustomSelectProps, FieldProps, KeyValuePairProps, RadioGroupProps } from "@/types/form";
+import {
+ CustomSelectProps,
+ FieldProps,
+ KeyValuePairProps,
+ RadioGroupProps,
+} from "@/types/form";
import { Switch, SwitchProps } from "@/components/ui/switch";
function FormTagsInputField(props: FieldProps) {
@@ -107,7 +112,8 @@ function FormKeyValueField(props: FieldProps) {
}
};
- const { name = "keyValue", placeholder = "" } = props.fieldTypeProps as KeyValuePairProps;
+ const { name = "keyValue", placeholder = "" } =
+ props.fieldTypeProps as KeyValuePairProps;
return (
<div className="grid grid-col-1 w-100 gap-4">
@@ -193,7 +199,7 @@ function FormRadioGroupField(props: FieldProps) {
defaultValue={fieldTypeProps.defaultValue as string}
name={fieldTypeProps.name}
ref={itemRef}
- className="grid grid-cols-4 gap-8 pt-2 ph-no-capture"
+ className={`grid grid-cols-${fieldTypeProps.options.length} gap-8 pt-2 ph-no-capture`}
>
{fieldTypeProps.options.map((option) => {
return (
@@ -208,7 +214,7 @@ function FormRadioGroupField(props: FieldProps) {
value={option.value}
className="sr-only ph-no-capture"
/>
- <div className="space-y-1 bg-stone-100 dark:bg-stone-800 p-4">
+ <div className="space-y-1 bg-stone-100 dark:bg-stone-800 p-4 h-full">
<h4 className="text-sm font-semibold">{option.title}</h4>
<p className="text-sm">{option.subText}</p>
</div>
diff --git a/src/client/src/components/common/loader.tsx b/src/client/src/components/common/loader.tsx
new file mode 100644
index 00000000..5a8e0f00
--- /dev/null
+++ b/src/client/src/components/common/loader.tsx
@@ -0,0 +1,39 @@
+export default function Loader() {
+ return (
+ <>
+ <style jsx>{`
+ @keyframes spin {
+ 100% {
+ transform: rotate(1turn);
+ }
+ }
+
+ .loader {
+ width: 50px;
+ aspect-ratio: 1;
+ border-radius: 50%;
+ border: 8px solid transparent;
+ border-right-color: #ffa50097;
+ position: relative;
+ animation: spin 1s infinite linear;
+ }
+
+ .loader::before,
+ .loader::after {
+ content: "";
+ position: absolute;
+ inset: -8px;
+ border-radius: 50%;
+ border: 8px solid transparent;
+ border-right-color: #ffa50097;
+ animation: spin 2s infinite linear;
+ }
+
+ .loader::after {
+ animation-duration: 4s;
+ }
+ `}</style>
+ <div className="loader" />
+ </>
+ );
+}
\ No newline at end of file
diff --git a/src/client/src/components/ui/alert.tsx b/src/client/src/components/ui/alert.tsx
new file mode 100644
index 00000000..2f3000a3
--- /dev/null
+++ b/src/client/src/components/ui/alert.tsx
@@ -0,0 +1,59 @@
+import * as React from "react"
+import { cva, type VariantProps } from "class-variance-authority"
+
+import { cn } from "@/lib/utils"
+
+const alertVariants = cva(
+ "relative w-full rounded-lg border border-stone-200 p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-stone-950 dark:border-stone-800 dark:[&>svg]:text-stone-50",
+ {
+ variants: {
+ variant: {
+ default: "bg-white text-stone-950 dark:bg-stone-950 dark:text-stone-50",
+ destructive:
+ "border-red-500/50 text-red-500 dark:border-red-500 [&>svg]:text-red-500 dark:border-red-900/50 dark:text-red-900 dark:dark:border-red-900 dark:[&>svg]:text-red-900",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ },
+ }
+)
+
+const Alert = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
+>(({ className, variant, ...props }, ref) => (
+ <div
+ ref={ref}
+ role="alert"
+ className={cn(alertVariants({ variant }), className)}
+ {...props}
+ />
+))
+Alert.displayName = "Alert"
+
+const AlertTitle = React.forwardRef<
+ HTMLParagraphElement,
+ React.HTMLAttributes<HTMLHeadingElement>
+>(({ className, ...props }, ref) => (
+ <h5
+ ref={ref}
+ className={cn("mb-1 font-medium leading-none tracking-tight", className)}
+ {...props}
+ />
+))
+AlertTitle.displayName = "AlertTitle"
+
+const AlertDescription = React.forwardRef<
+ HTMLParagraphElement,
+ React.HTMLAttributes<HTMLParagraphElement>
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ className={cn("text-sm [&_p]:leading-relaxed", className)}
+ {...props}
+ />
+))
+AlertDescription.displayName = "AlertDescription"
+
+export { Alert, AlertTitle, AlertDescription }
diff --git a/src/client/src/components/ui/tooltip.tsx b/src/client/src/components/ui/tooltip.tsx
index 15f831b1..4122104e 100644
--- a/src/client/src/components/ui/tooltip.tsx
+++ b/src/client/src/components/ui/tooltip.tsx
@@ -11,6 +11,8 @@ const Tooltip = TooltipPrimitive.Root
const TooltipTrigger = TooltipPrimitive.Trigger
+const TooltipPortal = TooltipPrimitive.Portal
+
const TooltipContent = React.forwardRef<
React.ElementRef<typeof TooltipPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
@@ -27,4 +29,4 @@ const TooltipContent = React.forwardRef<
))
TooltipContent.displayName = TooltipPrimitive.Content.displayName
-export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
+export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, TooltipPortal }
diff --git a/src/client/src/constants/events.ts b/src/client/src/constants/events.ts
index 831d1dfb..8e0ec3f8 100644
--- a/src/client/src/constants/events.ts
+++ b/src/client/src/constants/events.ts
@@ -41,6 +41,37 @@ export const CLIENT_EVENTS = {
EVALUATION_CONFIG_UPDATED_SUCCESS: "EVALUATION_CONFIG_UPDATED_SUCCESS",
EVALUATION_CONFIG_CREATED_FAILURE: "EVALUATION_CONFIG_CREATED_FAILURE",
EVALUATION_CONFIG_UPDATED_FAILURE: "EVALUATION_CONFIG_UPDATED_FAILURE",
+
+ // Custom dashboard
+ DASHBOARD_VIEWED: "DASHBOARD_VIEWED",
+ DASHBOARD_VIEW_FAILURE: "DASHBOARD_VIEW_FAILURE",
+ DASHBOARD_WIDGET_ADDED: "DASHBOARD_WIDGET_ADDED",
+ DASHBOARD_WIDGET_ADD_FAILURE: "DASHBOARD_WIDGET_ADD_FAILURE",
+ DASHBOARD_WIDGET_RUN_QUERY: "DASHBOARD_WIDGET_RUN_QUERY",
+ DASHBOARD_EXPLORER_LOADED: "DASHBOARD_EXPLORER_LOADED",
+ DASHBOARD_EXPLORER_LOAD_FAILURE: "DASHBOARD_EXPLORER_LOAD_FAILURE",
+ DASHBOARD_FOLDER_CREATED: "DASHBOARD_FOLDER_CREATED",
+ DASHBOARD_FOLDER_CREATE_FAILURE: "DASHBOARD_FOLDER_CREATE_FAILURE",
+ DASHBOARD_FOLDER_UPDATED: "DASHBOARD_FOLDER_UPDATED",
+ DASHBOARD_FOLDER_UPDATE_FAILURE: "DASHBOARD_FOLDER_UPDATE_FAILURE",
+ DASHBOARD_FOLDER_DELETED: "DASHBOARD_FOLDER_DELETED",
+ DASHBOARD_FOLDER_DELETE_FAILURE: "DASHBOARD_FOLDER_DELETE_FAILURE",
+ DASHBOARD_CREATED: "DASHBOARD_CREATED",
+ DASHBOARD_CREATE_FAILURE: "DASHBOARD_CREATE_FAILURE",
+ DASHBOARD_UPDATED: "DASHBOARD_UPDATED",
+ DASHBOARD_UPDATE_FAILURE: "DASHBOARD_UPDATE_FAILURE",
+ DASHBOARD_DELETED: "DASHBOARD_DELETED",
+ DASHBOARD_DELETE_FAILURE: "DASHBOARD_DELETE_FAILURE",
+ DASHBOARD_SET_MAIN_DASHBOARD: "DASHBOARD_SET_MAIN_DASHBOARD",
+ DASHBOARD_SET_MAIN_DASHBOARD_FAILURE: "DASHBOARD_SET_MAIN_DASHBOARD_FAILURE",
+ DASHBOARD_TOGGLE_PINNED: "DASHBOARD_TOGGLE_PINNED",
+ DASHBOARD_TOGGLE_PINNED_FAILURE: "DASHBOARD_TOGGLE_PINNED_FAILURE",
+ DASHBOARD_IMPORT_SUCCESS: "DASHBOARD_IMPORT_SUCCESS",
+ DASHBOARD_IMPORT_FAILURE: "DASHBOARD_IMPORT_FAILURE",
+
+ LIST_DASHBOARDS_PAGE_VISITED: "LIST_DASHBOARDS_PAGE_VISITED",
+ EXPLORE_DASHBOARDS_PAGE_VISITED: "EXPLORE_DASHBOARDS_PAGE_VISITED",
+ LIST_WIDGETS_PAGE_VISITED: "LIST_WIDGETS_PAGE_VISITED",
};
export const SERVER_EVENTS = {
@@ -53,4 +84,52 @@ export const SERVER_EVENTS = {
// Evaluation
EVALUATION_AUTO_SUCCESS: "EVALUATION_AUTO_SUCCESS",
EVALUATION_AUTO_FAILURE: "EVALUATION_AUTO_FAILURE",
+
+ // Custom dashboard
+ FOLDER_CREATE_SUCCESS: "FOLDER_CREATE_SUCCESS",
+ FOLDER_CREATE_FAILURE: "FOLDER_CREATE_FAILURE",
+ FOLDER_UPDATE_SUCCESS: "FOLDER_UPDATE_SUCCESS",
+ FOLDER_UPDATE_FAILURE: "FOLDER_UPDATE_FAILURE",
+ FOLDER_GET_SUCCESS: "FOLDER_GET_SUCCESS",
+ FOLDER_GET_FAILURE: "FOLDER_GET_FAILURE",
+ FOLDER_DELETE_SUCCESS: "FOLDER_DELETE_SUCCESS",
+ FOLDER_DELETE_FAILURE: "FOLDER_DELETE_FAILURE",
+ FOLDER_GET_HEIRARCHY_SUCCESS: "FOLDER_GET_HEIRARCHY_SUCCESS",
+ FOLDER_GET_HEIRARCHY_FAILURE: "FOLDER_GET_HEIRARCHY_FAILURE",
+
+ DASHBOARD_CREATE_SUCCESS: "DASHBOARD_CREATE_SUCCESS",
+ DASHBOARD_CREATE_FAILURE: "DASHBOARD_CREATE_FAILURE",
+ DASHBOARD_UPDATE_SUCCESS: "DASHBOARD_UPDATE_SUCCESS",
+ DASHBOARD_UPDATE_FAILURE: "DASHBOARD_UPDATE_FAILURE",
+ DASHBOARD_GET_SUCCESS: "DASHBOARD_GET_SUCCESS",
+ DASHBOARD_GET_FAILURE: "DASHBOARD_GET_FAILURE",
+ DASHBOARD_GET_MAIN_SUCCESS: "DASHBOARD_GET_MAIN_SUCCESS",
+ DASHBOARD_GET_MAIN_FAILURE: "DASHBOARD_GET_MAIN_FAILURE",
+ DASHBOARD_IMPORT_SUCCESS: "DASHBOARD_IMPORT_SUCCESS",
+ DASHBOARD_IMPORT_FAILURE: "DASHBOARD_IMPORT_FAILURE",
+ DASHBOARD_DELETE_SUCCESS: "DASHBOARD_DELETE_SUCCESS",
+ DASHBOARD_DELETE_FAILURE: "DASHBOARD_DELETE_FAILURE",
+ DASHBOARD_TOGGLE_MAIN_SUCCESS: "DASHBOARD_TOGGLE_MAIN_SUCCESS",
+ DASHBOARD_TOGGLE_MAIN_FAILURE: "DASHBOARD_TOGGLE_MAIN_FAILURE",
+ DASHBOARD_TOGGLE_PINNED_SUCCESS: "DASHBOARD_TOGGLE_PINNED_SUCCESS",
+ DASHBOARD_TOGGLE_PINNED_FAILURE: "DASHBOARD_TOGGLE_PINNED_FAILURE",
+ DASHBOARD_PATCH_FAILURE: "DASHBOARD_PATCH_FAILURE",
+ DASHBOARD_LAYOUT_UPDATE_SUCCESS: "DASHBOARD_LAYOUT_UPDATE_SUCCESS",
+ DASHBOARD_LAYOUT_UPDATE_FAILURE: "DASHBOARD_LAYOUT_UPDATE_FAILURE",
+ DASHBOARD_LAYOUT_GET_SUCCESS: "DASHBOARD_LAYOUT_GET_SUCCESS",
+ DASHBOARD_LAYOUT_GET_FAILURE: "DASHBOARD_LAYOUT_GET_FAILURE",
+ DASHBOARD_LAYOUT_EXPORT_SUCCESS: "DASHBOARD_LAYOUT_EXPORT_SUCCESS",
+ DASHBOARD_LAYOUT_EXPORT_FAILURE: "DASHBOARD_LAYOUT_EXPORT_FAILURE",
+ DASHBOARD_QUERY_RUN_SUCCESS: "DASHBOARD_QUERY_RUN_SUCCESS",
+ DASHBOARD_QUERY_RUN_FAILURE: "DASHBOARD_QUERY_RUN_FAILURE",
+ DASHBOARD_WIDGET_DELETE_SUCCESS: "DASHBOARD_WIDGET_DELETE_SUCCESS",
+ DASHBOARD_WIDGET_DELETE_FAILURE: "DASHBOARD_WIDGET_DELETE_FAILURE",
+ DASHBOARD_WIDGET_GET_SUCCESS: "DASHBOARD_WIDGET_GET_SUCCESS",
+ DASHBOARD_WIDGET_GET_FAILURE: "DASHBOARD_WIDGET_GET_FAILURE",
+ DASHBOARD_WIDGET_UPDATE_SUCCESS: "DASHBOARD_WIDGET_UPDATE_SUCCESS",
+ DASHBOARD_WIDGET_UPDATE_FAILURE: "DASHBOARD_WIDGET_UPDATE_FAILURE",
+ DASHBOARD_WIDGET_CREATE_SUCCESS: "DASHBOARD_WIDGET_CREATE_SUCCESS",
+ DASHBOARD_WIDGET_CREATE_FAILURE: "DASHBOARD_WIDGET_CREATE_FAILURE",
+ DASHBOARD_WIDGET_LIST_SUCCESS: "DASHBOARD_WIDGET_LIST_SUCCESS",
+ DASHBOARD_WIDGET_LIST_FAILURE: "DASHBOARD_WIDGET_LIST_FAILURE",
};
diff --git a/src/client/src/constants/messages/en.ts b/src/client/src/constants/messages/en.ts
index dbb1e221..b0eef6ce 100644
--- a/src/client/src/constants/messages/en.ts
+++ b/src/client/src/constants/messages/en.ts
@@ -53,3 +53,42 @@ export const TRACE_FETCHING_ERROR = "Error fetching trace!";
export const CRON_RECURRING_TIME_INVALID =
"Invalid cron schedule. Please check the format.";
export const CRON_JOB_UPDATION_ERROR = "Error updating cron job.";
+
+// Manage Dashboard
+export const BOARD_DATA_NOT_FOUND = "Board data not found!";
+export const MANAGE_DASHBOARD_EXPLORER_EMPTY_STATE =
+ "No dashboards or folders yet. Click 'Add' to create one.";
+export const BOARD_UPDATE_FAILED = "Board update failed!";
+export const BOARD_UPDATED_SUCCESSFULLY = "Board updated successfully!";
+export const FOLDER_UPDATE_FAILED = "Folder update failed!";
+export const FOLDER_UPDATED_SUCCESSFULLY = "Folder updated successfully!";
+export const WIDGET_UPDATE_FAILED = "Widget update failed!";
+export const WIDGET_CREATE_FAILED = "Widget create failed!";
+export const WIDGET_UPDATED_SUCCESSFULLY = "Widget updated successfully!";
+export const BOARD_LAYOUT_UPDATED_SUCCESSFULLY =
+ "Board layout updated successfully!";
+export const WIDGET_FETCH_FAILED = "Widget fetch failed!";
+export const WIDGET_RUN_FAILED = "Widget run failed!";
+export const BOARD_DELETE_FAILED = "Board delete failed!";
+export const BOARD_DELETED_SUCCESSFULLY = "Board deleted successfully!";
+export const FOLDER_DELETE_FAILED =
+ "Folder cannot be deleted! It has boards or folders inside it.";
+export const FOLDER_DELETED_SUCCESSFULLY = "Folder deleted successfully!";
+export const MAIN_DASHBOARD_NOT_FOUND = "Main dashboard not found!";
+export const BOARD_CREATE_FAILED = "Board create failed!";
+export const BOARD_IMPORT_FAILED = "Board import failed!";
+export const BOARD_IMPORT_SUCCESSFULLY = "Board import successfully!";
+export const NO_WIDGETS_YET = "No widgets yet!";
+export const NO_WIDGETS_YET_DESCRIPTION = "Create your first widget to start building your custom dashboard. Add charts, stats, and more to visualize your data.";
+export const NO_WIDGETS_YET_ACTION_BUTTON = "Add Your First Widget";
+export const NO_DASHBOARDS_YET = "No Dashboards Yet";
+export const NO_DASHBOARDS_YET_DESCRIPTION = "Create your first dashboard to start visualizing your data in a meaningful way.";
+export const NO_DASHBOARDS_YET_ACTION_BUTTON = "Create Dashboard";
+export const NO_DASHBOARDS_YET_SEARCH_TITLE = "No Dashboards Found";
+export const NO_DASHBOARDS_YET_SEARCH_DESCRIPTION = "No dashboards found matching your search.";
+export const NO_WIDGETS_YET_SEARCH_TITLE = "No Widgets Found";
+export const NO_WIDGETS_YET_SEARCH_DESCRIPTION = "No widgets found matching your search.";
+export const ADD_DASHBOARD_OR_FOLDER = "Create a new dashboard or folder";
+export const EDIT_DASHBOARD_OR_FOLDER = "Edit dashboard or folder";
+export const ERROR_OCCURED = "Broken Dashboard";
+export const ERROR_OCCURED_DESCRIPTION = "An error occurred while fetching the dashboard or the dashboard does not exist. Please try again later.";
\ No newline at end of file
diff --git a/src/client/src/helpers/server/widget.ts b/src/client/src/helpers/server/widget.ts
new file mode 100644
index 00000000..3da90c6e
--- /dev/null
+++ b/src/client/src/helpers/server/widget.ts
@@ -0,0 +1,51 @@
+import { DatabaseWidget, Widget } from "@/types/manage-dashboard";
+import { jsonParse, jsonStringify } from "@/utils/json";
+import Sanitizer from "@/utils/sanitizer";
+
+export function normalizeWidgetToClient(widget: DatabaseWidget) {
+ const unsanitizedWidget = unsanitizeWidget(widget);
+ return {
+ ...widget,
+ properties: unsanitizedWidget.properties ? jsonParse(unsanitizedWidget.properties) : unsanitizedWidget.properties,
+ config: unsanitizedWidget.config ? jsonParse(unsanitizedWidget.config) : unsanitizedWidget.config,
+ };
+}
+
+export function normalizeWidgetToServer(widget: Widget) {
+ return {
+ ...widget,
+ properties: widget.properties ? jsonStringify(widget.properties) : widget.properties,
+ config: widget.config ? jsonStringify(widget.config) : widget.config,
+ };
+}
+
+export function unsanitizeWidget(widget: DatabaseWidget) {
+ return {
+ ...widget,
+ config: widget.config
+ .replace(/\n/g, '\\n')
+ .replace(/\t/g, '\\t'),
+ };
+}
+
+export function sanitizeWidget(widget: Widget) {
+ const sanitizedWidget = Sanitizer.sanitizeObject(widget);
+
+ if (sanitizedWidget.config?.query) {
+ sanitizedWidget.config.query = sanitizedWidget.config.query.replace(/''/g, "'")
+ .replace(/\\'/g, "'").replace(/\\n/g, '\n')
+ .replace(/\\t/g, '\t');
+ }
+
+ if (sanitizedWidget.config?.content) {
+ sanitizedWidget.config.content = sanitizedWidget.config.content.replace(/''/g, "'")
+ .replace(/\\'/g, "'").replace(/\\n/g, '\n')
+ .replace(/\\t/g, '\t');
+ }
+
+ return sanitizedWidget;
+}
+
+export function escapeSingleQuotes(input: string) {
+ return input.replace(/'([^']*)'/g, "''$1''");
+}
\ No newline at end of file
diff --git a/src/client/src/lib/platform/clickhouse/clickhouse-client.ts b/src/client/src/lib/platform/clickhouse/clickhouse-client.ts
index fcfbe857..077c9ea0 100644
--- a/src/client/src/lib/platform/clickhouse/clickhouse-client.ts
+++ b/src/client/src/lib/platform/clickhouse/clickhouse-client.ts
@@ -47,10 +47,10 @@ export default function createClickhousePool(
};
return createPool(getClickHouseFactoryOptions(connectionObject), {
- max: 10,
- min: 2,
- idleTimeoutMillis: 10000,
- maxWaitingClients: 2,
+ max: 20,
+ min: 5,
+ idleTimeoutMillis: 30000,
+ maxWaitingClients: 5,
testOnBorrow: true,
acquireTimeoutMillis: 5000,
});
diff --git a/src/client/src/lib/platform/clickhouse/helpers.ts b/src/client/src/lib/platform/clickhouse/helpers.ts
index 57d7a5ed..7c600264 100644
--- a/src/client/src/lib/platform/clickhouse/helpers.ts
+++ b/src/client/src/lib/platform/clickhouse/helpers.ts
@@ -1,12 +1,24 @@
import migrations from "@/clickhouse/migrations";
import { dataCollector } from "../common";
+import asaw from "@/utils/asaw";
export async function pingClickhouse() {
- const data = await dataCollector({}, "ping");
- runClickhouseMigrations()
- return data;
+ const pingResponse = await dataCollector({}, "ping");
+ if (pingResponse.data) {
+ const [err] = await asaw(runClickhouseMigrations());
+ return {
+ err,
+ data: !err,
+ };
+ }
+
+ return pingResponse;
}
export async function runClickhouseMigrations() {
- await migrations();
+ try {
+ await migrations();
+ } catch (error) {
+ console.error("Error running migrations:", error);
+ }
}
diff --git a/src/client/src/lib/platform/common.ts b/src/client/src/lib/platform/common.ts
index f775dca6..8f6ba16f 100644
--- a/src/client/src/lib/platform/common.ts
+++ b/src/client/src/lib/platform/common.ts
@@ -43,7 +43,7 @@ export type GPU_TYPE_KEY =
| "power.draw"
| "power.limit";
-export interface GPUMetricParams extends MetricParams {}
+export interface GPUMetricParams extends MetricParams { }
export type DataCollectorType = { err?: unknown; data?: unknown };
export async function dataCollector(
@@ -52,7 +52,8 @@ export async function dataCollector(
format = "JSONEachRow",
table,
values,
- }: Partial<QueryParams & InsertParams & ExecParams & CommandParams>,
+ enable_readonly = false,
+ }: Partial<QueryParams & InsertParams & ExecParams & CommandParams & { enable_readonly?: boolean }>,
clientQueryType: "query" | "command" | "insert" | "exec" | "ping" = "query",
dbConfigId?: string
): Promise<DataCollectorType> {
@@ -82,11 +83,18 @@ export async function dataCollector(
if (clientQueryType === "query") {
if (!query) return { err: "No query specified!" };
+ const object: QueryParams = {
+ query,
+ format,
+ }
+ if (enable_readonly) {
+ object.clickhouse_settings = {
+ readonly: "2",
+ }
+ }
+
[respErr, result] = await asaw(
- client.query({
- query,
- format,
- })
+ client.query(object)
);
if (result) {
@@ -118,7 +126,9 @@ export async function dataCollector(
return { data: result };
}
} else if (clientQueryType === "ping") {
- [respErr, result] = await asaw(client.ping());
+ [respErr, result] = await asaw(client.query({
+ query: "SELECT 1",
+ }));
return { err: respErr, data: !!result };
} else if (clientQueryType === "command") {
diff --git a/src/client/src/lib/platform/manage-dashboard/board.ts b/src/client/src/lib/platform/manage-dashboard/board.ts
new file mode 100644
index 00000000..e2bde677
--- /dev/null
+++ b/src/client/src/lib/platform/manage-dashboard/board.ts
@@ -0,0 +1,528 @@
+import { Board, Widget } from "@/types/manage-dashboard";
+import { dataCollector } from "../common";
+import {
+ OPENLIT_BOARD_TABLE_NAME,
+ OPENLIT_BOARD_WIDGET_TABLE_NAME,
+} from "./table-details";
+import getMessage from "@/constants/messages";
+import Sanitizer from "@/utils/sanitizer";
+import { createWidget, getWidgets } from "./widget";
+import { pluck } from "lodash/fp";
+import { jsonParse, jsonStringify } from "@/utils/json";
+
+export function getBoardById(id: string) {
+ const query = `
+ SELECT *
+ FROM ${OPENLIT_BOARD_TABLE_NAME}
+ WHERE id = '${Sanitizer.sanitizeValue(id)}'
+ `;
+
+ return dataCollector({ query });
+}
+
+export function getBoards(isHome?: boolean) {
+ let query: string = '';
+ if (isHome) {
+ query = `
+ SELECT b.id, b.title, b.description, b.parent_id AS parentId,
+ b.is_main_dashboard AS isMainDashboard,
+ b.is_pinned AS isPinned,
+ b.created_at AS createdAt,
+ b.updated_at AS updatedAt, b.tags
+ FROM ${OPENLIT_BOARD_TABLE_NAME} b
+ WHERE b.is_main_dashboard = true OR b.is_pinned = true
+ ORDER BY b.updated_at DESC;
+ `;
+ } else {
+ query = `
+ SELECT b.id, b.title, b.description, b.parent_id AS parentId,
+ b.is_main_dashboard AS isMainDashboard,
+ b.is_pinned AS isPinned,
+ b.created_at AS createdAt,
+ b.updated_at AS updatedAt, COALESCE(bwc.total_widgets, 0) AS totalWidgets, b.tags
+ FROM ${OPENLIT_BOARD_TABLE_NAME} b
+ LEFT JOIN (
+ SELECT board_id, COUNT(*) AS total_widgets
+ FROM ${OPENLIT_BOARD_WIDGET_TABLE_NAME}
+ WHERE board_id IS NOT NULL
+ GROUP BY board_id
+ ) AS bwc ON b.id = bwc.board_id
+ ORDER BY b.updated_at DESC;
+ `;
+ }
+
+ return dataCollector({ query });
+}
+
+export async function createBoard(board: Board, databaseConfigId?: string) {
+ const sanitizedBoard = Sanitizer.sanitizeObject(board);
+
+ const { err, data } = await dataCollector(
+ {
+ table: OPENLIT_BOARD_TABLE_NAME,
+ values: [
+ {
+ title: sanitizedBoard.title,
+ description: sanitizedBoard.description,
+ parent_id: sanitizedBoard.parentId,
+ is_main_dashboard: sanitizedBoard.isMainDashboard,
+ is_pinned: sanitizedBoard.isPinned,
+ tags: jsonStringify(sanitizedBoard.tags),
+ },
+ ],
+ },
+ "insert",
+ databaseConfigId
+ );
+
+ if (err || !(data as { query_id: string }).query_id)
+ return { err: getMessage().BOARD_CREATE_FAILED };
+
+ const { data: data_board, err: err_board } = await dataCollector({
+ query: `Select * from ${OPENLIT_BOARD_TABLE_NAME} order by created_at desc limit 1`,
+ });
+
+
+ if (err_board) {
+ return { err: getMessage().BOARD_CREATE_FAILED };
+ }
+
+ return { data: (data_board as any[])[0] };
+}
+
+export async function updateBoard(board: Board & { updateParent?: boolean }) {
+ const sanitizedBoard = Sanitizer.sanitizeObject(board);
+
+ const updateValues = [
+ sanitizedBoard.title && `title = '${sanitizedBoard.title}'`,
+ sanitizedBoard.description &&
+ `description = '${sanitizedBoard.description}'`,
+ board.updateParent && `parent_id = ${sanitizedBoard.parentId ? `'${sanitizedBoard.parentId}'` : 'NULL'}`,
+ sanitizedBoard.tags && `tags = '${jsonStringify(sanitizedBoard.tags)}'`,
+ ];
+
+ const query = `
+ ALTER TABLE ${OPENLIT_BOARD_TABLE_NAME}
+ UPDATE
+ ${updateValues.filter((e) => e).join(" , ")}
+ WHERE id = '${sanitizedBoard.id}'
+ `;
+
+ const { err, data } = await dataCollector({ query }, "exec");
+
+ if (err || !(data as { query_id: string }).query_id)
+ return { err: getMessage().BOARD_UPDATE_FAILED };
+
+ const { data: boardData } = await getBoardById(sanitizedBoard.id);
+
+ return { data: boardData };
+}
+
+export async function deleteBoard(id: string) {
+ const query_board_widgets = `
+ DELETE FROM ${OPENLIT_BOARD_WIDGET_TABLE_NAME}
+ WHERE board_id = '${Sanitizer.sanitizeValue(id)}'
+ `;
+
+ const query = `
+ DELETE FROM ${OPENLIT_BOARD_TABLE_NAME}
+ WHERE id = '${Sanitizer.sanitizeValue(id)}'
+ `;
+
+ const { err: err_board_widgets } = await dataCollector(
+ { query: query_board_widgets },
+ "exec"
+ );
+
+ if (err_board_widgets) return { err: getMessage().BOARD_DELETE_FAILED };
+
+ const { err: err_board } = await dataCollector({ query }, "exec");
+
+ if (err_board) return { err: getMessage().BOARD_DELETE_FAILED };
+
+ return { data: getMessage().BOARD_DELETED_SUCCESSFULLY };
+}
+
+export async function getBoardLayout(id: string, databaseConfigId?: string) {
+ // First get the board details
+ const boardQuery = `
+ SELECT
+ id AS boardId,
+ title AS boardTitle,
+ description AS boardDescription,
+ is_main_dashboard AS isMainDashboard,
+ is_pinned AS isPinned,
+ created_at AS boardCreatedAt,
+ updated_at AS boardUpdatedAt,
+ tags AS tags
+ FROM ${OPENLIT_BOARD_TABLE_NAME}
+ WHERE id = '${Sanitizer.sanitizeValue(id)}'
+ `;
+
+ const { data: boardData, err: boardErr } = await dataCollector({
+ query: boardQuery,
+ }, "query", databaseConfigId);
+ const boardResult = (boardData as any[])?.[0] as {
+ boardId: string;
+ boardTitle: string;
+ boardDescription: string;
+ isMainDashboard: boolean;
+ isPinned: boolean;
+ boardCreatedAt: string;
+ boardUpdatedAt: string;
+ tags: string;
+ };
+
+ if (!boardResult || boardErr)
+ return { err: getMessage().BOARD_DATA_NOT_FOUND };
+
+ // Then get the widget mappings with positions
+ const widgetMappingsQuery = `
+ SELECT
+ bw.id AS boardWidgetId,
+ bw.widget_id AS widgetId,
+ bw.position,
+ bw.created_at AS boardWidgetCreatedAt,
+ bw.updated_at AS boardWidgetUpdatedAt
+ FROM ${OPENLIT_BOARD_WIDGET_TABLE_NAME} bw
+ WHERE bw.board_id = '${Sanitizer.sanitizeValue(id)}'
+ `;
+
+ const { data: mappingsData, err: mappingsErr } = await dataCollector({
+ query: widgetMappingsQuery,
+ }, "query", databaseConfigId);
+ const mappingsResult = (mappingsData || []) as Array<{
+ boardWidgetId: string;
+ widgetId: string;
+ position: string;
+ boardWidgetCreatedAt: string;
+ boardWidgetUpdatedAt: string;
+ tags: string;
+ }>;
+
+ // Finally get the widget details
+ const widgetIds = pluck("widgetId", mappingsResult);
+
+ let widgetsResult: Array<Widget> = [];
+
+ if (widgetIds) {
+ const { data: widgetsData } = await getWidgets(widgetIds);
+ widgetsResult = (widgetsData || []) as typeof widgetsResult;
+ }
+
+ // Create a map of widget details for easy lookup
+ const widgetDetailsMap = new Map(widgetsResult.map((w) => [w.id, w]));
+
+ // Construct the board object
+ const board: Board = {
+ id: boardResult.boardId,
+ title: boardResult.boardTitle,
+ description: boardResult.boardDescription,
+ parentId: null,
+ isMainDashboard: boardResult.isMainDashboard,
+ isPinned: boardResult.isPinned,
+ createdAt: boardResult.boardCreatedAt,
+ updatedAt: boardResult.boardUpdatedAt,
+ widgets: [],
+ tags: boardResult.tags,
+ };
+
+ // Construct the layout config format
+ type LayoutItem = {
+ i: string;
+ x: number;
+ y: number;
+ w: number;
+ h: number;
+ };
+
+ type LayoutConfig = {
+ layouts: {
+ lg: LayoutItem[];
+ };
+ widgets: {
+ [key: string]: Widget;
+ };
+ };
+
+ const layoutConfig: LayoutConfig = {
+ layouts: { lg: [] },
+ widgets: {},
+ };
+
+ // Map widgets and create layout config
+ board.widgets = mappingsResult.map((mapping) => {
+ const widgetDetails = widgetDetailsMap.get(mapping.widgetId);
+ const position = JSON.parse(mapping.position || "{}");
+
+ // Add to layouts
+ layoutConfig.layouts.lg.push({
+ i: mapping.widgetId,
+ x: position.x,
+ y: position.y,
+ w: position.w,
+ h: position.h,
+ });
+
+ // Add to widgets map
+ const widgetData = {
+ id: mapping.widgetId,
+ title: widgetDetails?.title || "",
+ description: widgetDetails?.description || "",
+ type: widgetDetails?.type || "",
+ properties: widgetDetails?.properties || {},
+ config: widgetDetails?.config || {},
+ createdAt: widgetDetails?.createdAt || "",
+ updatedAt: widgetDetails?.updatedAt || "",
+ } as const;
+
+ layoutConfig.widgets[mapping.widgetId] = widgetData;
+
+ // Return the board widget mapping
+ return {
+ id: mapping.boardWidgetId,
+ boardId: board.id,
+ widgetId: mapping.widgetId,
+ position: position || {},
+ createdAt: mapping.boardWidgetCreatedAt,
+ updatedAt: mapping.boardWidgetUpdatedAt,
+ widget: widgetData,
+ };
+ });
+
+ return {
+ data: {
+ ...board,
+ ...layoutConfig,
+ },
+ };
+}
+
+export async function updateBoardLayout(boardId: string, layoutConfig: any, databaseConfigId?: string) {
+ // First, get all existing widget mappings for this board
+ const getExistingWidgetsQuery = `
+ SELECT widget_id, id
+ FROM ${OPENLIT_BOARD_WIDGET_TABLE_NAME}
+ WHERE board_id = '${Sanitizer.sanitizeValue(boardId)}'
+ `;
+
+ const { data: existingWidgetsData } = await dataCollector({
+ query: getExistingWidgetsQuery,
+ }, "query", databaseConfigId);
+ const existingWidgets =
+ (existingWidgetsData as { widget_id: string; id: string }[]) || [];
+
+ // Create a map of existing widget IDs for quick lookup
+ const existingWidgetMap = new Map();
+ existingWidgets.forEach((widget) => {
+ existingWidgetMap.set(widget.widget_id, widget.id);
+ });
+
+ // Create a set of widget IDs from the new layout config
+ const newWidgetIds = new Set();
+ layoutConfig.layouts.lg.forEach((layout: { i: string }) => {
+ const widget = layoutConfig.widgets[layout.i];
+ if (widget && widget.id) {
+ newWidgetIds.add(widget.id);
+ }
+ });
+
+ // Delete widgets that are no longer in the layout
+ for (const existingWidget of existingWidgets) {
+ if (!newWidgetIds.has(existingWidget.widget_id)) {
+ const deleteQuery = `
+ DELETE FROM ${OPENLIT_BOARD_WIDGET_TABLE_NAME}
+ WHERE id = '${Sanitizer.sanitizeValue(existingWidget.id)}'
+ AND board_id = '${Sanitizer.sanitizeValue(boardId)}'
+ `;
+ await dataCollector({ query: deleteQuery }, "exec", databaseConfigId);
+ }
+ }
+
+ // Update or insert widget mappings
+ for (const layout of layoutConfig.layouts.lg) {
+ const widget = layoutConfig.widgets[layout.i];
+ if (widget && widget.id) {
+ const position = {
+ x: layout.x,
+ y: layout.y,
+ w: layout.w,
+ h: layout.h,
+ };
+
+ if (existingWidgetMap.has(widget.id)) {
+ // Update existing widget mapping
+ const updateQuery = `
+ ALTER TABLE ${OPENLIT_BOARD_WIDGET_TABLE_NAME}
+ UPDATE
+ position = '${JSON.stringify(position)}',
+ updated_at = NOW()
+ WHERE id = '${Sanitizer.sanitizeValue(existingWidgetMap.get(widget.id))}'
+ `;
+
+ await dataCollector({ query: updateQuery }, "exec", databaseConfigId);
+ } else {
+ // Insert new widget mapping
+ await dataCollector(
+ {
+ table: OPENLIT_BOARD_WIDGET_TABLE_NAME,
+ values: [
+ {
+ board_id: Sanitizer.sanitizeValue(boardId),
+ widget_id: Sanitizer.sanitizeValue(widget.id),
+ position: JSON.stringify(position),
+ },
+ ],
+ },
+ "insert",
+ databaseConfigId
+ );
+ }
+ }
+ }
+
+ return { data: getMessage().BOARD_LAYOUT_UPDATED_SUCCESSFULLY, err: null };
+}
+
+export async function setMainDashboard(boardId: string) {
+ // Set all boards to is_main_dashboard = false
+ const unsetQuery = `
+ ALTER TABLE ${OPENLIT_BOARD_TABLE_NAME}
+ UPDATE is_main_dashboard = false
+ WHERE is_main_dashboard = true
+ `;
+ await dataCollector({ query: unsetQuery }, "exec");
+
+ // Set the selected board to is_main_dashboard = true
+ const setQuery = `
+ ALTER TABLE ${OPENLIT_BOARD_TABLE_NAME}
+ UPDATE is_main_dashboard = true
+ WHERE id = '${Sanitizer.sanitizeValue(boardId)}'
+ `;
+ const { err, data } = await dataCollector({ query: setQuery }, "exec");
+
+ if (err || !(data as { query_id: string }).query_id)
+ return { err: err?.toString() || getMessage().BOARD_UPDATE_FAILED };
+
+ return { data: getMessage().BOARD_UPDATED_SUCCESSFULLY };
+}
+
+export async function getMainDashboard(layout?: boolean, databaseConfigId?: string) {
+ const query = `
+ SELECT id, is_main_dashboard AS isMainDashboard FROM ${OPENLIT_BOARD_TABLE_NAME}
+ WHERE is_main_dashboard = true
+ `;
+
+ const { data: mainDashboardData, err: mainDashboardErr } =
+ await dataCollector({ query }, "query", databaseConfigId);
+
+ if (mainDashboardErr || !(mainDashboardData as any[])[0])
+ return { err: mainDashboardErr?.toString() || getMessage().MAIN_DASHBOARD_NOT_FOUND };
+
+ if (layout) {
+ return getBoardLayout((mainDashboardData as any[])[0].id, databaseConfigId);
+ }
+
+ return { data: (mainDashboardData as any[])[0], err: null };
+}
+
+// TODO: fix the type of data
+export async function importBoardLayout(data: any, databaseConfigId?: string) {
+ const mainDashboard = await getMainDashboard(false, databaseConfigId);
+
+ const boardData: Partial<Board> = {
+ title: data.title,
+ description: data.description,
+ isPinned: data.isPinned,
+ isMainDashboard: mainDashboard.data?.isMainDashboard ? false : data.isMainDashboard,
+ tags: data.tags ? jsonParse(data.tags) : [],
+ };
+
+ // Create the board first
+ const boardResult = await createBoard(boardData as Board, databaseConfigId);
+
+ if ('err' in boardResult) {
+ return { err: boardResult.err };
+ }
+
+ const newBoardId = boardResult.data.id;
+
+ // Update the board layout with widgets and their positions
+ const layoutConfig = {
+ layouts: data.layouts,
+ widgets: data.widgets
+ };
+
+ const widgetIdMap = new Map();
+
+ const updatedWidgets = Object.values(layoutConfig.widgets).map((widget: any) => {
+ const newWidgetId = crypto.randomUUID();
+ widgetIdMap.set(widget.id, newWidgetId);
+
+ return {
+ ...widget,
+ id: newWidgetId,
+ };
+ });
+
+ const updatedLayouts = layoutConfig.layouts.lg.map((layout: any) => {
+ return {
+ ...layout,
+ i: widgetIdMap.get(layout.i)
+ }
+ });
+
+ await Promise.all(updatedWidgets.map(async (widget: any) => {
+ return await createWidget(widget, databaseConfigId);
+ }));
+
+ const layoutConfigData = {
+ layouts: {
+ lg: updatedLayouts
+ },
+ widgets: updatedWidgets.reduce((acc: any, widget: any) => {
+ acc[widget.id] = widget;
+ return acc;
+ }, {}),
+ }
+
+
+ const { data: layoutData, err: layoutErr } = await updateBoardLayout(newBoardId, layoutConfigData, databaseConfigId);
+
+
+ if (layoutData) {
+ return { data: boardResult.data };
+ }
+
+ return { err: layoutErr || getMessage().BOARD_IMPORT_FAILED };
+}
+
+export async function updatePinnedBoard(boardId: string) {
+ // Set the selected board to is_pinned = true
+ const setQuery = `
+ ALTER TABLE ${OPENLIT_BOARD_TABLE_NAME}
+ UPDATE is_pinned = NOT is_pinned
+ WHERE id = '${Sanitizer.sanitizeValue(boardId)}'
+ `;
+ const { err, data } = await dataCollector({ query: setQuery }, "exec");
+
+ if (err || !(data as { query_id: string }).query_id)
+ return { err: err?.toString() || getMessage().BOARD_UPDATE_FAILED };
+
+ return { data: getMessage().BOARD_UPDATED_SUCCESSFULLY };
+}
+
+export async function isBoardTableEmpty(databaseConfigId?: string) {
+ const query = `
+ SELECT COUNT(*) FROM ${OPENLIT_BOARD_TABLE_NAME}
+ `;
+
+ const { data: boardCount, err: boardCountErr } =
+ await dataCollector({ query }, "query", databaseConfigId);
+
+ if (boardCountErr) {
+ return { err: boardCountErr, data: false };
+ }
+
+ return { data: (boardCount as any[])[0].count === 0, err: null };
+}
\ No newline at end of file
diff --git a/src/client/src/lib/platform/manage-dashboard/folder.ts b/src/client/src/lib/platform/manage-dashboard/folder.ts
new file mode 100644
index 00000000..fbd50280
--- /dev/null
+++ b/src/client/src/lib/platform/manage-dashboard/folder.ts
@@ -0,0 +1,108 @@
+import { Folder } from "@/types/manage-dashboard";
+import { dataCollector } from "../common";
+import {
+ OPENLIT_BOARD_TABLE_NAME,
+ OPENLIT_FOLDER_TABLE_NAME,
+} from "./table-details";
+import Sanitizer from "@/utils/sanitizer";
+import getMessage from "@/constants/messages";
+import { jsonStringify } from "@/utils/json";
+
+export function getFolderById(id: string) {
+ const query = `
+ SELECT id, title, description, parent_id AS parentId, created_at AS createdAt, updated_at AS updatedAt, tags
+ FROM ${OPENLIT_FOLDER_TABLE_NAME}
+ WHERE id = '${Sanitizer.sanitizeValue(id)}'
+ `;
+
+ return dataCollector({ query });
+}
+
+export function getFolders() {
+ const query = `
+ SELECT id, title, description, parent_id AS parentId, created_at AS createdAt, updated_at AS updatedAt, tags
+ FROM ${OPENLIT_FOLDER_TABLE_NAME}
+ `;
+
+ return dataCollector({ query });
+}
+
+export function createFolder(folder: Folder) {
+ const sanitizedFolder = Sanitizer.sanitizeObject(folder);
+
+ return dataCollector(
+ {
+ table: OPENLIT_FOLDER_TABLE_NAME,
+ values: [
+ {
+ title: sanitizedFolder.title,
+ description: sanitizedFolder.description,
+ parent_id: sanitizedFolder.parentId,
+ tags: jsonStringify(sanitizedFolder.tags),
+ },
+ ],
+ },
+ "insert"
+ );
+}
+
+export async function updateFolder(folder: Folder) {
+ const sanitizedFolder = Sanitizer.sanitizeObject(folder);
+
+ const updateValues = [
+ sanitizedFolder.title && `title = '${sanitizedFolder.title}'`,
+ sanitizedFolder.description &&
+ `description = '${sanitizedFolder.description}'`,
+ `parent_id = '${sanitizedFolder.parentId}'`,
+ sanitizedFolder.tags && `tags = '${jsonStringify(sanitizedFolder.tags)}'`,
+ `updated_at = NOW()`,
+ ];
+
+ const query = `
+ ALTER TABLE ${OPENLIT_FOLDER_TABLE_NAME}
+ UPDATE
+ ${updateValues.filter((e) => e).join(" , ")}
+ WHERE id = '${sanitizedFolder.id}'
+ `;
+
+ const { err, data } = await dataCollector({ query }, "exec");
+
+ if (err || !(data as { query_id: string }).query_id)
+ return { err: getMessage().FOLDER_UPDATE_FAILED };
+
+ return { data: getMessage().FOLDER_UPDATED_SUCCESSFULLY };
+}
+
+export async function deleteFolder(id: string) {
+ const doesFolderHasBoardsQuery = `SELECT CAST(COUNT(*) AS INTEGER) as count FROM ${OPENLIT_BOARD_TABLE_NAME} WHERE parent_id = '${Sanitizer.sanitizeValue(
+ id
+ )}'`;
+ const doesFolderHasFoldersQuery = `SELECT CAST(COUNT(*) AS INTEGER) as count FROM ${OPENLIT_FOLDER_TABLE_NAME} WHERE parent_id = '${Sanitizer.sanitizeValue(
+ id
+ )}'`;
+
+ const [{ data: doesFolderHasBoards }, { data: doesFolderHasFolders }] =
+ await Promise.all([
+ dataCollector({ query: doesFolderHasBoardsQuery }),
+ dataCollector({ query: doesFolderHasFoldersQuery }),
+ ]);
+
+ if (
+ (doesFolderHasBoards as any)[0].count ||
+ (doesFolderHasFolders as any)[0].count
+ ) {
+ return { err: getMessage().FOLDER_DELETE_FAILED };
+ }
+
+ const query = `
+ DELETE FROM ${OPENLIT_FOLDER_TABLE_NAME}
+ WHERE id = '${Sanitizer.sanitizeValue(id)}'
+ `;
+
+ const { err, data } = await dataCollector({ query }, "exec");
+
+ if (err || !(data as { query_id: string }).query_id)
+ return { err: getMessage().FOLDER_DELETE_FAILED };
+
+ return { data: getMessage().FOLDER_DELETED_SUCCESSFULLY };
+}
diff --git a/src/client/src/lib/platform/manage-dashboard/heirarchy.ts b/src/client/src/lib/platform/manage-dashboard/heirarchy.ts
new file mode 100644
index 00000000..c48fcd32
--- /dev/null
+++ b/src/client/src/lib/platform/manage-dashboard/heirarchy.ts
@@ -0,0 +1,83 @@
+import {
+ Board,
+ DashboardHeirarchy,
+ Folder,
+ FolderHeirarchy,
+} from "@/types/manage-dashboard";
+import { getBoards } from "./board";
+import { getFolders } from "./folder";
+
+export async function getHeirarchy() {
+ const { data: boards = [], err: errBoards } = await getBoards();
+ const { data: folders = [], err: errFolders } = await getFolders();
+
+ if (errBoards || errFolders) return { err: errBoards || errFolders };
+
+ return { data: buildHierarchy(boards as Board[], folders as Folder[]) };
+}
+
+function buildHierarchy(
+ boards: Board[],
+ folders: Folder[]
+): DashboardHeirarchy[] {
+ const folderMap = new Map<string, FolderHeirarchy>();
+ const rootNodes: DashboardHeirarchy[] = [];
+ const processedFolders = new Set<string>();
+
+ // Initialize folders in map with empty children and boards
+ folders.forEach((folder) => {
+ folderMap.set(folder.id, {
+ ...folder,
+ type: "folder",
+ children: [],
+ boards: [],
+ });
+ });
+
+ // Build folder hierarchy first
+ folders.forEach((folder) => {
+ if (folder.parentId && folderMap.has(folder.parentId)) {
+ // Add this folder as a child to its parent
+ folderMap.get(folder.parentId)!.children.push(folderMap.get(folder.id)!);
+ processedFolders.add(folder.id);
+ }
+ });
+
+ // Add only root-level folders to rootNodes
+ folders.forEach((folder) => {
+ // Only add folders that don't have a parent or whose parent doesn't exist
+ // AND haven't been processed as a child of another folder
+ if ((!folder.parentId || !folderMap.has(folder.parentId)) &&
+ !processedFolders.has(folder.id)) {
+ if (folderMap.has(folder.id)) {
+ rootNodes.push(folderMap.get(folder.id)!);
+ }
+ }
+ });
+
+ // Assign boards to their respective folders (or root level)
+ boards.forEach((board) => {
+ const boardNode: DashboardHeirarchy = {
+ id: board.id,
+ title: board.title,
+ description: board.description,
+ isMainDashboard: board.isMainDashboard,
+ isPinned: board.isPinned,
+ type: "board",
+ children: [],
+ parentId: board.parentId,
+ tags: board.tags,
+ };
+
+ if (board.parentId && folderMap.has(board.parentId)) {
+ // Add board to its parent folder
+ folderMap.get(board.parentId)!.boards.push(board);
+ folderMap.get(board.parentId)!.children.push(boardNode);
+ } else {
+ // Root-level boards (not inside any folder)
+ rootNodes.push(boardNode);
+ }
+ });
+
+ return rootNodes;
+}
diff --git a/src/client/src/lib/platform/manage-dashboard/table-details.ts b/src/client/src/lib/platform/manage-dashboard/table-details.ts
new file mode 100644
index 00000000..7aaad230
--- /dev/null
+++ b/src/client/src/lib/platform/manage-dashboard/table-details.ts
@@ -0,0 +1,4 @@
+export const OPENLIT_BOARD_TABLE_NAME = "openlit_board";
+export const OPENLIT_FOLDER_TABLE_NAME = "openlit_folder";
+export const OPENLIT_WIDGET_TABLE_NAME = "openlit_widget";
+export const OPENLIT_BOARD_WIDGET_TABLE_NAME = "openlit_board_widget";
diff --git a/src/client/src/lib/platform/manage-dashboard/widget.ts b/src/client/src/lib/platform/manage-dashboard/widget.ts
new file mode 100644
index 00000000..33e0e65d
--- /dev/null
+++ b/src/client/src/lib/platform/manage-dashboard/widget.ts
@@ -0,0 +1,187 @@
+import { DatabaseWidget, Widget } from "@/types/manage-dashboard";
+import { dataCollector, MetricParams } from "../common";
+import { OPENLIT_BOARD_WIDGET_TABLE_NAME, OPENLIT_WIDGET_TABLE_NAME } from "./table-details";
+import Sanitizer from "@/utils/sanitizer";
+import getMessage from "@/constants/messages";
+import {
+ normalizeWidgetToClient,
+ sanitizeWidget,
+ escapeSingleQuotes,
+} from "@/helpers/server/widget";
+import mustache from "mustache";
+
+import { jsonStringify } from "@/utils/json";
+
+export async function getWidgetById(id: string) {
+ const query = `
+ SELECT id, title, description, widget_type AS type, created_at AS createdAt, updated_at AS updatedAt, properties,
+ config
+ FROM ${OPENLIT_WIDGET_TABLE_NAME}
+ WHERE id = '${Sanitizer.sanitizeValue(id)}'
+ `;
+
+ const { data, err } = await dataCollector({ query });
+
+ if (err) {
+ return { err: err.toString() || getMessage().WIDGET_FETCH_FAILED };
+ }
+
+ return { data: normalizeWidgetToClient((data as DatabaseWidget[])[0]) };
+}
+
+export async function getWidgets(widgetIds?: string[]) {
+ let query = "";
+ if (!widgetIds || widgetIds.length === 0) {
+ query = `
+ SELECT w.id, w.title, w.description, w.widget_type AS type, w.properties,
+ w.config, w.created_at AS createdAt, w.updated_at AS updatedAt, COUNT(DISTINCT bw.board_id) as totalBoards
+ FROM ${OPENLIT_WIDGET_TABLE_NAME} w
+ LEFT JOIN ${OPENLIT_BOARD_WIDGET_TABLE_NAME} bw ON w.id = bw.widget_id
+ GROUP BY w.id, w.title, w.description, w.widget_type, w.properties, w.config, w.created_at, w.updated_at
+ ORDER BY w.updated_at DESC
+ `;
+ } else {
+ query = `
+ SELECT w.id, w.title, w.description, w.widget_type AS type, w.properties,
+ w.config, w.created_at AS createdAt, w.updated_at AS updatedAt
+ FROM ${OPENLIT_WIDGET_TABLE_NAME} w
+ ${widgetIds
+ ? `WHERE id IN (${widgetIds
+ .map((id) => `'${Sanitizer.sanitizeValue(id)}'`)
+ .join(",")})`
+ : ""
+ }
+ `;
+ }
+
+ const { data, err } = await dataCollector({ query });
+
+ if (err) {
+ return { err: err.toString() || getMessage().WIDGET_FETCH_FAILED };
+ }
+
+ return { data: (data as Array<DatabaseWidget>).map(normalizeWidgetToClient) };
+}
+
+export async function createWidget(widget: Widget, databaseConfigId?: string) {
+ const sanitizedWidget = sanitizeWidget(widget);
+
+ const { err, data } = await dataCollector(
+ {
+ table: OPENLIT_WIDGET_TABLE_NAME,
+ values: [
+ {
+ id: sanitizedWidget.id,
+ title: sanitizedWidget.title,
+ description: sanitizedWidget.description,
+ widget_type: sanitizedWidget.type,
+ properties: JSON.stringify(sanitizedWidget.properties || {}),
+ config: JSON.stringify(sanitizedWidget.config || {}),
+ },
+ ],
+ },
+ "insert",
+ databaseConfigId
+ );
+
+ // Extract the ID from the response
+ const queryId = (data as { query_id: string })?.query_id;
+
+ if (err || !queryId) {
+ return { err: err || getMessage().WIDGET_CREATE_FAILED };
+ }
+
+ // Get the created widget to return its ID
+ if (queryId) {
+ const result = await dataCollector({
+ query: `SELECT id, title, description, widget_type AS type, created_at AS createdAt, properties,
+ config, updated_at AS updatedAt FROM ${OPENLIT_WIDGET_TABLE_NAME} ORDER BY created_at DESC LIMIT 1`,
+ }, "query", databaseConfigId);
+
+ if (
+ !result.err &&
+ result.data &&
+ Array.isArray(result.data) &&
+ result.data.length > 0
+ ) {
+ return {
+ data: {
+ ...normalizeWidgetToClient(result.data[0] as DatabaseWidget),
+ },
+ };
+ }
+ }
+
+ return { err: getMessage().WIDGET_CREATE_FAILED };
+}
+
+export async function updateWidget(widget: Widget) {
+ const sanitizedWidget = sanitizeWidget(widget);
+
+ const updateValues = [
+ sanitizedWidget.title && `title = '${sanitizedWidget.title}'`,
+ sanitizedWidget.description &&
+ `description = '${sanitizedWidget.description}'`,
+ sanitizedWidget.type && `widget_type = '${sanitizedWidget.type}'`,
+ sanitizedWidget.properties &&
+ `properties = '${jsonStringify(sanitizedWidget.properties)}'`,
+ sanitizedWidget.config &&
+ `config = '${escapeSingleQuotes(jsonStringify(sanitizedWidget.config))}'`,
+ `updated_at = NOW()`,
+ ];
+
+ const query = `
+ ALTER TABLE ${OPENLIT_WIDGET_TABLE_NAME}
+ UPDATE
+ ${updateValues.filter((e) => e).join(" , ")}
+ WHERE id = '${sanitizedWidget.id}'
+ `;
+
+ const { err, data } = await dataCollector({ query }, "exec");
+
+ if (err || !(data as { query_id: string }).query_id) {
+ return { err: err || getMessage().WIDGET_UPDATE_FAILED };
+ }
+
+ return { data: getMessage().WIDGET_UPDATED_SUCCESSFULLY };
+}
+
+export function deleteWidget(id: string) {
+ const query = `
+ DELETE FROM ${OPENLIT_WIDGET_TABLE_NAME}
+ WHERE id = '${Sanitizer.sanitizeValue(id)}'
+ `;
+
+ return dataCollector({ query }, "exec");
+}
+
+export async function runWidgetQuery(
+ widgetId: string,
+ {
+ userQuery,
+ filter,
+ }: {
+ userQuery?: string;
+ filter: MetricParams;
+ }
+) {
+ const { data: widget, err: widgetErr } = await getWidgetById(widgetId);
+
+ if (widgetErr || !widget) {
+ return { err: getMessage().WIDGET_FETCH_FAILED };
+ }
+
+ const query = userQuery
+ ? userQuery
+ : widget.config?.query || "";
+
+ const exactQuery = mustache.render(query, { filter });
+
+ const { data, err } = await dataCollector({ query: exactQuery, enable_readonly: true });
+
+ if (err) {
+ return { err: err || getMessage().WIDGET_RUN_FAILED };
+ }
+
+ return { data };
+}
diff --git a/src/client/src/lib/posthog.ts b/src/client/src/lib/posthog.ts
index 3eab73e7..e8028219 100644
--- a/src/client/src/lib/posthog.ts
+++ b/src/client/src/lib/posthog.ts
@@ -3,16 +3,19 @@ import {
NEXT_PUBLIC_POSTHOG_API_KEY,
} from "@/constants/posthog";
import { consoleLog } from "@/utils/log";
+import { randomUUID } from "crypto";
import { PostHog } from "posthog-node";
export default class PostHogServer {
static client: PostHog;
+ static distinctId: string;
static createClient() {
this.client = new PostHog(NEXT_PUBLIC_POSTHOG_API_KEY, {
host: NEXT_PUBLIC_POSTHOG_API_HOST,
flushAt: 1,
flushInterval: 0,
});
+ this.distinctId = randomUUID();
}
static capture(options: Parameters<PostHog["capture"]>[0]) {
@@ -37,4 +40,23 @@ export default class PostHogServer {
consoleLog("Error capturing telemetry events:", error);
}
}
+
+ static fireEvent({
+ event,
+ properties = {},
+ startTimestamp,
+ }: {
+ event: string;
+ properties?: Record<string, any>;
+ startTimestamp: number;
+ }) {
+ PostHogServer.capture({
+ event,
+ distinctId: this.distinctId,
+ properties: {
+ ...properties,
+ responseTime: Date.now() - startTimestamp,
+ },
+ });
+ }
}
diff --git a/src/client/src/middleware.ts b/src/client/src/middleware.ts
index a53163cf..e00baf17 100644
--- a/src/client/src/middleware.ts
+++ b/src/client/src/middleware.ts
@@ -22,5 +22,8 @@ export const config = {
"/vault",
"/settings",
"/telemetry-enabled",
+ "/home",
+ "/dashboards/:path*",
+ "/d/:path*",
],
};
diff --git a/src/client/src/middleware/check-auth.ts b/src/client/src/middleware/check-auth.ts
index 90556439..05b07978 100644
--- a/src/client/src/middleware/check-auth.ts
+++ b/src/client/src/middleware/check-auth.ts
@@ -24,49 +24,71 @@ export default function checkAuth(next: NextMiddleware) {
return next(request, _next);
}
- const token = await getToken({ req: request });
- const isAuth = !!token;
- const isAllowedRequestWithoutToken =
- ALLOWED_OPENLIT_ROUTES_WITHOUT_TOKEN.includes(pathname);
- const isCronJobRoute = CRON_JOB_ROUTES.includes(pathname);
- const isAuthPage =
- pathname.startsWith("/login") || pathname.startsWith("/register");
- const isApiPage = pathname.startsWith("/api");
+ try {
+ const token = await getToken({ req: request });
+ const isAuth = !!token;
+ const isAllowedRequestWithoutToken =
+ ALLOWED_OPENLIT_ROUTES_WITHOUT_TOKEN.includes(pathname);
+ const isCronJobRoute = CRON_JOB_ROUTES.includes(pathname);
+ const isAuthPage =
+ pathname.startsWith("/login") || pathname.startsWith("/register");
+ const isApiPage = pathname.startsWith("/api");
- if (isAuthPage) {
- if (isAuth) {
- return NextResponse.redirect(
- new URL(DEFAULT_LOGGED_IN_ROUTE, request.url)
- );
- }
+ if (isAuthPage) {
+ if (isAuth) {
+ return NextResponse.redirect(
+ new URL(DEFAULT_LOGGED_IN_ROUTE, request.url)
+ );
+ }
- return NextResponse.next();
- }
+ return NextResponse.next();
+ }
- if (isApiPage) {
- if (isAuth || isAllowedRequestWithoutToken || isCronJobRoute) {
- if (isCronJobRoute) {
- const cronJobToken = request.headers.get("X-CRON-JOB");
- if (cronJobToken) {
- return NextResponse.next();
+ if (isApiPage) {
+ if (isAuth || isAllowedRequestWithoutToken || isCronJobRoute) {
+ if (isCronJobRoute) {
+ const cronJobToken = request.headers.get("X-CRON-JOB");
+ if (cronJobToken) {
+ return NextResponse.next();
+ }
}
+ return NextResponse.next();
}
- return NextResponse.next();
}
- }
- if (!isAuth) {
- let from = pathname;
- if (request.nextUrl.search) {
- from += request.nextUrl.search;
+ if (!isAuth) {
+ let from = pathname;
+ if (request.nextUrl.search) {
+ from += request.nextUrl.search;
+ }
+
+ return NextResponse.redirect(
+ new URL(`/login?callbackUrl=${encodeURIComponent(from)}`, request.url)
+ );
}
- return NextResponse.redirect(
- new URL(`/login?callbackUrl=${encodeURIComponent(from)}`, request.url)
- );
- }
+ return NextResponse.next();
+ } catch (error) {
+ // If there's an error getting the token (e.g., invalid/corrupted token),
+ // treat as unauthenticated and redirect to login
+ console.error("Auth middleware error:", error);
+
+ const isAuthPage =
+ pathname.startsWith("/login") || pathname.startsWith("/register");
+
+ if (!isAuthPage) {
+ let from = pathname;
+ if (request.nextUrl.search) {
+ from += request.nextUrl.search;
+ }
- return NextResponse.next();
+ return NextResponse.redirect(
+ new URL(`/login?callbackUrl=${encodeURIComponent(from)}`, request.url)
+ );
+ }
+
+ return NextResponse.next();
+ }
},
{
callbacks: {
diff --git a/src/client/src/selectors/dashboards.ts b/src/client/src/selectors/dashboards.ts
new file mode 100644
index 00000000..c30c8aba
--- /dev/null
+++ b/src/client/src/selectors/dashboards.ts
@@ -0,0 +1,10 @@
+import { useRootStore } from "@/store";
+
+export const useDashboardPageSearch = () => {
+ const store = useRootStore();
+ return store.dashboards.page.search;
+}
+export const useSetDashboardPageSearch = () => {
+ const store = useRootStore();
+ return store.dashboards.setPageSearch;
+}
\ No newline at end of file
diff --git a/src/client/src/selectors/filter.ts b/src/client/src/selectors/filter.ts
index a5f6c4ed..06d09a95 100644
--- a/src/client/src/selectors/filter.ts
+++ b/src/client/src/selectors/filter.ts
@@ -1,4 +1,7 @@
+import { useRootStore } from "@/store";
import { RootStore } from "@/types/store/root";
+import { useMemo } from "react";
+import { getFilterParamsForDashboard } from "@/helpers/client/filter";
export const getFilterDetails = (state: RootStore) => state.filter.details;
@@ -7,3 +10,7 @@ export const getUpdateFilter = (state: RootStore) => state.filter.updateFilter;
export const getFilterConfig = (state: RootStore) => state.filter.config;
export const getUpdateConfig = (state: RootStore) => state.filter.updateConfig;
+
+export const useFilters = () => {
+ return useRootStore((state: RootStore) => state.filter);
+};
diff --git a/src/client/src/selectors/page.ts b/src/client/src/selectors/page.ts
index 93967f50..cf135be4 100644
--- a/src/client/src/selectors/page.ts
+++ b/src/client/src/selectors/page.ts
@@ -1,5 +1,6 @@
import { RootStore } from "@/types/store/root";
import { PAGE, REQUEST_VISIBILITY_COLUMNS } from "@/types/store/page";
+import { useRootStore } from "@/store";
export const getDashboardType = (state: RootStore) => state.page.dashboard.type;
@@ -11,3 +12,16 @@ export const getVisibilityColumnsOfPage = (state: RootStore, pageName: PAGE) =>
).visibilityColumns;
export const setPageData = (state: RootStore) => state.page.setData;
+
+
+
+const getPageHeader = (state: RootStore) => state.page.header;
+
+const setPageHeader = (state: RootStore) => state.page.setHeader;
+
+export const usePageHeader = () => {
+ const header = useRootStore(getPageHeader);
+ const setHeader = useRootStore(setPageHeader);
+
+ return { header, setHeader };
+};
diff --git a/src/client/src/store/dashboards.ts b/src/client/src/store/dashboards.ts
new file mode 100644
index 00000000..92537082
--- /dev/null
+++ b/src/client/src/store/dashboards.ts
@@ -0,0 +1,20 @@
+"use client";
+import { DashboardStore } from "@/types/store/dashboards";
+import { lens } from "@dhmk/zustand-lens";
+
+
+export const dashboardStoreSlice: DashboardStore = lens(
+ (setStore, getStore) => ({
+ page: {
+ search: "",
+ },
+ setPageSearch: (search) =>
+ setStore(() => ({
+ ...getStore(),
+ page: {
+ ...getStore().page,
+ search,
+ },
+ })),
+ })
+);
diff --git a/src/client/src/store/index.ts b/src/client/src/store/index.ts
index 00e66caa..b2cd0527 100644
--- a/src/client/src/store/index.ts
+++ b/src/client/src/store/index.ts
@@ -7,6 +7,7 @@ import { databaseConfigStoreSlice } from "./database-config";
import { opengroundStoreSlice } from "./openground";
import { pageStoreSlice } from "./page";
import { RootStore } from "@/types/store/root";
+import { dashboardStoreSlice } from "./dashboards";
export const useRootStore = create<RootStore>()(
devtools(
@@ -16,6 +17,7 @@ export const useRootStore = create<RootStore>()(
databaseConfig: databaseConfigStoreSlice,
openground: opengroundStoreSlice,
page: pageStoreSlice,
+ dashboards: dashboardStoreSlice,
})
)
);
diff --git a/src/client/src/store/page.ts b/src/client/src/store/page.ts
index eb8cba7a..0b08993a 100644
--- a/src/client/src/store/page.ts
+++ b/src/client/src/store/page.ts
@@ -25,6 +25,16 @@ export const pageStoreSlice: PageStore = lens((setStore, getStore) => ({
exceptionType: true,
},
},
+ header: {
+ title: "",
+ breadcrumbs: [],
+ },
+ setHeader: (header) => {
+ setStore({
+ ...getStore(),
+ header,
+ });
+ },
setData: (page, keyPath, value) => {
const store = getStore();
let pageObject = cloneDeep(store[page as keyof typeof store]);
diff --git a/src/client/src/types/fetch-wrapper.ts b/src/client/src/types/fetch-wrapper.ts
index 630dc507..caad9d43 100644
--- a/src/client/src/types/fetch-wrapper.ts
+++ b/src/client/src/types/fetch-wrapper.ts
@@ -2,7 +2,7 @@ export type FetchWrapperProps = {
body?: string;
failureCb?: (s?: string) => void;
url: string;
- requestType: "GET" | "POST" | "DELETE" | "PUT";
+ requestType: "GET" | "POST" | "DELETE" | "PUT" | "PATCH";
responseDataKey?: string;
successCb?: (res?: any) => void;
};
diff --git a/src/client/src/types/manage-dashboard.ts b/src/client/src/types/manage-dashboard.ts
new file mode 100644
index 00000000..efc14902
--- /dev/null
+++ b/src/client/src/types/manage-dashboard.ts
@@ -0,0 +1,81 @@
+export type GridPosition = {
+ x: number;
+ y: number;
+ w: number;
+ h: number;
+};
+
+export type Board = {
+ id: string;
+ title: string;
+ description: string;
+ parentId: string | null;
+ isMainDashboard: boolean;
+ isPinned: boolean;
+ createdAt: string;
+ updatedAt: string;
+ widgets: BoardWidget[];
+ totalWidgets?: number;
+ tags: string;
+};
+
+export type Folder = {
+ id: string;
+ title: string;
+ description: string;
+ createdAt: string;
+ updatedAt: string;
+ parentId: string | null;
+ tags: string;
+};
+
+export type BoardWidget = {
+ id: string;
+ boardId: string;
+ widgetId: string;
+ createdAt: string;
+ updatedAt: string;
+ position: GridPosition;
+ widget: Widget;
+};
+
+export interface Widget {
+ id: string;
+ title: string;
+ description: string;
+ type: string;
+ properties: Record<string, any>;
+ config: Record<string, any>;
+ createdAt: string;
+ updatedAt: string;
+ totalBoards?: number;
+}
+
+export interface DatabaseWidget {
+ properties: string;
+ config: string;
+}
+
+export type FolderHeirarchy = Folder & {
+ boards: Board[];
+ children: DashboardHeirarchy[];
+ type: "folder";
+};
+
+export type BoardHeirarchy = Board & {
+ type: "board";
+};
+
+export type DashboardItemType = "folder" | "board";
+
+export interface DashboardHeirarchy {
+ id: string;
+ title: string;
+ description: string;
+ isMainDashboard?: boolean;
+ isPinned?: boolean;
+ tags: string;
+ type: DashboardItemType;
+ children?: DashboardHeirarchy[];
+ parentId?: string | null;
+}
diff --git a/src/client/src/types/store/dashboards.ts b/src/client/src/types/store/dashboards.ts
new file mode 100644
index 00000000..5451bba0
--- /dev/null
+++ b/src/client/src/types/store/dashboards.ts
@@ -0,0 +1,6 @@
+export type DashboardStore = {
+ page: {
+ search: string;
+ },
+ setPageSearch: (search: string) => void;
+};
diff --git a/src/client/src/types/store/page.ts b/src/client/src/types/store/page.ts
index c5836db6..6b7883d1 100644
--- a/src/client/src/types/store/page.ts
+++ b/src/client/src/types/store/page.ts
@@ -26,4 +26,20 @@ export type PageStore = {
visibilityColumns: Partial<REQUEST_VISIBILITY_COLUMNS>;
};
setData: (p: PAGE, keyPath: string, value: unknown) => void;
+ header: {
+ title: string;
+ description?: string;
+ breadcrumbs: {
+ title: string;
+ href: string;
+ }[];
+ },
+ setHeader: (header: {
+ title: string;
+ description?: string;
+ breadcrumbs: {
+ title: string;
+ href: string;
+ }[];
+ }) => void;
};
\ No newline at end of file
diff --git a/src/client/src/types/store/root.ts b/src/client/src/types/store/root.ts
index 8dbfff8e..306a55d5 100644
--- a/src/client/src/types/store/root.ts
+++ b/src/client/src/types/store/root.ts
@@ -3,6 +3,7 @@ import { FilterStore } from "@/types/store/filter";
import { DatabaseConfigStore } from "@/types/store/database-config";
import { OpengroundStore } from "@/types/store/openground";
import { PageStore } from "@/types/store/page";
+import { DashboardStore } from "./dashboards";
export type RootStore = {
user: UserStore;
@@ -10,4 +11,5 @@ export type RootStore = {
databaseConfig: DatabaseConfigStore;
openground: OpengroundStore;
page: PageStore;
+ dashboards: DashboardStore;
};
diff --git a/src/client/src/utils/api.ts b/src/client/src/utils/api.ts
index d6031876..8e6b0283 100644
--- a/src/client/src/utils/api.ts
+++ b/src/client/src/utils/api.ts
@@ -1,6 +1,6 @@
type GET_DATA = {
body?: string;
- method?: "GET" | "POST" | "PUT";
+ method?: "GET" | "POST" | "PUT" | "PATCH";
url: string;
};
diff --git a/src/client/src/utils/hooks/useFetchWrapper.ts b/src/client/src/utils/hooks/useFetchWrapper.ts
index e5bcc822..4b95c4be 100644
--- a/src/client/src/utils/hooks/useFetchWrapper.ts
+++ b/src/client/src/utils/hooks/useFetchWrapper.ts
@@ -18,14 +18,16 @@ export default function useFetchWrapper<T>() {
responseDataKey = "",
successCb,
}: FetchWrapperProps) => {
+ let response;
+ let error;
setIsLoading(true);
setError(null);
try {
- let response;
if (
requestType === "GET" ||
requestType === "POST" ||
- requestType === "PUT"
+ requestType === "PUT" ||
+ requestType === "PATCH"
) {
response = await getData({
body,
@@ -48,6 +50,7 @@ export default function useFetchWrapper<T>() {
if (typeof successCb === "function") successCb(finalResponse);
}
} catch (error) {
+ error = error;
const updatedError = (error as any).toString().replaceAll("Error:", "");
setError(updatedError);
setData(null);
@@ -56,6 +59,8 @@ export default function useFetchWrapper<T>() {
setIsLoading(false);
setIsFetched(true);
+
+ return { response, error };
},
[setData, setError, setIsFetched, setIsLoading]
);
diff --git a/src/client/src/utils/json.ts b/src/client/src/utils/json.ts
index c4bd13c3..7eb04528 100644
--- a/src/client/src/utils/json.ts
+++ b/src/client/src/utils/json.ts
@@ -5,7 +5,7 @@ export function jsonStringify(json: any) {
const jsonS = JSON.stringify(json);
return jsonS;
} catch (e) {
- consoleLog(e);
+ consoleLog(e, json);
return "";
}
}
diff --git a/src/client/src/utils/sanitizer.ts b/src/client/src/utils/sanitizer.ts
index 0c0e19b5..7c8722d7 100644
--- a/src/client/src/utils/sanitizer.ts
+++ b/src/client/src/utils/sanitizer.ts
@@ -8,7 +8,13 @@ export default class Sanitizer {
const v = objectKeys(obj).reduce((acc: Partial<T>, key) => {
let value: T[keyof T] = obj[key];
if (isArray(value)) {
- value = value.map((val) => Sanitizer.sanitizeValue(val)) as T[keyof T];
+ value = value.map((val) => {
+ if (isObject(val)) {
+ return Sanitizer.sanitizeObject(val);
+ } else {
+ return Sanitizer.sanitizeValue(val);
+ }
+ }) as T[keyof T];
} else if (isObject(value)) {
value = Sanitizer.sanitizeObject(value);
} else {
@@ -21,6 +27,9 @@ export default class Sanitizer {
}
static sanitizeValue<T>(value: T): T {
if (!isNil(value)) {
+ if (typeof value === "boolean") {
+ return value as T;
+ }
if (typeof value === "string") {
return sqlString.escape(value).slice(1, -1) as T; // Remove outer quotes and escape the string
} else {