frontend: replace showAlert with showSnackbar for error notifications

This commit is contained in:
juancarmore 2025-08-28 20:22:53 +02:00
parent 0125fc0934
commit e20713288c
4 changed files with 19 additions and 26 deletions

View File

@ -122,7 +122,7 @@ export class RecordingsComponent implements OnInit {
this.nextPageToken = response.pagination.nextPageToken; this.nextPageToken = response.pagination.nextPageToken;
this.hasMoreRecordings = response.pagination.isTruncated; this.hasMoreRecordings = response.pagination.isTruncated;
} catch (error) { } catch (error) {
this.notificationService.showAlert('Failed to load recordings'); this.notificationService.showSnackbar('Failed to load recordings');
this.log.e('Error loading recordings:', error); this.log.e('Error loading recordings:', error);
} finally { } finally {
clearTimeout(delayLoader); clearTimeout(delayLoader);

View File

@ -154,7 +154,7 @@ export class RoomsComponent implements OnInit {
this.nextPageToken = response.pagination.nextPageToken; this.nextPageToken = response.pagination.nextPageToken;
this.hasMoreRooms = response.pagination.isTruncated; this.hasMoreRooms = response.pagination.isTruncated;
} catch (error) { } catch (error) {
this.notificationService.showAlert('Error loading rooms'); this.notificationService.showSnackbar('Error loading rooms');
this.log.e('Error loading rooms:', error); this.log.e('Error loading rooms:', error);
} finally { } finally {
clearTimeout(delayLoader); clearTimeout(delayLoader);
@ -226,7 +226,7 @@ export class RoomsComponent implements OnInit {
try { try {
await this.navigationService.navigateTo('rooms/new'); await this.navigationService.navigateTo('rooms/new');
} catch (error) { } catch (error) {
this.notificationService.showAlert('Error creating room'); this.notificationService.showSnackbar('Error creating room');
this.log.e('Error creating room:', error); this.log.e('Error creating room:', error);
return; return;
} }
@ -237,18 +237,10 @@ export class RoomsComponent implements OnInit {
} }
private async editRoomPreferences(room: MeetRoom) { 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 { try {
await this.navigationService.navigateTo(`rooms/${room.roomId}/edit`); await this.navigationService.navigateTo(`rooms/${room.roomId}/edit`);
} catch (error) { } 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); this.log.e('Error navigating to room preferences:', error);
} }
} }
@ -268,7 +260,7 @@ export class RoomsComponent implements OnInit {
try { try {
await this.navigationService.navigateTo('recordings', { 'room-id': room.roomId }); await this.navigationService.navigateTo('recordings', { 'room-id': room.roomId });
} catch (error) { } catch (error) {
this.notificationService.showAlert('Error navigating to recordings'); this.notificationService.showSnackbar('Error navigating to recordings');
this.log.e('Error navigating to recordings:', error); this.log.e('Error navigating to recordings:', error);
} }
} }
@ -293,7 +285,7 @@ export class RoomsComponent implements OnInit {
// this.dataSource.data = this.rooms(); // this.dataSource.data = this.rooms();
this.notificationService.showSnackbar('Room deleted successfully'); this.notificationService.showSnackbar('Room deleted successfully');
} catch (error) { } catch (error) {
this.notificationService.showAlert('Failed to delete room'); this.notificationService.showSnackbar('Failed to delete room');
this.log.e('Error deleting room:', error); 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.rooms.set(currentRooms.filter((r) => r.roomId !== roomId));
this.notificationService.showSnackbar('Room force deleted successfully'); this.notificationService.showSnackbar('Room force deleted successfully');
} catch (error) { } 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); this.log.e('Error force deleting room:', error);
} }
}; };
@ -374,7 +366,7 @@ export class RoomsComponent implements OnInit {
break; break;
} }
} catch (error) { } catch (error) {
this.notificationService.showAlert('Failed to delete rooms'); this.notificationService.showSnackbar('Failed to delete rooms');
this.log.e('Error deleting rooms:', error); 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.rooms.set(currentRooms.filter((r) => !roomIds.includes(r.roomId)));
this.notificationService.showSnackbar('All rooms force deleted successfully'); this.notificationService.showSnackbar('All rooms force deleted successfully');
} catch (error) { } 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); this.log.e('Error force deleting rooms:', error);
} }
}; };

View File

@ -134,7 +134,7 @@ export class RoomRecordingsComponent implements OnInit {
this.nextPageToken = response.pagination.nextPageToken; this.nextPageToken = response.pagination.nextPageToken;
this.hasMoreRecordings = response.pagination.isTruncated; this.hasMoreRecordings = response.pagination.isTruncated;
} catch (error) { } catch (error) {
this.notificationService.showAlert('Failed to load recordings'); this.notificationService.showSnackbar('Failed to load recordings');
this.log.e('Error loading recordings:', error); this.log.e('Error loading recordings:', error);
} finally { } finally {
clearTimeout(delayLoader); clearTimeout(delayLoader);

View File

@ -44,6 +44,7 @@ export class NotificationService {
panelClass: 'custom-snackbar' panelClass: 'custom-snackbar'
}); });
} }
showDialog(options: DialogOptions): void { showDialog(options: DialogOptions): void {
this.dialog.open(DialogComponent, { this.dialog.open(DialogComponent, {
data: options, data: options,
@ -53,13 +54,13 @@ export class NotificationService {
} }
showAlert(message: string): void { showAlert(message: string): void {
// this.dialog.open(AlertDialogComponent, { this.dialog.open(DialogComponent, {
// data: { data: {
// message, message,
// confirmText: 'OK' confirmText: 'OK'
// }, },
// width: '300px', width: '300px',
// disableClose: true disableClose: true
// }); });
} }
} }