Add admin module for admin pages

This commit is contained in:
Konstantinos Triantafyllou 2023-11-09 14:34:34 +02:00
parent 500bf0a077
commit 111cfe5c82
5 changed files with 23 additions and 17 deletions

View File

@ -11,11 +11,11 @@ import {ActivatedRoute, Router} from "@angular/router";
}) })
export class AdminComponent extends BaseComponent implements OnInit { export class AdminComponent extends BaseComponent implements OnInit {
constructor(private route: ActivatedRoute, constructor(protected _route: ActivatedRoute,
private stakeholderService: StakeholderService, private stakeholderService: StakeholderService,
protected _router: Router) { protected _router: Router) {
super() super()
this.initRouterParams(this.route); this.initRouterParams(this._route);
} }

View File

@ -9,7 +9,8 @@ import {AdminComponent} from "./admin.component";
{path: '', loadChildren: () => import('../openaireLibrary/monitor-admin/manageStakeholders/manageStakeholders.module').then(m => m.ManageStakeholdersModule)}, {path: '', loadChildren: () => import('../openaireLibrary/monitor-admin/manageStakeholders/manageStakeholders.module').then(m => m.ManageStakeholdersModule)},
{path: ':alias', children: [ {path: ':alias', children: [
{path: '', loadChildren: () => import('../openaireLibrary/monitor-admin/general/general.module').then(m => m.GeneralModule)} {path: '', loadChildren: () => import('../openaireLibrary/monitor-admin/general/general.module').then(m => m.GeneralModule)}
]} ]
}
]} ]}
])], ])],
declarations: [AdminComponent], declarations: [AdminComponent],

View File

@ -28,7 +28,7 @@ const routes: Routes = [
{ {
path: 'admin', path: 'admin',
loadChildren: () => import('./admin/admin.module').then(m => m.AdminModule), loadChildren: () => import('./admin/admin.module').then(m => m.AdminModule),
data: {title: Irish.METADATA_PREFIX + ' Admin | '} data: {title: Irish.METADATA_PREFIX + ' Admin | '},
}, },
]; ];

View File

@ -1,15 +1,14 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {properties} from "../environments/environment";
import {ActivatedRoute, Router} from "@angular/router"; import {ActivatedRoute, Router} from "@angular/router";
import {MenuItem} from "./openaireLibrary/sharedComponents/menu"; import {MenuItem} from "./openaireLibrary/sharedComponents/menu";
import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component"; import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component";
import {BaseComponent} from "./openaireLibrary/sharedComponents/base/base.component"; import {BaseComponent} from "./openaireLibrary/sharedComponents/base/base.component";
import {StakeholderEntities, stakeholderTypes} from "./openaireLibrary/monitor/entities/stakeholder"; import {StakeholderEntities} from "./openaireLibrary/monitor/entities/stakeholder";
import {Option} from "./openaireLibrary/sharedComponents/input/input.component";
import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service"; import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service";
import {Portal} from "./openaireLibrary/utils/entities/adminTool/portal";
import {Irish} from "./shared/irish"; import {Irish} from "./shared/irish";
import {CustomFilterService} from "./shared/customFilter.service"; import {CustomFilterService} from "./shared/customFilter.service";
import {UserManagementService} from "./openaireLibrary/services/user-management.service";
import {User} from "./openaireLibrary/login/utils/helper.class";
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
@ -20,8 +19,8 @@ import {CustomFilterService} from "./shared/customFilter.service";
<div *ngIf="!loading"> <div *ngIf="!loading">
<div> <div>
<div id="modal-container"></div> <div id="modal-container"></div>
<navbar *ngIf="hasHeader" portal="irish_monitor" [menuItems]="menuItems" [showMenu]="true" [header]="header"></navbar> <navbar *ngIf="hasHeader" portal="irish_monitor" [menuItems]="menuItems" [showMenu]="true" [header]="header" [user]="user" [userMenuItems]="[]"></navbar>
<div> <div class="sidebar_main_swipe">
<main> <main>
<router-outlet></router-outlet> <router-outlet></router-outlet>
</main> </main>
@ -51,16 +50,19 @@ export class AppComponent extends BaseComponent implements OnInit {
}; };
menuItems:MenuItem[] = []; menuItems:MenuItem[] = [];
irish: Irish = new Irish(); irish: Irish = new Irish();
user: User;
constructor(private route: ActivatedRoute, constructor(protected _route: ActivatedRoute,
private router: Router, private configurationService: ConfigurationService, private customFilterService:CustomFilterService) { protected _router: Router,
private configurationService: ConfigurationService, private customFilterService:CustomFilterService,
private userManagementService: UserManagementService) {
super(); super();
configurationService.initStaticPortal(this.irish.portal); this.configurationService.initStaticPortal(this.irish.portal);
//Test track event //Test track event
// let json = {test: "json"} // let json = {test: "json"}
// this._piwikService.doTrackEvent(properties,"test", properties.piwikSiteId,location.href,"Linking", "Link", JSON.stringify(json) ) // this._piwikService.doTrackEvent(properties,"test", properties.piwikSiteId,location.href,"Linking", "Link", JSON.stringify(json) )
} }
ngOnDestroy() { ngOnDestroy() {
super.ngOnDestroy(); super.ngOnDestroy();
this.customFilterService.clearSubscriptions(); this.customFilterService.clearSubscriptions();
@ -68,7 +70,10 @@ export class AppComponent extends BaseComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
this.initialize(); this.initialize();
})
} }
initialize() { initialize() {
@ -83,6 +88,6 @@ export class AppComponent extends BaseComponent implements OnInit {
} }
public removeView() { public removeView() {
this.router.navigate([], {relativeTo: this.route}); this._router.navigate([], {relativeTo: this._route});
} }
} }

@ -1 +1 @@
Subproject commit 5cd1e29871b2d76bae08243e65ccf446c5b6e516 Subproject commit 50a8d53221bab7f5cdadcec66d22032ac048281c