diff --git a/src/app/commons/component/layout/menu/app.menu.component.ts b/src/app/commons/component/layout/menu/app.menu.component.ts index e196998..dc76cd0 100644 --- a/src/app/commons/component/layout/menu/app.menu.component.ts +++ b/src/app/commons/component/layout/menu/app.menu.component.ts @@ -24,7 +24,7 @@ export class AppMenuComponent implements OnInit { label: 'Infra', icon: 'all_inclusive', items: [ { label: 'Map', icon: 'map', routerLink: ['/map'] }, { label: 'Sensors', icon: 'compare_arrows', routerLink: ['/sensors'] }, - { label: 'Probes', icon: 'dock', routerLink: ['/probe'] }, + { label: 'Probes', icon: 'dock', routerLink: ['/probe/list'] }, ] }, { diff --git a/src/app/pages/pages-routing.module.ts b/src/app/pages/pages-routing.module.ts index ecf72d9..3c9ca5e 100644 --- a/src/app/pages/pages-routing.module.ts +++ b/src/app/pages/pages-routing.module.ts @@ -9,7 +9,7 @@ const routes: Routes = [ children: [ { path: '', redirectTo: 'home' }, { path: 'home', loadChildren: './home/home-page.module#HomePageModule' }, - { path: 'probe', loadChildren: './probes/probes-page.module#ProbesPageModule' }, + { path: 'probe', loadChildren: './probes/probe-tab-page.module#ProbeTabPageModule' }, // { path: 'sensors', loadChildren: './sensors/sensors-page.module#SensorsPageModule' }, // { path: 'sensor', loadChildren: './sensor/sensor-page.module#SensorPageModule' }, // { path: 'map', loadChildren: './infra/infra-page.module#InfraPageModule' }, diff --git a/src/app/pages/probes/probe-tab-page-routing.module.ts b/src/app/pages/probes/probe-tab-page-routing.module.ts new file mode 100644 index 0000000..336a727 --- /dev/null +++ b/src/app/pages/probes/probe-tab-page-routing.module.ts @@ -0,0 +1,26 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { ProbeTabPageComponent } from './probe-tab-page.component'; + +import { DownloadComponent } from 'packages/probe/component/download/download.component'; + +const routes: Routes = [ + { + path: '', + component: ProbeTabPageComponent, + children: [ + { path: 'list', loadChildren: './probe/probe-page.module#ProbePageModule' }, + { 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/targets', loadChildren: 'app/pages/targets/targets-page.module#TargetsPageModule'}, + { path: ':id/history', component: null }, + ] + }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class ProbeTabPageRoutingModule { } diff --git a/src/app/pages/probes/probes-page.component.html b/src/app/pages/probes/probe-tab-page.component.html similarity index 97% rename from src/app/pages/probes/probes-page.component.html rename to src/app/pages/probes/probe-tab-page.component.html index 0328d41..9e8130b 100644 --- a/src/app/pages/probes/probes-page.component.html +++ b/src/app/pages/probes/probe-tab-page.component.html @@ -9,4 +9,4 @@ - \ No newline at end of file + diff --git a/src/app/pages/probes/probes-page.component.spec.ts b/src/app/pages/probes/probe-tab-page.component.spec.ts similarity index 53% rename from src/app/pages/probes/probes-page.component.spec.ts rename to src/app/pages/probes/probe-tab-page.component.spec.ts index 34d3d1c..cd8a544 100644 --- a/src/app/pages/probes/probes-page.component.spec.ts +++ b/src/app/pages/probes/probe-tab-page.component.spec.ts @@ -1,20 +1,20 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { ProbesPageComponent } from './probes-page.component'; +import { ProbeTabPageComponent } from './probe-tab-page.component'; -describe('ProbeComponent', () => { - let component: ProbesPageComponent; - let fixture: ComponentFixture; +describe('ProbeTabPageComponent', () => { + let component: ProbeTabPageComponent; + let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ ProbesPageComponent ] + declarations: [ ProbeTabPageComponent ] }) .compileComponents(); })); beforeEach(() => { - fixture = TestBed.createComponent(ProbesPageComponent); + fixture = TestBed.createComponent(ProbeTabPageComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/pages/probes/probes-page.component.ts b/src/app/pages/probes/probe-tab-page.component.ts similarity index 80% rename from src/app/pages/probes/probes-page.component.ts rename to src/app/pages/probes/probe-tab-page.component.ts index a9fe632..dcb761d 100644 --- a/src/app/pages/probes/probes-page.component.ts +++ b/src/app/pages/probes/probe-tab-page.component.ts @@ -3,10 +3,10 @@ import { Router, NavigationEnd } from '@angular/router'; import { Subscription } from 'rxjs/Subscription'; @Component({ - selector: 'of-pages-probes', - templateUrl: './probes-page.component.html', + selector: 'of-pages-probe-tab', + templateUrl: './probe-tab-page.component.html', }) -export class ProbesPageComponent implements OnDestroy { +export class ProbeTabPageComponent implements OnDestroy { private tabs = undefined; private routerSubscription$: Subscription; @@ -27,7 +27,7 @@ export class ProbesPageComponent implements OnDestroy { generateTabMenu(event: NavigationEnd) { try { - const parsedUrl = event.url.split('probes/')[1].split('/')[0]; + const parsedUrl = event.url.split('probe/')[1].split('/')[0]; switch (parsedUrl) { case 'list': case 'noauth': @@ -41,7 +41,7 @@ export class ProbesPageComponent implements OnDestroy { default: this.tabs = [ { label: 'INFO', routerLink: ['/probe/', parsedUrl, 'info'] }, - { label: 'TARGETS', routerLink: ['/probe/', parsedUrl, 'targets'], disabled: true }, + { label: 'TARGETS', path: ['/probe/', parsedUrl, 'targets'], disabled: true }, { label: 'HISTORY', path: ['/probe/', parsedUrl, 'history'], disabled: true }, ]; break; diff --git a/src/app/pages/probes/probes-page.module.ts b/src/app/pages/probes/probe-tab-page.module.ts similarity index 64% rename from src/app/pages/probes/probes-page.module.ts rename to src/app/pages/probes/probe-tab-page.module.ts index ecadf19..d530c3a 100644 --- a/src/app/pages/probes/probes-page.module.ts +++ b/src/app/pages/probes/probe-tab-page.module.ts @@ -1,8 +1,8 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; -import { ProbesPageComponent } from './probes-page.component'; -import { ProbesPageRoutingModule } from './probes-page-routing.module'; +import { ProbeTabPageComponent } from './probe-tab-page.component'; +import { ProbeTabPageRoutingModule } from './probe-tab-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'; @@ -10,13 +10,13 @@ import { TabbarModule } from 'app/commons/component/layout/tabbar/app.tabbar.mod @NgModule({ imports: [ CommonModule, - ProbesPageRoutingModule, + ProbeTabPageRoutingModule, PrimeNGModules, ProbeModule, TabbarModule, ], declarations: [ - ProbesPageComponent, + ProbeTabPageComponent, ] }) -export class ProbesPageModule { } +export class ProbeTabPageModule { } diff --git a/src/app/pages/probes/probe/probe-page-routing.module.ts b/src/app/pages/probes/probe/probe-page-routing.module.ts index dba82e0..df19980 100644 --- a/src/app/pages/probes/probe/probe-page-routing.module.ts +++ b/src/app/pages/probes/probe/probe-page-routing.module.ts @@ -5,7 +5,7 @@ import { ProbePageComponent } from './probe-page.component'; const routes: Routes = [ { path: '', - component: null, + component: ProbePageComponent, }, ]; diff --git a/src/app/pages/probes/probe/probe-page.component.html b/src/app/pages/probes/probe/probe-page.component.html index 8c83707..2e426c2 100644 --- a/src/app/pages/probes/probe/probe-page.component.html +++ b/src/app/pages/probes/probe/probe-page.component.html @@ -1 +1,7 @@ -probe page module \ No newline at end of file +
+ +
+ + + + \ 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-page.component.ts index d34db4c..01110c3 100644 --- a/src/app/pages/probes/probe/probe-page.component.ts +++ b/src/app/pages/probes/probe/probe-page.component.ts @@ -1,5 +1,8 @@ -import { Component } from '@angular/core'; -import { Router, ActivatedRoute } from '@angular/router'; +import { Component, OnDestroy } from '@angular/core'; +import { Router, ActivatedRoute, NavigationEnd } from '@angular/router'; +import { Subscription } from 'rxjs/Subscription'; +import { Probe } from '@overflow/commons-typescript/model/probe'; +import { Target } from '@overflow/commons-typescript/model/target'; @Component({ selector: 'of-pages-probe', @@ -7,11 +10,22 @@ import { Router, ActivatedRoute } from '@angular/router'; }) export class ProbePageComponent { - private index; + private isDetail: boolean; constructor( private router: Router, private route: ActivatedRoute - ) { } + ) { + this.route.params.subscribe(params => { + this.isDetail = params['id'] ? true : false; + }); + } + onProbeSelect(probe: Probe) { + this.router.navigate(['probe', probe.id, 'info']); + } + + onTargetSelect(target: Target) { + console.log(target); + } } diff --git a/src/app/pages/probes/probes-page-routing.module.ts b/src/app/pages/probes/probes-page-routing.module.ts deleted file mode 100644 index e1dc101..0000000 --- a/src/app/pages/probes/probes-page-routing.module.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; -import { ProbesPageComponent } from './probes-page.component'; - -import { DownloadComponent } from 'packages/probe/component/download/download.component'; - -const routes: Routes = [ - { - path: '', - component: ProbesPageComponent, - // children: [ - // { path: 'list', loadChildren: './probe/probe-page.module#ProbePageModule' }, - // { 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/targets', loadChildren: 'app/pages/targets/targets-page.module#TargetsPageModule'}, - // { path: ':id/history', component: null }, - // ] - }, -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule] -}) -export class ProbesPageRoutingModule { } diff --git a/src/packages/probe/component/list/list.component.ts b/src/packages/probe/component/list/list.component.ts index 6dbc58a..5a2994f 100644 --- a/src/packages/probe/component/list/list.component.ts +++ b/src/packages/probe/component/list/list.component.ts @@ -29,7 +29,6 @@ export class ListComponent implements OnInit, AfterContentInit, OnDestroy { ngOnInit() { this.probeHostsSubscription$ = this.probeHosts$.subscribe( (probeHosts: ProbeHost[]) => { - console.log(probeHosts); this.probeHosts = probeHosts; }, (error: RPCClientError) => { diff --git a/src/packages/probe/container/probe-detail-container.html b/src/packages/probe/container/probe-detail-container.html index 26e6c93..1782169 100644 --- a/src/packages/probe/container/probe-detail-container.html +++ b/src/packages/probe/container/probe-detail-container.html @@ -1 +1 @@ -Probe Detail Container \ No newline at end of file + \ No newline at end of file