diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 6b789a5..88debb1 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -6,7 +6,7 @@ const routes: Routes = [ { path: '', loadChildren: './pages/pages.module#PagesModule', canActivate: [AuthGuard] }, { path: 'auth', loadChildren: './pages/auth/auth-page.module#AuthPageModule' }, { path: '**', loadChildren: './pages/error/error-page.module#ErrorPageModule' }, - // { path: 'errors', loadChildren: './pages/errors/errors-page.module#ErrorsPageModule' }, + { path: 'error', loadChildren: './pages/error/error-page.module#ErrorPageModule' }, ]; @NgModule({ diff --git a/src/app/pages/error/error-page.component.html b/src/app/pages/error/error-page.component.html index a591d7d..e711847 100644 --- a/src/app/pages/error/error-page.component.html +++ b/src/app/pages/error/error-page.component.html @@ -1 +1,4 @@ -Error Page \ No newline at end of file +Error Page + + + diff --git a/src/app/pages/error/error-page.component.ts b/src/app/pages/error/error-page.component.ts index c443c6f..c398caa 100644 --- a/src/app/pages/error/error-page.component.ts +++ b/src/app/pages/error/error-page.component.ts @@ -1,4 +1,5 @@ import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; @@ -10,9 +11,14 @@ import { Component, OnInit } from '@angular/core'; export class ErrorPageComponent implements OnInit { - constructor() { } + constructor( + private router: Router, + ) { } ngOnInit() { } + onNavigateMain() { + this.router.navigate(['home']); + } } diff --git a/src/app/pages/download/download-page.component.html b/src/app/pages/probe/download/download-page.component.html similarity index 100% rename from src/app/pages/download/download-page.component.html rename to src/app/pages/probe/download/download-page.component.html diff --git a/src/app/pages/download/download-page.component.ts b/src/app/pages/probe/download/download-page.component.ts similarity index 100% rename from src/app/pages/download/download-page.component.ts rename to src/app/pages/probe/download/download-page.component.ts diff --git a/src/app/pages/download/download-page.module.ts b/src/app/pages/probe/download/download-page.module.ts similarity index 100% rename from src/app/pages/download/download-page.module.ts rename to src/app/pages/probe/download/download-page.module.ts diff --git a/src/app/pages/noauth-probe/noauth-probe-page-routing.module.ts b/src/app/pages/probe/noauth-probe/noauth-probe-page-routing.module.ts similarity index 100% rename from src/app/pages/noauth-probe/noauth-probe-page-routing.module.ts rename to src/app/pages/probe/noauth-probe/noauth-probe-page-routing.module.ts diff --git a/src/app/pages/noauth-probe/noauth-probe-page.component.html b/src/app/pages/probe/noauth-probe/noauth-probe-page.component.html similarity index 100% rename from src/app/pages/noauth-probe/noauth-probe-page.component.html rename to src/app/pages/probe/noauth-probe/noauth-probe-page.component.html diff --git a/src/app/pages/noauth-probe/noauth-probe-page.component.ts b/src/app/pages/probe/noauth-probe/noauth-probe-page.component.ts similarity index 100% rename from src/app/pages/noauth-probe/noauth-probe-page.component.ts rename to src/app/pages/probe/noauth-probe/noauth-probe-page.component.ts diff --git a/src/app/pages/noauth-probe/noauth-probe-page.module.ts b/src/app/pages/probe/noauth-probe/noauth-probe-page.module.ts similarity index 100% rename from src/app/pages/noauth-probe/noauth-probe-page.module.ts rename to src/app/pages/probe/noauth-probe/noauth-probe-page.module.ts diff --git a/src/app/pages/probe/probe-page-routing.module.ts b/src/app/pages/probe/probe-page-routing.module.ts index 5b72e28..c1857df 100644 --- a/src/app/pages/probe/probe-page-routing.module.ts +++ b/src/app/pages/probe/probe-page-routing.module.ts @@ -2,8 +2,8 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { ProbePageComponent } from './probe-page.component'; -import { ProbeListComponent } from './list/list.component'; -import { ProbeDetailComponent } from './detail/detail.component'; +import { ProbeListComponent } from './probe/list.component'; +import { ProbeDetailComponent } from './probe/detail.component'; import { DownloadComponent } from 'packages/probe/component/download/download.component'; @@ -13,7 +13,7 @@ const routes: Routes = [ component: ProbePageComponent, children: [ { path: 'list', component: ProbeListComponent }, - { path: 'noauth', loadChildren: 'app/pages/noauth-probe/noauth-probe-page.module#NoAuthProbePageModule' }, + { path: 'noauth', loadChildren: 'app/pages/probe/noauth-probe/noauth-probe-page.module#NoAuthProbePageModule' }, { path: 'download', component: DownloadComponent }, { path: ':id/info', component: ProbeDetailComponent }, // { path: ':id/targets', loadChildren: 'app/pages/targets/targets-page.module#TargetsPageModule'}, diff --git a/src/app/pages/probe/probe-page.component.ts b/src/app/pages/probe/probe-page.component.ts index 766b373..ff9a220 100644 --- a/src/app/pages/probe/probe-page.component.ts +++ b/src/app/pages/probe/probe-page.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; +import { Component, OnDestroy } from '@angular/core'; import { Router, NavigationEnd } from '@angular/router'; import { Subscription } from 'rxjs/Subscription'; @@ -6,15 +6,12 @@ import { Subscription } from 'rxjs/Subscription'; selector: 'of-pages-probe', templateUrl: './probe-page.component.html', }) -export class ProbePageComponent implements OnInit, OnDestroy { +export class ProbePageComponent implements OnDestroy { private tabs = undefined; private routerSubscription$: Subscription; constructor(private router: Router) { - } - - ngOnInit() { this.routerSubscription$ = this.router.events.subscribe((event) => { if (event instanceof NavigationEnd) { this.generateTabMenu(event); @@ -27,24 +24,28 @@ export class ProbePageComponent implements OnInit, OnDestroy { } generateTabMenu(event: NavigationEnd) { - const parsedUrl = event.url.split('probe/')[1].split('/')[0]; - switch (parsedUrl) { - case 'list': - case 'noauth': - case 'download': - this.tabs = [ - { label: 'PROBES', routerLink: ['/probe/list'] }, - { label: 'UNAUTHORIZED', routerLink: ['/probe/noauth'] }, - { label: 'DOWNLOAD', routerLink: ['/probe/download'] }, - ]; - break; - default: - this.tabs = [ - { label: 'INFO', routerLink: ['/probe/', parsedUrl, 'info'] }, - { label: 'TARGETS', routerLink: ['/probe/', parsedUrl, 'targets'], disabled: true }, - { label: 'HISTORY', path: ['/probe/', parsedUrl, 'history'], disabled: true }, - ]; - break; + try { + const parsedUrl = event.url.split('probe/')[1].split('/')[0]; + switch (parsedUrl) { + case 'list': + case 'noauth': + case 'download': + this.tabs = [ + { label: 'PROBES', routerLink: ['/probe/list'] }, + { label: 'UNAUTHORIZED', routerLink: ['/probe/noauth'] }, + { label: 'DOWNLOAD', routerLink: ['/probe/download'] }, + ]; + break; + default: + this.tabs = [ + { label: 'INFO', routerLink: ['/probe/', parsedUrl, 'info'] }, + { label: 'TARGETS', routerLink: ['/probe/', parsedUrl, 'targets'], disabled: true }, + { label: 'HISTORY', path: ['/probe/', parsedUrl, 'history'], disabled: true }, + ]; + break; + } + } catch { + this.router.navigate(['error']); } } diff --git a/src/app/pages/probe/probe-page.module.ts b/src/app/pages/probe/probe-page.module.ts index 4fc22af..6b6ad74 100644 --- a/src/app/pages/probe/probe-page.module.ts +++ b/src/app/pages/probe/probe-page.module.ts @@ -8,8 +8,8 @@ import { PrimeNGModules } from 'packages/commons/prime-ng/prime-ng.module'; import { ProbeModule } from 'packages/probe/probe.module'; import { TabbarModule } from 'app/commons/component/layout/tabbar/app.tabbar.module'; import { NoauthModule } from 'packages/noauth/noauth.module'; -import { ProbeListComponent } from './list/list.component'; -import { ProbeDetailComponent } from './detail/detail.component'; +import { ProbeListComponent } from './probe/list.component'; +import { ProbeDetailComponent } from './probe/detail.component'; @NgModule({ imports: [ diff --git a/src/app/pages/probe/detail/detail.component.html b/src/app/pages/probe/probe/detail.component.html similarity index 100% rename from src/app/pages/probe/detail/detail.component.html rename to src/app/pages/probe/probe/detail.component.html diff --git a/src/app/pages/probe/detail/detail.component.ts b/src/app/pages/probe/probe/detail.component.ts similarity index 100% rename from src/app/pages/probe/detail/detail.component.ts rename to src/app/pages/probe/probe/detail.component.ts diff --git a/src/app/pages/probe/list/list.component.html b/src/app/pages/probe/probe/list.component.html similarity index 100% rename from src/app/pages/probe/list/list.component.html rename to src/app/pages/probe/probe/list.component.html diff --git a/src/app/pages/probe/list/list.component.ts b/src/app/pages/probe/probe/list.component.ts similarity index 100% rename from src/app/pages/probe/list/list.component.ts rename to src/app/pages/probe/probe/list.component.ts