From 409f263479e5d30cda5c89876f6c0bc6d305b906 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Fri, 24 Mar 2023 17:15:41 +0200 Subject: [PATCH] Add notification configuration in order to works in mobile --- src/app/app.component.html | 6 +++--- src/app/app.component.ts | 34 +++++++++++++++++++++------------- src/app/openaireLibrary | 2 +- src/assets/common-assets | 2 +- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/app/app.component.html b/src/app/app.component.html index 6b0bc58..8b1bf09 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -6,7 +6,8 @@ [class.sidebar_mini]="!open && (hasSidebar || hasAdminMenu || hasInternalSidebar)" [class.sidebar_hover]="hover"> - +
@@ -15,8 +16,7 @@ - +
You are currently in a "Preview" mode. The current view of this dashboard may differ. diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 91048e4..81085dc 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -24,6 +24,9 @@ import {SmoothScroll} from "./openaireLibrary/utils/smooth-scroll"; import {ConnectHelper} from "./openaireLibrary/connect/connectHelper"; import {ResourcesService} from "./openaireLibrary/monitor/services/resources.service"; import {StringUtils} from "./openaireLibrary/utils/string-utils.class"; +import { + NotificationConfiguration +} from "./openaireLibrary/notifications/notifications-sidebar/notifications-sidebar.component"; @Component({ @@ -41,13 +44,13 @@ export class AppComponent implements OnInit, OnDestroy { hasAdminMenu: boolean = false; hasInternalSidebar: boolean = false; isFrontPage: boolean = false; + isMobile: boolean = false; view: Visibility; sideBarItems: MenuItem[] = []; backItem: MenuItem = null; menuItems: MenuItem[] = []; - notificationGroups: Option[] = []; - entities: string[]; notificationGroupsInitialized: boolean = false; + notificationConfiguration: NotificationConfiguration = new NotificationConfiguration(); stakeholderUtils: StakeholderUtils = new StakeholderUtils(); public stakeholderEntities = StakeholderEntities; menuHeader: Header = { @@ -118,6 +121,10 @@ export class AppComponent implements OnInit, OnDestroy { this.isFrontPage = isFrontPage; this.cdr.detectChanges(); })); + this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { + this.isMobile = isMobile; + this.cdr.detectChanges(); + })); this.route.queryParams.subscribe(params => { this.view = params['view']; if(this.stakeholder) { @@ -136,12 +143,12 @@ export class AppComponent implements OnInit, OnDestroy { if (user) { this.user = user; if (!this.notificationGroupsInitialized) { - this.setNotificationGroups(); + this.setNotificationConfiguration(); } } else if(this.user) { this.user = user; this.notificationGroupsInitialized = false; - this.notificationGroups = []; + this.notificationConfiguration.availableGroups = []; } if(this.paramsSubscription) { this.paramsSubscription.unsubscribe(); @@ -201,26 +208,27 @@ export class AppComponent implements OnInit, OnDestroy { } } - public setNotificationGroups() { - this.entities = this.stakeholderUtils.types.map(option => option.value); - this.notificationGroups = []; + public setNotificationConfiguration() { + this.notificationConfiguration.entities = this.stakeholderUtils.types.map(option => option.value); + this.notificationConfiguration.service = 'monitor'; + this.notificationConfiguration.availableGroups = []; if (Session.isPortalAdministrator(this.user)) { - this.notificationGroups.push({value: Role.PORTAL_ADMIN, label: 'Portal Administrators'}); + this.notificationConfiguration.availableGroups.push({value: Role.PORTAL_ADMIN, label: 'Portal Administrators'}); } for (let type of this.stakeholderUtils.types) { if (Session.isCurator(type.value, this.user) || Session.isPortalAdministrator(this.user)) { - this.notificationGroups.push({value: Role.curator(type.value), label: type.label + ' Curators'}); - this.notificationGroups.push({value: Role.typeManager(type.value), label: type.label + ' Managers'}); - this.notificationGroups.push({value: Role.typeMember(type.value), label: type.label + ' Members'}); + this.notificationConfiguration.availableGroups.push({value: Role.curator(type.value), label: type.label + ' Curators'}); + this.notificationConfiguration.availableGroups.push({value: Role.typeManager(type.value), label: type.label + ' Managers'}); + this.notificationConfiguration.availableGroups.push({value: Role.typeMember(type.value), label: type.label + ' Members'}); } } this.subscriptions.push(this.stakeholderService.getMyStakeholders(this.properties.monitorServiceAPIURL).subscribe(stakeholders => { stakeholders.forEach(stakeholder => { - this.notificationGroups.push({ + this.notificationConfiguration.availableGroups.push({ value: Role.manager(stakeholder.type, stakeholder.alias), label: stakeholder.name + ' Managers' }); - this.notificationGroups.push({ + this.notificationConfiguration.availableGroups.push({ value: Role.member(stakeholder.type, stakeholder.alias), label: stakeholder.name + ' Members' }); diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 31d52de..a9f31d8 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 31d52de0e8f7a8ed506f597c555c5b952bcbdb02 +Subproject commit a9f31d830740cfdcea33266248b2421815834899 diff --git a/src/assets/common-assets b/src/assets/common-assets index 22728ec..7c314ad 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit 22728ec7de6c106bb4ede71e12a71cb061c6e8f8 +Subproject commit 7c314ad2eb1c0b855f97e8eed7295075710be2fd