mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-4484] Quick notifications (#4688)
* quick notifications (info, error, warning) * update code docs
This commit is contained in:
@@ -85,4 +85,40 @@ export class NotificationService {
|
||||
dismissSnackMessageAction() {
|
||||
return this.snackBar.dismiss();
|
||||
}
|
||||
|
||||
protected showMessage(message: string, panelClass: string, action?: string): MatSnackBarRef<any> {
|
||||
message = this.translationService.instant(message);
|
||||
|
||||
return this.snackBar.open(message, action, {
|
||||
duration: this.DEFAULT_DURATION_MESSAGE,
|
||||
panelClass
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Rase error message
|
||||
* @param message Text message or translation key for the message.
|
||||
* @param action (optional) Action name
|
||||
*/
|
||||
showError(message: string, action?: string): MatSnackBarRef<any> {
|
||||
return this.showMessage(message, 'adf-error-snackbar', action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rase info message
|
||||
* @param message Text message or translation key for the message.
|
||||
* @param action (optional) Action name
|
||||
*/
|
||||
showInfo(message: string, action?: string): MatSnackBarRef<any> {
|
||||
return this.showMessage(message, 'adf-info-snackbar', action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rase warning message
|
||||
* @param message Text message or translation key for the message.
|
||||
* @param action (optional) Action name
|
||||
*/
|
||||
showWarning(message: string, action?: string): MatSnackBarRef<any> {
|
||||
return this.showMessage(message, 'adf-warning-snackbar', action);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user