From 1a6510957406745d278897bb076a7cdca2d8556c Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 16 May 2018 21:01:37 +0900 Subject: [PATCH] probe download route --- src/app/app-routing.module.ts | 2 +- .../breadcrumb/app.breadcrumb.component.ts | 2 +- .../layout/tabbar/app.tabbar.component.ts | 3 ++- .../layout/topbar/app.topbar.component.html | 2 +- .../breadcrumb.service.ts | 0 src/app/pages/pages.module.ts | 2 +- .../download/download-page-routing.module.ts | 20 +++++++++++++++++++ .../download/download-page.component.html | 2 +- .../probe/download/download-page.component.ts | 18 ++++++++++++----- .../probe/download/download-page.module.ts | 5 ++++- .../noauth-probe-page.component.ts | 6 ++++-- .../noauth-probe/noauth-probe-page.module.ts | 2 -- .../pages/probe/probe-page-routing.module.ts | 4 ++-- src/app/pages/probe/probe-page.component.ts | 4 +++- src/app/pages/probe/probe-page.module.ts | 2 -- .../download/download.component.html | 18 +++++++++++------ .../component/download/download.component.ts | 12 +++++++++-- 17 files changed, 75 insertions(+), 29 deletions(-) rename src/app/commons/{component/layout/breadcrumb => service}/breadcrumb.service.ts (100%) create mode 100644 src/app/pages/probe/download/download-page-routing.module.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 88debb1..d292388 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -5,8 +5,8 @@ import { AuthGuard } from './commons/guard/auth.guard'; 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: 'error', loadChildren: './pages/error/error-page.module#ErrorPageModule' }, + { path: '**', redirectTo: 'error' }, ]; @NgModule({ diff --git a/src/app/commons/component/layout/breadcrumb/app.breadcrumb.component.ts b/src/app/commons/component/layout/breadcrumb/app.breadcrumb.component.ts index 1d8cc95..363ec6b 100644 --- a/src/app/commons/component/layout/breadcrumb/app.breadcrumb.component.ts +++ b/src/app/commons/component/layout/breadcrumb/app.breadcrumb.component.ts @@ -1,8 +1,8 @@ import { Component, OnDestroy } from '@angular/core'; import { AppComponent } from 'app/app.component'; -import { BreadcrumbService } from './breadcrumb.service'; import { Subscription } from 'rxjs/Subscription'; import { MenuItem } from 'primeng/primeng'; +import { BreadcrumbService } from 'app/commons/service/breadcrumb.service'; @Component({ selector: 'of-breadcrumb', diff --git a/src/app/commons/component/layout/tabbar/app.tabbar.component.ts b/src/app/commons/component/layout/tabbar/app.tabbar.component.ts index 7cfc418..cd5354f 100644 --- a/src/app/commons/component/layout/tabbar/app.tabbar.component.ts +++ b/src/app/commons/component/layout/tabbar/app.tabbar.component.ts @@ -1,13 +1,14 @@ import { Component, Input, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { Language } from 'angular-l10n'; +import { MenuItem } from 'primeng/api'; @Component({ selector: 'of-tabbar', templateUrl: './app.tabbar.component.html', }) export class TabbarComponent implements OnInit { - @Input() tabs: any; + @Input() tabs: MenuItem[]; constructor(public router: Router) { } diff --git a/src/app/commons/component/layout/topbar/app.topbar.component.html b/src/app/commons/component/layout/topbar/app.topbar.component.html index 82751ef..cf6bb5c 100644 --- a/src/app/commons/component/layout/topbar/app.topbar.component.html +++ b/src/app/commons/component/layout/topbar/app.topbar.component.html @@ -129,7 +129,7 @@
  • notifications - + {{notificationCount}} Notifications diff --git a/src/app/commons/component/layout/breadcrumb/breadcrumb.service.ts b/src/app/commons/service/breadcrumb.service.ts similarity index 100% rename from src/app/commons/component/layout/breadcrumb/breadcrumb.service.ts rename to src/app/commons/service/breadcrumb.service.ts diff --git a/src/app/pages/pages.module.ts b/src/app/pages/pages.module.ts index 8397d21..0bd7855 100644 --- a/src/app/pages/pages.module.ts +++ b/src/app/pages/pages.module.ts @@ -8,7 +8,7 @@ import { AppFooterComponent } from 'app/commons/component/layout/footer/app.foot import { AppBreadcrumbComponent } from 'app/commons/component/layout/breadcrumb/app.breadcrumb.component'; import { AppRightpanelComponent } from 'app/commons/component/layout/right-panel/app.rightpanel.component'; import { AppInlineProfileComponent } from 'app/commons/component/layout/profile/app.profile.component'; -import { BreadcrumbService } from 'app/commons/component/layout/breadcrumb/breadcrumb.service'; +import { BreadcrumbService } from 'app/commons/service/breadcrumb.service'; import { LocalizationModule, diff --git a/src/app/pages/probe/download/download-page-routing.module.ts b/src/app/pages/probe/download/download-page-routing.module.ts new file mode 100644 index 0000000..4571de5 --- /dev/null +++ b/src/app/pages/probe/download/download-page-routing.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { ProbeDownloadPageComponent } from './download-page.component'; + +const routes: Routes = [ + { + path: '', + component: ProbeDownloadPageComponent, + }, + { + path: ':idx', + component: ProbeDownloadPageComponent, + }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class ProbeDownloadPageRoutingModule { } diff --git a/src/app/pages/probe/download/download-page.component.html b/src/app/pages/probe/download/download-page.component.html index 993740c..1947a35 100644 --- a/src/app/pages/probe/download/download-page.component.html +++ b/src/app/pages/probe/download/download-page.component.html @@ -1 +1 @@ -
    download
    \ No newline at end of file + \ No newline at end of file diff --git a/src/app/pages/probe/download/download-page.component.ts b/src/app/pages/probe/download/download-page.component.ts index d9a247b..8a3c71f 100644 --- a/src/app/pages/probe/download/download-page.component.ts +++ b/src/app/pages/probe/download/download-page.component.ts @@ -1,6 +1,5 @@ import { Component, OnInit } from '@angular/core'; - - +import { Router, ActivatedRoute } from '@angular/router'; @Component({ selector: 'of-pages-download', @@ -8,11 +7,20 @@ import { Component, OnInit } from '@angular/core'; }) export class ProbeDownloadPageComponent implements OnInit { - constructor() { } + private index; + + constructor( + private router: Router, + private route: ActivatedRoute + ) { } ngOnInit() { + this.route.params.subscribe((params: any) => { + this.index = params['idx']; + }); } - - + onSelect(index) { + this.router.navigate(['/probe/download', index]); + } } diff --git a/src/app/pages/probe/download/download-page.module.ts b/src/app/pages/probe/download/download-page.module.ts index 8ce3f7e..ddcf90f 100644 --- a/src/app/pages/probe/download/download-page.module.ts +++ b/src/app/pages/probe/download/download-page.module.ts @@ -3,11 +3,14 @@ import { CommonModule } from '@angular/common'; import { PrimeNGModules } from 'packages/commons/prime-ng/prime-ng.module'; import { ProbeDownloadPageComponent } from './download-page.component'; +import { ProbeDownloadPageRoutingModule } from './download-page-routing.module'; +import { ProbeModule } from 'packages/probe/probe.module'; @NgModule({ imports: [ CommonModule, - PrimeNGModules, + ProbeDownloadPageRoutingModule, + ProbeModule ], entryComponents: [ ], diff --git a/src/app/pages/probe/noauth-probe/noauth-probe-page.component.ts b/src/app/pages/probe/noauth-probe/noauth-probe-page.component.ts index d32f3ed..aa8cbd5 100644 --- a/src/app/pages/probe/noauth-probe/noauth-probe-page.component.ts +++ b/src/app/pages/probe/noauth-probe/noauth-probe-page.component.ts @@ -4,8 +4,10 @@ import { Component, OnInit } from '@angular/core'; selector: 'of-pages-noauth-probe', templateUrl: './noauth-probe-page.component.html', }) -export class NoAuthProbePageComponent { +export class NoAuthProbePageComponent { - constructor() { } + constructor( + ) { + } } diff --git a/src/app/pages/probe/noauth-probe/noauth-probe-page.module.ts b/src/app/pages/probe/noauth-probe/noauth-probe-page.module.ts index deacdfa..5023f44 100644 --- a/src/app/pages/probe/noauth-probe/noauth-probe-page.module.ts +++ b/src/app/pages/probe/noauth-probe/noauth-probe-page.module.ts @@ -1,6 +1,5 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; -import { ProbeModule } from 'packages/probe/probe.module'; import { NoauthModule } from 'packages/noauth/noauth.module'; import { NoAuthProbePageComponent } from './noauth-probe-page.component'; import { NoAuthProbePageRoutingModule } from './noauth-probe-page-routing.module'; @@ -11,7 +10,6 @@ import { TabbarModule } from 'app/commons/component/layout/tabbar/app.tabbar.mod CommonModule, NoAuthProbePageRoutingModule, TabbarModule, - ProbeModule, NoauthModule, ], declarations: [ diff --git a/src/app/pages/probe/probe-page-routing.module.ts b/src/app/pages/probe/probe-page-routing.module.ts index c1857df..646fcd9 100644 --- a/src/app/pages/probe/probe-page-routing.module.ts +++ b/src/app/pages/probe/probe-page-routing.module.ts @@ -13,8 +13,8 @@ const routes: Routes = [ component: ProbePageComponent, children: [ { path: 'list', component: ProbeListComponent }, - { path: 'noauth', loadChildren: 'app/pages/probe/noauth-probe/noauth-probe-page.module#NoAuthProbePageModule' }, - { path: 'download', component: DownloadComponent }, + { path: 'noauth', loadChildren: './noauth-probe/noauth-probe-page.module#NoAuthProbePageModule' }, + { path: 'download', loadChildren: './download/download-page.module#ProbeDownloadPageModule' }, { path: ':id/info', component: ProbeDetailComponent }, // { path: ':id/targets', loadChildren: 'app/pages/targets/targets-page.module#TargetsPageModule'}, { path: ':id/history', component: null }, diff --git a/src/app/pages/probe/probe-page.component.ts b/src/app/pages/probe/probe-page.component.ts index ff9a220..d6b031f 100644 --- a/src/app/pages/probe/probe-page.component.ts +++ b/src/app/pages/probe/probe-page.component.ts @@ -11,7 +11,9 @@ export class ProbePageComponent implements OnDestroy { private tabs = undefined; private routerSubscription$: Subscription; - constructor(private router: Router) { + constructor( + private router: Router + ) { this.routerSubscription$ = this.router.events.subscribe((event) => { if (event instanceof NavigationEnd) { this.generateTabMenu(event); diff --git a/src/app/pages/probe/probe-page.module.ts b/src/app/pages/probe/probe-page.module.ts index 6b6ad74..08326ff 100644 --- a/src/app/pages/probe/probe-page.module.ts +++ b/src/app/pages/probe/probe-page.module.ts @@ -7,7 +7,6 @@ import { ProbePageRoutingModule } from './probe-page-routing.module'; 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 './probe/list.component'; import { ProbeDetailComponent } from './probe/detail.component'; @@ -17,7 +16,6 @@ import { ProbeDetailComponent } from './probe/detail.component'; ProbePageRoutingModule, PrimeNGModules, ProbeModule, - NoauthModule, TabbarModule, ], declarations: [ diff --git a/src/packages/probe/component/download/download.component.html b/src/packages/probe/component/download/download.component.html index 1d4fa92..a880929 100644 --- a/src/packages/probe/component/download/download.component.html +++ b/src/packages/probe/component/download/download.component.html @@ -1,17 +1,23 @@

    Download

    - + - - Content 1 + + + Complex Content to Lazy Load1 + - - Content 2 + + + Complex Content to Lazy Load2 + - Content 3 + + Complex Content to Lazy Load3 + \ No newline at end of file diff --git a/src/packages/probe/component/download/download.component.ts b/src/packages/probe/component/download/download.component.ts index a5f3e90..3ac388e 100644 --- a/src/packages/probe/component/download/download.component.ts +++ b/src/packages/probe/component/download/download.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; @Component({ selector: 'of-download', @@ -6,8 +6,16 @@ import { Component, OnInit } from '@angular/core'; }) export class DownloadComponent implements OnInit { - constructor() { } + @Input() index; + @Output() select = new EventEmitter(); + + constructor( + ) { } ngOnInit() { } + + onChange(event) { + this.select.emit(event.index); + } }