Merge pull request #9018 from ArtemDzhereleiko/AD/imp/notification-tabs
Refactoring User notification settings
This commit is contained in:
commit
857f69d7d5
@ -136,42 +136,6 @@ export class MenuService {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: 'account',
|
|
||||||
name: 'profile.profile',
|
|
||||||
type: 'link',
|
|
||||||
path: '/account',
|
|
||||||
disabled: true,
|
|
||||||
icon: 'mdi:message-badge',
|
|
||||||
isMdiIcon: true,
|
|
||||||
pages: [
|
|
||||||
{
|
|
||||||
id: 'personal_info',
|
|
||||||
name: 'account.personal-info',
|
|
||||||
fullName: 'account.personal-info',
|
|
||||||
type: 'link',
|
|
||||||
path: '/account/profile',
|
|
||||||
icon: 'mdi:badge-account-horizontal',
|
|
||||||
isMdiIcon: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'security',
|
|
||||||
name: 'security.security',
|
|
||||||
fullName: 'security.security',
|
|
||||||
type: 'link',
|
|
||||||
path: '/account/security',
|
|
||||||
icon: 'lock'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'notificationSettings',
|
|
||||||
name: 'account.notification-settings',
|
|
||||||
fullName: 'account.notification-settings',
|
|
||||||
type: 'link',
|
|
||||||
path: '/account/notificationSettings',
|
|
||||||
icon: 'settings'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: 'notifications_center',
|
id: 'notifications_center',
|
||||||
name: 'notification.notification-center',
|
name: 'notification.notification-center',
|
||||||
@ -540,42 +504,6 @@ export class MenuService {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: 'account',
|
|
||||||
name: 'profile.profile',
|
|
||||||
type: 'link',
|
|
||||||
path: '/account',
|
|
||||||
disabled: true,
|
|
||||||
icon: 'mdi:message-badge',
|
|
||||||
isMdiIcon: true,
|
|
||||||
pages: [
|
|
||||||
{
|
|
||||||
id: 'personal_info',
|
|
||||||
name: 'account.personal-info',
|
|
||||||
fullName: 'account.personal-info',
|
|
||||||
type: 'link',
|
|
||||||
path: '/account/profile',
|
|
||||||
icon: 'mdi:badge-account-horizontal',
|
|
||||||
isMdiIcon: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'security',
|
|
||||||
name: 'security.security',
|
|
||||||
fullName: 'security.security',
|
|
||||||
type: 'link',
|
|
||||||
path: '/account/security',
|
|
||||||
icon: 'lock'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'notificationSettings',
|
|
||||||
name: 'account.notification-settings',
|
|
||||||
fullName: 'account.notification-settings',
|
|
||||||
type: 'link',
|
|
||||||
path: '/account/notificationSettings',
|
|
||||||
icon: 'settings'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: 'notifications_center',
|
id: 'notifications_center',
|
||||||
name: 'notification.notification-center',
|
name: 'notification.notification-center',
|
||||||
@ -904,34 +832,6 @@ export class MenuService {
|
|||||||
icon: 'view_quilt'
|
icon: 'view_quilt'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'account',
|
|
||||||
name: 'profile.profile',
|
|
||||||
type: 'link',
|
|
||||||
path: '/account',
|
|
||||||
disabled: true,
|
|
||||||
icon: 'mdi:message-badge',
|
|
||||||
isMdiIcon: true,
|
|
||||||
pages: [
|
|
||||||
{
|
|
||||||
id: 'personal_info',
|
|
||||||
name: 'account.personal-info',
|
|
||||||
fullName: 'account.personal-info',
|
|
||||||
type: 'link',
|
|
||||||
path: '/account/profile',
|
|
||||||
icon: 'mdi:badge-account-horizontal',
|
|
||||||
isMdiIcon: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'security',
|
|
||||||
name: 'security.security',
|
|
||||||
fullName: 'security.security',
|
|
||||||
type: 'link',
|
|
||||||
path: '/account/security',
|
|
||||||
icon: 'lock'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (authState.edgesSupportEnabled) {
|
if (authState.edgesSupportEnabled) {
|
||||||
|
|||||||
@ -17,8 +17,6 @@
|
|||||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||||
import { MenuService } from '@core/services/menu.service';
|
import { MenuService } from '@core/services/menu.service';
|
||||||
import { MenuSection } from '@core/services/menu.models';
|
import { MenuSection } from '@core/services/menu.models';
|
||||||
import { Observable, of } from 'rxjs';
|
|
||||||
import { mergeMap, share } from 'rxjs/operators';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-side-menu',
|
selector: 'tb-side-menu',
|
||||||
@ -28,23 +26,15 @@ import { mergeMap, share } from 'rxjs/operators';
|
|||||||
})
|
})
|
||||||
export class SideMenuComponent implements OnInit {
|
export class SideMenuComponent implements OnInit {
|
||||||
|
|
||||||
menuSections$: Observable<Array<MenuSection>>;
|
menuSections$ = this.menuService.menuSections();
|
||||||
|
|
||||||
constructor(private menuService: MenuService) {
|
constructor(private menuService: MenuService) {
|
||||||
this.menuSections$ = this.menuService.menuSections().pipe(
|
|
||||||
mergeMap((sections) => this.filterSections(sections)),
|
|
||||||
share()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
trackByMenuSection(index: number, section: MenuSection){
|
trackByMenuSection(index: number, section: MenuSection){
|
||||||
return section.id;
|
return section.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
private filterSections(sections: Array<MenuSection>): Observable<Array<MenuSection>> {
|
|
||||||
return of(sections.filter(section => !section.disabled));
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import { getCurrentAuthState } from '@core/auth/auth.selectors';
|
|||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { AppState } from '@core/core.state';
|
import { AppState } from '@core/core.state';
|
||||||
import {
|
import {
|
||||||
NotificationUserSettingsRoutes
|
notificationUserSettingsRoutes
|
||||||
} from '@home/pages/notification/settings/notification-settings-routing.modules';
|
} from '@home/pages/notification/settings/notification-settings-routing.modules';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
@ -53,7 +53,7 @@ const routes: Routes = [
|
|||||||
},
|
},
|
||||||
...profileRoutes,
|
...profileRoutes,
|
||||||
...securityRoutes,
|
...securityRoutes,
|
||||||
...NotificationUserSettingsRoutes
|
...notificationUserSettingsRoutes
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@ -36,9 +36,6 @@ import { EscalationsComponent } from '@home/pages/notification/rule/escalations.
|
|||||||
import { RuleNotificationDialogComponent } from '@home/pages/notification/rule/rule-notification-dialog.component';
|
import { RuleNotificationDialogComponent } from '@home/pages/notification/rule/rule-notification-dialog.component';
|
||||||
import { RuleTableHeaderComponent } from '@home/pages/notification/rule/rule-table-header.component';
|
import { RuleTableHeaderComponent } from '@home/pages/notification/rule/rule-table-header.component';
|
||||||
import { NotificationSettingsComponent } from '@home/pages/notification/settings/notification-settings.component';
|
import { NotificationSettingsComponent } from '@home/pages/notification/settings/notification-settings.component';
|
||||||
import {
|
|
||||||
NotificationSettingsRoutingModules
|
|
||||||
} from '@home/pages/notification/settings/notification-settings-routing.modules';
|
|
||||||
import {
|
import {
|
||||||
NotificationSettingFormComponent
|
NotificationSettingFormComponent
|
||||||
} from '@home/pages/notification/settings/notification-setting-form.component';
|
} from '@home/pages/notification/settings/notification-setting-form.component';
|
||||||
@ -64,7 +61,6 @@ import {
|
|||||||
CommonModule,
|
CommonModule,
|
||||||
SharedModule,
|
SharedModule,
|
||||||
NotificationRoutingModule,
|
NotificationRoutingModule,
|
||||||
NotificationSettingsRoutingModules,
|
|
||||||
HomeComponentsModule
|
HomeComponentsModule
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
@ -14,29 +14,14 @@
|
|||||||
/// limitations under the License.
|
/// limitations under the License.
|
||||||
///
|
///
|
||||||
|
|
||||||
import { Resolve, RouterModule, Routes } from '@angular/router';
|
import { Routes } from '@angular/router';
|
||||||
import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard';
|
import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard';
|
||||||
import { Authority } from '@shared/models/authority.enum';
|
import { Authority } from '@shared/models/authority.enum';
|
||||||
import { Injectable, NgModule } from '@angular/core';
|
import { inject, NgModule } from '@angular/core';
|
||||||
import { NotificationSettingsComponent } from '@home/pages/notification/settings/notification-settings.component';
|
import { NotificationSettingsComponent } from '@home/pages/notification/settings/notification-settings.component';
|
||||||
import { Store } from '@ngrx/store';
|
|
||||||
import { AppState } from '@core/core.state';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { NotificationService } from '@core/http/notification.service';
|
import { NotificationService } from '@core/http/notification.service';
|
||||||
|
|
||||||
@Injectable()
|
export const notificationUserSettingsRoutes: Routes = [
|
||||||
export class NotificationUserSettingsResolver implements Resolve<any> {
|
|
||||||
|
|
||||||
constructor(private store: Store<AppState>,
|
|
||||||
private notificationService: NotificationService) {
|
|
||||||
}
|
|
||||||
|
|
||||||
resolve(): Observable<any> {
|
|
||||||
return this.notificationService.getNotificationUserSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const NotificationUserSettingsRoutes: Routes = [
|
|
||||||
{
|
{
|
||||||
path: 'notificationSettings',
|
path: 'notificationSettings',
|
||||||
component: NotificationSettingsComponent,
|
component: NotificationSettingsComponent,
|
||||||
@ -50,21 +35,7 @@ export const NotificationUserSettingsRoutes: Routes = [
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
userSettings: NotificationUserSettingsResolver
|
userSettings: () => inject(NotificationService).getNotificationUserSettings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const routes: Routes = [
|
|
||||||
{
|
|
||||||
path: 'notificationSettings',
|
|
||||||
redirectTo: '/account/notificationSettings'
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [RouterModule.forChild(routes)],
|
|
||||||
exports: [RouterModule],
|
|
||||||
providers: [NotificationUserSettingsResolver]
|
|
||||||
})
|
|
||||||
export class NotificationSettingsRoutingModules { }
|
|
||||||
|
|||||||
@ -11,7 +11,8 @@
|
|||||||
"permission-denied-text": "You don't have permission to perform this operation!"
|
"permission-denied-text": "You don't have permission to perform this operation!"
|
||||||
},
|
},
|
||||||
"account": {
|
"account": {
|
||||||
"account": "Account"
|
"account": "Account",
|
||||||
|
"notification-settings": "Notification settings"
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"activate": "Activate",
|
"activate": "Activate",
|
||||||
@ -3221,11 +3222,6 @@
|
|||||||
"profiles": {
|
"profiles": {
|
||||||
"profiles": "Profiles"
|
"profiles": "Profiles"
|
||||||
},
|
},
|
||||||
"account": {
|
|
||||||
"account": "Account",
|
|
||||||
"personal-info": "Personal info",
|
|
||||||
"notification-settings": "Notification settings"
|
|
||||||
},
|
|
||||||
"security": {
|
"security": {
|
||||||
"security": "Security",
|
"security": "Security",
|
||||||
"general-settings": "General security settings",
|
"general-settings": "General security settings",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user