diff --git a/ui-ngx/src/app/core/services/menu.service.ts b/ui-ngx/src/app/core/services/menu.service.ts
index ace01694f9..0348ef8e88 100644
--- a/ui-ngx/src/app/core/services/menu.service.ts
+++ b/ui-ngx/src/app/core/services/menu.service.ts
@@ -140,8 +140,48 @@ export class MenuService {
id: guid(),
name: 'notification.notification-center',
type: 'link',
- path: '/notification-center',
- icon: 'notifications'
+ path: '/notification',
+ icon: 'mdi:message-badge',
+ isMdiIcon: true,
+ pages: [
+ {
+ id: guid(),
+ name: 'notification.inbox',
+ type: 'link',
+ path: '/notification/inbox',
+ icon: 'inbox'
+ },
+ {
+ id: guid(),
+ name: 'notification.sent',
+ type: 'link',
+ path: '/notification/sent',
+ icon: 'outbox'
+ },
+ {
+ id: guid(),
+ name: 'notification.templates',
+ type: 'link',
+ path: '/notification/templates',
+ icon: 'mdi:message-draw',
+ isMdiIcon: true
+ },
+ {
+ id: guid(),
+ name: 'notification.recipients',
+ type: 'link',
+ path: '/notification/recipients',
+ icon: 'contacts'
+ },
+ {
+ id: guid(),
+ name: 'notification.rules',
+ type: 'link',
+ path: '/notification/rules',
+ icon: 'mdi:message-cog',
+ isMdiIcon: true
+ }
+ ]
},
{
id: guid(),
@@ -253,16 +293,6 @@ export class MenuService {
}
]
},
- {
- name: 'notification.management',
- places: [
- {
- name: 'notification.notification-center',
- path: '/notification-center',
- icon: 'notifications'
- },
- ]
- },
{
name: 'admin.system-settings',
places: [
@@ -541,13 +571,6 @@ export class MenuService {
path: '/usage',
icon: 'insert_chart'
},
- {
- id: guid(),
- name: 'notification.notification-center',
- type: 'link',
- path: '/notification-center',
- icon: 'notifications'
- },
{
id: guid(),
name: 'admin.settings',
@@ -721,16 +744,6 @@ export class MenuService {
}
]
},
- {
- name: 'notification.management',
- places: [
- {
- name: 'notification.notification-center',
- path: '/notification-center',
- icon: 'notifications'
- },
- ]
- },
{
name: 'audit-log.audit',
places: [
@@ -855,6 +868,25 @@ export class MenuService {
icon: 'dashboard'
}
);
+ sections.push(
+ {
+ id: guid(),
+ name: 'notification.notification-center',
+ type: 'link',
+ path: '/notification',
+ icon: 'mdi:message-badge',
+ isMdiIcon: true,
+ pages: [
+ {
+ id: guid(),
+ name: 'notification.inbox',
+ type: 'link',
+ path: '/notification/inbox',
+ icon: 'inbox'
+ }
+ ]
+ }
+ );
return sections;
}
@@ -916,16 +948,6 @@ export class MenuService {
path: '/dashboards'
}
]
- },
- {
- name: 'notification.management',
- places: [
- {
- name: 'notification.notification-center',
- path: '/notification-center',
- icon: 'notifications'
- },
- ]
}
);
return homeSections;
diff --git a/ui-ngx/src/app/modules/home/components/notification/show-notification-popover.component.ts b/ui-ngx/src/app/modules/home/components/notification/show-notification-popover.component.ts
index ed6f1a025b..5e94289055 100644
--- a/ui-ngx/src/app/modules/home/components/notification/show-notification-popover.component.ts
+++ b/ui-ngx/src/app/modules/home/components/notification/show-notification-popover.component.ts
@@ -92,7 +92,7 @@ export class ShowNotificationPopoverComponent extends PageComponent implements O
$event.stopPropagation();
}
this.onClose();
- this.router.navigateByUrl(this.router.createUrlTree(['notification-center'])).then(() => {});
+ this.router.navigateByUrl(this.router.parseUrl('/notification/inbox')).then(() => {});
}
trackById(index: number, item: NotificationRequest): string {
diff --git a/ui-ngx/src/app/modules/home/pages/home-pages.module.ts b/ui-ngx/src/app/modules/home/pages/home-pages.module.ts
index 84f1c7e518..b1f4715c33 100644
--- a/ui-ngx/src/app/modules/home/pages/home-pages.module.ts
+++ b/ui-ngx/src/app/modules/home/pages/home-pages.module.ts
@@ -42,7 +42,6 @@ import { AlarmModule } from '@home/pages/alarm/alarm.module';
import { EntitiesModule } from '@home/pages/entities/entities.module';
import { FeaturesModule } from '@home/pages/features/features.module';
import { NotificationModule } from '@home/pages/notification/notification.module';
-import { NotificationCenterModule } from '@home/pages/notification-center/notification-center.module';
@NgModule({
exports: [
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-center-routing.module.ts b/ui-ngx/src/app/modules/home/pages/notification-center/notification-center-routing.module.ts
deleted file mode 100644
index 1a99fa6608..0000000000
--- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-center-routing.module.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-///
-/// Copyright © 2016-2023 The Thingsboard Authors
-///
-/// 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 { NgModule } from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
-import { Authority } from '@shared/models/authority.enum';
-import { NotificationCenterComponent } from '@home/pages/notification-center/notification-center.component';
-
-const routes: Routes = [
- {
- path: 'notification-center',
- component: NotificationCenterComponent,
- data: {
- auth: [Authority.SYS_ADMIN, Authority.TENANT_ADMIN, Authority.CUSTOMER_USER],
- title: 'notification.notification-center',
- breadcrumb: {
- label: 'notification.notification-center',
- icon: 'notifications'
- }
- }
- }
-];
-
-@NgModule({
- imports: [RouterModule.forChild(routes)],
- exports: [RouterModule]
-})
-export class NotificationCenterRoutingModule { }
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-center.component.html b/ui-ngx/src/app/modules/home/pages/notification-center/notification-center.component.html
deleted file mode 100644
index 9ea951a251..0000000000
--- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-center.component.html
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-center.component.scss b/ui-ngx/src/app/modules/home/pages/notification-center/notification-center.component.scss
deleted file mode 100644
index b8971abfa4..0000000000
--- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-center.component.scss
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * Copyright © 2016-2023 The Thingsboard Authors
- *
- * 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 '../../../../../scss/constants';
-
-:host {
- width: 100%;
- height: 100%;
- display: block;
- .tb-notification-center {
- padding: 8px;
- width: 100%;
- height: 100%;
- display: block;
-
- .tb-notification-center-content {
- width: 100%;
- height: 100%;
- background: #fff;
- border-radius: 4px;
- box-shadow: 0 4px 10px rgba(23, 33, 90, 0.08);
- display: flex;
- flex-direction: column;
-
- .tabs-container {
- position: relative;
- flex-direction: column;
- flex: 1 1 100%;
- }
- }
- }
-}
-
-:host ::ng-deep {
- .tabs-container {
- > .mat-mdc-tab-group {
- > .mat-mdc-tab-body-wrapper {
- position: absolute;
- top: 49px;
- left: 0;
- right: 0;
- bottom: 0;
- }
-
- > .mat-mdc-tab-header {
- .mat-mdc-tab {
- &.mat-mdc-tab-disabled {
- opacity: 1;
- flex: 1;
-
- .mdc-tab__content, .mdc-tab__text-label {
- flex: 1;
- }
- }
- }
- }
- }
-
- .tb-entity-table {
- padding: 0;
-
- .mat-toolbar-single-row, .mat-toolbar-tools {
- height: 56px;
- }
-
- .mat-toolbar-tools > div {
- width: 100%;
- }
-
- .mat-toolbar-single-row {
- padding: 0 24px 0 12px;
- }
- }
- }
-
- @media #{$mat-xs} {
- .tabs-container {
- > .mat-mdc-tab-group {
- > .mat-mdc-tab-header {
- .mat-mdc-tab {
- &.mat-tab-disabled {
- width: auto;
- }
- }
- }
- }
- }
- }
-}
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-center.component.ts b/ui-ngx/src/app/modules/home/pages/notification-center/notification-center.component.ts
deleted file mode 100644
index b78ad2b320..0000000000
--- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-center.component.ts
+++ /dev/null
@@ -1,74 +0,0 @@
-///
-/// Copyright © 2016-2023 The Thingsboard Authors
-///
-/// 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 { Component, QueryList, ViewChild, ViewChildren } from '@angular/core';
-import { PageComponent } from '@shared/components/page.component';
-import { Store } from '@ngrx/store';
-import { AppState } from '@core/core.state';
-import { MatTab, MatTabGroup } from '@angular/material/tabs';
-import {
- NotificationTableComponent
-} from '@home/pages/notification-center/notification-table/notification-table.component';
-import { EntityType } from '@shared/models/entity-type.models';
-import { Authority } from '@shared/models/authority.enum';
-import { AuthState } from '@core/auth/auth.models';
-import { getCurrentAuthState } from '@core/auth/auth.selectors';
-import { AuthUser } from '@shared/models/user.model';
-
-@Component({
- selector: 'tb-notification-center',
- templateUrl: './notification-center.component.html',
- styleUrls: ['notification-center.component.scss']
-})
-export class NotificationCenterComponent extends PageComponent {
-
- private authState: AuthState = getCurrentAuthState(this.store);
- private authUser: AuthUser = this.authState.authUser;
-
- entityType = EntityType;
-
- @ViewChild('matTabGroup') matTabs: MatTabGroup;
- @ViewChild('requestTab') requestTab: MatTab;
- @ViewChild('notificationRequest') notificationRequestTable: NotificationTableComponent;
- @ViewChildren(NotificationTableComponent) tableComponent: QueryList;
-
-
- constructor(
- protected store: Store) {
- super(store);
- }
-
- updateData() {
- this.currentTableComponent?.updateData();
- }
-
- openSetting() {
-
- }
-
- private get currentTableComponent(): NotificationTableComponent {
- return this.tableComponent.get(this.matTabs.selectedIndex);
- }
-
- sendNotification($event: Event) {
- this.notificationRequestTable.entityTableConfig
- .onEntityAction({event: $event, action: this.requestTab.isActive ? 'add' : 'add-without-update', entity: null});
- }
-
- public isCustomerUser(): boolean {
- return this.authUser.authority === Authority.CUSTOMER_USER;
- }
-}
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-center.module.ts b/ui-ngx/src/app/modules/home/pages/notification-center/notification-center.module.ts
deleted file mode 100644
index 383387b647..0000000000
--- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-center.module.ts
+++ /dev/null
@@ -1,83 +0,0 @@
-///
-/// Copyright © 2016-2023 The Thingsboard Authors
-///
-/// 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 { NgModule } from '@angular/core';
-import { CommonModule } from '@angular/common';
-import { SharedModule } from '@shared/shared.module';
-import { NotificationCenterRoutingModule } from './notification-center-routing.module';
-import { NotificationCenterComponent } from './notification-center.component';
-import { HomeComponentsModule } from '@home/components/home-components.module';
-import {
- TargetNotificationDialogComponent
-} from '@home/pages/notification-center/targets-table/target-notification-dialog.componet';
-import {
- NotificationTableComponent
-} from '@home/pages/notification-center/notification-table/notification-table.component';
-import {
- TemplateNotificationDialogComponent
-} from '@home/pages/notification-center/template-table/template-notification-dialog.component';
-import {
- TargetTableHeaderComponent
-} from '@home/pages/notification-center/targets-table/target-table-header.component';
-import {
- TemplateTableHeaderComponent
-} from '@home/pages/notification-center/template-table/template-table-header.component';
-import {
- RequestNotificationDialogComponent
-} from '@home/pages/notification-center/request-table/request-notification-dialog.componet';
-import {
- TemplateAutocompleteComponent
-} from '@home/pages/notification-center/template-table/template-autocomplete.component';
-import { InboxTableHeaderComponent } from '@home/pages/notification-center/inbox-table/inbox-table-header.component';
-import { RuleTableHeaderComponent } from '@home/pages/notification-center/rule-table/rule-table-header.component';
-import {
- RuleNotificationDialogComponent
-} from '@home/pages/notification-center/rule-table/rule-notification-dialog.component';
-import { EscalationsComponent } from '@home/pages/notification-center/rule-table/escalations.component';
-import { EscalationFormComponent } from '@home/pages/notification-center/rule-table/escalation-form.component';
-import {
- InboxNotificationDialogComponent
-} from '@home/pages/notification-center/inbox-table/inbox-notification-dialog.component';
-import {
- NotificationRequestErrorDialogComponent
-} from '@home/pages/notification-center/request-table/notification-request-error-dialog.component';
-
-@NgModule({
- declarations: [
- NotificationCenterComponent,
- TargetNotificationDialogComponent,
- TemplateNotificationDialogComponent,
- RequestNotificationDialogComponent,
- TargetTableHeaderComponent,
- TemplateTableHeaderComponent,
- NotificationTableComponent,
- TemplateAutocompleteComponent,
- InboxTableHeaderComponent,
- RuleTableHeaderComponent,
- RuleNotificationDialogComponent,
- EscalationsComponent,
- EscalationFormComponent,
- InboxNotificationDialogComponent,
- NotificationRequestErrorDialogComponent
- ],
- imports: [
- CommonModule,
- SharedModule,
- NotificationCenterRoutingModule,
- HomeComponentsModule
- ]
-})
-export class NotificationCenterModule { }
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/notification-table.component.html b/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/notification-table.component.html
deleted file mode 100644
index d2bc7e8cf7..0000000000
--- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/notification-table.component.html
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/notification-table.component.ts b/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/notification-table.component.ts
deleted file mode 100644
index a84c9a32c0..0000000000
--- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/notification-table.component.ts
+++ /dev/null
@@ -1,98 +0,0 @@
-///
-/// Copyright © 2016-2023 The Thingsboard Authors
-///
-/// 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 { Component, Input, OnInit, ViewChild } from '@angular/core';
-import { EntitiesTableComponent } from '@home/components/entity/entities-table.component';
-import { NotificationService } from '@core/http/notification.service';
-import { TargetsTableConfig } from '@home/pages/notification-center/notification-table/targets-table-config';
-import { TranslateService } from '@ngx-translate/core';
-import { MatDialog } from '@angular/material/dialog';
-import { EntityType } from '@shared/models/entity-type.models';
-import { EntityTableConfig } from '@home/models/entity/entities-table-config.models';
-import { InboxTableConfig } from '@home/pages/notification-center/notification-table/inbox-table-config';
-import { DatePipe } from '@angular/common';
-import { TemplateTableConfig } from '@home/pages/notification-center/notification-table/template-table-config';
-import { RequestTableConfig } from '@home/pages/notification-center/notification-table/request-table-config';
-import { RuleTableConfig } from '@home/pages/notification-center/notification-table/rule-table-config';
-
-@Component({
- selector: 'tb-notification-table',
- templateUrl: './notification-table.component.html'
-})
-export class NotificationTableComponent implements OnInit {
-
- @Input()
- notificationType = EntityType.NOTIFICATION;
-
- @ViewChild(EntitiesTableComponent, {static: true}) entitiesTable: EntitiesTableComponent;
-
- entityTableConfig: EntityTableConfig;
-
- constructor(private notificationService: NotificationService,
- private translate: TranslateService,
- private datePipe: DatePipe,
- private dialog: MatDialog) {
- }
-
- ngOnInit() {
- this.entityTableConfig = this.getTableConfig();
- this.entityTableConfig.pageMode = false;
- this.entityTableConfig.detailsPanelEnabled = false;
- this.entityTableConfig.selectionEnabled = false;
- this.entityTableConfig.addEnabled = false;
- }
-
- updateData() {
- this.entitiesTable.updateData();
- }
-
- private getTableConfig(): EntityTableConfig {
- switch (this.notificationType) {
- case EntityType.NOTIFICATION_TARGET:
- return new TargetsTableConfig(
- this.notificationService,
- this.translate,
- this.dialog
- );
- case EntityType.NOTIFICATION:
- return new InboxTableConfig(
- this.notificationService,
- this.translate,
- this.dialog,
- this.datePipe
- );
- case EntityType.NOTIFICATION_TEMPLATE:
- return new TemplateTableConfig(
- this.notificationService,
- this.translate,
- this.dialog
- );
- case EntityType.NOTIFICATION_REQUEST:
- return new RequestTableConfig(
- this.notificationService,
- this.translate,
- this.dialog,
- this.datePipe
- );
- case EntityType.NOTIFICATION_RULE:
- return new RuleTableConfig(
- this.notificationService,
- this.translate,
- this.dialog
- );
- }
- }
-}
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-notification-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification/inbox/inbox-notification-dialog.component.html
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-notification-dialog.component.html
rename to ui-ngx/src/app/modules/home/pages/notification/inbox/inbox-notification-dialog.component.html
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-notification-dialog.component.scss b/ui-ngx/src/app/modules/home/pages/notification/inbox/inbox-notification-dialog.component.scss
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-notification-dialog.component.scss
rename to ui-ngx/src/app/modules/home/pages/notification/inbox/inbox-notification-dialog.component.scss
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-notification-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/notification/inbox/inbox-notification-dialog.component.ts
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-notification-dialog.component.ts
rename to ui-ngx/src/app/modules/home/pages/notification/inbox/inbox-notification-dialog.component.ts
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/inbox-table-config.ts b/ui-ngx/src/app/modules/home/pages/notification/inbox/inbox-table-config.resolver.ts
similarity index 66%
rename from ui-ngx/src/app/modules/home/pages/notification-center/notification-table/inbox-table-config.ts
rename to ui-ngx/src/app/modules/home/pages/notification/inbox/inbox-table-config.resolver.ts
index 3dc5ae366e..4a6f4e15bf 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/inbox-table-config.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/inbox/inbox-table-config.resolver.ts
@@ -29,54 +29,64 @@ import {
NotificationTemplateTypeTranslateMap
} from '@shared/models/notification.models';
import { NotificationService } from '@core/http/notification.service';
-import { InboxTableHeaderComponent } from '@home/pages/notification-center/inbox-table/inbox-table-header.component';
+import { InboxTableHeaderComponent } from '@home/pages/notification/inbox/inbox-table-header.component';
import { TranslateService } from '@ngx-translate/core';
import { take } from 'rxjs/operators';
import { MatDialog } from '@angular/material/dialog';
import {
- InboxNotificationDialogComponent, InboxNotificationDialogData
-} from '@home/pages/notification-center/inbox-table/inbox-notification-dialog.component';
+ InboxNotificationDialogComponent,
+ InboxNotificationDialogData
+} from '@home/pages/notification/inbox/inbox-notification-dialog.component';
+import { Injectable } from '@angular/core';
+import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
-export class InboxTableConfig extends EntityTableConfig {
+@Injectable()
+export class InboxTableConfigResolver implements Resolve> {
+
+ private readonly config: EntityTableConfig = new EntityTableConfig();
constructor(private notificationService: NotificationService,
private translate: TranslateService,
private dialog: MatDialog,
private datePipe: DatePipe) {
- super();
- this.entitiesDeleteEnabled = false;
- this.rowPointer = true;
- this.entityTranslations = {
+
+ this.config.detailsPanelEnabled = false;
+ this.config.selectionEnabled = false;
+ this.config.addEnabled = false;
+ this.config.entitiesDeleteEnabled = false;
+ this.config.rowPointer = true;
+ this.config.entityTranslations = {
noEntities: 'notification.no-inbox-notification',
search: 'notification.search-notification'
};
- this.entityResources = {} as EntityTypeResource;
+ this.config.entityResources = {} as EntityTypeResource;
- this.entitiesFetchFunction = pageLink => this.notificationService.getNotifications(pageLink, this.componentsData.unreadOnly);
+ this.config.entitiesFetchFunction = pageLink =>
+ this.notificationService.getNotifications(pageLink, this.config.componentsData.unreadOnly);
- this.defaultSortOrder = {property: 'createdTime', direction: Direction.DESC};
+ this.config.defaultSortOrder = {property: 'createdTime', direction: Direction.DESC};
- this.handleRowClick = ($event, notification) => {
+ this.config.handleRowClick = ($event, notification) => {
this.showNotification($event, notification);
return true;
};
- this.componentsData = {
+ this.config.componentsData = {
unreadOnly: true
};
- this.cellActionDescriptors = this.configureCellActions();
+ this.config.cellActionDescriptors = this.configureCellActions();
- this.headerComponent = InboxTableHeaderComponent;
+ this.config.headerComponent = InboxTableHeaderComponent;
- this.headerActionDescriptors = [{
+ this.config.headerActionDescriptors = [{
name: this.translate.instant('notification.mark-all-as-read'),
icon: 'done_all',
isEnabled: () => true,
onAction: $event => this.markAllRead($event)
}];
- this.columns.push(
+ this.config.columns.push(
new DateEntityTableColumn('createdTime', 'notification.created-time', this.datePipe, '170px'),
new EntityTableColumn('type', 'notification.type', '10%', (notification) =>
this.translate.instant(NotificationTemplateTypeTranslateMap.get(notification.type).name)),
@@ -86,6 +96,10 @@ export class InboxTableConfig extends EntityTableConfig {
}
+ resolve(route: ActivatedRouteSnapshot): EntityTableConfig {
+ return this.config;
+ }
+
private configureCellActions(): Array> {
return [{
name: this.translate.instant('notification.mark-as-read'),
@@ -100,10 +114,10 @@ export class InboxTableConfig extends EntityTableConfig {
$event.stopPropagation();
}
this.notificationService.markAllNotificationsAsRead().subscribe(() => {
- if (this.componentsData.unreadOnly) {
- this.getTable().resetSortAndFilter(true);
+ if (this.config.componentsData.unreadOnly) {
+ this.config.getTable().resetSortAndFilter(true);
} else {
- this.updateData();
+ this.config.updateData();
}
});
}
@@ -113,18 +127,18 @@ export class InboxTableConfig extends EntityTableConfig {
$event.stopPropagation();
}
this.notificationService.markNotificationAsRead(entity.id.id).subscribe(() => {
- if (this.componentsData.unreadOnly) {
- this.getTable().dataSource.pageData$.pipe(take(1)).subscribe(
+ if (this.config.componentsData.unreadOnly) {
+ this.config.getTable().dataSource.pageData$.pipe(take(1)).subscribe(
(value) => {
- if (value.data.length === 1 && this.getTable().pageLink.page) {
- this.getTable().pageLink.page--;
+ if (value.data.length === 1 && this.config.getTable().pageLink.page) {
+ this.config.getTable().pageLink.page--;
}
- this.updateData();
+ this.config.updateData();
}
);
} else {
entity.status = NotificationStatus.READ;
- this.getTable().detectChanges();
+ this.config.getTable().detectChanges();
}
});
}
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-table-header.component.html b/ui-ngx/src/app/modules/home/pages/notification/inbox/inbox-table-header.component.html
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-table-header.component.html
rename to ui-ngx/src/app/modules/home/pages/notification/inbox/inbox-table-header.component.html
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-table-header.component.scss b/ui-ngx/src/app/modules/home/pages/notification/inbox/inbox-table-header.component.scss
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-table-header.component.scss
rename to ui-ngx/src/app/modules/home/pages/notification/inbox/inbox-table-header.component.scss
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-table-header.component.ts b/ui-ngx/src/app/modules/home/pages/notification/inbox/inbox-table-header.component.ts
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/inbox-table/inbox-table-header.component.ts
rename to ui-ngx/src/app/modules/home/pages/notification/inbox/inbox-table-header.component.ts
diff --git a/ui-ngx/src/app/modules/home/pages/notification/notification-routing.module.ts b/ui-ngx/src/app/modules/home/pages/notification/notification-routing.module.ts
index 4101f61411..791a1d97c4 100644
--- a/ui-ngx/src/app/modules/home/pages/notification/notification-routing.module.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/notification-routing.module.ts
@@ -14,36 +14,23 @@
/// limitations under the License.
///
-import { ActivatedRoute, RouterModule, Routes } from '@angular/router';
+import { RouterModule, Routes } from '@angular/router';
import { Authority } from '@shared/models/authority.enum';
-import { Component, NgModule, OnInit } from '@angular/core';
+import { NgModule } from '@angular/core';
import { RouterTabsComponent } from '@home/components/router-tabs.component';
-import { isDefinedAndNotNull } from '@core/utils';
-
-@Component({
- selector: 'tb-notification-temp-component',
- template: '{{text}}
',
- styleUrls: []
-})
-class NotificationTempComponent implements OnInit {
-
- text: string;
-
- constructor(private route: ActivatedRoute) {}
-
- ngOnInit() {
- if (isDefinedAndNotNull(this.route.snapshot.data.text)) {
- this.text = this.route.snapshot.data.text;
- }
- }
-}
+import { EntitiesTableComponent } from '@home/components/entity/entities-table.component';
+import { InboxTableConfigResolver } from '@home/pages/notification/inbox/inbox-table-config.resolver';
+import { SentTableConfigResolver } from '@home/pages/notification/sent/sent-table-config.resolver';
+import { RecipientTableConfigResolver } from '@home/pages/notification/recipient/recipient-table-config.resolver';
+import { TemplateTableConfigResolver } from '@home/pages/notification/template/template-table-config.resolver';
+import { RuleTableConfigResolver } from '@home/pages/notification/rule/rule-table-config.resolver';
const routes: Routes = [
{
path: 'notification',
component: RouterTabsComponent,
data: {
- auth: [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER],
+ auth: [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER, Authority.SYS_ADMIN],
breadcrumb: {
label: 'notification.notification-center',
icon: 'mdi:message-badge'
@@ -54,73 +41,83 @@ const routes: Routes = [
path: '',
children: [],
data: {
- auth: [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER],
+ auth: [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER, Authority.SYS_ADMIN],
redirectTo: '/notification/inbox'
}
},
{
path: 'inbox',
- component: NotificationTempComponent,
+ component: EntitiesTableComponent,
data: {
- auth: [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER],
+ auth: [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER, Authority.SYS_ADMIN],
title: 'notification.inbox',
breadcrumb: {
label: 'notification.inbox',
icon: 'inbox'
- },
- text: 'TODO: Implement inbox'
+ }
+ },
+ resolve: {
+ entitiesTableConfig: InboxTableConfigResolver
}
},
{
path: 'sent',
- component: NotificationTempComponent,
+ component: EntitiesTableComponent,
data: {
- auth: [Authority.TENANT_ADMIN],
+ auth: [Authority.TENANT_ADMIN, Authority.SYS_ADMIN],
title: 'notification.sent',
breadcrumb: {
label: 'notification.sent',
icon: 'outbox'
- },
- text: 'TODO: Implement sent'
+ }
+ },
+ resolve: {
+ entitiesTableConfig: SentTableConfigResolver
}
},
{
path: 'templates',
- component: NotificationTempComponent,
+ component: EntitiesTableComponent,
data: {
- auth: [Authority.TENANT_ADMIN],
+ auth: [Authority.TENANT_ADMIN, Authority.SYS_ADMIN],
title: 'notification.templates',
breadcrumb: {
label: 'notification.templates',
icon: 'mdi:message-draw'
- },
- text: 'TODO: Implement templates'
+ }
+ },
+ resolve: {
+ entitiesTableConfig: TemplateTableConfigResolver
}
},
{
path: 'recipients',
- component: NotificationTempComponent,
+ component: EntitiesTableComponent,
data: {
- auth: [Authority.TENANT_ADMIN],
+ auth: [Authority.TENANT_ADMIN, Authority.SYS_ADMIN],
title: 'notification.recipients',
breadcrumb: {
label: 'notification.recipients',
icon: 'contacts'
},
- text: 'TODO: Implement recipients'
+ },
+ resolve: {
+ entitiesTableConfig: RecipientTableConfigResolver
}
},
{
path: 'rules',
- component: NotificationTempComponent,
+ component: EntitiesTableComponent,
data: {
- auth: [Authority.TENANT_ADMIN],
+ auth: [Authority.TENANT_ADMIN, Authority.SYS_ADMIN],
title: 'notification.rules',
breadcrumb: {
label: 'notification.rules',
icon: 'mdi:message-cog'
- },
- text: 'TODO: Implement rules'
+ }
+ },
+ resolve: {
+ entitiesTableConfig: RuleTableConfigResolver
}
}
]
@@ -128,7 +125,13 @@ const routes: Routes = [
];
@NgModule({
- declarations: [NotificationTempComponent],
+ providers: [
+ InboxTableConfigResolver,
+ SentTableConfigResolver,
+ RecipientTableConfigResolver,
+ TemplateTableConfigResolver,
+ RuleTableConfigResolver
+ ],
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
diff --git a/ui-ngx/src/app/modules/home/pages/notification/notification.module.ts b/ui-ngx/src/app/modules/home/pages/notification/notification.module.ts
index b81855b79d..53fbb095dd 100644
--- a/ui-ngx/src/app/modules/home/pages/notification/notification.module.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/notification.module.ts
@@ -18,13 +18,46 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SharedModule } from '@shared/shared.module';
import { NotificationRoutingModule } from '@home/pages/notification/notification-routing.module';
+import { InboxTableHeaderComponent } from '@home/pages/notification/inbox/inbox-table-header.component';
+import { InboxNotificationDialogComponent } from '@home/pages/notification/inbox/inbox-notification-dialog.component';
+import { HomeComponentsModule } from '@home/components/home-components.module';
+import { SentErrorDialogComponent } from '@home/pages/notification/sent/sent-error-dialog.component';
+import { SentNotificationDialogComponent } from '@home/pages/notification/sent/sent-notification-dialog.componet';
+import {
+ RecipientNotificationDialogComponent
+} from '@home/pages/notification/recipient/recipient-notification-dialog.componet';
+import { RecipientTableHeaderComponent } from '@home/pages/notification/recipient/recipient-table-header.component';
+import { TemplateAutocompleteComponent } from '@home/pages/notification/template/template-autocomplete.component';
+import {
+ TemplateNotificationDialogComponent
+} from '@home/pages/notification/template/template-notification-dialog.component';
+import { TemplateTableHeaderComponent } from '@home/pages/notification/template/template-table-header.component';
+import { EscalationFormComponent } from '@home/pages/notification/rule/escalation-form.component';
+import { EscalationsComponent } from '@home/pages/notification/rule/escalations.component';
+import { RuleNotificationDialogComponent } from '@home/pages/notification/rule/rule-notification-dialog.component';
+import { RuleTableHeaderComponent } from '@home/pages/notification/rule/rule-table-header.component';
@NgModule({
- declarations: [],
+ declarations: [
+ InboxTableHeaderComponent,
+ InboxNotificationDialogComponent,
+ SentErrorDialogComponent,
+ SentNotificationDialogComponent,
+ RecipientNotificationDialogComponent,
+ RecipientTableHeaderComponent,
+ TemplateAutocompleteComponent,
+ TemplateNotificationDialogComponent,
+ TemplateTableHeaderComponent,
+ EscalationFormComponent,
+ EscalationsComponent,
+ RuleNotificationDialogComponent,
+ RuleTableHeaderComponent
+ ],
imports: [
CommonModule,
SharedModule,
- NotificationRoutingModule
+ NotificationRoutingModule,
+ HomeComponentsModule
]
})
export class NotificationModule { }
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-notification-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-notification-dialog.component.html
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-notification-dialog.component.html
rename to ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-notification-dialog.component.html
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-notification-dialog.componet.scss b/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-notification-dialog.componet.scss
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-notification-dialog.componet.scss
rename to ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-notification-dialog.componet.scss
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-notification-dialog.componet.ts b/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-notification-dialog.componet.ts
similarity index 94%
rename from ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-notification-dialog.componet.ts
rename to ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-notification-dialog.componet.ts
index 868145a824..f0a0b0aa3c 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-notification-dialog.componet.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-notification-dialog.componet.ts
@@ -40,18 +40,18 @@ import { AuthState } from '@core/auth/auth.models';
import { getCurrentAuthState } from '@core/auth/auth.selectors';
import { AuthUser } from '@shared/models/user.model';
-export interface TargetsNotificationDialogData {
+export interface RecipientNotificationDialogData {
target?: NotificationTarget;
isAdd?: boolean;
}
@Component({
selector: 'tb-target-notification-dialog',
- templateUrl: './target-notification-dialog.component.html',
- styleUrls: ['target-notification-dialog.componet.scss']
+ templateUrl: './recipient-notification-dialog.component.html',
+ styleUrls: ['recipient-notification-dialog.componet.scss']
})
-export class TargetNotificationDialogComponent extends
- DialogComponent implements OnDestroy {
+export class RecipientNotificationDialogComponent extends
+ DialogComponent implements OnDestroy {
private authState: AuthState = getCurrentAuthState(this.store);
private authUser: AuthUser = this.authState.authUser;
@@ -73,8 +73,8 @@ export class TargetNotificationDialogComponent extends
constructor(protected store: Store,
protected router: Router,
- protected dialogRef: MatDialogRef,
- @Inject(MAT_DIALOG_DATA) public data: TargetsNotificationDialogData,
+ protected dialogRef: MatDialogRef,
+ @Inject(MAT_DIALOG_DATA) public data: RecipientNotificationDialogData,
private fb: FormBuilder,
private notificationService: NotificationService) {
super(store, router, dialogRef);
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/targets-table-config.ts b/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-table-config.resolver.ts
similarity index 58%
rename from ui-ngx/src/app/modules/home/pages/notification-center/notification-table/targets-table-config.ts
rename to ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-table-config.resolver.ts
index 2f4093813d..d616ed67b0 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/targets-table-config.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-table-config.resolver.ts
@@ -25,49 +25,54 @@ import { NotificationTarget, NotificationTargetTypeTranslationMap } from '@share
import { NotificationService } from '@core/http/notification.service';
import { TranslateService } from '@ngx-translate/core';
import {
- TargetNotificationDialogComponent,
- TargetsNotificationDialogData
-} from '@home/pages/notification-center/targets-table/target-notification-dialog.componet';
+ RecipientNotificationDialogComponent,
+ RecipientNotificationDialogData
+} from '@home/pages/notification/recipient/recipient-notification-dialog.componet';
import { MatDialog } from '@angular/material/dialog';
import { EntityAction } from '@home/models/entity/entity-component.models';
-import {
- TargetTableHeaderComponent
-} from '@home/pages/notification-center/targets-table/target-table-header.component';
+import { RecipientTableHeaderComponent } from '@home/pages/notification/recipient/recipient-table-header.component';
+import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class RecipientTableConfigResolver implements Resolve> {
-export class TargetsTableConfig extends EntityTableConfig {
+ private readonly config: EntityTableConfig = new EntityTableConfig();
constructor(private notificationService: NotificationService,
private translate: TranslateService,
private dialog: MatDialog) {
- super();
- this.loadDataOnInit = false;
- this.rowPointer = true;
- this.entityTranslations = {
+ this.config.detailsPanelEnabled = false;
+ this.config.selectionEnabled = false;
+ this.config.addEnabled = false;
+ this.config.rowPointer = true;
+
+ this.config.entityTranslations = {
noEntities: 'notification.no-targets-notification',
search: 'notification.search-targets'
};
- this.entityResources = {} as EntityTypeResource;
+ this.config.entityResources = {} as EntityTypeResource;
- this.entitiesFetchFunction = pageLink => this.notificationService.getNotificationTargets(pageLink);
+ this.config.entitiesFetchFunction = pageLink => this.notificationService.getNotificationTargets(pageLink);
- this.deleteEntityTitle = target => this.translate.instant('notification.delete-target-title', {targetName: target.name});
- this.deleteEntityContent = () => this.translate.instant('notification.delete-target-text');
- this.deleteEntity = id => this.notificationService.deleteNotificationTarget(id.id);
+ this.config.deleteEntityTitle = target => this.translate.instant('notification.delete-target-title', {targetName: target.name});
+ this.config.deleteEntityContent = () => this.translate.instant('notification.delete-target-text');
+ this.config.deleteEntity = id => this.notificationService.deleteNotificationTarget(id.id);
- this.cellActionDescriptors = this.configureCellActions();
+ this.config.cellActionDescriptors = this.configureCellActions();
- this.headerComponent = TargetTableHeaderComponent;
- this.onEntityAction = action => this.onTargetAction(action);
+ this.config.headerComponent = RecipientTableHeaderComponent;
+ this.config.onEntityAction = action => this.onTargetAction(action);
- this.defaultSortOrder = {property: 'name', direction: Direction.ASC};
+ this.config.defaultSortOrder = {property: 'name', direction: Direction.ASC};
- this.handleRowClick = ($event, target) => {
+ this.config.handleRowClick = ($event, target) => {
this.editTarget($event, target);
return true;
};
- this.columns.push(
+ this.config.columns.push(
new EntityTableColumn('name', 'notification.notification-target', '20%'),
new EntityTableColumn('configuration.type', 'notification.type', '20%',
(target) => this.translate.instant(NotificationTargetTypeTranslationMap.get(target.configuration.type)),
@@ -78,6 +83,10 @@ export class TargetsTableConfig extends EntityTableConfig {
);
}
+ resolve(route: ActivatedRouteSnapshot): EntityTableConfig {
+ return this.config;
+ }
+
private configureCellActions(): Array> {
return [];
}
@@ -86,8 +95,8 @@ export class TargetsTableConfig extends EntityTableConfig {
if ($event) {
$event.stopPropagation();
}
- this.dialog.open(TargetNotificationDialogComponent, {
+ this.dialog.open(RecipientNotificationDialogComponent, {
disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
data: {
@@ -97,7 +106,7 @@ export class TargetsTableConfig extends EntityTableConfig {
}).afterClosed()
.subscribe((res) => {
if (res) {
- this.updateData();
+ this.config.updateData();
}
});
}
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-table-header.component.html b/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-table-header.component.html
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-table-header.component.html
rename to ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-table-header.component.html
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-table-header.component.scss b/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-table-header.component.scss
similarity index 97%
rename from ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-table-header.component.scss
rename to ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-table-header.component.scss
index 37c58a4b53..33537b4b23 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-table-header.component.scss
+++ b/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-table-header.component.scss
@@ -14,5 +14,5 @@
* limitations under the License.
*/
:host{
- width: 100%;
+ width: 10000px;
}
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-table-header.component.ts b/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-table-header.component.ts
similarity index 81%
rename from ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-table-header.component.ts
rename to ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-table-header.component.ts
index 19aaae7ad6..f7285d3836 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-table-header.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-table-header.component.ts
@@ -21,11 +21,11 @@ import { AppState } from '@core/core.state';
import { NotificationTarget } from '@shared/models/notification.models';
@Component({
- selector: 'tb-target-table-header',
- templateUrl: './target-table-header.component.html',
- styleUrls: ['target-table-header.component.scss']
+ selector: 'tb-recipient-table-header',
+ templateUrl: './recipient-table-header.component.html',
+ styleUrls: ['recipient-table-header.component.scss']
})
-export class TargetTableHeaderComponent extends EntityTableHeaderComponent {
+export class RecipientTableHeaderComponent extends EntityTableHeaderComponent {
constructor(protected store: Store) {
super(store);
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalation-form.component.html b/ui-ngx/src/app/modules/home/pages/notification/rule/escalation-form.component.html
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalation-form.component.html
rename to ui-ngx/src/app/modules/home/pages/notification/rule/escalation-form.component.html
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalation-form.component.scss b/ui-ngx/src/app/modules/home/pages/notification/rule/escalation-form.component.scss
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalation-form.component.scss
rename to ui-ngx/src/app/modules/home/pages/notification/rule/escalation-form.component.scss
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalation-form.component.ts b/ui-ngx/src/app/modules/home/pages/notification/rule/escalation-form.component.ts
similarity index 93%
rename from ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalation-form.component.ts
rename to ui-ngx/src/app/modules/home/pages/notification/rule/escalation-form.component.ts
index 852b9f9b16..0b8bb103fd 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalation-form.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/rule/escalation-form.component.ts
@@ -31,9 +31,9 @@ import { NonConfirmedNotificationEscalation, NotificationTarget } from '@shared/
import { EntityType } from '@shared/models/entity-type.models';
import { takeUntil } from 'rxjs/operators';
import {
- TargetNotificationDialogComponent,
- TargetsNotificationDialogData
-} from '@home/pages/notification-center/targets-table/target-notification-dialog.componet';
+ RecipientNotificationDialogComponent,
+ RecipientNotificationDialogData
+} from '@home/pages/notification/recipient/recipient-notification-dialog.componet';
import { MatDialog } from '@angular/material/dialog';
import { MatButton } from '@angular/material/button';
@@ -130,8 +130,8 @@ export class EscalationFormComponent implements ControlValueAccessor, OnInit, On
$event.stopPropagation();
}
button._elementRef.nativeElement.blur();
- this.dialog.open(TargetNotificationDialogComponent, {
+ this.dialog.open(RecipientNotificationDialogComponent, {
disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
data: {}
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalations.component.html b/ui-ngx/src/app/modules/home/pages/notification/rule/escalations.component.html
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalations.component.html
rename to ui-ngx/src/app/modules/home/pages/notification/rule/escalations.component.html
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalations.component.ts b/ui-ngx/src/app/modules/home/pages/notification/rule/escalations.component.ts
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalations.component.ts
rename to ui-ngx/src/app/modules/home/pages/notification/rule/escalations.component.ts
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.html
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.html
rename to ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.html
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.scss b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.scss
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.scss
rename to ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.scss
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.ts
similarity index 97%
rename from ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts
rename to ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.ts
index dd6ad5266c..a39468db0f 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-notification-dialog.component.ts
@@ -50,9 +50,9 @@ import {
} from '@shared/models/alarm.models';
import { TranslateService } from '@ngx-translate/core';
import {
- TargetNotificationDialogComponent,
- TargetsNotificationDialogData
-} from '@home/pages/notification-center/targets-table/target-notification-dialog.componet';
+ RecipientNotificationDialogComponent,
+ RecipientNotificationDialogData
+} from '@home/pages/notification/recipient/recipient-notification-dialog.componet';
import { MatButton } from '@angular/material/button';
import { AuthState } from '@core/auth/auth.models';
import { getCurrentAuthState } from '@core/auth/auth.selectors';
@@ -364,8 +364,8 @@ export class RuleNotificationDialogComponent extends
$event.stopPropagation();
}
button._elementRef.nativeElement.blur();
- this.dialog.open(TargetNotificationDialogComponent, {
+ this.dialog.open(RecipientNotificationDialogComponent, {
disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
data: {}
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/rule-table-config.ts b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-table-config.resolver.ts
similarity index 67%
rename from ui-ngx/src/app/modules/home/pages/notification-center/notification-table/rule-table-config.ts
rename to ui-ngx/src/app/modules/home/pages/notification/rule/rule-table-config.resolver.ts
index a659946a73..50b7b20990 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/rule-table-config.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-table-config.resolver.ts
@@ -26,45 +26,52 @@ import { NotificationService } from '@core/http/notification.service';
import { TranslateService } from '@ngx-translate/core';
import { MatDialog } from '@angular/material/dialog';
import { EntityAction } from '@home/models/entity/entity-component.models';
-import { RuleTableHeaderComponent } from '@home/pages/notification-center/rule-table/rule-table-header.component';
+import { RuleTableHeaderComponent } from '@home/pages/notification/rule/rule-table-header.component';
import {
RuleNotificationDialogComponent,
RuleNotificationDialogData
-} from '@home/pages/notification-center/rule-table/rule-notification-dialog.component';
+} from '@home/pages/notification/rule/rule-notification-dialog.component';
+import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
+import { Injectable } from '@angular/core';
-export class RuleTableConfig extends EntityTableConfig {
+@Injectable()
+export class RuleTableConfigResolver implements Resolve> {
+
+ private readonly config: EntityTableConfig = new EntityTableConfig();
constructor(private notificationService: NotificationService,
private translate: TranslateService,
private dialog: MatDialog) {
- super();
- this.loadDataOnInit = false;
- this.rowPointer = true;
- this.entityTranslations = {
+ this.config.detailsPanelEnabled = false;
+ this.config.selectionEnabled = false;
+ this.config.addEnabled = false;
+ this.config.rowPointer = true;
+
+ this.config.entityTranslations = {
noEntities: 'notification.no-rules-notification',
search: 'notification.search-rules'
};
- this.entityResources = {} as EntityTypeResource;
+ this.config.entityResources = {} as EntityTypeResource;
- this.entitiesFetchFunction = pageLink => this.notificationService.getNotificationRules(pageLink);
+ this.config.entitiesFetchFunction = pageLink => this.notificationService.getNotificationRules(pageLink);
- this.deleteEntityTitle = rule => this.translate.instant('notification.delete-rule-title', {ruleName: rule.name});
- this.deleteEntityContent = () => this.translate.instant('notification.delete-rule-text');
- this.deleteEntity = id => this.notificationService.deleteNotificationRule(id.id);
+ this.config.deleteEntityTitle = rule => this.translate.instant('notification.delete-rule-title', {ruleName: rule.name});
+ this.config.deleteEntityContent = () => this.translate.instant('notification.delete-rule-text');
+ this.config.deleteEntity = id => this.notificationService.deleteNotificationRule(id.id);
- this.cellActionDescriptors = this.configureCellActions();
- this.headerComponent = RuleTableHeaderComponent;
- this.onEntityAction = action => this.onTargetAction(action);
+ this.config.cellActionDescriptors = this.configureCellActions();
+ this.config.headerComponent = RuleTableHeaderComponent;
+ this.config.onEntityAction = action => this.onTargetAction(action);
- this.defaultSortOrder = {property: 'name', direction: Direction.ASC};
+ this.config.defaultSortOrder = {property: 'name', direction: Direction.ASC};
- this.handleRowClick = ($event, rule) => {
+ this.config.handleRowClick = ($event, rule) => {
this.editRule($event, rule);
return true;
};
- this.columns.push(
+ this.config.columns.push(
new EntityTableColumn('name', 'notification.rule-name', '30%'),
new EntityTableColumn('templateName', 'notification.template', '20%'),
new EntityTableColumn('triggerType', 'notification.trigger.trigger', '20%',
@@ -76,6 +83,10 @@ export class RuleTableConfig extends EntityTableConfig {
);
}
+ resolve(route: ActivatedRouteSnapshot): EntityTableConfig {
+ return this.config;
+ }
+
private configureCellActions(): Array> {
return [{
name: this.translate.instant('notification.copy-rule'),
@@ -101,7 +112,7 @@ export class RuleTableConfig extends EntityTableConfig {
}).afterClosed()
.subscribe((res) => {
if (res) {
- this.updateData();
+ this.config.updateData();
}
});
}
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-table-header.component.html b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-table-header.component.html
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-table-header.component.html
rename to ui-ngx/src/app/modules/home/pages/notification/rule/rule-table-header.component.html
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-table-header.component.scss b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-table-header.component.scss
similarity index 97%
rename from ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-table-header.component.scss
rename to ui-ngx/src/app/modules/home/pages/notification/rule/rule-table-header.component.scss
index 37c58a4b53..33537b4b23 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-table-header.component.scss
+++ b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-table-header.component.scss
@@ -14,5 +14,5 @@
* limitations under the License.
*/
:host{
- width: 100%;
+ width: 10000px;
}
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-table-header.component.ts b/ui-ngx/src/app/modules/home/pages/notification/rule/rule-table-header.component.ts
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-table-header.component.ts
rename to ui-ngx/src/app/modules/home/pages/notification/rule/rule-table-header.component.ts
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/notification-request-error-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-error-dialog.component.html
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/request-table/notification-request-error-dialog.component.html
rename to ui-ngx/src/app/modules/home/pages/notification/sent/sent-error-dialog.component.html
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/notification-request-error-dialog.component.scss b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-error-dialog.component.scss
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/request-table/notification-request-error-dialog.component.scss
rename to ui-ngx/src/app/modules/home/pages/notification/sent/sent-error-dialog.component.scss
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/notification-request-error-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-error-dialog.component.ts
similarity index 83%
rename from ui-ngx/src/app/modules/home/pages/notification-center/request-table/notification-request-error-dialog.component.ts
rename to ui-ngx/src/app/modules/home/pages/notification/sent/sent-error-dialog.component.ts
index 114e082623..5a5ad40a82 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/notification-request-error-dialog.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-error-dialog.component.ts
@@ -27,11 +27,11 @@ export interface NotificationRequestErrorDialogData {
}
@Component({
- selector: 'tb-notification-request-error-dialog',
- templateUrl: './notification-request-error-dialog.component.html',
- styleUrls: ['notification-request-error-dialog.component.scss']
+ selector: 'tb-notification-send-error-dialog',
+ templateUrl: './sent-error-dialog.component.html',
+ styleUrls: ['sent-error-dialog.component.scss']
})
-export class NotificationRequestErrorDialogComponent extends DialogComponent {
+export class SentErrorDialogComponent extends DialogComponent {
errorStats: { [key in NotificationDeliveryMethod]: {[errorKey in string]: string}};
@@ -44,7 +44,7 @@ export class NotificationRequestErrorDialogComponent extends DialogComponent,
protected router: Router,
- protected dialogRef: MatDialogRef,
+ protected dialogRef: MatDialogRef,
@Inject(MAT_DIALOG_DATA) public data: NotificationRequestErrorDialogData) {
super(store, router, dialogRef);
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.component.html
rename to ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.component.scss b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.scss
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.component.scss
rename to ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.scss
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.componet.ts b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.componet.ts
similarity index 90%
rename from ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.componet.ts
rename to ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.componet.ts
index 8d0fa8b7fa..b910a4cb99 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.componet.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.componet.ts
@@ -39,11 +39,11 @@ import { MediaBreakpoints } from '@shared/models/constants';
import { map, takeUntil } from 'rxjs/operators';
import { getCurrentTime } from '@shared/models/time/time.models';
import {
- TargetNotificationDialogComponent,
- TargetsNotificationDialogData
-} from '@home/pages/notification-center/targets-table/target-notification-dialog.componet';
+ RecipientNotificationDialogComponent,
+ RecipientNotificationDialogData
+} from '@home/pages/notification/recipient/recipient-notification-dialog.componet';
import { MatButton } from '@angular/material/button';
-import { TemplateConfiguration } from '@home/pages/notification-center/template-table/template-configuration';
+import { TemplateConfiguration } from '@home/pages/notification/template/template-configuration';
export interface RequestNotificationDialogData {
request?: NotificationRequest;
@@ -51,12 +51,12 @@ export interface RequestNotificationDialogData {
}
@Component({
- selector: 'tb-request-notification-dialog',
- templateUrl: './request-notification-dialog.component.html',
- styleUrls: ['./request-notification-dialog.component.scss']
+ selector: 'tb-sent-notification-dialog',
+ templateUrl: './sent-notification-dialog.component.html',
+ styleUrls: ['./sent-notification-dialog.component.scss']
})
-export class RequestNotificationDialogComponent extends
- TemplateConfiguration implements OnDestroy {
+export class SentNotificationDialogComponent extends
+ TemplateConfiguration implements OnDestroy {
@ViewChild('createNotification', {static: true}) createNotification: MatStepper;
stepperOrientation: Observable;
@@ -76,7 +76,7 @@ export class RequestNotificationDialogComponent extends
constructor(protected store: Store,
protected router: Router,
- protected dialogRef: MatDialogRef,
+ protected dialogRef: MatDialogRef,
@Inject(MAT_DIALOG_DATA) public data: RequestNotificationDialogData,
private breakpointObserver: BreakpointObserver,
protected fb: FormBuilder,
@@ -242,8 +242,8 @@ export class RequestNotificationDialogComponent extends
$event.stopPropagation();
}
button._elementRef.nativeElement.blur();
- this.dialog.open(TargetNotificationDialogComponent, {
+ this.dialog.open(RecipientNotificationDialogComponent, {
disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
data: {}
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/request-table-config.ts b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-table-config.resolver.ts
similarity index 72%
rename from ui-ngx/src/app/modules/home/pages/notification-center/notification-table/request-table-config.ts
rename to ui-ngx/src/app/modules/home/pages/notification/sent/sent-table-config.resolver.ts
index 929dd32fab..2274332950 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/request-table-config.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-table-config.resolver.ts
@@ -37,50 +37,58 @@ import { Direction } from '@shared/models/page/sort-order';
import { DatePipe } from '@angular/common';
import { EntityAction } from '@home/models/entity/entity-component.models';
import {
- RequestNotificationDialogComponent,
- RequestNotificationDialogData
-} from '@home/pages/notification-center/request-table/request-notification-dialog.componet';
+ RequestNotificationDialogData,
+ SentNotificationDialogComponent
+} from '@home/pages/notification/sent/sent-notification-dialog.componet';
import { PageLink } from '@shared/models/page/page-link';
import {
- NotificationRequestErrorDialogComponent,
- NotificationRequestErrorDialogData
-} from '@home/pages/notification-center/request-table/notification-request-error-dialog.component';
+ NotificationRequestErrorDialogData,
+ SentErrorDialogComponent
+} from '@home/pages/notification/sent/sent-error-dialog.component';
+import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
+import { Injectable } from '@angular/core';
-export class RequestTableConfig extends EntityTableConfig {
+@Injectable()
+export class SentTableConfigResolver implements Resolve> {
+
+ private readonly config: EntityTableConfig =
+ new EntityTableConfig();
constructor(private notificationService: NotificationService,
private translate: TranslateService,
private dialog: MatDialog,
private datePipe: DatePipe) {
- super();
- this.loadDataOnInit = false;
- this.searchEnabled = false;
- this.entityTranslations = {
+
+ this.config.detailsPanelEnabled = false;
+ this.config.selectionEnabled = false;
+ this.config.addEnabled = false;
+ this.config.searchEnabled = false;
+ this.config.entityTranslations = {
noEntities: 'notification.no-notification-request',
};
- this.entityResources = {} as EntityTypeResource;
+ this.config.entityResources = {} as EntityTypeResource;
- this.entitiesFetchFunction = pageLink => this.notificationService.getNotificationRequests(pageLink);
+ this.config.entitiesFetchFunction = pageLink => this.notificationService.getNotificationRequests(pageLink);
- this.deleteEnabled = (request) => request.status === NotificationRequestStatus.SCHEDULED;
- this.deleteEntityTitle = () => this.translate.instant('notification.delete-request-title');
- this.deleteEntityContent = () => this.translate.instant('notification.delete-request-text');
- this.deleteEntity = id => this.notificationService.deleteNotificationRequest(id.id);
+ this.config.deleteEnabled = (request) => request.status === NotificationRequestStatus.SCHEDULED;
+ this.config.deleteEntityTitle = () => this.translate.instant('notification.delete-request-title');
+ this.config.deleteEntityContent = () => this.translate.instant('notification.delete-request-text');
+ this.config.deleteEntity = id => this.notificationService.deleteNotificationRequest(id.id);
- this.cellActionDescriptors = this.configureCellActions();
+ this.config.cellActionDescriptors = this.configureCellActions();
- this.onEntityAction = action => this.onRequestAction(action);
+ this.config.onEntityAction = action => this.onRequestAction(action);
- this.handleRowClick = (event, entity) => {
+ this.config.handleRowClick = (event, entity) => {
if ((event.target as HTMLElement).getElementsByClassName('stats').length || (event.target as HTMLElement).className === 'stats') {
this.openStatsErrorDialog(event, entity);
}
return true;
};
- this.defaultSortOrder = {property: 'createdTime', direction: Direction.DESC};
+ this.config.defaultSortOrder = {property: 'createdTime', direction: Direction.DESC};
- this.columns.push(
+ this.config.columns.push(
new DateEntityTableColumn('createdTime', 'notification.created-time', this.datePipe, '170px'),
new EntityTableColumn('status', 'notification.status', '15%',
request => `${this.requestStatus(request.status)}${this.requestStats(request.stats)}`,
@@ -93,6 +101,10 @@ export class RequestTableConfig extends EntityTableConfig {
+ return this.config;
+ }
+
private configureCellActions(): Array> {
return [{
name: this.translate.instant('notification.notify-again'),
@@ -106,8 +118,8 @@ export class RequestTableConfig extends EntityTableConfig(RequestNotificationDialogComponent, {
+ this.dialog.open(SentNotificationDialogComponent, {
disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
data: {
@@ -116,7 +128,7 @@ export class RequestTableConfig extends EntityTableConfig {
if (res && updateData) {
- this.updateData();
+ this.config.updateData();
}
});
}
@@ -151,6 +163,9 @@ export class RequestTableConfig extends EntityTableConfig countError += Object.keys(stats.errors[method]).length);
if (countError === 0) {
@@ -183,8 +198,8 @@ export class RequestTableConfig extends EntityTableConfig(NotificationRequestErrorDialogComponent, {
+ this.dialog.open(SentErrorDialogComponent, {
disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
data: {
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-autocomplete.component.html b/ui-ngx/src/app/modules/home/pages/notification/template/template-autocomplete.component.html
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-autocomplete.component.html
rename to ui-ngx/src/app/modules/home/pages/notification/template/template-autocomplete.component.html
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-autocomplete.component.scss b/ui-ngx/src/app/modules/home/pages/notification/template/template-autocomplete.component.scss
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-autocomplete.component.scss
rename to ui-ngx/src/app/modules/home/pages/notification/template/template-autocomplete.component.scss
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-autocomplete.component.ts b/ui-ngx/src/app/modules/home/pages/notification/template/template-autocomplete.component.ts
similarity index 98%
rename from ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-autocomplete.component.ts
rename to ui-ngx/src/app/modules/home/pages/notification/template/template-autocomplete.component.ts
index aea112f924..9a3e6037a1 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-autocomplete.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/template/template-autocomplete.component.ts
@@ -37,7 +37,7 @@ import { isEqual } from '@core/utils';
import {
TemplateNotificationDialogComponent,
TemplateNotificationDialogData
-} from '@home/pages/notification-center/template-table/template-notification-dialog.component';
+} from '@home/pages/notification/template/template-notification-dialog.component';
import { MatDialog } from '@angular/material/dialog';
import { MatButton } from '@angular/material/button';
import { coerceBoolean } from '@shared/decorators/coerce-boolean';
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-configuration.ts b/ui-ngx/src/app/modules/home/pages/notification/template/template-configuration.ts
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-configuration.ts
rename to ui-ngx/src/app/modules/home/pages/notification/template/template-configuration.ts
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-notification-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification/template/template-notification-dialog.component.html
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-notification-dialog.component.html
rename to ui-ngx/src/app/modules/home/pages/notification/template/template-notification-dialog.component.html
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-notification-dialog.component.scss b/ui-ngx/src/app/modules/home/pages/notification/template/template-notification-dialog.component.scss
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-notification-dialog.component.scss
rename to ui-ngx/src/app/modules/home/pages/notification/template/template-notification-dialog.component.scss
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-notification-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/notification/template/template-notification-dialog.component.ts
similarity index 98%
rename from ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-notification-dialog.component.ts
rename to ui-ngx/src/app/modules/home/pages/notification/template/template-notification-dialog.component.ts
index 571e7ea932..2c3ca06ba6 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-notification-dialog.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/template/template-notification-dialog.component.ts
@@ -30,7 +30,7 @@ import { MatStepper } from '@angular/material/stepper';
import { BreakpointObserver } from '@angular/cdk/layout';
import { MediaBreakpoints } from '@shared/models/constants';
import { TranslateService } from '@ngx-translate/core';
-import { TemplateConfiguration } from '@home/pages/notification-center/template-table/template-configuration';
+import { TemplateConfiguration } from '@home/pages/notification/template/template-configuration';
import { AuthState } from '@core/auth/auth.models';
import { getCurrentAuthState } from '@core/auth/auth.selectors';
import { AuthUser } from '@shared/models/user.model';
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/template-table-config.ts b/ui-ngx/src/app/modules/home/pages/notification/template/template-table-config.resolver.ts
similarity index 66%
rename from ui-ngx/src/app/modules/home/pages/notification-center/notification-table/template-table-config.ts
rename to ui-ngx/src/app/modules/home/pages/notification/template/template-table-config.resolver.ts
index 382b4614ea..de66a563ee 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/notification-table/template-table-config.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/template/template-table-config.resolver.ts
@@ -28,46 +28,51 @@ import { MatDialog } from '@angular/material/dialog';
import {
TemplateNotificationDialogComponent,
TemplateNotificationDialogData
-} from '@home/pages/notification-center/template-table/template-notification-dialog.component';
+} from '@home/pages/notification/template/template-notification-dialog.component';
import { TranslateService } from '@ngx-translate/core';
-import {
- TemplateTableHeaderComponent
-} from '@home/pages/notification-center/template-table/template-table-header.component';
+import { TemplateTableHeaderComponent } from '@home/pages/notification/template/template-table-header.component';
+import { Injectable } from '@angular/core';
+import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
+
+@Injectable()
+export class TemplateTableConfigResolver implements Resolve> {
-export class TemplateTableConfig extends EntityTableConfig {
+ private readonly config: EntityTableConfig = new EntityTableConfig();
constructor(private notificationService: NotificationService,
private translate: TranslateService,
private dialog: MatDialog) {
- super();
- this.loadDataOnInit = false;
- this.rowPointer = true;
- this.entityTranslations = {
+ this.config.detailsPanelEnabled = false;
+ this.config.selectionEnabled = false;
+ this.config.addEnabled = false;
+ this.config.rowPointer = true;
+
+ this.config.entityTranslations = {
noEntities: 'notification.no-notification-templates',
search: 'notification.search-templates'
};
- this.entityResources = {} as EntityTypeResource;
+ this.config.entityResources = {} as EntityTypeResource;
- this.entitiesFetchFunction = pageLink => this.notificationService.getNotificationTemplates(pageLink);
+ this.config.entitiesFetchFunction = pageLink => this.notificationService.getNotificationTemplates(pageLink);
- this.deleteEntityTitle = template => this.translate.instant('notification.delete-template-title', {templateName: template.name});
- this.deleteEntityContent = () => this.translate.instant('notification.delete-template-text');
- this.deleteEntity = id => this.notificationService.deleteNotificationTemplate(id.id);
+ this.config.deleteEntityTitle = template => this.translate.instant('notification.delete-template-title', {templateName: template.name});
+ this.config.deleteEntityContent = () => this.translate.instant('notification.delete-template-text');
+ this.config.deleteEntity = id => this.notificationService.deleteNotificationTemplate(id.id);
- this.cellActionDescriptors = this.configureCellActions();
+ this.config.cellActionDescriptors = this.configureCellActions();
- this.headerComponent = TemplateTableHeaderComponent;
- this.onEntityAction = action => this.onTemplateAction(action);
+ this.config.headerComponent = TemplateTableHeaderComponent;
+ this.config.onEntityAction = action => this.onTemplateAction(action);
- this.defaultSortOrder = {property: 'notificationType', direction: Direction.ASC};
+ this.config.defaultSortOrder = {property: 'notificationType', direction: Direction.ASC};
- this.handleRowClick = ($event, template) => {
+ this.config.handleRowClick = ($event, template) => {
this.editTemplate($event, template);
return true;
};
- this.columns.push(
+ this.config.columns.push(
new EntityTableColumn('notificationType', 'notification.type', '15%',
(template) => this.translate.instant(NotificationTemplateTypeTranslateMap.get(template.notificationType).name)),
new EntityTableColumn('name', 'notification.template', '25%'),
@@ -78,6 +83,10 @@ export class TemplateTableConfig extends EntityTableConfig
);
}
+ resolve(route: ActivatedRouteSnapshot): EntityTableConfig {
+ return this.config;
+ }
+
private configureCellActions(): Array> {
return [
{
@@ -105,7 +114,7 @@ export class TemplateTableConfig extends EntityTableConfig
}).afterClosed()
.subscribe((res) => {
if (res) {
- this.updateData();
+ this.config.updateData();
}
});
}
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-table-header.component.html b/ui-ngx/src/app/modules/home/pages/notification/template/template-table-header.component.html
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-table-header.component.html
rename to ui-ngx/src/app/modules/home/pages/notification/template/template-table-header.component.html
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-table-header.component.scss b/ui-ngx/src/app/modules/home/pages/notification/template/template-table-header.component.scss
similarity index 97%
rename from ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-table-header.component.scss
rename to ui-ngx/src/app/modules/home/pages/notification/template/template-table-header.component.scss
index 37c58a4b53..33537b4b23 100644
--- a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-table-header.component.scss
+++ b/ui-ngx/src/app/modules/home/pages/notification/template/template-table-header.component.scss
@@ -14,5 +14,5 @@
* limitations under the License.
*/
:host{
- width: 100%;
+ width: 10000px;
}
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-table-header.component.ts b/ui-ngx/src/app/modules/home/pages/notification/template/template-table-header.component.ts
similarity index 100%
rename from ui-ngx/src/app/modules/home/pages/notification-center/template-table/template-table-header.component.ts
rename to ui-ngx/src/app/modules/home/pages/notification/template/template-table-header.component.ts
diff --git a/ui-ngx/src/app/shared/models/notification.models.ts b/ui-ngx/src/app/shared/models/notification.models.ts
index 72a32989e5..c51ff5c777 100644
--- a/ui-ngx/src/app/shared/models/notification.models.ts
+++ b/ui-ngx/src/app/shared/models/notification.models.ts
@@ -388,14 +388,14 @@ export const NotificationTargetConfigTypeInfoMap = new Map