From c7dd7d04dc5d58c2d95f7270de268139549be2cb Mon Sep 17 00:00:00 2001 From: insanity Date: Fri, 2 Feb 2018 18:23:21 +0900 Subject: [PATCH] target detail --- .../component/detail/detail.component.html | 43 +++++++++++++++++++ .../component/detail/detail.component.scss | 27 ++++++++++++ .../component/detail/detail.component.spec.ts | 25 +++++++++++ .../component/detail/detail.component.ts | 17 ++++++++ .../target/component/list/list.component.html | 2 +- .../target/component/list/list.component.ts | 4 +- src/app/packages/target/target.module.ts | 10 +++-- src/app/pages/pages-routing.module.ts | 1 + .../pages/probe/probe-page-routing.module.ts | 2 +- src/app/pages/probe/probe-page.component.ts | 12 +++--- src/app/pages/probe/probe-page.module.ts | 4 +- .../target/target-page-routing.module.ts | 18 ++++++++ .../pages/target/target-page.component.html | 1 + .../pages/target/target-page.component.scss | 0 .../target/target-page.component.spec.ts | 25 +++++++++++ src/app/pages/target/target-page.component.ts | 16 +++++++ src/app/pages/target/target-page.module.ts | 21 +++++++++ 17 files changed, 214 insertions(+), 14 deletions(-) create mode 100644 src/app/packages/target/component/detail/detail.component.html create mode 100644 src/app/packages/target/component/detail/detail.component.scss create mode 100644 src/app/packages/target/component/detail/detail.component.spec.ts create mode 100644 src/app/packages/target/component/detail/detail.component.ts create mode 100644 src/app/pages/target/target-page-routing.module.ts create mode 100644 src/app/pages/target/target-page.component.html create mode 100644 src/app/pages/target/target-page.component.scss create mode 100644 src/app/pages/target/target-page.component.spec.ts create mode 100644 src/app/pages/target/target-page.component.ts create mode 100644 src/app/pages/target/target-page.module.ts diff --git a/src/app/packages/target/component/detail/detail.component.html b/src/app/packages/target/component/detail/detail.component.html new file mode 100644 index 0000000..89e0f1f --- /dev/null +++ b/src/app/packages/target/component/detail/detail.component.html @@ -0,0 +1,43 @@ +
+ + + +
+ +
+ TARGET ALIAS +
+ +
+ + +
+ +
+
+ info + +
+ +
+ +
+
+ + + + + + + +
{{ detail?.country }}{{ detail?.sales }}{{ detail?.percentage }}
+ +
+
+
+ +
+
+ + + diff --git a/src/app/packages/target/component/detail/detail.component.scss b/src/app/packages/target/component/detail/detail.component.scss new file mode 100644 index 0000000..3cdd426 --- /dev/null +++ b/src/app/packages/target/component/detail/detail.component.scss @@ -0,0 +1,27 @@ +.table { + width: 100%; + max-width: 100%; + border-collapse: collapse; +} +.table tr:first-child td { + border-top: none; +} + +.text-right { + text-align: right; +} + +th, td { + padding: 8px; + text-align: left; + border-top: 1px solid #ddd; +} +.nav-item { + transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1); + cursor: default; + + &:hover { + transform: translate(0, -8px); + box-shadow: 0 20px 20px rgba(0, 0, 0, .16) + } +} diff --git a/src/app/packages/target/component/detail/detail.component.spec.ts b/src/app/packages/target/component/detail/detail.component.spec.ts new file mode 100644 index 0000000..149b9be --- /dev/null +++ b/src/app/packages/target/component/detail/detail.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DetailComponent } from './detail.component'; + +describe('DetailComponent', () => { + let component: DetailComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DetailComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DetailComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/packages/target/component/detail/detail.component.ts b/src/app/packages/target/component/detail/detail.component.ts new file mode 100644 index 0000000..849f5f9 --- /dev/null +++ b/src/app/packages/target/component/detail/detail.component.ts @@ -0,0 +1,17 @@ +import { Component, OnInit, Input } from '@angular/core'; + +@Component({ + selector: 'of-target-detail', + templateUrl: './detail.component.html', + styleUrls: ['./detail.component.scss'] +}) +export class DetailComponent implements OnInit { + + @Input() sensors = []; + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/app/packages/target/component/list/list.component.html b/src/app/packages/target/component/list/list.component.html index 02a3e93..c670bbe 100644 --- a/src/app/packages/target/component/list/list.component.html +++ b/src/app/packages/target/component/list/list.component.html @@ -1,7 +1,7 @@
-
+
Filter Area
diff --git a/src/app/packages/target/component/list/list.component.ts b/src/app/packages/target/component/list/list.component.ts index 2d05372..005f86f 100644 --- a/src/app/packages/target/component/list/list.component.ts +++ b/src/app/packages/target/component/list/list.component.ts @@ -35,7 +35,7 @@ export class ListComponent implements OnInit, AfterContentInit { const data: Probe[] = new Array(); for (let i = 0; i < 10; i++) { const p: Probe = { - id: String('id' + i), + id: String(i), name: String('name' + i), ip: String('ip' + i), os: String('os' + i), @@ -57,6 +57,6 @@ export class ListComponent implements OnInit, AfterContentInit { } handleRowClick(obj: Probe) { - this.router.navigate(['probe', obj.id]); + this.router.navigate(['target', obj.id]); } } diff --git a/src/app/packages/target/target.module.ts b/src/app/packages/target/target.module.ts index d8f558c..167469b 100644 --- a/src/app/packages/target/target.module.ts +++ b/src/app/packages/target/target.module.ts @@ -2,15 +2,19 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { ListComponent } from 'app/packages/target/component/list/list.component'; import { MaterialModule } from 'app/commons/ui/material/material.module'; +import { DetailComponent } from './component/detail/detail.component'; +import { InfoTableModule } from 'app/commons/component/info-table/info-table.module'; @NgModule({ imports: [ CommonModule, - MaterialModule + MaterialModule, + InfoTableModule ], - declarations: [ListComponent], + declarations: [ListComponent, DetailComponent], exports: [ - ListComponent + ListComponent, + DetailComponent ] }) export class TargetModule { } diff --git a/src/app/pages/pages-routing.module.ts b/src/app/pages/pages-routing.module.ts index f179fc6..2525034 100644 --- a/src/app/pages/pages-routing.module.ts +++ b/src/app/pages/pages-routing.module.ts @@ -14,6 +14,7 @@ const routes: Routes = [ { path: 'discovery', loadChildren: './discovery/discovery-page.module#DiscoveryPageModule' }, { path: 'map', loadChildren: './infra/infra-page.module#InfraPageModule' }, { path: 'sensor-setting', loadChildren: './sensor-setting/sensor-setting-page.module#SensorSettingPageModule' }, + { path: 'target', loadChildren: './target/target-page.module#TargetPageModule' }, ] } ]; diff --git a/src/app/pages/probe/probe-page-routing.module.ts b/src/app/pages/probe/probe-page-routing.module.ts index 7d1856d..46952b7 100644 --- a/src/app/pages/probe/probe-page-routing.module.ts +++ b/src/app/pages/probe/probe-page-routing.module.ts @@ -20,4 +20,4 @@ const routes: Routes = [ imports: [RouterModule.forChild(routes)], exports: [RouterModule] }) -export class ProbesPageRoutingModule { } +export class ProbePageRoutingModule { } diff --git a/src/app/pages/probe/probe-page.component.ts b/src/app/pages/probe/probe-page.component.ts index ca18f27..233ad82 100644 --- a/src/app/pages/probe/probe-page.component.ts +++ b/src/app/pages/probe/probe-page.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { Router } from '@angular/router'; +import { Router, ActivatedRoute } from '@angular/router'; @Component({ selector: 'of-pages-probe', @@ -10,14 +10,16 @@ export class ProbePageComponent implements OnInit { tabs = undefined; - constructor(private router: Router) { + constructor(private route: ActivatedRoute, private router: Router) { } ngOnInit() { + const id = this.router.url.split('probe/')[1].split('/')[0]; + this.tabs = [ - { label: 'Info', path: this.router.url }, - { label: 'Targets', path: this.router.url + '/targets' }, - { label: 'History', path: this.router.url + '/history' }, + { label: 'Info', path: '/probe/' + id }, + { label: 'Targets', path: '/probe/' + id + '/targets' }, + { label: 'History', path: '/probe/' + id + '/history' }, ]; } diff --git a/src/app/pages/probe/probe-page.module.ts b/src/app/pages/probe/probe-page.module.ts index 70937fc..d5b8adb 100644 --- a/src/app/pages/probe/probe-page.module.ts +++ b/src/app/pages/probe/probe-page.module.ts @@ -1,7 +1,7 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { ProbePageComponent } from './probe-page.component'; -import { ProbesPageRoutingModule } from './probe-page-routing.module'; +import { ProbePageRoutingModule } 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/component/sub-menubar/sub-menubar.module'; @@ -9,7 +9,7 @@ import { SubMenubarModule } from 'app/commons/component/sub-menubar/sub-menubar. @NgModule({ imports: [ CommonModule, - ProbesPageRoutingModule, + ProbePageRoutingModule, MaterialModule, ProbeModule, SubMenubarModule, diff --git a/src/app/pages/target/target-page-routing.module.ts b/src/app/pages/target/target-page-routing.module.ts new file mode 100644 index 0000000..4f0225f --- /dev/null +++ b/src/app/pages/target/target-page-routing.module.ts @@ -0,0 +1,18 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { TargetPageComponent } from './target-page.component'; + +const routes: Routes = [ + { + path: ':id', + component: TargetPageComponent, + children: [ + ] + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class TargetPageRoutingModule { } diff --git a/src/app/pages/target/target-page.component.html b/src/app/pages/target/target-page.component.html new file mode 100644 index 0000000..0178d45 --- /dev/null +++ b/src/app/pages/target/target-page.component.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/app/pages/target/target-page.component.scss b/src/app/pages/target/target-page.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/target/target-page.component.spec.ts b/src/app/pages/target/target-page.component.spec.ts new file mode 100644 index 0000000..1c82b34 --- /dev/null +++ b/src/app/pages/target/target-page.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TargetPageComponent } from './target-page.component'; + +describe('ProbeComponent', () => { + let component: TargetPageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TargetPageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TargetPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/target/target-page.component.ts b/src/app/pages/target/target-page.component.ts new file mode 100644 index 0000000..79870ea --- /dev/null +++ b/src/app/pages/target/target-page.component.ts @@ -0,0 +1,16 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'of-pages-target', + templateUrl: './target-page.component.html', + styleUrls: ['./target-page.component.scss'] +}) +export class TargetPageComponent implements OnInit { + + constructor() { + } + + ngOnInit() { + } + +} diff --git a/src/app/pages/target/target-page.module.ts b/src/app/pages/target/target-page.module.ts new file mode 100644 index 0000000..12db881 --- /dev/null +++ b/src/app/pages/target/target-page.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { TargetPageComponent } from './target-page.component'; +import { TargetPageRoutingModule } from './target-page-routing.module'; +import { MaterialModule } from 'app/commons/ui/material/material.module'; +import { TargetModule } from 'app/packages/target/target.module'; +import { SubMenubarModule } from 'app/commons/component/sub-menubar/sub-menubar.module'; + +@NgModule({ + imports: [ + CommonModule, + TargetPageRoutingModule, + MaterialModule, + TargetModule, + SubMenubarModule, + ], + declarations: [ + TargetPageComponent, + ] +}) +export class TargetPageModule { }