Skip to content

Commit

Permalink
Merged in bugfix/SHIBUI-1665 (pull request #444)
Browse files Browse the repository at this point in the history
SHIBUI-1665 Made notifications announce

Approved-by: Ryan Mathis <rmathis@unicon.net>
  • Loading branch information
rmathis committed Dec 3, 2019
2 parents 5c3977a + 0e4a34a commit f48a3c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions ui/src/app/metadata/provider/effect/collection.effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export class CollectionEffects {
map(action => action.payload),
withLatestFrom(this.store.select(fromI18n.getMessages)),
map(([error, messages]) => {
console.log(error);
let message = `${error.errorCode}: ${this.i18nService.translate(error.errorMessage, null, messages)}`;
message = error.cause ? `${message} - ${error.cause}` : message;
return new AddNotification(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
import { Notification } from '../model/notification';
import { LiveAnnouncer } from '@angular/cdk/a11y';

@Component({
selector: 'notification-item',
Expand All @@ -10,11 +11,15 @@ export class NotificationItemComponent implements OnInit {
@Input() notification: Notification;
@Output() clear: EventEmitter<Notification> = new EventEmitter<Notification>();
readonly timerCallback = () => this.clear.emit(this.notification);
constructor() {}
constructor(
private announce: LiveAnnouncer
) {}

ngOnInit(): void {
if (this.notification.timeout > 0) {
setTimeout(this.timerCallback, this.notification.timeout);
}

this.announce.announce(`Error: ${this.notification.body}`);
}
} /* istanbul ignore next */

0 comments on commit f48a3c3

Please sign in to comment.