From 0e4a34a0cf7ebd15ad2626abf556f42fc1f30fb5 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Tue, 3 Dec 2019 11:28:50 -0700 Subject: [PATCH] SHIBUI-1665 Made notifications announce --- ui/src/app/metadata/provider/effect/collection.effect.ts | 1 + .../notification/component/notification-item.component.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/src/app/metadata/provider/effect/collection.effect.ts b/ui/src/app/metadata/provider/effect/collection.effect.ts index 1eb9e5093..70aff3257 100644 --- a/ui/src/app/metadata/provider/effect/collection.effect.ts +++ b/ui/src/app/metadata/provider/effect/collection.effect.ts @@ -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( diff --git a/ui/src/app/notification/component/notification-item.component.ts b/ui/src/app/notification/component/notification-item.component.ts index bc7b93e27..b080724e5 100644 --- a/ui/src/app/notification/component/notification-item.component.ts +++ b/ui/src/app/notification/component/notification-item.component.ts @@ -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', @@ -10,11 +11,15 @@ export class NotificationItemComponent implements OnInit { @Input() notification: Notification; @Output() clear: EventEmitter = new EventEmitter(); 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 */