From ba4dee6d5fa9a2b87b65759d427436d22e132043 Mon Sep 17 00:00:00 2001 From: Konstantinos Triantafyllou Date: Wed, 27 Nov 2019 10:51:21 +0000 Subject: [PATCH] [Monitor Dashboard]: Change monitor route to / and / to admin git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57707 d315682c-612b-4755-9ff5-7f18f6832af3 --- src/app/app-routing.module.ts | 14 ++++++------ src/app/app.component.ts | 3 +-- .../sharedComponents/input/focus.directive.ts | 22 ------------------- .../sharedComponents/input/input.module.ts | 2 -- src/app/monitor/monitor.component.ts | 8 +++---- 5 files changed, 12 insertions(+), 37 deletions(-) delete mode 100644 src/app/library/sharedComponents/input/focus.directive.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 4dcc104..78326ca 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -7,11 +7,6 @@ import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/env import {OpenaireErrorPageComponent} from './error/errorPage.component'; const routes: Routes = [ - { - path: 'monitor', - loadChildren: './monitor/monitor.module#MonitorModule', - resolve: {envSpecific: EnvironmentSpecificResolver} - }, { path: 'reload', loadChildren: './reload/libReload.module#LibReloadModule', @@ -29,15 +24,20 @@ const routes: Routes = [ data: {hasSidebar: false} }, { - path: ':stakeholder', + path: 'admin/:stakeholder', loadChildren: './home/home.module#HomeModule', resolve: {envSpecific: EnvironmentSpecificResolver} }, { - path: ':stakeholder/:topic', + path: 'admin/:stakeholder/:topic', loadChildren: './topic/topic.module#TopicModule', resolve: {envSpecific: EnvironmentSpecificResolver} }, + { + path: '', + loadChildren: './monitor/monitor.module#MonitorModule', + resolve: {envSpecific: EnvironmentSpecificResolver}, + }, { path: '**', pathMatch: 'full', diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 812b9ff..99de85a 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,5 +1,5 @@ import {ChangeDetectorRef, Component, OnDestroy, OnInit} from '@angular/core'; -import {ActivatedRoute, NavigationEnd, Router} from '@angular/router'; +import {ActivatedRoute, NavigationEnd, RouteConfigLoadEnd, Router} from '@angular/router'; import {EnvProperties} from './openaireLibrary/utils/properties/env-properties'; import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service'; @@ -70,7 +70,6 @@ export class AppComponent implements OnInit, OnDestroy { })); this.subscriptions.push(this.layoutService.hasHeader.subscribe(hasHeader => { this.hasHeader = hasHeader; - console.log(this.hasHeader); this.cdr.detectChanges(); })); } diff --git a/src/app/library/sharedComponents/input/focus.directive.ts b/src/app/library/sharedComponents/input/focus.directive.ts deleted file mode 100644 index 5724b83..0000000 --- a/src/app/library/sharedComponents/input/focus.directive.ts +++ /dev/null @@ -1,22 +0,0 @@ -import {Directive, HostListener, Input} from "@angular/core"; - -@Directive({ - selector: '[focus-directive]', -}) -export class FocusDirective { - @Input('formInput') formControl: any; - - constructor() { } - - @HostListener - ('focus', ['$event.target']) - onFocus(target) { - this.formControl.markAsTouched({onlySelf: true}); - } - - @HostListener('blur', ['$event.target']) - onBlur(target) { - this.formControl.markAsUntouched({onlySelf: true}); - } - -} diff --git a/src/app/library/sharedComponents/input/input.module.ts b/src/app/library/sharedComponents/input/input.module.ts index de1f692..bdd8cd9 100644 --- a/src/app/library/sharedComponents/input/input.module.ts +++ b/src/app/library/sharedComponents/input/input.module.ts @@ -1,6 +1,5 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; -import {FocusDirective} from "./focus.directive"; import {InputComponent} from "./input.component"; import {SharedModule} from "../../../shared/shared.module"; import {MatFormFieldModule} from "@angular/material/form-field"; @@ -19,7 +18,6 @@ import {MatSelectModule} from "@angular/material/select"; InputComponent ], declarations: [ - FocusDirective, InputComponent ] }) diff --git a/src/app/monitor/monitor.component.ts b/src/app/monitor/monitor.component.ts index 1fc7a76..33266ee 100644 --- a/src/app/monitor/monitor.component.ts +++ b/src/app/monitor/monitor.component.ts @@ -1,4 +1,4 @@ -import {AfterViewInit, ChangeDetectorRef, Component, OnDestroy, OnInit} from '@angular/core'; +import {ChangeDetectorRef, Component, OnDestroy, OnInit} from '@angular/core'; import {ActivatedRoute, Params, Router} from '@angular/router'; import {DomSanitizer, Meta, Title} from '@angular/platform-browser'; import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; @@ -179,13 +179,13 @@ export class MonitorComponent implements OnInit, OnDestroy { category.subCategories.forEach(subCategory => { if (subCategory.alias != null && subCategory.isPublic && subCategory.isActive) { subItems.push(new Item(subCategory.name, ( - '/monitor/' + this.stakeholder.alias + '/' + this.activeTopic.alias + '/' + category.alias + '/' + subCategory.alias), + this.stakeholder.alias + '/' + this.activeTopic.alias + '/' + category.alias + '/' + subCategory.alias), null, null, false)); } }); const open = this.activeCategory.alias === category.alias; items.push(new Item(category.name, ( - '/monitor/' + this.stakeholder.alias + '/' + this.activeTopic.alias + '/' + category.alias), + this.stakeholder.alias + '/' + this.activeTopic.alias + '/' + category.alias), subItems, null, open)); } }); @@ -246,7 +246,7 @@ export class MonitorComponent implements OnInit, OnDestroy { } public navigateTo(stakeholder: string, topic: string, category: string = null, subcategory: string = null) { - let url = '/monitor/' + stakeholder + '/' + topic + ((category) ? ('/' + let url = stakeholder + '/' + topic + ((category) ? ('/' + category) : '') + ((subcategory) ? ('/' + subcategory) : ''); return this._router.navigate([url]); }