Commit 126de83b by Ooh-Ao

เอา popup ออก

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