mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-5416] remove internal notification icon pipe (#8659)
This commit is contained in:
@@ -43,8 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<ng-template #no_avatar>
|
<ng-template #no_avatar>
|
||||||
<mat-icon mat-list-icon
|
<mat-icon mat-list-icon
|
||||||
class="adf-notification-history-menu-initiator">{{ notification | notificationIcon
|
class="adf-notification-history-menu-initiator">{{notification.icon}}</mat-icon>
|
||||||
}}</mat-icon>
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<p class="adf-notification-history-menu-message"
|
<p class="adf-notification-history-menu-message"
|
||||||
*ngFor="let message of notification.messages"
|
*ngFor="let message of notification.messages"
|
||||||
|
@@ -52,7 +52,7 @@ export class NotificationHistoryComponent implements OnDestroy, OnInit, AfterVie
|
|||||||
|
|
||||||
onDestroy$ = new Subject<boolean>();
|
onDestroy$ = new Subject<boolean>();
|
||||||
notifications: NotificationModel[] = [];
|
notifications: NotificationModel[] = [];
|
||||||
paginatedNotifications = [];
|
paginatedNotifications: NotificationModel[] = [];
|
||||||
pagination: PaginationModel;
|
pagination: PaginationModel;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@@ -28,6 +28,7 @@ export const rootInitiator: NotificationInitiator = {
|
|||||||
|
|
||||||
export const info = (messages: string | string[], initiator: NotificationInitiator = rootInitiator): NotificationModel => ({
|
export const info = (messages: string | string[], initiator: NotificationInitiator = rootInitiator): NotificationModel => ({
|
||||||
type: NOTIFICATION_TYPE.INFO,
|
type: NOTIFICATION_TYPE.INFO,
|
||||||
|
icon: 'info',
|
||||||
datetime: new Date(),
|
datetime: new Date(),
|
||||||
initiator,
|
initiator,
|
||||||
messages: [].concat(messages)
|
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 => ({
|
export const warning = (messages: string | string[], initiator: NotificationInitiator = rootInitiator): NotificationModel => ({
|
||||||
type: NOTIFICATION_TYPE.WARN,
|
type: NOTIFICATION_TYPE.WARN,
|
||||||
|
icon: 'warning',
|
||||||
datetime: new Date(),
|
datetime: new Date(),
|
||||||
initiator,
|
initiator,
|
||||||
messages: [].concat(messages)
|
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 => ({
|
export const error = (messages: string | string[], initiator: NotificationInitiator = rootInitiator): NotificationModel => ({
|
||||||
type: NOTIFICATION_TYPE.ERROR,
|
type: NOTIFICATION_TYPE.ERROR,
|
||||||
|
icon: 'error',
|
||||||
datetime: new Date(),
|
datetime: new Date(),
|
||||||
initiator,
|
initiator,
|
||||||
messages: [].concat(messages)
|
messages: [].concat(messages)
|
||||||
|
@@ -21,7 +21,6 @@ import { MaterialModule } from '../material.module';
|
|||||||
import { PipeModule } from '../pipes/pipe.module';
|
import { PipeModule } from '../pipes/pipe.module';
|
||||||
import { NotificationHistoryComponent } from './components/notification-history.component';
|
import { NotificationHistoryComponent } from './components/notification-history.component';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { NotificationIconPipe } from './pipes/notification-icon.pipe';
|
|
||||||
import { PaginationModule } from '../pagination/pagination.module';
|
import { PaginationModule } from '../pagination/pagination.module';
|
||||||
import { AddNotificationStorybookComponent } from './components/add-notification.stories.component';
|
import { AddNotificationStorybookComponent } from './components/add-notification.stories.component';
|
||||||
|
|
||||||
@@ -35,8 +34,7 @@ import { AddNotificationStorybookComponent } from './components/add-notification
|
|||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
NotificationHistoryComponent,
|
NotificationHistoryComponent,
|
||||||
AddNotificationStorybookComponent,
|
AddNotificationStorybookComponent
|
||||||
NotificationIconPipe
|
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
NotificationHistoryComponent,
|
NotificationHistoryComponent,
|
||||||
|
@@ -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';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user