[master | DONE | ADDED]: app.component.ts: Added user menu items "Super Admin options" and "Irish options" | admin.component.ts: Added Pages & Entities in sidebar and added method "setProperties()" to init portal | admin.module.ts & admin-tools-routing.module.ts & portal-admin-tools-routing.module.ts: Added routes for admin tools (help texts).
This commit is contained in:
parent
6858fcb72c
commit
e32581c236
|
@ -0,0 +1,41 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule} from '@angular/router';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{
|
||||
path: 'entities',
|
||||
loadChildren: () => import('../openaireLibrary/dashboard/entity/entities.module').then(m => m.EntitiesModule),
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'classContents',
|
||||
loadChildren: () => import('../openaireLibrary/dashboard/divhelpcontent/class-help-contents.module').then(m => m.ClassHelpContentsModule),
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'classContents/edit',
|
||||
loadChildren: () => import('../openaireLibrary/dashboard/divhelpcontent/class-help-content-form.module').then(m => m.ClassHelpContentFormModule),
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'helptexts',
|
||||
loadChildren: () => import('../openaireLibrary/dashboard/helpTexts/page-help-contents.module').then(m => m.PageHelpContentsModule),
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'helptexts/edit',
|
||||
loadChildren: () => import('../openaireLibrary/dashboard/helpTexts/page-help-content-form.module').then(m => m.PageHelpContentFormModule),
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'pages',
|
||||
loadChildren: () => import('../openaireLibrary/dashboard/page/pages.module').then(m => m.PagesModule),
|
||||
pathMatch: 'full'
|
||||
}
|
||||
])
|
||||
]
|
||||
})
|
||||
export class AdminToolsRoutingModule {
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
import {NgModule} from "@angular/core";
|
||||
import {RouterModule} from "@angular/router";
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild([
|
||||
{path: '', loadChildren: () => import('./admin-tools-routing.module').then(m => m.AdminToolsRoutingModule)},
|
||||
{path: 'portals', loadChildren: () => import('../openaireLibrary/dashboard/portal/portals.module').then(m => m.PortalsModule)},
|
||||
{path: 'classes', loadChildren: () => import('../openaireLibrary/dashboard/divId/divIds.module').then(m => m.DivIdsModule)}
|
||||
])]
|
||||
})
|
||||
export class PortalAdminToolsRoutingModule {
|
||||
|
||||
}
|
|
@ -5,6 +5,10 @@ import {SidebarBaseComponent} from "../openaireLibrary/dashboard/sharedComponent
|
|||
import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
|
||||
import {Stakeholder} from "../openaireLibrary/monitor/entities/stakeholder";
|
||||
import {MenuItem} from "../openaireLibrary/sharedComponents/menu";
|
||||
import {Session, User} from "../openaireLibrary/login/utils/helper.class";
|
||||
import {UserManagementService} from "../openaireLibrary/services/user-management.service";
|
||||
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
|
||||
import {ConfigurationService} from "../openaireLibrary/utils/configuration/configuration.service";
|
||||
|
||||
@Component({
|
||||
selector: 'admin',
|
||||
|
@ -27,39 +31,49 @@ import {MenuItem} from "../openaireLibrary/sharedComponents/menu";
|
|||
export class AdminComponent extends SidebarBaseComponent implements OnInit {
|
||||
stakeholder: Stakeholder;
|
||||
loading: boolean = true;
|
||||
user: User;
|
||||
|
||||
constructor(protected _route: ActivatedRoute,
|
||||
protected _router: Router,
|
||||
protected layoutService: LayoutService,
|
||||
protected cdr: ChangeDetectorRef,
|
||||
private stakeholderService: StakeholderService) {
|
||||
private stakeholderService: StakeholderService,
|
||||
private userManagementService: UserManagementService,
|
||||
private configurationService: ConfigurationService) {
|
||||
super();
|
||||
this.initRouterParams(this._route);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
this.subscriptions.push(this.params.subscribe(params => {
|
||||
this.sideBarItems = [];
|
||||
this.loading = true;
|
||||
if(params['alias']) {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(params['alias']).subscribe(stakeholder => {
|
||||
this.stakeholder = stakeholder;
|
||||
this.layoutService.setRootClass(this.stakeholder.type);
|
||||
this.sideBarItems.push(new MenuItem("general", "General", "", "/admin/" + this.stakeholder.alias, false, [], [], {}, {name: 'badge'}));
|
||||
this.sideBarItems.push(new MenuItem("indicators", "Indicators", "", "/admin/" + this.stakeholder.alias + '/indicators', false, [], [], {}, {name: 'bar_chart'}, null, "uk-visible@m"));
|
||||
if (this.stakeholder.defaultId) {
|
||||
this.sideBarItems.push(new MenuItem("users", "Users", "", "/admin/" + this.stakeholder.alias + '/users', false, [], [], {}, {name: 'group'}, null, "uk-visible@m", "/admin/" + this.stakeholder.alias + "/users"));
|
||||
}
|
||||
this.backItem = new MenuItem("back", "Manage profiles", "", "/admin", false, [], null, {}, {name: 'west'});
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
this.subscriptions.push(this.params.subscribe(params => {
|
||||
this.sideBarItems = [];
|
||||
this.loading = true;
|
||||
if(params['stakeholder']) {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(params['stakeholder']).subscribe(stakeholder => {
|
||||
this.stakeholder = stakeholder;
|
||||
this.setProperties(this.stakeholder.alias, this.stakeholder.type);
|
||||
this.layoutService.setRootClass(this.stakeholder.type);
|
||||
this.sideBarItems.push(new MenuItem("general", "General", "", "/admin/" + this.stakeholder.alias, false, [], [], {}, {name: 'badge'}));
|
||||
this.sideBarItems.push(new MenuItem("indicators", "Indicators", "", "/admin/" + this.stakeholder.alias + '/indicators', false, [], [], {}, {name: 'bar_chart'}, null, "uk-visible@m"));
|
||||
if (this.stakeholder.defaultId) {
|
||||
this.sideBarItems.push(new MenuItem("users", "Users", "", "/admin/" + this.stakeholder.alias + '/users', false, [], [], {}, {name: 'group'}, null, "uk-visible@m", "/admin/" + this.stakeholder.alias + "/users"));
|
||||
}
|
||||
if (this.isAdmin) {
|
||||
this.sideBarItems.push(new MenuItem("admin-tools", "Pages & Entities", "", "/admin/" + this.stakeholder.alias + "/admin-tools/pages", false, [], [], {}, {name: 'description'}, null, "uk-visible@m", "/admin/" + this.stakeholder.alias + "/admin-tools"));
|
||||
}
|
||||
this.backItem = new MenuItem("back", "Manage profiles", "", "/admin", false, [], null, {}, {name: 'west'});
|
||||
this.loading = false;
|
||||
}));
|
||||
} else {
|
||||
this.stakeholderService.setStakeholder(null);
|
||||
this.layoutService.setRootClass(null);
|
||||
this.hasSidebar = false;
|
||||
this.loading = false;
|
||||
}));
|
||||
} else {
|
||||
this.stakeholderService.setStakeholder(null);
|
||||
this.layoutService.setRootClass(null);
|
||||
this.hasSidebar = false;
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
}));
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -67,4 +81,18 @@ export class AdminComponent extends SidebarBaseComponent implements OnInit {
|
|||
super.ngOnDestroy();
|
||||
this.layoutService.setRootClass(null);
|
||||
}
|
||||
|
||||
setProperties(id, type = null) {
|
||||
this.properties.adminToolsCommunity = id;
|
||||
if (type) {
|
||||
this.properties.adminToolsPortalType = type;
|
||||
} else {
|
||||
ConnectHelper.setPortalTypeFromPid(id);
|
||||
}
|
||||
this.configurationService.initPortal(this.properties, this.properties.adminToolsCommunity);
|
||||
}
|
||||
|
||||
public get isAdmin() {
|
||||
return Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
|
|||
import {SideBarModule} from "../openaireLibrary/dashboard/sharedComponents/sidebar/sideBar.module";
|
||||
import {LoadingModule} from "../openaireLibrary/utils/loading/loading.module";
|
||||
import {LogoUrlPipeModule} from "../openaireLibrary/utils/pipes/logoUrlPipe.module";
|
||||
import {AdminLoginGuard} from "../openaireLibrary/login/adminLoginGuard.guard";
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, RouterModule.forChild([
|
||||
|
@ -16,7 +17,19 @@ import {LogoUrlPipeModule} from "../openaireLibrary/utils/pipes/logoUrlPipe.modu
|
|||
loadChildren: () => import('../openaireLibrary/monitor-admin/manageStakeholders/manageStakeholders.module').then(m => m.ManageStakeholdersModule)
|
||||
},
|
||||
{
|
||||
path: ':alias', children: [
|
||||
path: 'admin-tools',
|
||||
loadChildren: () => import('../admin-tools/portal-admin-tools-routing.module').then(m => m.PortalAdminToolsRoutingModule),
|
||||
canActivateChild: [AdminLoginGuard],
|
||||
data: {hasAdminMenu: true, hasSidebar: false}
|
||||
},
|
||||
{
|
||||
path: 'irish/admin-tools',
|
||||
loadChildren: () => import('../admin-tools/admin-tools-routing.module').then(m => m.AdminToolsRoutingModule),
|
||||
canActivateChild: [AdminLoginGuard],
|
||||
data: {hasAdminMenu: true, hasSidebar: false, portal: 'irish', monitorCurator: true, parentClass: 'monitor'}
|
||||
},
|
||||
{
|
||||
path: ':stakeholder', children: [
|
||||
{
|
||||
path: '',
|
||||
loadChildren: () => import('../openaireLibrary/monitor-admin/general/general.module').then(m => m.GeneralModule)
|
||||
|
@ -37,6 +50,11 @@ import {LogoUrlPipeModule} from "../openaireLibrary/utils/pipes/logoUrlPipe.modu
|
|||
loadChildren: () => import('./users/users.module').then(m => m.UsersModule),
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'admin-tools',
|
||||
loadChildren: () => import('../admin-tools/admin-tools-routing.module').then(m => m.AdminToolsRoutingModule),
|
||||
data: {param: 'stakeholder', parentClass: 'monitor'}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -217,6 +217,12 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit {
|
|||
if (this.isAdmin) {
|
||||
this.userMenuItems.push(new MenuItem("stakeholders", "Manage profiles", "", "/admin", false, [], [], {}, {name: 'settings'}));
|
||||
}
|
||||
if (Session.isPortalAdministrator(this.user)) {
|
||||
this.userMenuItems.push(new MenuItem("adminOptions", "Super Admin options", "", "/admin/admin-tools/portals", false, [], [], {},null, null, "uk-visible@m"));
|
||||
}
|
||||
if (this.isAdmin) {
|
||||
this.userMenuItems.push(new MenuItem("irishOptions", "Irish options", "", "/admin/irish/admin-tools/pages", false, [], [], {},null, null, "uk-visible@m"));
|
||||
}
|
||||
}
|
||||
|
||||
setProperties(id, type = null) {
|
||||
|
|
Loading…
Reference in New Issue