Commit 82b33d42 by Ooh-Ao

dashboard

parent 60f86e50
......@@ -294,6 +294,7 @@ export class DashboardManagementComponent implements OnInit {
}
addWidgetToDashboard(menuItem: MenuItemsWidget): void {
console.log('Adding widget to dashboard:', menuItem);
if (!this.dashboardData) {
this.notificationService.warning('Warning', 'Please select or create a dashboard first.');
return;
......@@ -301,7 +302,9 @@ export class DashboardManagementComponent implements OnInit {
// Create a new widget instance from the menu item's widget template
const newWidgetInstance = new WidgetModel(menuItem.widget);
if(menuItem.config) {
newWidgetInstance.config = menuItem.config;
}
// Ensure the config is an object
if (typeof newWidgetInstance.config === 'string') {
try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment