From 386aa973946b92497eccbae59a741c06c0054d52 Mon Sep 17 00:00:00 2001 From: Konstantinos Triantafyllou Date: Tue, 26 Jan 2021 17:01:22 +0000 Subject: [PATCH] [Monitor Dashboard | Trunk]: Fix routes of admin-tools base on stakeholder git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@60298 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../admin-stakeholder-routing.module.ts | 42 ++++ .../admin-tool/admin-tool-routing.module.ts | 186 ------------------ .../admin-tools/admin-tools-routing.module.ts | 65 ++++++ .../portal-admin-tools-routing.module.ts | 13 ++ src/app/app-routing.module.ts | 52 ++--- src/app/app.component.ts | 6 +- 6 files changed, 138 insertions(+), 226 deletions(-) create mode 100644 src/app/admin-stakeholder/admin-stakeholder-routing.module.ts delete mode 100644 src/app/admin-tool/admin-tool-routing.module.ts create mode 100644 src/app/admin-tools/admin-tools-routing.module.ts create mode 100644 src/app/admin-tools/portal-admin-tools-routing.module.ts diff --git a/src/app/admin-stakeholder/admin-stakeholder-routing.module.ts b/src/app/admin-stakeholder/admin-stakeholder-routing.module.ts new file mode 100644 index 0000000..bb7654d --- /dev/null +++ b/src/app/admin-stakeholder/admin-stakeholder-routing.module.ts @@ -0,0 +1,42 @@ +import {NgModule} from "@angular/core"; +import {RouterModule} from "@angular/router"; +import {ConnectRIGuard} from "../openaireLibrary/connect/communityGuard/connectRIGuard.guard"; +import {EnvironmentSpecificResolver} from "../openaireLibrary/utils/properties/environmentSpecificResolver"; + +@NgModule({ + imports: [RouterModule.forChild([ + { + path: '', + loadChildren: '../general/general.module#GeneralModule', + data: {hasAdminMenu: true}, + pathMatch: 'full' + }, + { + path: 'users', + loadChildren: '../users/users.module#UsersModule', + data: {hasAdminMenu: true}, + pathMatch: 'full' + }, + { + path: 'indicators', + loadChildren: '../topic/topic.module#TopicModule', + pathMatch: 'full' + }, + { + path: 'indicators/:topic', + loadChildren: '../topic/topic.module#TopicModule', + pathMatch: 'full' + }, + { + path: 'admin-tools', + loadChildren: '../admin-tools/admin-tools-routing.module#AdminToolsRoutingModule', + data: { + hasAdminMenu: true, + param: 'stakeholder' + } + } + ])] +}) +export class AdminStakeholderRoutingModule { + +} diff --git a/src/app/admin-tool/admin-tool-routing.module.ts b/src/app/admin-tool/admin-tool-routing.module.ts deleted file mode 100644 index d8decc7..0000000 --- a/src/app/admin-tool/admin-tool-routing.module.ts +++ /dev/null @@ -1,186 +0,0 @@ -import {NgModule} from '@angular/core'; -import {RouterModule} from '@angular/router'; -import {EnvironmentSpecificResolver} from "../openaireLibrary/utils/properties/environmentSpecificResolver"; -import {AdminLoginGuard} from "../openaireLibrary/login/adminLoginGuard.guard"; -import {AdminDashboardGuard} from "../utils/adminDashboard.guard"; - -@NgModule({ - imports: [ - RouterModule.forChild([ - {path: '', redirectTo: '/admin', pathMatch: 'full'}, - { - path: 'portals', - loadChildren: '../openaireLibrary/dashboard/portal/portals.module#PortalsModule', - canActivate:[AdminLoginGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: 'entities', - loadChildren: '../openaireLibrary/dashboard/entity/entities.module#EntitiesModule', - canActivate:[AdminLoginGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: 'classes', - loadChildren: '../openaireLibrary/dashboard/divId/divIds.module#DivIdsModule', - canActivate:[AdminLoginGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: 'classContents', - loadChildren: '../openaireLibrary/dashboard/divhelpcontent/div-help-contents.module#DivHelpContentsModule', - canActivate:[AdminLoginGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: 'classContents/new', - loadChildren: '../openaireLibrary/dashboard/divhelpcontent/new-div-help-content.module#NewDivHelpContentModule', - canActivate:[AdminLoginGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: 'classContents/edit', - loadChildren: '../openaireLibrary/dashboard/divhelpcontent/edit-div-help-content.module#EditDivHelpContentModule', - canActivate:[AdminLoginGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: 'helptexts', - loadChildren: '../openaireLibrary/dashboard/helpTexts/page-help-contents.module#PageHelpContentsModule', - canActivate:[AdminLoginGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: 'helptexts/new', - loadChildren: '../openaireLibrary/dashboard/helpTexts/new-page-help-content.module#NewPageHelpContentModule', - canActivate:[AdminLoginGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: 'helptexts/edit', - loadChildren: '../openaireLibrary/dashboard/helpTexts/edit-page-help-content.module#EditPageHelpContentModule', - canActivate:[AdminLoginGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: 'pages', - loadChildren: '../openaireLibrary/dashboard/page/pages.module#PagesModule', - canActivate:[AdminLoginGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: 'pageContents', - loadChildren: '../openaireLibrary/dashboard/helpTexts/page-help-contents.module#PageHelpContentsModule', - canActivate:[AdminLoginGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: 'pageContents/new', - loadChildren: '../openaireLibrary/dashboard/helpTexts/new-page-help-content.module#NewPageHelpContentModule', - canActivate:[AdminLoginGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: 'pageContents/edit', - loadChildren: '../openaireLibrary/dashboard/helpTexts/edit-page-help-content.module#EditPageHelpContentModule', - canActivate:[AdminLoginGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - - - // stakeholder: - { - path: ':stakeholder/entities', - loadChildren: '../openaireLibrary/dashboard/entity/entities.module#EntitiesModule', - canActivate:[AdminDashboardGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: ':stakeholder/classContents', - loadChildren: '../openaireLibrary/dashboard/divhelpcontent/div-help-contents.module#DivHelpContentsModule', - canActivate:[AdminDashboardGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: ':stakeholder/classContents/new', - loadChildren: '../openaireLibrary/dashboard/divhelpcontent/new-div-help-content.module#NewDivHelpContentModule', - canActivate:[AdminDashboardGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: ':stakeholder/classContents/edit', - loadChildren: '../openaireLibrary/dashboard/divhelpcontent/edit-div-help-content.module#EditDivHelpContentModule', - canActivate:[AdminDashboardGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: ':stakeholder/helptexts', - loadChildren: '../openaireLibrary/dashboard/helpTexts/page-help-contents.module#PageHelpContentsModule', - canActivate:[AdminDashboardGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: ':stakeholder/helptexts/new', - loadChildren: '../openaireLibrary/dashboard/helpTexts/new-page-help-content.module#NewPageHelpContentModule', - canActivate:[AdminDashboardGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: ':stakeholder/helptexts/edit', - loadChildren: '../openaireLibrary/dashboard/helpTexts/edit-page-help-content.module#EditPageHelpContentModule', - canActivate:[AdminDashboardGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: ':stakeholder/pages', - loadChildren: '../openaireLibrary/dashboard/page/pages.module#PagesModule', - canActivate:[AdminDashboardGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: ':stakeholder/pageContents', - loadChildren: '../openaireLibrary/dashboard/helpTexts/page-help-contents.module#PageHelpContentsModule', - canActivate:[AdminDashboardGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: ':stakeholder/pageContents/new', - loadChildren: '../openaireLibrary/dashboard/helpTexts/new-page-help-content.module#NewPageHelpContentModule', - canActivate:[AdminDashboardGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - }, - { - path: ':stakeholder/pageContents/edit', - loadChildren: '../openaireLibrary/dashboard/helpTexts/edit-page-help-content.module#EditPageHelpContentModule', - canActivate:[AdminDashboardGuard], - resolve: { envSpecific: EnvironmentSpecificResolver }, - data: {hasAdminMenu: true} - } - ]) - ] -}) -export class AdminToolRoutingModule { -} diff --git a/src/app/admin-tools/admin-tools-routing.module.ts b/src/app/admin-tools/admin-tools-routing.module.ts new file mode 100644 index 0000000..3dd5564 --- /dev/null +++ b/src/app/admin-tools/admin-tools-routing.module.ts @@ -0,0 +1,65 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { + path: 'entities', + loadChildren: '../openaireLibrary/dashboard/entity/entities.module#EntitiesModule', + pathMatch: 'full' + }, + { + path: 'classContents', + loadChildren: '../openaireLibrary/dashboard/divhelpcontent/div-help-contents.module#DivHelpContentsModule' + }, + { + path: 'classContents/new', + loadChildren: '../openaireLibrary/dashboard/divhelpcontent/new-div-help-content.module#NewDivHelpContentModule', + pathMatch: 'full' + }, + { + path: 'classContents/edit', + loadChildren: '../openaireLibrary/dashboard/divhelpcontent/edit-div-help-content.module#EditDivHelpContentModule', + pathMatch: 'full' + }, + { + path: 'helptexts', + loadChildren: '../openaireLibrary/dashboard/helpTexts/page-help-contents.module#PageHelpContentsModule', + pathMatch: 'full' + }, + { + path: 'helptexts/new', + loadChildren: '../openaireLibrary/dashboard/helpTexts/new-page-help-content.module#NewPageHelpContentModule', + pathMatch: 'full' + }, + { + path: 'helptexts/edit', + loadChildren: '../openaireLibrary/dashboard/helpTexts/edit-page-help-content.module#EditPageHelpContentModule', + pathMatch: 'full' + }, + { + path: 'pages', + loadChildren: '../openaireLibrary/dashboard/page/pages.module#PagesModule', + pathMatch: 'full' + }, + { + path: 'pageContents', + loadChildren: '../openaireLibrary/dashboard/helpTexts/page-help-contents.module#PageHelpContentsModule', + pathMatch: 'full' + }, + { + path: 'pageContents/new', + loadChildren: '../openaireLibrary/dashboard/helpTexts/new-page-help-content.module#NewPageHelpContentModule', + pathMatch: 'full' + }, + { + path: 'pageContents/edit', + loadChildren: '../openaireLibrary/dashboard/helpTexts/edit-page-help-content.module#EditPageHelpContentModule', + pathMatch: 'full' + } + ]) + ] +}) +export class AdminToolsRoutingModule { +} diff --git a/src/app/admin-tools/portal-admin-tools-routing.module.ts b/src/app/admin-tools/portal-admin-tools-routing.module.ts new file mode 100644 index 0000000..b179ef9 --- /dev/null +++ b/src/app/admin-tools/portal-admin-tools-routing.module.ts @@ -0,0 +1,13 @@ +import {NgModule} from "@angular/core"; +import {RouterModule} from "@angular/router"; + +@NgModule({ + imports: [RouterModule.forChild([ + {path: '', loadChildren: './admin-tools-routing.module#AdminToolsRoutingModule'}, + {path: 'portals', loadChildren: '../openaireLibrary/dashboard/portal/portals.module#PortalsModule'}, + {path: 'classes', loadChildren: '../openaireLibrary/dashboard/divId/divIds.module#DivIdsModule'} + ])] +}) +export class PortalAdminToolsRoutingModule { + +} diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index f2feb1d..a175493 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -5,78 +5,55 @@ import {EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/en import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service'; import {OpenaireErrorPageComponent} from './error/errorPage.component'; +import {AdminLoginGuard} from "./openaireLibrary/login/adminLoginGuard.guard"; const routes: Routes = [ { path: 'reload', loadChildren: './reload/libReload.module#LibReloadModule', - resolve: {envSpecific: EnvironmentSpecificResolver}, data: {hasSidebar: false, hasHeader: false} }, { path: 'user-info', loadChildren: './login/libUser.module#LibUserModule', - resolve: {envSpecific: EnvironmentSpecificResolver}, data: {hasSidebar: false, isFrontPage: true} }, { path: 'error', component: OpenaireErrorPageComponent, - resolve: {envSpecific: EnvironmentSpecificResolver}, data: {hasSidebar: false, isFrontPage: true} }, { path: 'admin', loadChildren: './manageStakeholders/manageStakeholders.module#ManageStakeholdersModule', - resolve: {envSpecific: EnvironmentSpecificResolver}, data: {hasAdminMenu: true} }, { - path: 'admin/:stakeholder/users', - loadChildren: './users/users.module#UsersModule', - resolve: {envSpecific: EnvironmentSpecificResolver}, - data: {hasAdminMenu: true}, - pathMatch: 'full' + path: 'admin/admin-tools', + loadChildren: './admin-tools/portal-admin-tools-routing.module#PortalAdminToolsRoutingModule', + canActivate: [AdminLoginGuard], + data: {hasAdminMenu: true} + }, + { + path: 'admin/monitor/admin-tools', + loadChildren: './admin-tools/admin-tools-routing.module#AdminToolsRoutingModule', + canActivate: [AdminLoginGuard], + data: {hasAdminMenu: true, portal: 'monitor'} }, { path: 'admin/:stakeholder', - loadChildren: './general/general.module#GeneralModule', - resolve: {envSpecific: EnvironmentSpecificResolver}, - data: {hasAdminMenu: true}, - pathMatch: 'full' + loadChildren: './admin-stakeholder/admin-stakeholder-routing.module#AdminStakeholderRoutingModule', }, - { - path: 'admin/:stakeholder/indicators/:topic', - loadChildren: './topic/topic.module#TopicModule', - resolve: {envSpecific: EnvironmentSpecificResolver}, - pathMatch: 'full' - }, - { - path: 'admin/:stakeholder/indicators', - loadChildren: './topic/topic.module#TopicModule', - resolve: {envSpecific: EnvironmentSpecificResolver}, - pathMatch: 'full' - }, - - /* Library paths*/ - - { - path: 'admin-tools', - loadChildren: './admin-tool/admin-tool-routing.module#AdminToolRoutingModule', - resolve: {envSpecific: EnvironmentSpecificResolver}, - }, - { path: 'theme', loadChildren: './openaireLibrary/utils/theme/theme.module#ThemeModule'}, + {path: 'theme', loadChildren: './openaireLibrary/utils/theme/theme.module#ThemeModule'}, { path: '', loadChildren: './monitor/monitor.module#MonitorModule', - resolve: {envSpecific: EnvironmentSpecificResolver}, data: {isFrontPage: true} }, { path: '**', pathMatch: 'full', component: OpenaireErrorPageComponent, - resolve: {envSpecific: EnvironmentSpecificResolver}, data: {hasSidebar: false, hasAdminMenu: false, isFrontPage: true} } ]; @@ -85,7 +62,8 @@ const routes: Routes = [ imports: [RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules, scrollPositionRestoration: "top", - onSameUrlNavigation: "reload" + onSameUrlNavigation: "reload", + relativeLinkResolution: 'corrected' })], exports: [RouterModule], providers: [EnvironmentSpecificResolver, EnvironmentSpecificService] diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 606a914..4fe323c 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -225,8 +225,8 @@ export class AppComponent implements OnInit, OnDestroy { "", "/admin", false, [], [], {})); } if(Session.isPortalAdministrator(this.user) ) { - this.userMenuItems.push( new MenuItem("adminOptions", "Super Admin options","", "/admin-tools/portals", false, [], [], {})); - this.userMenuItems.push(new MenuItem("monitorOptions", "Monitor portal options","", "/admin-tools/pages", false, [], [], {communityId: 'monitor'})); + this.userMenuItems.push( new MenuItem("adminOptions", "Super Admin options","", "/admin/admin-tools/portals", false, [], [], {})); + this.userMenuItems.push(new MenuItem("monitorOptions", "Monitor portal options","", "/admin/monitor/admin-tools/pages", false, [], [], {})); } this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {})); @@ -310,7 +310,7 @@ export class AppComponent implements OnInit, OnDestroy { if(this.stakeholder.defaultId) { this.adminMenuItems.push(new MenuItem("users", "Users", "", "/admin/" + this.stakeholder.alias + "/users", false, [], [], {}, "")); if (Session.isPortalAdministrator(this.user)) { - this.adminMenuItems.push(new MenuItem("monitorOptions", "Pages & Entities", "", "/admin-tools/" + this.stakeholder.alias + "/pages", false, [], [], {communityId: this.stakeholder.alias})); + this.adminMenuItems.push(new MenuItem("admin-tools", "Pages & Entities", "", "/admin/" + this.stakeholder.alias + "/admin-tools/pages", false, [], [], {}, null, null, null, "/admin/" + this.stakeholder.alias + "/admin-tools")); } } this.specialSideBarMenuItem = new MenuItem("back", "Manage profiles", "", "/admin", false, [], null, {});