Commit 126de83b by Ooh-Ao

เอา popup ออก

parent 1d851225
......@@ -225,7 +225,7 @@ export class DashboardManagementComponent implements OnInit {
if (dashboard.datasetId) {
this.dashboardStateService.selectDataset(dashboard.datasetId);
}
this.notificationService.success('Success', 'Dashboard loaded successfully!');
// this.notificationService.success('Success', 'Dashboard loaded successfully!');
}
});
}
......@@ -241,14 +241,23 @@ export class DashboardManagementComponent implements OnInit {
widgets: []
});
this.dashboardDataService.saveDashboard(newDashboard).pipe(
switchMap(addedDashboard => {
// After saving, refetch the list of all dashboards
return this.dashboardDataService.getDashboards().pipe(
map(dashboards => ({
addedDashboard,
dashboards
}))
);
}),
catchError(error => {
this.notificationService.error('Error', 'Failed to create new dashboard.');
return throwError(() => error);
})
).subscribe(addedDashboard => {
this.userDashboards.push(addedDashboard);
this.selectedDashboardId = addedDashboard;
this.loadSelectedDashboard();
).subscribe(({ addedDashboard, dashboards }) => {
this.userDashboards = dashboards; // Update the local list with the fresh list
this.selectedDashboardId = addedDashboard; // Select the new dashboard
this.loadSelectedDashboard(); // Load the new dashboard
this.notificationService.success('Success', 'New dashboard created successfully!');
});
}
......@@ -262,7 +271,7 @@ export class DashboardManagementComponent implements OnInit {
return throwError(() => error);
})
).subscribe(() => {
this.notificationService.success('Success', 'Dashboard name saved successfully!');
// this.notificationService.success('Success', 'Dashboard name saved successfully!');
});
}
}
......@@ -319,7 +328,7 @@ export class DashboardManagementComponent implements OnInit {
return throwError(() => error);
})
).subscribe(() => {
this.notificationService.success('Success', 'Dashboard layout saved successfully!');
// this.notificationService.success('Success', 'Dashboard layout saved successfully!');
this.loadSelectedDashboard();
});
}
......@@ -347,7 +356,7 @@ export class DashboardManagementComponent implements OnInit {
this.dashboardData!.widgets.push(newWidgetInstance);
this.panels = this.mapWidgetsToPanels(this.dashboardData!.widgets);
this.notificationService.info('Info', `Added widget: ${widget.thName}`);
// this.notificationService.info('Info', `Added widget: ${widget.thName}`);
});
}
......@@ -371,7 +380,7 @@ export class DashboardManagementComponent implements OnInit {
const updatedDashboard = { ...this.dashboardData, widgets: this.dashboardData.widgets.filter(w => w.widgetId !== panelId) };
this.dashboardData = updatedDashboard;
this.panels = this.mapWidgetsToPanels(updatedDashboard.widgets);
this.notificationService.info('Info', 'Widget removed from dashboard.');
// this.notificationService.info('Info', 'Widget removed from dashboard.');
}
}
......
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