From e20713288c56b6d7ed96d217749790e1d3679b46 Mon Sep 17 00:00:00 2001 From: juancarmore Date: Thu, 28 Aug 2025 20:22:53 +0200 Subject: [PATCH] frontend: replace showAlert with showSnackbar for error notifications --- .../recordings/recordings.component.ts | 2 +- .../pages/console/rooms/rooms.component.ts | 24 +++++++------------ .../room-recordings.component.ts | 2 +- .../src/lib/services/notification.service.ts | 17 ++++++------- 4 files changed, 19 insertions(+), 26 deletions(-) diff --git a/frontend/projects/shared-meet-components/src/lib/pages/console/recordings/recordings.component.ts b/frontend/projects/shared-meet-components/src/lib/pages/console/recordings/recordings.component.ts index a3286d3..7435732 100644 --- a/frontend/projects/shared-meet-components/src/lib/pages/console/recordings/recordings.component.ts +++ b/frontend/projects/shared-meet-components/src/lib/pages/console/recordings/recordings.component.ts @@ -122,7 +122,7 @@ export class RecordingsComponent implements OnInit { this.nextPageToken = response.pagination.nextPageToken; this.hasMoreRecordings = response.pagination.isTruncated; } catch (error) { - this.notificationService.showAlert('Failed to load recordings'); + this.notificationService.showSnackbar('Failed to load recordings'); this.log.e('Error loading recordings:', error); } finally { clearTimeout(delayLoader); diff --git a/frontend/projects/shared-meet-components/src/lib/pages/console/rooms/rooms.component.ts b/frontend/projects/shared-meet-components/src/lib/pages/console/rooms/rooms.component.ts index bb64330..673aa20 100644 --- a/frontend/projects/shared-meet-components/src/lib/pages/console/rooms/rooms.component.ts +++ b/frontend/projects/shared-meet-components/src/lib/pages/console/rooms/rooms.component.ts @@ -154,7 +154,7 @@ export class RoomsComponent implements OnInit { this.nextPageToken = response.pagination.nextPageToken; this.hasMoreRooms = response.pagination.isTruncated; } catch (error) { - this.notificationService.showAlert('Error loading rooms'); + this.notificationService.showSnackbar('Error loading rooms'); this.log.e('Error loading rooms:', error); } finally { clearTimeout(delayLoader); @@ -226,7 +226,7 @@ export class RoomsComponent implements OnInit { try { await this.navigationService.navigateTo('rooms/new'); } catch (error) { - this.notificationService.showAlert('Error creating room'); + this.notificationService.showSnackbar('Error creating room'); this.log.e('Error creating room:', error); return; } @@ -237,18 +237,10 @@ export class RoomsComponent implements OnInit { } private async editRoomPreferences(room: MeetRoom) { - // Check if room is marked for deletion - if (room.markedForDeletion) { - this.notificationService.showAlert( - 'Room preferences cannot be modified. This room is marked for deletion.' - ); - return; - } - try { await this.navigationService.navigateTo(`rooms/${room.roomId}/edit`); } catch (error) { - this.notificationService.showAlert('Error navigating to room preferences'); + this.notificationService.showSnackbar('Error navigating to room preferences'); this.log.e('Error navigating to room preferences:', error); } } @@ -268,7 +260,7 @@ export class RoomsComponent implements OnInit { try { await this.navigationService.navigateTo('recordings', { 'room-id': room.roomId }); } catch (error) { - this.notificationService.showAlert('Error navigating to recordings'); + this.notificationService.showSnackbar('Error navigating to recordings'); this.log.e('Error navigating to recordings:', error); } } @@ -293,7 +285,7 @@ export class RoomsComponent implements OnInit { // this.dataSource.data = this.rooms(); this.notificationService.showSnackbar('Room deleted successfully'); } catch (error) { - this.notificationService.showAlert('Failed to delete room'); + this.notificationService.showSnackbar('Failed to delete room'); this.log.e('Error deleting room:', error); } }; @@ -306,7 +298,7 @@ export class RoomsComponent implements OnInit { this.rooms.set(currentRooms.filter((r) => r.roomId !== roomId)); this.notificationService.showSnackbar('Room force deleted successfully'); } catch (error) { - this.notificationService.showAlert('Failed to force delete room'); + this.notificationService.showSnackbar('Failed to force delete room'); this.log.e('Error force deleting room:', error); } }; @@ -374,7 +366,7 @@ export class RoomsComponent implements OnInit { break; } } catch (error) { - this.notificationService.showAlert('Failed to delete rooms'); + this.notificationService.showSnackbar('Failed to delete rooms'); this.log.e('Error deleting rooms:', error); } }; @@ -388,7 +380,7 @@ export class RoomsComponent implements OnInit { this.rooms.set(currentRooms.filter((r) => !roomIds.includes(r.roomId))); this.notificationService.showSnackbar('All rooms force deleted successfully'); } catch (error) { - this.notificationService.showAlert('Failed to force delete rooms'); + this.notificationService.showSnackbar('Failed to force delete rooms'); this.log.e('Error force deleting rooms:', error); } }; diff --git a/frontend/projects/shared-meet-components/src/lib/pages/room-recordings/room-recordings.component.ts b/frontend/projects/shared-meet-components/src/lib/pages/room-recordings/room-recordings.component.ts index 2d42e33..a55d46f 100644 --- a/frontend/projects/shared-meet-components/src/lib/pages/room-recordings/room-recordings.component.ts +++ b/frontend/projects/shared-meet-components/src/lib/pages/room-recordings/room-recordings.component.ts @@ -134,7 +134,7 @@ export class RoomRecordingsComponent implements OnInit { this.nextPageToken = response.pagination.nextPageToken; this.hasMoreRecordings = response.pagination.isTruncated; } catch (error) { - this.notificationService.showAlert('Failed to load recordings'); + this.notificationService.showSnackbar('Failed to load recordings'); this.log.e('Error loading recordings:', error); } finally { clearTimeout(delayLoader); diff --git a/frontend/projects/shared-meet-components/src/lib/services/notification.service.ts b/frontend/projects/shared-meet-components/src/lib/services/notification.service.ts index 40b7667..7105c65 100644 --- a/frontend/projects/shared-meet-components/src/lib/services/notification.service.ts +++ b/frontend/projects/shared-meet-components/src/lib/services/notification.service.ts @@ -44,6 +44,7 @@ export class NotificationService { panelClass: 'custom-snackbar' }); } + showDialog(options: DialogOptions): void { this.dialog.open(DialogComponent, { data: options, @@ -53,13 +54,13 @@ export class NotificationService { } showAlert(message: string): void { - // this.dialog.open(AlertDialogComponent, { - // data: { - // message, - // confirmText: 'OK' - // }, - // width: '300px', - // disableClose: true - // }); + this.dialog.open(DialogComponent, { + data: { + message, + confirmText: 'OK' + }, + width: '300px', + disableClose: true + }); } }