From 479159ff861df3a0160f5284686183c134757715 Mon Sep 17 00:00:00 2001 From: amentis Date: Thu, 11 Jan 2024 17:59:27 +0200 Subject: [PATCH] add notifications listing ui --- .../controllers/NotificationController.java | 3 +- .../cite/notification/model/Notification.java | 63 ++++- .../model/builder/NotificationBuilder.java | 5 + .../notification/query/NotificationQuery.java | 16 +- .../query/lookup/NotificationLookup.java | 32 ++- .../lookup/NotificationTemplateLookup.java | 11 + dmp-frontend/src/app/app-routing.module.ts | 12 + .../common/enum/notification-contact-type.ts | 4 + .../common/enum/notification-notify-state.ts | 7 + .../enum/notification-tracking-process.ts | 7 + .../enum/notification-tracking-state.ts | 10 + .../app/core/common/enum/permission.enum.ts | 1 + .../src/app/core/core-service.module.ts | 4 +- .../model/notification/notification.model.ts | 22 ++ .../query/notification-template.lookup.ts | 3 + .../src/app/core/query/notification.lookup.ts | 36 +++ .../notification/notification-service.ts | 34 +++ .../services/utilities/enum-utils.service.ts | 44 ++++ ...on-template-listing-filters.component.html | 20 +- ...tion-template-listing-filters.component.ts | 16 +- ...tification-template-listing.component.html | 46 ++-- ...tification-template-listing.component.scss | 2 +- ...notification-template-listing.component.ts | 22 +- ...otification-listing-filters.component.html | 76 ++++++ ...otification-listing-filters.component.scss | 21 ++ .../notification-listing-filters.component.ts | 124 ++++++++++ .../notification-listing.component.html | 92 +++++++ .../notification-listing.component.scss | 27 +++ .../notification-listing.component.ts | 224 ++++++++++++++++++ .../admin/notification/notification.module.ts | 41 ++++ .../notification/notification.routing.ts | 20 ++ .../src/app/ui/sidebar/sidebar.component.ts | 1 + dmp-frontend/src/assets/i18n/en.json | 136 ++++++++--- .../formatting/common-formatting.module.ts | 22 +- .../pipes/notification-contact-type.pipe.ts | 11 + .../pipes/notification-notify-state.pipe.ts | 11 + .../notification-tracking-process.pipe.ts | 11 + .../pipes/notification-tracking-state.pipe.ts | 11 + 38 files changed, 1161 insertions(+), 87 deletions(-) create mode 100644 dmp-frontend/src/app/core/common/enum/notification-contact-type.ts create mode 100644 dmp-frontend/src/app/core/common/enum/notification-notify-state.ts create mode 100644 dmp-frontend/src/app/core/common/enum/notification-tracking-process.ts create mode 100644 dmp-frontend/src/app/core/common/enum/notification-tracking-state.ts create mode 100644 dmp-frontend/src/app/core/model/notification/notification.model.ts create mode 100644 dmp-frontend/src/app/core/query/notification.lookup.ts create mode 100644 dmp-frontend/src/app/core/services/notification/notification-service.ts create mode 100644 dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.html create mode 100644 dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.scss create mode 100644 dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.ts create mode 100644 dmp-frontend/src/app/ui/admin/notification/notification-listing.component.html create mode 100644 dmp-frontend/src/app/ui/admin/notification/notification-listing.component.scss create mode 100644 dmp-frontend/src/app/ui/admin/notification/notification-listing.component.ts create mode 100644 dmp-frontend/src/app/ui/admin/notification/notification.module.ts create mode 100644 dmp-frontend/src/app/ui/admin/notification/notification.routing.ts create mode 100644 dmp-frontend/src/common/formatting/pipes/notification-contact-type.pipe.ts create mode 100644 dmp-frontend/src/common/formatting/pipes/notification-notify-state.pipe.ts create mode 100644 dmp-frontend/src/common/formatting/pipes/notification-tracking-process.pipe.ts create mode 100644 dmp-frontend/src/common/formatting/pipes/notification-tracking-state.pipe.ts diff --git a/dmp-backend/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/NotificationController.java b/dmp-backend/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/NotificationController.java index 236769802..d5127e0df 100644 --- a/dmp-backend/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/NotificationController.java +++ b/dmp-backend/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/NotificationController.java @@ -2,6 +2,7 @@ package gr.cite.notification.web.controllers; import gr.cite.notification.audit.AuditableAction; import gr.cite.notification.authorization.AuthorizationFlags; +import gr.cite.notification.common.enums.IsActive; import gr.cite.notification.data.NotificationEntity; import gr.cite.notification.model.Notification; import gr.cite.notification.model.SendNotificationResult; @@ -34,7 +35,7 @@ import javax.transaction.Transactional; import java.util.*; @RestController -@RequestMapping(path = "api/notification/notification") +@RequestMapping(path = "api/notification") public class NotificationController { private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(NotificationController.class)); diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/Notification.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/Notification.java index 16248f64a..4db8fbeab 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/Notification.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/Notification.java @@ -1,8 +1,12 @@ package gr.cite.notification.model; -import gr.cite.notification.common.enums.IsActive; -import gr.cite.notification.common.enums.NotificationContactType; +import gr.cite.notification.common.enums.*; +import gr.cite.notification.data.conventers.IsActiveConverter; +import gr.cite.notification.data.conventers.NotificationTrackingProcessConverter; +import gr.cite.notification.data.conventers.NotificationTrackingStateConverter; +import javax.persistence.Column; +import javax.persistence.Convert; import java.time.Instant; import java.util.UUID; @@ -29,6 +33,21 @@ public class Notification { private Instant notifiedAt; public final static String _notifiedAt = "notifiedAt"; + private NotificationNotifyState notifyState; + public final static String _notifyState = "notifyState"; + + private NotificationContactType notifiedWith; + public final static String _notifiedWith = "notifiedWith"; + + private Integer retryCount; + public final static String _retryCount = "retryCount"; + + private NotificationTrackingState trackingState; + public final static String _trackingState = "trackingState"; + + private NotificationTrackingProcess trackingProcess; + public final static String _trackingProcess = "trackingProcess"; + private String hash; public final static String _hash = "hash"; @@ -97,6 +116,46 @@ public class Notification { this.notifiedAt = notifiedAt; } + public NotificationNotifyState getNotifyState() { + return notifyState; + } + + public void setNotifyState(NotificationNotifyState notifyState) { + this.notifyState = notifyState; + } + + public NotificationContactType getNotifiedWith() { + return notifiedWith; + } + + public void setNotifiedWith(NotificationContactType notifiedWith) { + this.notifiedWith = notifiedWith; + } + + public Integer getRetryCount() { + return retryCount; + } + + public void setRetryCount(Integer retryCount) { + this.retryCount = retryCount; + } + + public NotificationTrackingState getTrackingState() { + return trackingState; + } + + public void setTrackingState(NotificationTrackingState trackingState) { + this.trackingState = trackingState; + } + + public NotificationTrackingProcess getTrackingProcess() { + return trackingProcess; + } + + public void setTrackingProcess(NotificationTrackingProcess trackingProcess) { + this.trackingProcess = trackingProcess; + } + public String getHash() { return hash; } diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/builder/NotificationBuilder.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/builder/NotificationBuilder.java index 26082a3ae..e31e5e747 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/builder/NotificationBuilder.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/builder/NotificationBuilder.java @@ -70,6 +70,11 @@ public class NotificationBuilder extends BaseBuilder { else if (item.match(Notification._contactTypeHint)) return NotificationEntity.Field._contactTypeHint; else if (item.match(Notification._updatedAt)) return NotificationEntity.Field._updatedAt; else if (item.match(Notification._notifiedAt)) return NotificationEntity.Field._notifiedAt; - else if (item.match(Notification._tenant)) return NotificationEntity.Field._tenantId; - else if (item.match(Notification._user)) return NotificationEntity.Field._userId; + else if (item.prefix(Notification._tenant)) return NotificationEntity.Field._tenantId; + else if (item.prefix(Notification._user)) return NotificationEntity.Field._userId; else if (item.match(Notification._type)) return NotificationEntity.Field._type; + else if (item.match(Notification._notifyState)) return NotificationEntity.Field._notifyState; + else if (item.match(Notification._notifiedWith)) return NotificationEntity.Field._notifiedWith; + else if (item.match(Notification._trackingState)) return NotificationEntity.Field._trackingState; + else if (item.match(Notification._trackingProcess)) return NotificationEntity.Field._trackingProcess; + else if (item.match(Notification._retryCount)) return NotificationEntity.Field._retryCount; + else return null; } @@ -283,6 +289,12 @@ public class NotificationQuery extends QueryBase { item.setCreatedAt(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._createdAt, Instant.class)); item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._updatedAt, Instant.class)); item.setIsActive(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._isActive, IsActive.class)); + item.setNotifyState(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._notifyState, NotificationNotifyState.class)); + item.setNotifiedWith(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._notifiedWith, NotificationContactType.class)); + item.setTrackingState(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._trackingState, NotificationTrackingState.class)); + item.setTrackingProcess(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._trackingProcess, NotificationTrackingProcess.class)); + item.setRetryCount(QueryBase.convertSafe(tuple, columns, NotificationEntity.Field._retryCount, Integer.class)); + return item; } } diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/query/lookup/NotificationLookup.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/query/lookup/NotificationLookup.java index 28f40fcfb..70938b9b0 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/query/lookup/NotificationLookup.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/query/lookup/NotificationLookup.java @@ -1,8 +1,6 @@ package gr.cite.notification.query.lookup; -import gr.cite.notification.common.enums.IsActive; -import gr.cite.notification.common.enums.NotificationContactType; -import gr.cite.notification.common.enums.NotificationNotifyState; +import gr.cite.notification.common.enums.*; import gr.cite.notification.query.NotificationQuery; import gr.cite.notification.query.TenantQuery; import gr.cite.tools.data.query.Lookup; @@ -16,14 +14,16 @@ import java.util.UUID; public class NotificationLookup extends Lookup { private List isActive; private List ids; - private List notifyState = new ArrayList<>(); - private List notifiedWith = new ArrayList<>(); + private List notifyState; + private List notifiedWith; private Boolean notifiedWithHasValue; private Boolean notifiedAtHasValue; - private List type = new ArrayList<>(); - private List contactType = new ArrayList<>(); + private List type; + private List contactType; private Integer retryThreshold; private Instant createdAfter; + private List trackingState; + private List trackingProcess; public List getIsActive() { @@ -106,6 +106,22 @@ public class NotificationLookup extends Lookup { this.createdAfter = createdAfter; } + public List getTrackingState() { + return trackingState; + } + + public void setTrackingState(List trackingState) { + this.trackingState = trackingState; + } + + public List getTrackingProcess() { + return trackingProcess; + } + + public void setTrackingProcess(List trackingProcess) { + this.trackingProcess = trackingProcess; + } + public NotificationQuery enrich(QueryFactory queryFactory) { NotificationQuery query = queryFactory.query(NotificationQuery.class); if (this.isActive != null) query.isActive(this.isActive); @@ -118,6 +134,8 @@ public class NotificationLookup extends Lookup { if (this.notifiedWith != null) query.notifiedWith(this.notifiedWith); if (this.retryThreshold != null) query.retryThreshold(this.retryThreshold); if (this.type != null) query.type(this.type); + if (this.trackingProcess != null) query.trackingProgress(this.trackingProcess); + if (this.trackingState != null) query.trackingState(this.trackingState); this.enrichCommon(query); diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/query/lookup/NotificationTemplateLookup.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/query/lookup/NotificationTemplateLookup.java index 9625e3600..938531dfb 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/query/lookup/NotificationTemplateLookup.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/query/lookup/NotificationTemplateLookup.java @@ -14,6 +14,8 @@ public class NotificationTemplateLookup extends Lookup { private List isActive; + private List notificationTypes; + private List channels; private List kinds; @@ -26,6 +28,14 @@ public class NotificationTemplateLookup extends Lookup { return isActive; } + public List getNotificationTypes() { + return notificationTypes; + } + + public void setNotificationTypes(List notificationTypes) { + this.notificationTypes = notificationTypes; + } + public void setIsActive(List isActive) { this.isActive = isActive; } @@ -66,6 +76,7 @@ public class NotificationTemplateLookup extends Lookup { NotificationTemplateQuery query = queryFactory.query(NotificationTemplateQuery.class); if (this.ids != null) query.ids(this.ids); if (this.excludedIds != null) query.excludedIds(this.excludedIds); + if (this.notificationTypes != null) query.notificationTypes(this.notificationTypes); if (this.isActive != null) query.isActive(this.isActive); if (this.channels != null) query.channels(this.channels); if (this.kinds != null) query.kinds(this.kinds); diff --git a/dmp-frontend/src/app/app-routing.module.ts b/dmp-frontend/src/app/app-routing.module.ts index 798ddb163..f5385cbfa 100644 --- a/dmp-frontend/src/app/app-routing.module.ts +++ b/dmp-frontend/src/app/app-routing.module.ts @@ -270,6 +270,18 @@ const appRoutes: Routes = [ }) }, }, + { + path: 'notifications', + loadChildren: () => import('./ui/admin/notification/notification.module').then(m => m.NotificationModule), + data: { + authContext: { + permissions: [AppPermission.ViewNotificationPage] + }, + ...BreadcrumbService.generateRouteDataConfiguration({ + title: 'BREADCRUMBS.NOTIFICATIONS' + }) + }, + }, { path: 'notification-templates', loadChildren: () => import('./ui/admin/notification-template/notification-template.module').then(m => m.NotificationTemplateModule), diff --git a/dmp-frontend/src/app/core/common/enum/notification-contact-type.ts b/dmp-frontend/src/app/core/common/enum/notification-contact-type.ts new file mode 100644 index 000000000..a0d2bd316 --- /dev/null +++ b/dmp-frontend/src/app/core/common/enum/notification-contact-type.ts @@ -0,0 +1,4 @@ +export enum NotificationContactType { + EMAIL = 0, + IN_APP = 3, +} \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/notification-notify-state.ts b/dmp-frontend/src/app/core/common/enum/notification-notify-state.ts new file mode 100644 index 000000000..c93c24e73 --- /dev/null +++ b/dmp-frontend/src/app/core/common/enum/notification-notify-state.ts @@ -0,0 +1,7 @@ +export enum NotificationNotifyState { + PENDING = 0, + PROCESSING = 1, + SUCCESSFUL = 2, + ERROR = 3, + OMITTED = 4 +} \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/notification-tracking-process.ts b/dmp-frontend/src/app/core/common/enum/notification-tracking-process.ts new file mode 100644 index 000000000..9cb3e30f3 --- /dev/null +++ b/dmp-frontend/src/app/core/common/enum/notification-tracking-process.ts @@ -0,0 +1,7 @@ +export enum NotificationTrackingProcess { + PENDING = 0, + PROCESSING = 1, + SUCCESSFUL = 2, + ERROR = 3, + OMITTED = 4 +} \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/notification-tracking-state.ts b/dmp-frontend/src/app/core/common/enum/notification-tracking-state.ts new file mode 100644 index 000000000..99b7fca9d --- /dev/null +++ b/dmp-frontend/src/app/core/common/enum/notification-tracking-state.ts @@ -0,0 +1,10 @@ +export enum NotificationTrackingState { + UNDEFINED = 0, + NA = 1, + QUEUED = 2, + SENT = 3, + DELIVERED = 4, + UNDELIVERED = 5, + FAILED = 6, + UNSENT = 7 +} \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/permission.enum.ts b/dmp-frontend/src/app/core/common/enum/permission.enum.ts index ab36ba6fb..0077e5859 100644 --- a/dmp-frontend/src/app/core/common/enum/permission.enum.ts +++ b/dmp-frontend/src/app/core/common/enum/permission.enum.ts @@ -35,6 +35,7 @@ export enum AppPermission { ViewLanguagePage = "ViewLanguagePage", ViewNotificationTemplatePage = "ViewNotificationTemplatePage", ViewMineInAppNotificationPage = "ViewMineInAppNotificationPage", + ViewNotificationPage = "ViewNotificationPage", //ReferenceType BrowseReferenceType = "BrowseReferenceType", diff --git a/dmp-frontend/src/app/core/core-service.module.ts b/dmp-frontend/src/app/core/core-service.module.ts index 824193065..4bf56873c 100644 --- a/dmp-frontend/src/app/core/core-service.module.ts +++ b/dmp-frontend/src/app/core/core-service.module.ts @@ -45,6 +45,7 @@ import { FileUtils } from './services/utilities/file-utils.service'; import { QueryParamsService } from './services/utilities/query-params.service'; import { FileTransformerHttpService } from './services/file-transformer/file-transformer.http.service'; import { InAppNotificationService } from './services/inapp-notification/inapp-notification.service'; +import { NotificationService } from './services/notification/notification-service'; // // // This is shared module that provides all the services. Its imported only once on the AppModule. @@ -108,7 +109,8 @@ export class CoreServiceModule { CanDeactivateGuard, FileTransformerService, FileTransformerHttpService, - InAppNotificationService + InAppNotificationService, + NotificationService ], }; } diff --git a/dmp-frontend/src/app/core/model/notification/notification.model.ts b/dmp-frontend/src/app/core/model/notification/notification.model.ts new file mode 100644 index 000000000..39088df68 --- /dev/null +++ b/dmp-frontend/src/app/core/model/notification/notification.model.ts @@ -0,0 +1,22 @@ +import { NotificationContactType } from '@app/core/common/enum/notification-contact-type'; +import { User } from '../user/user'; +import { NotificationType } from '@app/core/common/enum/notification-type'; +import { BaseEntity } from '@common/base/base-entity.model'; +import { NotificationNotifyState } from '@app/core/common/enum/notification-notify-state'; +import { NotificationTrackingProcess } from '@app/core/common/enum/notification-tracking-process'; +import { NotificationTrackingState } from '@app/core/common/enum/notification-tracking-state'; + +export interface Notification extends BaseEntity{ + user: User; + type: NotificationType; + contactTypeHint: NotificationContactType; + contactHint: string; + data: string; + notifyState: NotificationNotifyState; + notifiedWith: NotificationContactType; + notifiedAt: Date; + retryCount: number; + trackingState: NotificationTrackingState; + trackingProcess: NotificationTrackingProcess; + trackingData: string; +} diff --git a/dmp-frontend/src/app/core/query/notification-template.lookup.ts b/dmp-frontend/src/app/core/query/notification-template.lookup.ts index 6d24e6be8..7fdaa95ce 100644 --- a/dmp-frontend/src/app/core/query/notification-template.lookup.ts +++ b/dmp-frontend/src/app/core/query/notification-template.lookup.ts @@ -3,6 +3,7 @@ import { Guid } from "@common/types/guid"; import { IsActive } from "../common/enum/is-active.enum"; import { NotificationTemplateKind } from "../common/enum/notification-template-kind"; import { NotificationTemplateChannel } from "../common/enum/notification-template-channel"; +import { NotificationType } from "../common/enum/notification-type"; export class NotificationTemplateLookup extends Lookup implements NotificationTemplateFilter { ids: Guid[]; @@ -10,6 +11,7 @@ export class NotificationTemplateLookup extends Lookup implements NotificationTe isActive: IsActive[]; kinds: NotificationTemplateKind[]; channels: NotificationTemplateChannel[]; + notificationTypes: NotificationType[]; constructor() { super(); @@ -22,4 +24,5 @@ export interface NotificationTemplateFilter { isActive: IsActive[]; kinds: NotificationTemplateKind[]; channels: NotificationTemplateChannel[]; + notificationTypes: NotificationType[]; } \ No newline at end of file diff --git a/dmp-frontend/src/app/core/query/notification.lookup.ts b/dmp-frontend/src/app/core/query/notification.lookup.ts new file mode 100644 index 000000000..7c4d3ac71 --- /dev/null +++ b/dmp-frontend/src/app/core/query/notification.lookup.ts @@ -0,0 +1,36 @@ +import { Lookup } from "@common/model/lookup"; +import { Guid } from "@common/types/guid"; +import { IsActive } from "../common/enum/is-active.enum"; +import { NotificationType } from "../common/enum/notification-type"; +import { NotificationNotifyState } from "../common/enum/notification-notify-state"; +import { NotificationContactType } from "../common/enum/notification-contact-type"; +import { NotificationTrackingState } from "../common/enum/notification-tracking-state"; +import { NotificationTrackingProcess } from "../common/enum/notification-tracking-process"; + +export class NotificationLookup extends Lookup implements NotificationFilter { + ids: Guid[]; + excludedIds: Guid[]; + isActive: IsActive[]; + type: NotificationType[]; + notifyState: NotificationNotifyState[]; + notifiedWith: NotificationContactType[]; + contactType: NotificationContactType[]; + trackingState: NotificationTrackingState[]; + trackingProcess: NotificationTrackingProcess[]; + + constructor() { + super(); + } +} + +export interface NotificationFilter { + ids: Guid[]; + excludedIds: Guid[]; + isActive: IsActive[]; + type: NotificationType[]; + notifyState: NotificationNotifyState[]; + notifiedWith: NotificationContactType[]; + contactType: NotificationContactType[]; + trackingState: NotificationTrackingState[]; + trackingProcess: NotificationTrackingProcess[]; +} \ No newline at end of file diff --git a/dmp-frontend/src/app/core/services/notification/notification-service.ts b/dmp-frontend/src/app/core/services/notification/notification-service.ts new file mode 100644 index 000000000..af3aa747b --- /dev/null +++ b/dmp-frontend/src/app/core/services/notification/notification-service.ts @@ -0,0 +1,34 @@ +import { Injectable } from '@angular/core'; +import { QueryResult } from '@common/model/query-result'; +import { Guid } from '@common/types/guid'; +import { NotificationLookup } from '@app/core/query/notification.lookup'; +import { Observable, throwError } from 'rxjs'; +import { catchError } from 'rxjs/operators'; +import { Notification } from '@app/core/model/notification/notification.model'; +import { BaseHttpV2Service } from '../http/base-http-v2.service'; +import { ConfigurationService } from '../configuration/configuration.service'; + +@Injectable() +export class NotificationService { + + constructor(private http: BaseHttpV2Service, private configurationService: ConfigurationService) { + } + + private get apiBase(): string { return `${this.configurationService.notificationServiceAddress}notification`; } + + query(q: NotificationLookup): Observable> { + const url = `${this.apiBase}/query`; + + return this.http + .post>(url, q).pipe( + catchError((error: any) => throwError(error))); + } + + delete(id: Guid): Observable { + const url = `${this.apiBase}/${id}`; + + return this.http + .delete(url).pipe( + catchError((error: any) => throwError(error))); + } +} \ No newline at end of file diff --git a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts index 92b453c9e..88bc7eb69 100644 --- a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts +++ b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts @@ -28,6 +28,10 @@ import { ValidationType } from '../../common/enum/validation-type'; import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order'; import { NotificationType } from '@app/core/common/enum/notification-type'; import { NotificationInAppTracking } from '@app/core/common/enum/notification-inapp-tracking.enum'; +import { NotificationContactType } from '@app/core/common/enum/notification-contact-type'; +import { NotificationNotifyState } from '@app/core/common/enum/notification-notify-state'; +import { NotificationTrackingState } from '@app/core/common/enum/notification-tracking-state'; +import { NotificationTrackingProcess } from '@app/core/common/enum/notification-tracking-process'; @Injectable() export class EnumUtils { @@ -342,4 +346,44 @@ export class EnumUtils { case NotificationInAppTracking.Stored: return this.language.instant('TYPES.NOTIFICATION-INAPP-TRACKING.STORED'); } } + + public toNotificationContactTypeString(value: NotificationContactType): string { + switch (value) { + case NotificationContactType.EMAIL: return this.language.instant('TYPES.NOTIFICATION-CONTACT-TYPE.EMAIL'); + case NotificationContactType.IN_APP: return this.language.instant('TYPES.NOTIFICATION-CONTACT-TYPE.INAPP'); + } + } + + public toNotificationNotifyStateString(value: NotificationNotifyState): string { + switch (value) { + case NotificationNotifyState.PENDING: return this.language.instant('TYPES.NOTIFICATION-NOTIFY-STATE.PENDING'); + case NotificationNotifyState.PROCESSING: return this.language.instant('TYPES.NOTIFICATION-NOTIFY-STATE.PROCESSING'); + case NotificationNotifyState.SUCCESSFUL: return this.language.instant('TYPES.NOTIFICATION-NOTIFY-STATE.SUCCESSFUL'); + case NotificationNotifyState.ERROR: return this.language.instant('TYPES.NOTIFICATION-NOTIFY-STATE.ERROR'); + case NotificationNotifyState.OMITTED: return this.language.instant('TYPES.NOTIFICATION-NOTIFY-STATE.OMITTED'); + } + } + + public toNotificationTrackingStateString(value: NotificationTrackingState): string { + switch (value) { + case NotificationTrackingState.UNDEFINED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.UNDEFINED'); + case NotificationTrackingState.NA: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.NA'); + case NotificationTrackingState.QUEUED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.QUEUED'); + case NotificationTrackingState.SENT: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.SENT'); + case NotificationTrackingState.DELIVERED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.DELIVERED'); + case NotificationTrackingState.UNDELIVERED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.UNDELIVERED'); + case NotificationTrackingState.FAILED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.FAILED'); + case NotificationTrackingState.UNSENT: return this.language.instant('TYPES.NOTIFICATION-TRACKING-STATE.UNSENT'); + } + } + + public toNotificationTrackingProcessString(value: NotificationTrackingProcess): string { + switch (value) { + case NotificationTrackingProcess.PENDING: return this.language.instant('TYPES.NOTIFICATION-TRACKING-PROCESS.PENDING'); + case NotificationTrackingProcess.PROCESSING: return this.language.instant('TYPES.NOTIFICATION-TRACKING-PROCESS.PROCESSING'); + case NotificationTrackingProcess.SUCCESSFUL: return this.language.instant('TYPES.NOTIFICATION-TRACKING-PROCESS.SUCCESSFUL'); + case NotificationTrackingProcess.ERROR: return this.language.instant('TYPES.NOTIFICATION-TRACKING-PROCESS.ERROR'); + case NotificationTrackingProcess.OMITTED: return this.language.instant('TYPES.NOTIFICATION-TRACKING-PROCESS.OMITTED'); + } + } } diff --git a/dmp-frontend/src/app/ui/admin/notification-template/listing/filters/notification-template-listing-filters.component.html b/dmp-frontend/src/app/ui/admin/notification-template/listing/filters/notification-template-listing-filters.component.html index 10b269637..4674a0024 100644 --- a/dmp-frontend/src/app/ui/admin/notification-template/listing/filters/notification-template-listing-filters.component.html +++ b/dmp-frontend/src/app/ui/admin/notification-template/listing/filters/notification-template-listing-filters.component.html @@ -10,18 +10,26 @@
-

{{'NOTIFICATION-TEMPLATE-LISTING.FILTER.TITLE' | translate}}

+

{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.FILTER.TITLE' | translate}}

- {{'NOTIFICATION-TEMPLATE-LISTING.FILTER.IS-ACTIVE' | translate}} + {{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.FILTER.IS-ACTIVE' | translate}}
- {{'NOTIFICATION-TEMPLATE-LISTING.FILTER.KIND' | translate}} + {{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.FILTER.NOTIFICATION-TYPE' | translate}} + + {{enumUtils.toNotificationTypeString(type)}} + + +
+ +
+ {{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.FILTER.KIND' | translate}} {{enumUtils.toNotificationTemplateKindString(kind)}} @@ -29,7 +37,7 @@
- {{'NOTIFICATION-TEMPLATE-LISTING.FILTER.CHANNEL' | translate}} + {{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.FILTER.CHANNEL' | translate}} {{enumUtils.toNotificationTemplateChannelString(channel)}} @@ -38,10 +46,10 @@
diff --git a/dmp-frontend/src/app/ui/admin/notification-template/listing/filters/notification-template-listing-filters.component.ts b/dmp-frontend/src/app/ui/admin/notification-template/listing/filters/notification-template-listing-filters.component.ts index eff5f21a1..e18f4a269 100644 --- a/dmp-frontend/src/app/ui/admin/notification-template/listing/filters/notification-template-listing-filters.component.ts +++ b/dmp-frontend/src/app/ui/admin/notification-template/listing/filters/notification-template-listing-filters.component.ts @@ -2,6 +2,7 @@ import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChange import { IsActive } from '@app/core/common/enum/is-active.enum'; import { NotificationTemplateChannel } from '@app/core/common/enum/notification-template-channel'; import { NotificationTemplateKind } from '@app/core/common/enum/notification-template-kind'; +import { NotificationType } from '@app/core/common/enum/notification-type'; import { NotificationTemplateFilter } from '@app/core/query/notification-template.lookup'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { BaseComponent } from '@common/base/base.component'; @@ -18,6 +19,7 @@ export class NotificationTemplateListingFiltersComponent extends BaseComponent i @Output() filterChange = new EventEmitter(); notificationTemplateKindEnumValues = this.enumUtils.getEnumValues(NotificationTemplateKind) notificationTemplateChannelEnumValues = this.enumUtils.getEnumValues(NotificationTemplateChannel); + notificationTypeEnumValues = this.enumUtils.getEnumValues(NotificationType); // * State internalFilters: NotificationTemplateListingFilters = this._getEmptyFilters(); @@ -49,13 +51,14 @@ export class NotificationTemplateListingFiltersComponent extends BaseComponent i } protected applyFilters(): void { - const { isActive, kinds, channels } = this.internalFilters ?? {} + const { isActive, kinds, channels, notificationTypes } = this.internalFilters ?? {} this.filterChange.emit({ ...this.filter, // like, isActive: isActive ? [IsActive.Active] : [IsActive.Inactive], kinds, - channels + channels, + notificationTypes }) } @@ -65,12 +68,13 @@ export class NotificationTemplateListingFiltersComponent extends BaseComponent i return this._getEmptyFilters(); } - let { isActive, kinds, channels } = inputFilter; + let { isActive, kinds, channels, notificationTypes } = inputFilter; return { isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length, kinds: kinds, - channels: channels + channels: channels, + notificationTypes: notificationTypes } } @@ -79,7 +83,8 @@ export class NotificationTemplateListingFiltersComponent extends BaseComponent i return { isActive: true, kinds: null, - channels: null + channels: null, + notificationTypes: null } } @@ -100,4 +105,5 @@ interface NotificationTemplateListingFilters { isActive: boolean; kinds: NotificationTemplateKind[]; channels: NotificationTemplateChannel[]; + notificationTypes: NotificationType[]; } diff --git a/dmp-frontend/src/app/ui/admin/notification-template/listing/notification-template-listing.component.html b/dmp-frontend/src/app/ui/admin/notification-template/listing/notification-template-listing.component.html index e38459e2f..70c326c4d 100644 --- a/dmp-frontend/src/app/ui/admin/notification-template/listing/notification-template-listing.component.html +++ b/dmp-frontend/src/app/ui/admin/notification-template/listing/notification-template-listing.component.html @@ -1,9 +1,9 @@ -
+
-

{{'NOTIFICATION-TEMPLATE-LISTING.TITLE' | translate}}

+

{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.TITLE' | translate}}

@@ -12,7 +12,7 @@ *ngIf="authService.hasPermission(authService.permissionEnum.EditNotificationTemplate)" [routerLink]="['/notification-templates/new']"> add - {{'NOTIFICATION-TEMPLATE-LISTING.CREATE' | translate}} + {{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.CREATE' | translate}}
@@ -44,28 +44,36 @@ (click)="$event.stopPropagation()">{{item?.name | nullifyValue}}
- - -
-
- {{enumUtils.toDescriptionTemplateTypeStatusString(item.status) | nullifyValue}} -
-
-
- - + - {{'NOTIFICATION-TEMPLATE-LISTING.FIELDS.CREATED-AT' | translate}}: + {{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.FIELDS.NOTIFICATION-TYPE' | translate}}: - {{item?.createdAt | dateTimeFormatter : 'short' | nullifyValue}} + {{enumUtils.toNotificationTypeString(item.notificationType) | nullifyValue}} + + +
+
+ + + {{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.FIELDS.KIND' | translate}}: + + {{enumUtils.toNotificationTemplateKindString(item.kind) | nullifyValue}} + + +
+
+ + + {{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.FIELDS.CHANNEL' | translate}}: + + {{enumUtils.toNotificationTemplateChannelString(item.channel) | nullifyValue}}
- {{'NOTIFICATION-TEMPLATE-LISTING.FIELDS.UPDATED-AT' | translate}}: + {{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.FIELDS.UPDATED-AT' | translate}}: {{item?.updatedAt | dateTimeFormatter : 'short' | nullifyValue}} @@ -83,11 +91,11 @@
diff --git a/dmp-frontend/src/app/ui/admin/notification-template/listing/notification-template-listing.component.scss b/dmp-frontend/src/app/ui/admin/notification-template/listing/notification-template-listing.component.scss index 6e1b48814..1bf5a1acb 100644 --- a/dmp-frontend/src/app/ui/admin/notification-template/listing/notification-template-listing.component.scss +++ b/dmp-frontend/src/app/ui/admin/notification-template/listing/notification-template-listing.component.scss @@ -1,4 +1,4 @@ -.description-template-type-listing { +.notification-template-listing { margin-top: 1.3rem; margin-left: 1rem; margin-right: 2rem; diff --git a/dmp-frontend/src/app/ui/admin/notification-template/listing/notification-template-listing.component.ts b/dmp-frontend/src/app/ui/admin/notification-template/listing/notification-template-listing.component.ts index ab7109fea..412c8a137 100644 --- a/dmp-frontend/src/app/ui/admin/notification-template/listing/notification-template-listing.component.ts +++ b/dmp-frontend/src/app/ui/admin/notification-template/listing/notification-template-listing.component.ts @@ -25,10 +25,11 @@ import { NotificationTemplateService } from '@app/core/services/notification-tem import { NotificationTemplateChannelPipe } from '@common/formatting/pipes/notification-template-channel.pipe'; import { NotificationTemplateKindPipe } from '@common/formatting/pipes/notification-template-kind.pipe'; import { Language } from '@app/core/model/language/language'; +import { NotificationTypePipe } from '@common/formatting/pipes/notification-type.pipe'; @Component({ - templateUrl: './NOTIFICATION-TEMPLATE-LISTING.component.html', - styleUrls: ['./NOTIFICATION-TEMPLATE-LISTING.component.scss'] + templateUrl: './notification-template-listing.component.html', + styleUrls: ['./notification-template-listing.component.scss'] }) export class NotificationTemplateListingComponent extends BaseListingComponent implements OnInit { publish = false; @@ -40,6 +41,7 @@ export class NotificationTemplateListingComponent extends BaseListingComponent(x => x.id), + nameof(x => x.notificationType), nameof(x => x.kind), nameof(x => x.channel), nameof(x => x.updatedAt), @@ -90,33 +92,39 @@ export class NotificationTemplateListingComponent extends BaseListingComponent(x => x.notificationType), + sortable: true, + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.FIELDS.NOTIFICATION-TYPE', + pipe: this.pipeService.getPipe(NotificationTypePipe) + }, + { prop: nameof(x => x.kind), sortable: true, - languageName: 'NOTIFICATION-TEMPLATE-LISTING.FIELDS.KIND', + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.FIELDS.KIND', pipe: this.pipeService.getPipe(NotificationTemplateKindPipe) }, { prop: nameof(x => x.channel), sortable: true, - languageName: 'NOTIFICATION-TEMPLATE-LISTING.FIELDS.CHANNEL', + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.FIELDS.CHANNEL', pipe: this.pipeService.getPipe(NotificationTemplateChannelPipe) }, { prop: nameof(x => x.createdAt), sortable: true, - languageName: 'NOTIFICATION-TEMPLATE-LISTING.FIELDS.CREATED-AT', + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.FIELDS.CREATED-AT', pipe: this.pipeService.getPipe(DataTableDateTimeFormatPipe).withFormat('short') }, { prop: nameof(x => x.updatedAt), sortable: true, - languageName: 'NOTIFICATION-TEMPLATE-LISTING.FIELDS.UPDATED-AT', + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.FIELDS.UPDATED-AT', pipe: this.pipeService.getPipe(DataTableDateTimeFormatPipe).withFormat('short') }, { prop: nameof(x => x.isActive), sortable: true, - languageName: 'NOTIFICATION-TEMPLATE-LISTING.FIELDS.IS-ACTIVE', + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-LISTING.FIELDS.IS-ACTIVE', pipe: this.pipeService.getPipe(IsActiveTypePipe) }, { diff --git a/dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.html b/dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.html new file mode 100644 index 000000000..b06b4cd12 --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.html @@ -0,0 +1,76 @@ +
+ + + + + +
+
+
+

{{'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FILTER.TITLE' | translate}}

+ +
+ + + {{'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FILTER.IS-ACTIVE' | translate}} + + +
+ {{'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FILTER.NOTIFICATION-TYPE' | translate}} + + {{enumUtils.toNotificationTypeString(type)}} + + +
+ +
+ {{'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FILTER.CONTACT-TYPE' | translate}} + + {{enumUtils.toNotificationContactTypeString(contactType)}} + + +
+ +
+ {{'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FILTER.NOTIFY-STATE' | translate}} + + {{enumUtils.toNotificationNotifyStateString(notifyState)}} + + +
+ +
+ {{'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FILTER.TRACKING-STATE' | translate}} + + {{enumUtils.toNotificationTrackingStateString(trackingState)}} + + +
+ +
+ {{'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FILTER.TRACKING-PROCESS' | translate}} + + {{enumUtils.toNotificationTrackingProcessString(trackingProcess)}} + + +
+ +
+ + +
+
+
+
+ + +
diff --git a/dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.scss b/dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.scss new file mode 100644 index 000000000..ea00a215c --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.scss @@ -0,0 +1,21 @@ +::ng-deep.mat-mdc-menu-panel { + max-width: 100% !important; + height: 100% !important; +} + +:host::ng-deep.mat-mdc-menu-content:not(:empty) { + padding-top: 0 !important; +} + + +.filter-button{ + padding-top: .6rem; + padding-bottom: .6rem; + // .mat-icon{ + // font-size: 1.5em; + // width: 1.2em; + // height: 1.2em; + // } +} + + diff --git a/dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.ts b/dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.ts new file mode 100644 index 000000000..088945fb2 --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/notification/filters/notification-listing-filters.component.ts @@ -0,0 +1,124 @@ +import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; +import { IsActive } from '@app/core/common/enum/is-active.enum'; +import { NotificationContactType } from '@app/core/common/enum/notification-contact-type'; +import { NotificationNotifyState } from '@app/core/common/enum/notification-notify-state'; +import { NotificationTrackingProcess } from '@app/core/common/enum/notification-tracking-process'; +import { NotificationTrackingState } from '@app/core/common/enum/notification-tracking-state'; +import { NotificationType } from '@app/core/common/enum/notification-type'; +import { NotificationFilter } from '@app/core/query/notification.lookup'; +import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; +import { BaseComponent } from '@common/base/base.component'; +import { nameof } from 'ts-simple-nameof'; + +@Component({ + selector: 'app-notification-listing-filters', + templateUrl: './notification-listing-filters.component.html', + styleUrls: ['./notification-listing-filters.component.scss'] +}) +export class NotificationListingFiltersComponent extends BaseComponent implements OnInit, OnChanges { + + @Input() readonly filter: NotificationFilter; + @Output() filterChange = new EventEmitter(); + notificationContactTypeEnumValues = this.enumUtils.getEnumValues(NotificationContactType) + notificationNotifyStateEnumValues = this.enumUtils.getEnumValues(NotificationNotifyState); + notificationTrackingStateEnumValues = this.enumUtils.getEnumValues(NotificationTrackingState); + notificationTrackingProcessEnumValues = this.enumUtils.getEnumValues(NotificationTrackingProcess); + notificationTypeEnumValues = this.enumUtils.getEnumValues(NotificationType); + + // * State + internalFilters: NotificationListingFilters = this._getEmptyFilters(); + + protected appliedFilterCount: number = 0; + constructor( + public enumUtils: EnumUtils, + ) { super(); } + + ngOnInit() { + } + + ngOnChanges(changes: SimpleChanges): void { + const filterChange = changes[nameof(x => x.filter)]?.currentValue as NotificationFilter; + if (filterChange) { + this.updateFilters() + } + } + + + onSearchTermChange(searchTerm: string): void { + this.applyFilters() + } + + + protected updateFilters(): void { + this.internalFilters = this._parseToInternalFilters(this.filter); + this.appliedFilterCount = this._computeAppliedFilters(this.internalFilters); + } + + protected applyFilters(): void { + const { isActive, type, notifyState, notifiedWith, contactType, trackingState, trackingProcess } = this.internalFilters ?? {} + this.filterChange.emit({ + ...this.filter, + isActive: isActive ? [IsActive.Active] : [IsActive.Inactive], + type, + notifyState, + notifiedWith, + contactType, + trackingState, + trackingProcess + }) + } + + + private _parseToInternalFilters(inputFilter: NotificationFilter): NotificationListingFilters { + if (!inputFilter) { + return this._getEmptyFilters(); + } + + let { isActive, type, notifyState, notifiedWith, contactType, trackingState, trackingProcess } = inputFilter; + + return { + isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length, + type: type, + notifyState: notifyState, + notifiedWith: notifiedWith, + contactType: contactType, + trackingState: trackingState, + trackingProcess: trackingProcess + } + + } + + private _getEmptyFilters(): NotificationListingFilters { + return { + isActive: true, + type: null, + notifyState: null, + notifiedWith: null, + contactType: null, + trackingState: null, + trackingProcess: null + } + } + + private _computeAppliedFilters(filters: NotificationListingFilters): number { + let count = 0; + if (filters?.isActive) { + count++ + } + return count; + } + + clearFilters() { + this.internalFilters = this._getEmptyFilters(); + } +} + +interface NotificationListingFilters { + isActive: boolean; + type: NotificationType[]; + notifyState: NotificationNotifyState[]; + notifiedWith: NotificationContactType[]; + contactType: NotificationContactType[]; + trackingState: NotificationTrackingState[]; + trackingProcess: NotificationTrackingProcess[]; +} diff --git a/dmp-frontend/src/app/ui/admin/notification/notification-listing.component.html b/dmp-frontend/src/app/ui/admin/notification/notification-listing.component.html new file mode 100644 index 000000000..bdd4865f8 --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/notification/notification-listing.component.html @@ -0,0 +1,92 @@ +
+
+ +
+
+

{{'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.TITLE' | translate}}

+ + +
+
+ + + + + + + + +
+
+ + + + +
+
+ + {{item?.name | nullifyValue}} +
+
+ + + {{'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FIELDS.NOTIFICATION-TYPE' | translate}}: + + {{enumUtils.toNotificationTypeString(item.notificationType) | nullifyValue}} + + +
+
+ + + {{'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FIELDS.KIND' | translate}}: + + {{enumUtils.toNotificationTemplateKindString(item.kind) | nullifyValue}} + + +
+
+ + + {{'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FIELDS.CHANNEL' | translate}}: + + {{enumUtils.toNotificationTemplateChannelString(item.channel) | nullifyValue}} + + +
+
+ + + {{'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FIELDS.UPDATED-AT' | translate}}: + + {{item?.updatedAt | dateTimeFormatter : 'short' | nullifyValue}} + + + +
+
+
+ + +
+
+ + + + +
+
+
\ No newline at end of file diff --git a/dmp-frontend/src/app/ui/admin/notification/notification-listing.component.scss b/dmp-frontend/src/app/ui/admin/notification/notification-listing.component.scss new file mode 100644 index 000000000..09eab6ac5 --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/notification/notification-listing.component.scss @@ -0,0 +1,27 @@ +.notification-listing { + margin-top: 1.3rem; + margin-left: 1rem; + margin-right: 2rem; + + .mat-header-row{ + background: #f3f5f8; + } + .mat-card { + margin: 16px 0; + padding: 0px; + } + + .mat-row { + cursor: pointer; + min-height: 4.5em; + } + + mat-row:hover { + background-color: #eef5f6; + } + .mat-fab-bottom-right { + float: right; + z-index: 5; + } +} + diff --git a/dmp-frontend/src/app/ui/admin/notification/notification-listing.component.ts b/dmp-frontend/src/app/ui/admin/notification/notification-listing.component.ts new file mode 100644 index 000000000..7d23dccda --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/notification/notification-listing.component.ts @@ -0,0 +1,224 @@ +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; +import { ActivatedRoute, Router } from '@angular/router'; +import { IsActive } from '@app/core/common/enum/is-active.enum'; +import { AuthService } from '@app/core/services/auth/auth.service'; +import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; +import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; +import { QueryParamsService } from '@app/core/services/utilities/query-params.service'; +import { BaseListingComponent } from '@common/base/base-listing-component'; +import { PipeService } from '@common/formatting/pipe.service'; +import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe'; +import { QueryResult } from '@common/model/query-result'; +import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; +import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service'; +import { ColumnDefinition, ColumnsChangedEvent, HybridListingComponent, PageLoadEvent } from '@common/modules/hybrid-listing/hybrid-listing.component'; +import { Guid } from '@common/types/guid'; +import { TranslateService } from '@ngx-translate/core'; +import { Observable } from 'rxjs'; +import { takeUntil } from 'rxjs/operators'; +import { nameof } from 'ts-simple-nameof'; +import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe'; +import { Notification } from '@app/core/model/notification/notification.model'; +import { NotificationLookup } from '@app/core/query/notification.lookup'; +import { NotificationService } from '@app/core/services/notification/notification-service'; +import { NotificationTypePipe } from '@common/formatting/pipes/notification-type.pipe'; +import { NotificationContactTypePipe } from '@common/formatting/pipes/notification-contact-type.pipe'; +import { NotificationNotifyStatePipe } from '@common/formatting/pipes/notification-notify-state.pipe'; +import { NotificationTrackingStatePipe } from '@common/formatting/pipes/notification-tracking-state.pipe'; +import { NotificationTrackingProcessPipe } from '@common/formatting/pipes/notification-tracking-process.pipe'; + +@Component({ + templateUrl: './notification-listing.component.html', + styleUrls: ['./notification-listing.component.scss'] +}) +export class NotificationListingComponent extends BaseListingComponent implements OnInit { + publish = false; + userSettingsKey = { key: 'NotificationListingUserSettings' }; + propertiesAvailableForOrder: ColumnDefinition[]; + + @ViewChild('actions', { static: true }) actions?: TemplateRef; + @ViewChild(HybridListingComponent, { static: true }) hybridListingComponent: HybridListingComponent; + + private readonly lookupFields: string[] = [ + nameof(x => x.id), + nameof(x => x.type), + nameof(x => x.retryCount), + nameof(x => x.trackingState), + nameof(x => x.trackingProcess), + nameof(x => x.contactTypeHint), + nameof(x => x.notifyState), + nameof(x => x.notifiedWith), + nameof(x => x.notifiedAt), + nameof(x => x.createdAt), + nameof(x => x.updatedAt), + nameof(x => x.hash), + nameof(x => x.isActive) + ]; + + rowIdentity = x => x.id; + + constructor( + protected router: Router, + protected route: ActivatedRoute, + protected uiNotificationService: UiNotificationService, + protected httpErrorHandlingService: HttpErrorHandlingService, + protected queryParamsService: QueryParamsService, + private notificationService: NotificationService, + public authService: AuthService, + private pipeService: PipeService, + public enumUtils: EnumUtils, + private language: TranslateService, + private dialog: MatDialog + ) { + super(router, route, uiNotificationService, httpErrorHandlingService, queryParamsService); + // Lookup setup + // Default lookup values are defined in the user settings class. + this.lookup = this.initializeLookup(); + } + + ngOnInit() { + super.ngOnInit(); + } + + protected initializeLookup(): NotificationLookup { + const lookup = new NotificationLookup(); + lookup.metadata = { countAll: true }; + lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE }; + lookup.isActive = [IsActive.Active]; + lookup.order = { items: [this.toDescSortField(nameof(x => x.createdAt))] }; + this.updateOrderUiFields(lookup.order); + + lookup.project = { + fields: this.lookupFields + }; + + return lookup; + } + + protected setupColumns() { + this.gridColumns.push(...[{ + prop: nameof(x => x.type), + sortable: true, + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FIELDS.NOTIFICATION-TYPE', + pipe: this.pipeService.getPipe(NotificationTypePipe) + }, + { + prop: nameof(x => x.contactTypeHint), + sortable: true, + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FIELDS.CONTACT-TYPE', + pipe: this.pipeService.getPipe(NotificationContactTypePipe) + }, + { + prop: nameof(x => x.notifyState), + sortable: true, + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FIELDS.NOTIFY-STATE', + pipe: this.pipeService.getPipe(NotificationNotifyStatePipe) + }, + { + prop: nameof(x => x.notifiedWith), + sortable: true, + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FIELDS.NOTIFIED-WITH', + pipe: this.pipeService.getPipe(NotificationContactTypePipe) + }, + { + prop: nameof(x => x.notifiedAt), + sortable: true, + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FIELDS.NOTIFIED-AT', + // pipe: this.pipeService.getPipe(NotificationContactTypePipe) + }, + { + prop: nameof(x => x.trackingState), + sortable: true, + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FIELDS.TRACKING-STATE', + pipe: this.pipeService.getPipe(NotificationTrackingStatePipe) + }, + { + prop: nameof(x => x.trackingProcess), + sortable: true, + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FIELDS.TRACKING-PROCESS', + pipe: this.pipeService.getPipe(NotificationTrackingProcessPipe) + }, + { + prop: nameof(x => x.retryCount), + sortable: true, + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FIELDS.RETRY-COUNT', + }, + { + prop: nameof(x => x.createdAt), + sortable: true, + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FIELDS.CREATED-AT', + pipe: this.pipeService.getPipe(DataTableDateTimeFormatPipe).withFormat('short') + }, + { + prop: nameof(x => x.updatedAt), + sortable: true, + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FIELDS.UPDATED-AT', + pipe: this.pipeService.getPipe(DataTableDateTimeFormatPipe).withFormat('short') + }, + { + prop: nameof(x => x.isActive), + sortable: true, + languageName: 'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.FIELDS.IS-ACTIVE', + pipe: this.pipeService.getPipe(IsActiveTypePipe) + }, + { + alwaysShown: true, + cellTemplate: this.actions, + maxWidth: 120 + } + ]); + this.propertiesAvailableForOrder = this.gridColumns.filter(x => x.sortable); + } + + // + // Listing Component functions + // + onColumnsChanged(event: ColumnsChangedEvent) { + super.onColumnsChanged(event); + this.onColumnsChangedInternal(event.properties.map(x => x.toString())); + } + + private onColumnsChangedInternal(columns: string[]) { + // Here are defined the projection fields that always requested from the api. + const fields = new Set(this.lookupFields); + this.gridColumns.map(x => x.prop) + .filter(x => !columns?.includes(x as string)) + .forEach(item => { + fields.delete(item as string) + }); + this.lookup.project = { fields: [...fields] }; + this.onPageLoad({ offset: 0 } as PageLoadEvent); + } + + protected loadListing(): Observable> { + return this.notificationService.query(this.lookup); + } + + public deleteType(id: Guid) { + if (id) { + const dialogRef = this.dialog.open(ConfirmationDialogComponent, { + data: { + isDeleteConfirmation: true, + message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'), + confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'), + cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL') + } + }); + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { + if (result) { + this.notificationService.delete(id).pipe(takeUntil(this._destroyed)) + .subscribe( + complete => this.onCallbackSuccess(), + error => this.onCallbackError(error) + ); + } + }); + } + } + + onCallbackSuccess(): void { + this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success); + this.ngOnInit(); + } +} diff --git a/dmp-frontend/src/app/ui/admin/notification/notification.module.ts b/dmp-frontend/src/app/ui/admin/notification/notification.module.ts new file mode 100644 index 000000000..68d779f10 --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/notification/notification.module.ts @@ -0,0 +1,41 @@ +import { DragDropModule } from '@angular/cdk/drag-drop'; +import { NgModule } from "@angular/core"; +import { AutoCompleteModule } from "@app/library/auto-complete/auto-complete.module"; +import { CommonFormattingModule } from '@common/formatting/common-formatting.module'; +import { CommonFormsModule } from '@common/forms/common-forms.module'; +import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module'; +import { HybridListingModule } from "@common/modules/hybrid-listing/hybrid-listing.module"; +import { TextFilterModule } from "@common/modules/text-filter/text-filter.module"; +import { UserSettingsModule } from "@common/modules/user-settings/user-settings.module"; +import { CommonUiModule } from '@common/ui/common-ui.module'; +import { NgxDropzoneModule } from "ngx-dropzone"; +import { NotificationListingComponent } from './notification-listing.component'; +import { RichTextEditorModule } from '@app/library/rich-text-editor/rich-text-editor.module'; +import { NotificationRoutingModule } from './notification.routing'; +import { NotificationListingFiltersComponent } from './filters/notification-listing-filters.component'; +import { MatIconModule } from '@angular/material/icon'; +import { EditorModule } from '@tinymce/tinymce-angular'; + +@NgModule({ + imports: [ + CommonUiModule, + CommonFormsModule, + ConfirmationDialogModule, + NotificationRoutingModule, + NgxDropzoneModule, + DragDropModule, + AutoCompleteModule, + HybridListingModule, + TextFilterModule, + UserSettingsModule, + CommonFormattingModule, + RichTextEditorModule, + MatIconModule, + EditorModule + ], + declarations: [ + NotificationListingComponent, + NotificationListingFiltersComponent + ] +}) +export class NotificationModule { } diff --git a/dmp-frontend/src/app/ui/admin/notification/notification.routing.ts b/dmp-frontend/src/app/ui/admin/notification/notification.routing.ts new file mode 100644 index 000000000..9174a1ae0 --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/notification/notification.routing.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { AuthGuard } from '@app/core/auth-guard.service'; +import { NotificationListingComponent } from './notification-listing.component'; + +const routes: Routes = [ + { + path: '', + component: NotificationListingComponent, + canActivate: [AuthGuard] + }, + { path: '**', loadChildren: () => import('@common/modules/page-not-found/page-not-found.module').then(m => m.PageNotFoundModule) }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], + providers: [] +}) +export class NotificationRoutingModule { } diff --git a/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts b/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts index 76c6c70f6..6dbf6d10c 100644 --- a/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts +++ b/dmp-frontend/src/app/ui/sidebar/sidebar.component.ts @@ -58,6 +58,7 @@ export const ADMIN_ROUTES: RouteInfo[] = [ { path: '/languages', title: 'SIDE-BAR.LANGUAGES', icon: 'language' }, { path: '/supportive-material', title: 'SIDE-BAR.SUPPORTIVE-MATERIAL', icon: 'dataset_linked' }, { path: '/notification-templates', title: 'SIDE-BAR.NOTIFICATION-TEMPLATES', icon: 'build'}, + { path: '/notifications', title: 'SIDE-BAR.NOTIFICATIONS', icon: 'build'}, { path: '/index-managment', title: 'SIDE-BAR.MAINTENANCE', icon: 'build'} ]; diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index 94b4bec00..b6e029b5e 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -255,7 +255,8 @@ "NEW-LANGUAGE": "New", "EDIT-LANGUAGE": "Edit", "NOTIFICATION-TEMPLATES": "Notification Templates", - "INAPP-NOTIFICATIONS":"Notifications" + "INAPP-NOTIFICATIONS":"Notifications", + "NOTIFICATIONS": "Notifications" }, "COOKIE": { "MESSAGE": "This website uses cookies to enhance the user experience.", @@ -357,7 +358,8 @@ "REFERENCES": "References", "LANGUAGES": "Languages", "MAINTENANCE": "Maintenance", - "NOTIFICATION-TEMPLATES": "Notification Templates" + "NOTIFICATION-TEMPLATES": "Notification Templates", + "NOTIFICATIONS":"Notifications" }, "DESCRIPTION-TEMPLATE-EDITOR": { "TITLE": { @@ -1252,37 +1254,6 @@ "SUCCESSFUL-DELETE": "Successful Delete", "UNSUCCESSFUL-DELETE": "This item could not be deleted." }, - "NOTIFICATION-TEMPLATE-LISTING": { - "TITLE": "Notification Templates", - "CREATE": "Create Notification Template", - "FIELDS": { - "LANGUAGE": "Language", - "KIND": "Kind", - "CHANNEL": "Channel", - "UPDATED-AT": "Updated", - "CREATED-AT": "Created", - "IS-ACTIVE": "Is Active" - }, - "FILTER": { - "TITLE": "Filters", - "IS-ACTIVE": "Is Active", - "KIND": "Kind", - "CHANNEL": "Channel", - "CANCEL": "Cancel", - "APPLY-FILTERS": "Apply filters" - }, - "CONFIRM-DELETE-DIALOG": { - "MESSAGE": "Would you like to delete this Notification Template?", - "CONFIRM-BUTTON": "Yes, delete", - "CANCEL-BUTTON": "No" - }, - "ACTIONS": { - "DELETE": "Delete", - "EDIT": "Edit" - }, - "SUCCESSFUL-DELETE": "Successful Delete", - "UNSUCCESSFUL-DELETE": "This item could not be deleted." - }, "SUPPORTIVE-MATERIAL-EDITOR": { "TITLE": "Supportive Material", "FIELDS": { @@ -1368,6 +1339,39 @@ "DELETE": "Delete" } }, + "NOTIFICATION-TEMPLATE-LISTING": { + "TITLE": "Notification Templates", + "CREATE": "Create Notification Template", + "FIELDS": { + "NOTIFICATION-TYPE": "Type", + "LANGUAGE": "Language", + "KIND": "Kind", + "CHANNEL": "Channel", + "UPDATED-AT": "Updated", + "CREATED-AT": "Created", + "IS-ACTIVE": "Is Active" + }, + "FILTER": { + "TITLE": "Filters", + "NOTIFICATION-TYPE": "Type", + "IS-ACTIVE": "Is Active", + "KIND": "Kind", + "CHANNEL": "Channel", + "CANCEL": "Cancel", + "APPLY-FILTERS": "Apply filters" + }, + "CONFIRM-DELETE-DIALOG": { + "MESSAGE": "Would you like to delete this Notification Template?", + "CONFIRM-BUTTON": "Yes, delete", + "CANCEL-BUTTON": "No" + }, + "ACTIONS": { + "DELETE": "Delete", + "EDIT": "Edit" + }, + "SUCCESSFUL-DELETE": "Successful Delete", + "UNSUCCESSFUL-DELETE": "This item could not be deleted." + }, "NOTIFICATION-TEMPLATE-EDITOR": { "NEW": "New Notification Template", "FIELDS": { @@ -1405,6 +1409,44 @@ "CANCEL": "Cancel", "DELETE": "Delete" } + }, + "NOTIFICATION-LISTING": { + "TITLE": "Notifications", + "FIELDS": { + "NOTIFICATION-TYPE": "Type", + "NOTIFY-STATE": "Notify State", + "NOTIFIED-WITH": "Notified With", + "CONTACT-TYPE": "Contact Type", + "TRACKING-STATE": "Tracking State", + "TRACKING-PROCESS": "Tracking Process", + "RETRY-COUNT": "Retry Count", + "NOTIFIED-AT": "Notified At", + "UPDATED-AT": "Updated", + "CREATED-AT": "Created", + "IS-ACTIVE": "Is Active" + }, + "FILTER": { + "TITLE": "Filters", + "NOTIFICATION-TYPE": "Type", + "IS-ACTIVE": "Is Active", + "NOTIFY-STATE": "Notify State", + "CONTACT-TYPE": "Contact Type", + "TRACKING-STATE": "Tracking State", + "TRACKING-PROCESS": "Tracking Process", + "CANCEL": "Cancel", + "APPLY-FILTERS": "Apply filters" + }, + "CONFIRM-DELETE-DIALOG": { + "MESSAGE": "Would you like to delete this Notification?", + "CONFIRM-BUTTON": "Yes, delete", + "CANCEL-BUTTON": "No" + }, + "ACTIONS": { + "DELETE": "Delete", + "EDIT": "Edit" + }, + "SUCCESSFUL-DELETE": "Successful Delete", + "UNSUCCESSFUL-DELETE": "This item could not be deleted." } }, "DESCRIPTION-TEMPLATE-TYPE-EDITOR": { @@ -2319,6 +2361,34 @@ "NOTIFICATION-INAPP-TRACKING": { "STORED": "Unread", "DELIVERED": "Read" + }, + "NOTIFICATION-CONTACT-TYPE": { + "EMAIL": "Email", + "INAPP": "In App" + }, + "NOTIFICATION-NOTIFY-STATE": { + "PENDING": "Pending", + "PROCESSING": "Processing", + "SUCCESSFUL": "Successful", + "ERROR":"Error", + "OMITTED": "Omitted" + }, + "NOTIFICATION-TRACKING-STATE": { + "UNDEFINED": "Undefined", + "NA": "NA", + "QUEUED": "Queued", + "SENT":"Sent", + "DELIVERED": "Delivered", + "UNDELIVERED": "Undelivered", + "FAILED": "Failed", + "UNSENT": "Unsent" + }, + "NOTIFICATION-TRACKING-PROCESS": { + "PENDING": "Pending", + "PROCESSING": "Processing", + "SUCCESSFUL": "Successful", + "ERROR":"Error", + "OMITTED": "Omitted" } }, "ADDRESEARCHERS-EDITOR": { diff --git a/dmp-frontend/src/common/formatting/common-formatting.module.ts b/dmp-frontend/src/common/formatting/common-formatting.module.ts index 2ed1bea50..788a33ee9 100644 --- a/dmp-frontend/src/common/formatting/common-formatting.module.ts +++ b/dmp-frontend/src/common/formatting/common-formatting.module.ts @@ -10,6 +10,10 @@ import { ReferenceSourceTypePipe } from './pipes/reference-source-type.pipe'; import { NotificationTemplateChannelPipe } from './pipes/notification-template-channel.pipe'; import { NotificationTemplateKindPipe } from './pipes/notification-template-kind.pipe'; import { NotificationTypePipe } from './pipes/notification-type.pipe'; +import { NotificationContactTypePipe } from './pipes/notification-contact-type.pipe'; +import { NotificationNotifyStatePipe } from './pipes/notification-notify-state.pipe'; +import { NotificationTrackingProcessPipe } from './pipes/notification-tracking-process.pipe'; +import { NotificationTrackingStatePipe } from './pipes/notification-tracking-state.pipe'; // // @@ -31,7 +35,11 @@ import { NotificationTypePipe } from './pipes/notification-type.pipe'; ReferenceSourceTypePipe, NotificationTemplateChannelPipe, NotificationTemplateKindPipe, - NotificationTypePipe + NotificationTypePipe, + NotificationContactTypePipe, + NotificationNotifyStatePipe, + NotificationTrackingProcessPipe, + NotificationTrackingStatePipe ], exports: [ DateFormatPipe, @@ -47,7 +55,11 @@ import { NotificationTypePipe } from './pipes/notification-type.pipe'; ReferenceSourceTypePipe, NotificationTemplateChannelPipe, NotificationTemplateKindPipe, - NotificationTypePipe + NotificationTypePipe, + NotificationContactTypePipe, + NotificationNotifyStatePipe, + NotificationTrackingProcessPipe, + NotificationTrackingStatePipe ], providers: [ DateFormatPipe, @@ -63,7 +75,11 @@ import { NotificationTypePipe } from './pipes/notification-type.pipe'; ReferenceSourceTypePipe, NotificationTemplateChannelPipe, NotificationTemplateKindPipe, - NotificationTypePipe + NotificationTypePipe, + NotificationContactTypePipe, + NotificationNotifyStatePipe, + NotificationTrackingProcessPipe, + NotificationTrackingStatePipe ] }) export class CommonFormattingModule { } diff --git a/dmp-frontend/src/common/formatting/pipes/notification-contact-type.pipe.ts b/dmp-frontend/src/common/formatting/pipes/notification-contact-type.pipe.ts new file mode 100644 index 000000000..160498482 --- /dev/null +++ b/dmp-frontend/src/common/formatting/pipes/notification-contact-type.pipe.ts @@ -0,0 +1,11 @@ +import { Pipe, PipeTransform } from '@angular/core'; +import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; + +@Pipe({ name: 'NotificationContactTypeFormat' }) +export class NotificationContactTypePipe implements PipeTransform { + constructor(private enumUtils: EnumUtils) { } + + public transform(value): any { + return this.enumUtils.toNotificationContactTypeString(value); + } +} \ No newline at end of file diff --git a/dmp-frontend/src/common/formatting/pipes/notification-notify-state.pipe.ts b/dmp-frontend/src/common/formatting/pipes/notification-notify-state.pipe.ts new file mode 100644 index 000000000..f056c5bb1 --- /dev/null +++ b/dmp-frontend/src/common/formatting/pipes/notification-notify-state.pipe.ts @@ -0,0 +1,11 @@ +import { Pipe, PipeTransform } from '@angular/core'; +import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; + +@Pipe({ name: 'NotificationNotifyStateFormat' }) +export class NotificationNotifyStatePipe implements PipeTransform { + constructor(private enumUtils: EnumUtils) { } + + public transform(value): any { + return this.enumUtils.toNotificationNotifyStateString(value); + } +} \ No newline at end of file diff --git a/dmp-frontend/src/common/formatting/pipes/notification-tracking-process.pipe.ts b/dmp-frontend/src/common/formatting/pipes/notification-tracking-process.pipe.ts new file mode 100644 index 000000000..de69188b6 --- /dev/null +++ b/dmp-frontend/src/common/formatting/pipes/notification-tracking-process.pipe.ts @@ -0,0 +1,11 @@ +import { Pipe, PipeTransform } from '@angular/core'; +import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; + +@Pipe({ name: 'NotificationTrackingProcessFormat' }) +export class NotificationTrackingProcessPipe implements PipeTransform { + constructor(private enumUtils: EnumUtils) { } + + public transform(value): any { + return this.enumUtils.toNotificationTrackingProcessString(value); + } +} \ No newline at end of file diff --git a/dmp-frontend/src/common/formatting/pipes/notification-tracking-state.pipe.ts b/dmp-frontend/src/common/formatting/pipes/notification-tracking-state.pipe.ts new file mode 100644 index 000000000..450225329 --- /dev/null +++ b/dmp-frontend/src/common/formatting/pipes/notification-tracking-state.pipe.ts @@ -0,0 +1,11 @@ +import { Pipe, PipeTransform } from '@angular/core'; +import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; + +@Pipe({ name: 'NotificationTrackingStateFormat' }) +export class NotificationTrackingStatePipe implements PipeTransform { + constructor(private enumUtils: EnumUtils) { } + + public transform(value): any { + return this.enumUtils.toNotificationTrackingStateString(value); + } +} \ No newline at end of file