From 0a897c4be2da22b82a9c99f3766a7315cc2e71bf Mon Sep 17 00:00:00 2001 From: insanity Date: Mon, 4 Jun 2018 15:14:00 +0900 Subject: [PATCH] probe routing --- .../probe/component/probe-list.component.ts | 10 +++--- .../probes/probe-tab-page-routing.module.ts | 6 ++-- src/app/pages/probes/probe-tab-page.module.ts | 4 +++ .../probe/probe-detail-page.component.html | 1 + ...nent.ts => probe-detail-page.component.ts} | 32 +++---------------- .../probe/probe-list-page.component.html | 1 + .../probes/probe/probe-list-page.component.ts | 27 ++++++++++++++++ .../probes/probe/probe-page-routing.module.ts | 16 ---------- .../probes/probe/probe-page.component.html | 7 ---- .../pages/probes/probe/probe-page.module.ts | 21 ------------ 10 files changed, 46 insertions(+), 79 deletions(-) create mode 100644 src/app/pages/probes/probe/probe-detail-page.component.html rename src/app/pages/probes/probe/{probe-page.component.ts => probe-detail-page.component.ts} (52%) create mode 100644 src/app/pages/probes/probe/probe-list-page.component.html create mode 100644 src/app/pages/probes/probe/probe-list-page.component.ts delete mode 100644 src/app/pages/probes/probe/probe-page-routing.module.ts delete mode 100644 src/app/pages/probes/probe/probe-page.component.html delete mode 100644 src/app/pages/probes/probe/probe-page.module.ts diff --git a/@overflow/probe/component/probe-list.component.ts b/@overflow/probe/component/probe-list.component.ts index 2cb4b26..fc65c99 100644 --- a/@overflow/probe/component/probe-list.component.ts +++ b/@overflow/probe/component/probe-list.component.ts @@ -53,11 +53,11 @@ export class ProbeListComponent implements OnInit { } getUptime(probe: Probe) { - if (!probe.connectDate) { - return 'Not Connected.'; - } - const hours = Math.abs(new Date().getTime() - probe.connectDate.getTime()); - return this.convertUptimeString(hours); + // if (!probe.connectDate) { + // return 'Not Connected.'; + // } + // const hours = Math.abs(new Date().getTime() - probe.connectDate.getTime()); + // return this.convertUptimeString(hours); } convertUptimeString(hours: number) { diff --git a/src/app/pages/probes/probe-tab-page-routing.module.ts b/src/app/pages/probes/probe-tab-page-routing.module.ts index 6a5a9b1..31b45b4 100644 --- a/src/app/pages/probes/probe-tab-page-routing.module.ts +++ b/src/app/pages/probes/probe-tab-page-routing.module.ts @@ -1,16 +1,18 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { ProbeTabPageComponent } from './probe-tab-page.component'; +import { ProbeListPageComponent } from '@app/pages/probes/probe/probe-list-page.component'; +import { ProbeDetailPageComponent } from '@app/pages/probes/probe/probe-detail-page.component'; const routes: Routes = [ { path: '', component: ProbeTabPageComponent, children: [ - { path: 'list', loadChildren: './probe/probe-page.module#ProbePageModule' }, + { path: 'list', component: ProbeListPageComponent }, { path: 'noauth', loadChildren: './noauth-probe/noauth-probe-page.module#NoAuthProbePageModule' }, { path: 'download', loadChildren: './download/download-page.module#ProbeDownloadPageModule' }, - { path: ':id/info', loadChildren: './probe/probe-page.module#ProbePageModule' }, + { path: ':id/info', component: ProbeDetailPageComponent }, // { path: ':id/targets', loadChildren: 'app/pages/targets/targets-page.module#TargetsPageModule'}, { path: ':id/history', component: null }, ] diff --git a/src/app/pages/probes/probe-tab-page.module.ts b/src/app/pages/probes/probe-tab-page.module.ts index 6aae54f..8e1f886 100644 --- a/src/app/pages/probes/probe-tab-page.module.ts +++ b/src/app/pages/probes/probe-tab-page.module.ts @@ -7,6 +7,8 @@ import { ProbeModule } from '@overflow/probe/probe.module'; import { ProbeTabPageComponent } from './probe-tab-page.component'; import { ProbeTabPageRoutingModule } from './probe-tab-page-routing.module'; import { TabbarModule } from '../../commons/component/layout/tabbar/app.tabbar.module'; +import { ProbeListPageComponent } from '@app/pages/probes/probe/probe-list-page.component'; +import { ProbeDetailPageComponent } from '@app/pages/probes/probe/probe-detail-page.component'; @NgModule({ imports: [ @@ -18,6 +20,8 @@ import { TabbarModule } from '../../commons/component/layout/tabbar/app.tabbar.m ], declarations: [ ProbeTabPageComponent, + ProbeListPageComponent, + ProbeDetailPageComponent ] }) export class ProbeTabPageModule { } diff --git a/src/app/pages/probes/probe/probe-detail-page.component.html b/src/app/pages/probes/probe/probe-detail-page.component.html new file mode 100644 index 0000000..1f8cb9b --- /dev/null +++ b/src/app/pages/probes/probe/probe-detail-page.component.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/app/pages/probes/probe/probe-page.component.ts b/src/app/pages/probes/probe/probe-detail-page.component.ts similarity index 52% rename from src/app/pages/probes/probe/probe-page.component.ts rename to src/app/pages/probes/probe/probe-detail-page.component.ts index 7b37e8b..3d4cce9 100644 --- a/src/app/pages/probes/probe/probe-page.component.ts +++ b/src/app/pages/probes/probe/probe-detail-page.component.ts @@ -6,10 +6,10 @@ import { Target } from '@overflow/commons-typescript/model/target'; import { BreadcrumbService } from '@app/commons/service/breadcrumb.service'; @Component({ - selector: 'of-pages-probe', - templateUrl: './probe-page.component.html', + selector: 'of-pages-probe-detail', + templateUrl: './probe-detail-page.component.html', }) -export class ProbePageComponent { +export class ProbeDetailPageComponent { isDetail: boolean; probeHostID: string; @@ -20,34 +20,10 @@ export class ProbePageComponent { private breadcrumbService: BreadcrumbService ) { this.route.params.subscribe(params => { - if (params['id']) { - this.onDetailContainer(params['id']); - } else { - this.onListContainer(); - } + this.probeHostID = params['id']; }); } - onListContainer() { - this.breadcrumbService.setItems([ - { label: 'Probe', routerLink: ['/probe/list'], } - ]); - this.isDetail = false; - } - - onDetailContainer(probeHostID: string) { - this.probeHostID = probeHostID; - this.breadcrumbService.setItems([ - { label: 'Probe', routerLink: ['/probe/list'] }, - { label: this.probeHostID } - ]); - this.isDetail = true; - } - - onProbeSelect(probeHost: ProbeHost) { - this.router.navigate(['probe', probeHost.id, 'info']); - } - onTargetSelect(target: Target) { console.log(target); } diff --git a/src/app/pages/probes/probe/probe-list-page.component.html b/src/app/pages/probes/probe/probe-list-page.component.html new file mode 100644 index 0000000..7f99cad --- /dev/null +++ b/src/app/pages/probes/probe/probe-list-page.component.html @@ -0,0 +1 @@ + diff --git a/src/app/pages/probes/probe/probe-list-page.component.ts b/src/app/pages/probes/probe/probe-list-page.component.ts new file mode 100644 index 0000000..ab05898 --- /dev/null +++ b/src/app/pages/probes/probe/probe-list-page.component.ts @@ -0,0 +1,27 @@ +import { Component, OnDestroy } from '@angular/core'; +import { Router, ActivatedRoute, NavigationEnd } from '@angular/router'; +import { Subscription } from 'rxjs/Subscription'; +import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe'; +import { Target } from '@overflow/commons-typescript/model/target'; +import { BreadcrumbService } from '@app/commons/service/breadcrumb.service'; + +@Component({ + selector: 'of-pages-probe-list', + templateUrl: './probe-list-page.component.html', +}) +export class ProbeListPageComponent { + + constructor( + private router: Router, + private route: ActivatedRoute, + private breadcrumbService: BreadcrumbService + ) { + this.breadcrumbService.setItems([ + { label: 'Probe', routerLink: ['/probe/list'], } + ]); + } + + onProbeSelect(probeHost: ProbeHost) { + this.router.navigate(['probe', probeHost.id, 'info']); + } +} diff --git a/src/app/pages/probes/probe/probe-page-routing.module.ts b/src/app/pages/probes/probe/probe-page-routing.module.ts deleted file mode 100644 index df19980..0000000 --- a/src/app/pages/probes/probe/probe-page-routing.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; -import { ProbePageComponent } from './probe-page.component'; - -const routes: Routes = [ - { - path: '', - component: ProbePageComponent, - }, -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule] -}) -export class ProbePageRoutingModule { } diff --git a/src/app/pages/probes/probe/probe-page.component.html b/src/app/pages/probes/probe/probe-page.component.html deleted file mode 100644 index 9e08bd8..0000000 --- a/src/app/pages/probes/probe/probe-page.component.html +++ /dev/null @@ -1,7 +0,0 @@ -
- -
- - - - \ No newline at end of file diff --git a/src/app/pages/probes/probe/probe-page.module.ts b/src/app/pages/probes/probe/probe-page.module.ts deleted file mode 100644 index 1e731c1..0000000 --- a/src/app/pages/probes/probe/probe-page.module.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; - -import { UIModule } from '@overflow/shared/ui/ui.module'; -import { ProbeModule } from '@overflow/probe/probe.module'; - -import { ProbePageComponent } from './probe-page.component'; -import { ProbePageRoutingModule } from './probe-page-routing.module'; - -@NgModule({ - imports: [ - CommonModule, - UIModule, - ProbePageRoutingModule, - ProbeModule, - ], - entryComponents: [ - ], - declarations: [ProbePageComponent] -}) -export class ProbePageModule { }