From dd3285511e871e4ad6ad5e81793ec99958020d5e Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 13 Jun 2023 17:09:05 +0100 Subject: [PATCH] [ACS-5416] remove internal notification icon pipe (#8659) --- .../notification-history.component.html | 3 +- .../notification-history.component.ts | 2 +- .../helpers/notification.factory.ts | 3 ++ .../notification-history.module.ts | 4 +- .../pipes/notification-icon.pipe.ts | 40 ------------------- 5 files changed, 6 insertions(+), 46 deletions(-) delete mode 100644 lib/core/src/lib/notifications/pipes/notification-icon.pipe.ts diff --git a/lib/core/src/lib/notifications/components/notification-history.component.html b/lib/core/src/lib/notifications/components/notification-history.component.html index 670778b628..8085129315 100644 --- a/lib/core/src/lib/notifications/components/notification-history.component.html +++ b/lib/core/src/lib/notifications/components/notification-history.component.html @@ -43,8 +43,7 @@ {{ notification | notificationIcon - }} + class="adf-notification-history-menu-initiator">{{notification.icon}}

(); notifications: NotificationModel[] = []; - paginatedNotifications = []; + paginatedNotifications: NotificationModel[] = []; pagination: PaginationModel; constructor( diff --git a/lib/core/src/lib/notifications/helpers/notification.factory.ts b/lib/core/src/lib/notifications/helpers/notification.factory.ts index 0b45b0570c..0c11a9889a 100644 --- a/lib/core/src/lib/notifications/helpers/notification.factory.ts +++ b/lib/core/src/lib/notifications/helpers/notification.factory.ts @@ -28,6 +28,7 @@ export const rootInitiator: NotificationInitiator = { export const info = (messages: string | string[], initiator: NotificationInitiator = rootInitiator): NotificationModel => ({ type: NOTIFICATION_TYPE.INFO, + icon: 'info', datetime: new Date(), initiator, messages: [].concat(messages) @@ -35,6 +36,7 @@ export const info = (messages: string | string[], initiator: NotificationInitiat export const warning = (messages: string | string[], initiator: NotificationInitiator = rootInitiator): NotificationModel => ({ type: NOTIFICATION_TYPE.WARN, + icon: 'warning', datetime: new Date(), initiator, messages: [].concat(messages) @@ -42,6 +44,7 @@ export const warning = (messages: string | string[], initiator: NotificationInit export const error = (messages: string | string[], initiator: NotificationInitiator = rootInitiator): NotificationModel => ({ type: NOTIFICATION_TYPE.ERROR, + icon: 'error', datetime: new Date(), initiator, messages: [].concat(messages) diff --git a/lib/core/src/lib/notifications/notification-history.module.ts b/lib/core/src/lib/notifications/notification-history.module.ts index 335f00090a..351c490a97 100644 --- a/lib/core/src/lib/notifications/notification-history.module.ts +++ b/lib/core/src/lib/notifications/notification-history.module.ts @@ -21,7 +21,6 @@ import { MaterialModule } from '../material.module'; import { PipeModule } from '../pipes/pipe.module'; import { NotificationHistoryComponent } from './components/notification-history.component'; import { TranslateModule } from '@ngx-translate/core'; -import { NotificationIconPipe } from './pipes/notification-icon.pipe'; import { PaginationModule } from '../pagination/pagination.module'; import { AddNotificationStorybookComponent } from './components/add-notification.stories.component'; @@ -35,8 +34,7 @@ import { AddNotificationStorybookComponent } from './components/add-notification ], declarations: [ NotificationHistoryComponent, - AddNotificationStorybookComponent, - NotificationIconPipe + AddNotificationStorybookComponent ], exports: [ NotificationHistoryComponent, diff --git a/lib/core/src/lib/notifications/pipes/notification-icon.pipe.ts b/lib/core/src/lib/notifications/pipes/notification-icon.pipe.ts deleted file mode 100644 index 720777350f..0000000000 --- a/lib/core/src/lib/notifications/pipes/notification-icon.pipe.ts +++ /dev/null @@ -1,40 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Pipe, PipeTransform } from '@angular/core'; -import { NotificationModel, NOTIFICATION_TYPE } from '../models/notification.model'; - -@Pipe({ - name: 'notificationIcon' -}) -export class NotificationIconPipe implements PipeTransform { - - transform(notification: NotificationModel): string { - if (notification.icon) { - return notification.icon; - } else { - switch (notification.type) { - case NOTIFICATION_TYPE.ERROR: - return 'error'; - case NOTIFICATION_TYPE.WARN: - return 'warning'; - default: - return 'info'; - } - } - } -}