diff --git a/src/app/commons/layouts/sub-menubar/sub-menubar.module.ts b/src/app/commons/layouts/sub-menubar/sub-menubar.module.ts new file mode 100644 index 0000000..53ebecb --- /dev/null +++ b/src/app/commons/layouts/sub-menubar/sub-menubar.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { SubMenubarComponent } from 'app/commons/layouts/sub-menubar/sub-menubar.component'; +import { MaterialModule } from 'app/commons/ui/material/material.module'; +import { RouterModule } from '@angular/router'; + +@NgModule({ + imports: [ + CommonModule, + MaterialModule, + RouterModule, + ], + declarations: [ + SubMenubarComponent, + ], + exports: [ + SubMenubarComponent, + ] +}) +export class SubMenubarModule { } diff --git a/src/app/packages/probe/component/detail/detail.component.html b/src/app/packages/probe/component/detail/detail.component.html index 6f936ed..9a92530 100644 --- a/src/app/packages/probe/component/detail/detail.component.html +++ b/src/app/packages/probe/component/detail/detail.component.html @@ -1,3 +1,3 @@

- detail works! + {{probeId}} detail

diff --git a/src/app/packages/probe/component/detail/detail.component.ts b/src/app/packages/probe/component/detail/detail.component.ts index c7b90c6..3878294 100644 --- a/src/app/packages/probe/component/detail/detail.component.ts +++ b/src/app/packages/probe/component/detail/detail.component.ts @@ -1,4 +1,5 @@ import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; @Component({ selector: 'of-detail', @@ -7,9 +8,12 @@ import { Component, OnInit } from '@angular/core'; }) export class DetailComponent implements OnInit { - constructor() { } + probeId = undefined; + + constructor(private route: ActivatedRoute, private router: Router) { } ngOnInit() { + this.probeId = this.route.snapshot.paramMap.get('id'); } } diff --git a/src/app/packages/probe/component/list/list.component.ts b/src/app/packages/probe/component/list/list.component.ts index b455f4d..913d43f 100644 --- a/src/app/packages/probe/component/list/list.component.ts +++ b/src/app/packages/probe/component/list/list.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core'; import { MatTableDataSource, MatSort } from '@angular/material'; import { AfterContentInit } from '@angular/core/src/metadata/lifecycle_hooks'; +import { Router } from '@angular/router'; export interface Probe { id: string; @@ -19,7 +20,7 @@ export interface Probe { templateUrl: './list.component.html', styleUrls: ['./list.component.scss'] }) -export class ListComponent implements OnInit, AfterContentInit { +export class ListComponent implements OnInit, AfterContentInit { displayedColumns = ['name', 'ip', 'os', 'cidr', 'targetCnt', 'date', 'authBy']; dataSource: MatTableDataSource; @@ -39,7 +40,7 @@ export class ListComponent implements OnInit, AfterContentInit { ip: String('ip' + i), os: String('os' + i), cidr: String('cidr' + i), - targetCnt : i, + targetCnt: i, date: String('date' + i), authBy: String('insanity') }; @@ -50,12 +51,12 @@ export class ListComponent implements OnInit, AfterContentInit { this.dataSource.sort = this.sort; } - constructor() { } + constructor(private router: Router) { } ngOnInit() { } handleRowClick(obj: Probe) { - alert(obj.id); + this.router.navigate(['probe', obj.id]); } } diff --git a/src/app/pages/pages-routing.module.ts b/src/app/pages/pages-routing.module.ts index 8d98aa4..b54031a 100644 --- a/src/app/pages/pages-routing.module.ts +++ b/src/app/pages/pages-routing.module.ts @@ -9,8 +9,8 @@ const routes: Routes = [ children: [ { path: '', redirectTo: 'home' }, { path: 'home', loadChildren: './home/home-page.module#HomePageModule' }, - { path: 'probe', loadChildren: './probes/probes-page.module#ProbesPageModule' }, - + { path: 'probes', loadChildren: './probes/probes-page.module#ProbesPageModule' }, + { path: 'probe', loadChildren: './probe/probe-page.module#ProbePageModule' }, { path: 'discovery', loadChildren: './discovery/discovery-page.module#DiscoveryPageModule' }, { path: 'map', loadChildren: './infra/infra-page.module#InfraPageModule' }, ] diff --git a/src/app/pages/pages.component.html b/src/app/pages/pages.component.html index 05b90c1..783ac93 100644 --- a/src/app/pages/pages.component.html +++ b/src/app/pages/pages.component.html @@ -26,7 +26,7 @@ -
+
diff --git a/src/app/pages/pages.module.ts b/src/app/pages/pages.module.ts index 158b0ef..5d49bc1 100644 --- a/src/app/pages/pages.module.ts +++ b/src/app/pages/pages.module.ts @@ -28,7 +28,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = { CovalentModule, MaterialModule, PerfectScrollbarModule, - FlexLayoutModule + FlexLayoutModule, ], declarations: [ PagesComponent, diff --git a/src/app/pages/probe/probe-page-routing.module.ts b/src/app/pages/probe/probe-page-routing.module.ts new file mode 100644 index 0000000..872216e --- /dev/null +++ b/src/app/pages/probe/probe-page-routing.module.ts @@ -0,0 +1,22 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { ProbePageComponent } from './probe-page.component'; +import { DetailComponent as ProbeDetailComponent } from 'app/packages/probe/component/detail/detail.component'; + +const routes: Routes = [ + { + path: '', + component: ProbePageComponent, + children: [ + { path: ':id', component: ProbeDetailComponent }, + { path: ':id/target', component: ProbeDetailComponent }, + { path: ':id/history', component: ProbeDetailComponent }, + ] + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class ProbesPageRoutingModule { } diff --git a/src/app/pages/probe/probe-page.component.html b/src/app/pages/probe/probe-page.component.html new file mode 100644 index 0000000..975a544 --- /dev/null +++ b/src/app/pages/probe/probe-page.component.html @@ -0,0 +1,6 @@ +
+ +
+ +
+
\ No newline at end of file diff --git a/src/app/pages/probe/probe-page.component.scss b/src/app/pages/probe/probe-page.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/probe/probe-page.component.spec.ts b/src/app/pages/probe/probe-page.component.spec.ts new file mode 100644 index 0000000..7e72ea9 --- /dev/null +++ b/src/app/pages/probe/probe-page.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ProbePageComponent } from './probe-page.component'; + +describe('ProbeComponent', () => { + let component: ProbePageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ProbePageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ProbePageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/probe/probe-page.component.ts b/src/app/pages/probe/probe-page.component.ts new file mode 100644 index 0000000..131a15a --- /dev/null +++ b/src/app/pages/probe/probe-page.component.ts @@ -0,0 +1,24 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; + +@Component({ + selector: 'of-pages-probe', + templateUrl: './probe-page.component.html', + styleUrls: ['./probe-page.component.scss'] +}) +export class ProbePageComponent implements OnInit { + + tabs = undefined; + + constructor(private router: Router) { + } + + ngOnInit() { + this.tabs = [ + { label: 'Info', path: this.router.url }, + { label: 'Targets', path: '/target' }, + { label: 'History', path: '/probe/history' }, + ]; + } + +} diff --git a/src/app/pages/probe/probe-page.module.ts b/src/app/pages/probe/probe-page.module.ts new file mode 100644 index 0000000..090453f --- /dev/null +++ b/src/app/pages/probe/probe-page.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { ProbePageComponent } from './probe-page.component'; +import { ProbesPageRoutingModule } from './probe-page-routing.module'; +import { MaterialModule } from 'app/commons/ui/material/material.module'; +import { ProbeModule } from 'app/packages/probe/probe.module'; +import { SubMenubarModule } from 'app/commons/layouts/sub-menubar/sub-menubar.module'; + +@NgModule({ + imports: [ + CommonModule, + ProbesPageRoutingModule, + MaterialModule, + ProbeModule, + SubMenubarModule + ], + declarations: [ + ProbePageComponent, + ] +}) +export class ProbePageModule { } diff --git a/src/app/pages/probes/probes-page-routing.module.ts b/src/app/pages/probes/probes-page-routing.module.ts index f2583f7..3205cba 100644 --- a/src/app/pages/probes/probes-page-routing.module.ts +++ b/src/app/pages/probes/probes-page-routing.module.ts @@ -12,7 +12,6 @@ const routes: Routes = [ component: ProbesPageComponent, children: [ { path: '', component: ProbeListComponent }, - { path: 'detail/:id', component: ProbeDetailComponent }, { path: 'noauth', component: NoauthListComponent }, { path: 'download', component: DownloadComponent }, ] diff --git a/src/app/pages/probes/probes-page.component.ts b/src/app/pages/probes/probes-page.component.ts index ce5c45c..12ea362 100644 --- a/src/app/pages/probes/probes-page.component.ts +++ b/src/app/pages/probes/probes-page.component.ts @@ -13,12 +13,6 @@ export class ProbesPageComponent { { label: 'Download', path: '/probes/download' }, ]; - // tabs2 = [ - // { label: 'Info', path: '/probe/' }, - // { label: 'Targets', path: '/target' }, - // { label: 'History', path: '/probe/history' }, - // ]; - constructor() { } } diff --git a/src/app/pages/probes/probes-page.module.ts b/src/app/pages/probes/probes-page.module.ts index bf0f845..db7879b 100644 --- a/src/app/pages/probes/probes-page.module.ts +++ b/src/app/pages/probes/probes-page.module.ts @@ -2,10 +2,10 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { ProbesPageComponent } from './probes-page.component'; import { ProbesPageRoutingModule } from './probes-page-routing.module'; -import { SubMenubarComponent } from 'app/commons/layouts/sub-menubar/sub-menubar.component'; import { MaterialModule } from 'app/commons/ui/material/material.module'; import { ProbeModule } from 'app/packages/probe/probe.module'; import { NoauthModule } from 'app/packages/noauth/noauth.module'; +import { SubMenubarModule } from 'app/commons/layouts/sub-menubar/sub-menubar.module'; @NgModule({ imports: [ @@ -14,10 +14,10 @@ import { NoauthModule } from 'app/packages/noauth/noauth.module'; MaterialModule, ProbeModule, NoauthModule, + SubMenubarModule ], declarations: [ ProbesPageComponent, - SubMenubarComponent ] }) export class ProbesPageModule { }