From 7237decc092cae1dc61de92498711070614ed859 Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 31 Jan 2018 16:03:21 +0900 Subject: [PATCH 1/3] T_____________T --- .../layouts/sub-menubar/sub-menubar.module.ts | 15 +++++++++++ src/app/pages/pages-routing.module.ts | 4 +-- src/app/pages/pages.component.html | 2 +- src/app/pages/pages.module.ts | 4 ++- .../pages/probe/probe-page-routing.module.ts | 23 +++++++++++++++++ src/app/pages/probe/probe-page.component.html | 6 +++++ src/app/pages/probe/probe-page.component.scss | 0 .../pages/probe/probe-page.component.spec.ts | 25 +++++++++++++++++++ src/app/pages/probe/probe-page.component.ts | 18 +++++++++++++ src/app/pages/probe/probe-page.module.ts | 19 ++++++++++++++ .../probes/probes-page-routing.module.ts | 1 - src/app/pages/probes/probes-page.component.ts | 6 ----- src/app/pages/probes/probes-page.module.ts | 2 -- 13 files changed, 112 insertions(+), 13 deletions(-) create mode 100644 src/app/commons/layouts/sub-menubar/sub-menubar.module.ts create mode 100644 src/app/pages/probe/probe-page-routing.module.ts create mode 100644 src/app/pages/probe/probe-page.component.html create mode 100644 src/app/pages/probe/probe-page.component.scss create mode 100644 src/app/pages/probe/probe-page.component.spec.ts create mode 100644 src/app/pages/probe/probe-page.component.ts create mode 100644 src/app/pages/probe/probe-page.module.ts 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..5ba1c7d --- /dev/null +++ b/src/app/commons/layouts/sub-menubar/sub-menubar.module.ts @@ -0,0 +1,15 @@ +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'; + +@NgModule({ + imports: [ + CommonModule, + MaterialModule + ], + declarations: [ + SubMenubarComponent + ] +}) +export class SubMenubarModule { } 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..34f58f2 100644 --- a/src/app/pages/pages.module.ts +++ b/src/app/pages/pages.module.ts @@ -15,6 +15,7 @@ import { PerfectScrollbarConfigInterface } from 'ngx-perfect-scrollbar'; import { NotificationComponent } from 'app/packages/notification/notification.component'; +import { SubMenubarModule } from 'app/commons/layouts/sub-menubar/sub-menubar.module'; const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = { suppressScrollX: true @@ -28,7 +29,8 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = { CovalentModule, MaterialModule, PerfectScrollbarModule, - FlexLayoutModule + FlexLayoutModule, + SubMenubarModule ], 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..445e794 --- /dev/null +++ b/src/app/pages/probe/probe-page-routing.module.ts @@ -0,0 +1,23 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { ProbePageComponent } from './probe-page.component'; +import { ListComponent as ProbeListComponent } from 'app/packages/probe/component/list/list.component'; +import { ListComponent as NoauthListComponent } from 'app/packages/noauth/component/list/list.component'; +import { DownloadComponent } from 'app/packages/probe/component/download/download.component'; +import { DetailComponent as ProbeDetailComponent } from 'app/packages/probe/component/detail/detail.component'; + +const routes: Routes = [ + { + path: '', + component: ProbePageComponent, + children: [ + { path: '', component: ProbeListComponent }, + ] + } +]; + +@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..190e412 --- /dev/null +++ b/src/app/pages/probe/probe-page.component.html @@ -0,0 +1,6 @@ +
+ +
+ 이거슨 detail +
+
\ 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..f94d610 --- /dev/null +++ b/src/app/pages/probe/probe-page.component.ts @@ -0,0 +1,18 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'of-pages-probe', + templateUrl: './probe-page.component.html', + styleUrls: ['./probe-page.component.scss'] +}) +export class ProbePageComponent { + + tabs2 = [ + { label: 'Info', path: '/probe/' }, + { label: 'Targets', path: '/target' }, + { label: 'History', path: '/probe/history' }, + ]; + + constructor() { } + +} 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..d6f6431 --- /dev/null +++ b/src/app/pages/probe/probe-page.module.ts @@ -0,0 +1,19 @@ +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'; + +@NgModule({ + imports: [ + CommonModule, + ProbesPageRoutingModule, + MaterialModule, + ProbeModule, + ], + 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..67fd10e 100644 --- a/src/app/pages/probes/probes-page.module.ts +++ b/src/app/pages/probes/probes-page.module.ts @@ -2,7 +2,6 @@ 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'; @@ -17,7 +16,6 @@ import { NoauthModule } from 'app/packages/noauth/noauth.module'; ], declarations: [ ProbesPageComponent, - SubMenubarComponent ] }) export class ProbesPageModule { } From 516a0bffa613613da277a5650d0916e4ce6ac468 Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 31 Jan 2018 17:19:00 +0900 Subject: [PATCH 2/3] probe detail layout --- .../commons/layouts/sub-menubar/sub-menubar.module.ts | 9 +++++++-- src/app/pages/pages.module.ts | 2 -- src/app/pages/probe/probe-page-routing.module.ts | 7 +++---- src/app/pages/probe/probe-page.component.html | 2 +- src/app/pages/probe/probe-page.component.ts | 4 ++-- src/app/pages/probe/probe-page.module.ts | 2 ++ src/app/pages/probes/probes-page.module.ts | 2 ++ 7 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/app/commons/layouts/sub-menubar/sub-menubar.module.ts b/src/app/commons/layouts/sub-menubar/sub-menubar.module.ts index 5ba1c7d..53ebecb 100644 --- a/src/app/commons/layouts/sub-menubar/sub-menubar.module.ts +++ b/src/app/commons/layouts/sub-menubar/sub-menubar.module.ts @@ -2,14 +2,19 @@ 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 + MaterialModule, + RouterModule, ], declarations: [ - SubMenubarComponent + SubMenubarComponent, + ], + exports: [ + SubMenubarComponent, ] }) export class SubMenubarModule { } diff --git a/src/app/pages/pages.module.ts b/src/app/pages/pages.module.ts index 34f58f2..5d49bc1 100644 --- a/src/app/pages/pages.module.ts +++ b/src/app/pages/pages.module.ts @@ -15,7 +15,6 @@ import { PerfectScrollbarConfigInterface } from 'ngx-perfect-scrollbar'; import { NotificationComponent } from 'app/packages/notification/notification.component'; -import { SubMenubarModule } from 'app/commons/layouts/sub-menubar/sub-menubar.module'; const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = { suppressScrollX: true @@ -30,7 +29,6 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = { MaterialModule, PerfectScrollbarModule, FlexLayoutModule, - SubMenubarModule ], declarations: [ PagesComponent, diff --git a/src/app/pages/probe/probe-page-routing.module.ts b/src/app/pages/probe/probe-page-routing.module.ts index 445e794..872216e 100644 --- a/src/app/pages/probe/probe-page-routing.module.ts +++ b/src/app/pages/probe/probe-page-routing.module.ts @@ -1,9 +1,6 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { ProbePageComponent } from './probe-page.component'; -import { ListComponent as ProbeListComponent } from 'app/packages/probe/component/list/list.component'; -import { ListComponent as NoauthListComponent } from 'app/packages/noauth/component/list/list.component'; -import { DownloadComponent } from 'app/packages/probe/component/download/download.component'; import { DetailComponent as ProbeDetailComponent } from 'app/packages/probe/component/detail/detail.component'; const routes: Routes = [ @@ -11,7 +8,9 @@ const routes: Routes = [ path: '', component: ProbePageComponent, children: [ - { path: '', component: ProbeListComponent }, + { path: ':id', component: ProbeDetailComponent }, + { path: ':id/target', component: ProbeDetailComponent }, + { path: ':id/history', component: ProbeDetailComponent }, ] } ]; diff --git a/src/app/pages/probe/probe-page.component.html b/src/app/pages/probe/probe-page.component.html index 190e412..975a544 100644 --- a/src/app/pages/probe/probe-page.component.html +++ b/src/app/pages/probe/probe-page.component.html @@ -1,6 +1,6 @@
- 이거슨 detail +
\ No newline at end of file diff --git a/src/app/pages/probe/probe-page.component.ts b/src/app/pages/probe/probe-page.component.ts index f94d610..9309cba 100644 --- a/src/app/pages/probe/probe-page.component.ts +++ b/src/app/pages/probe/probe-page.component.ts @@ -7,8 +7,8 @@ import { Component, OnInit } from '@angular/core'; }) export class ProbePageComponent { - tabs2 = [ - { label: 'Info', path: '/probe/' }, + tabs = [ + { label: 'Info', path: '/probe' }, { 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 index d6f6431..090453f 100644 --- a/src/app/pages/probe/probe-page.module.ts +++ b/src/app/pages/probe/probe-page.module.ts @@ -4,6 +4,7 @@ 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: [ @@ -11,6 +12,7 @@ import { ProbeModule } from 'app/packages/probe/probe.module'; ProbesPageRoutingModule, MaterialModule, ProbeModule, + SubMenubarModule ], declarations: [ ProbePageComponent, diff --git a/src/app/pages/probes/probes-page.module.ts b/src/app/pages/probes/probes-page.module.ts index 67fd10e..db7879b 100644 --- a/src/app/pages/probes/probes-page.module.ts +++ b/src/app/pages/probes/probes-page.module.ts @@ -5,6 +5,7 @@ import { ProbesPageRoutingModule } from './probes-page-routing.module'; 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: [ @@ -13,6 +14,7 @@ import { NoauthModule } from 'app/packages/noauth/noauth.module'; MaterialModule, ProbeModule, NoauthModule, + SubMenubarModule ], declarations: [ ProbesPageComponent, From c89be32cf365bb8490d4cff9c80377491ffe601f Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 31 Jan 2018 17:40:53 +0900 Subject: [PATCH 3/3] probe detail router --- .../component/detail/detail.component.html | 2 +- .../component/detail/detail.component.ts | 6 +++++- .../probe/component/list/list.component.ts | 9 +++++---- src/app/pages/probe/probe-page.component.ts | 20 ++++++++++++------- 4 files changed, 24 insertions(+), 13 deletions(-) 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/probe/probe-page.component.ts b/src/app/pages/probe/probe-page.component.ts index 9309cba..131a15a 100644 --- a/src/app/pages/probe/probe-page.component.ts +++ b/src/app/pages/probe/probe-page.component.ts @@ -1,18 +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 { +export class ProbePageComponent implements OnInit { - tabs = [ - { label: 'Info', path: '/probe' }, - { label: 'Targets', path: '/target' }, - { label: 'History', path: '/probe/history' }, - ]; + tabs = undefined; - constructor() { } + constructor(private router: Router) { + } + + ngOnInit() { + this.tabs = [ + { label: 'Info', path: this.router.url }, + { label: 'Targets', path: '/target' }, + { label: 'History', path: '/probe/history' }, + ]; + } }