From 63a3288969dc885b34bf44b3ee2b9c8c936c6dc9 Mon Sep 17 00:00:00 2001 From: insanity Date: Thu, 15 Mar 2018 12:47:25 +0900 Subject: [PATCH] ing --- .../commons/component/sidebar/menu-element.ts | 2 +- .../pages/alert/alert-page-routing.module.ts | 18 +++ src/app/pages/alert/alert-page.component.html | 1 + src/app/pages/alert/alert-page.component.scss | 0 .../pages/alert/alert-page.component.spec.ts | 25 ++++ src/app/pages/alert/alert-page.component.ts | 18 +++ src/app/pages/alert/alert-page.module.ts | 18 +++ src/app/pages/pages-routing.module.ts | 1 + .../component/detail/detail.component.html | 11 +- .../component/detail/detail.component.ts | 135 +++++++++--------- src/packages/probe/service/probe.service.ts | 5 +- 11 files changed, 156 insertions(+), 78 deletions(-) create mode 100644 src/app/pages/alert/alert-page-routing.module.ts create mode 100644 src/app/pages/alert/alert-page.component.html create mode 100644 src/app/pages/alert/alert-page.component.scss create mode 100644 src/app/pages/alert/alert-page.component.spec.ts create mode 100644 src/app/pages/alert/alert-page.component.ts create mode 100644 src/app/pages/alert/alert-page.module.ts diff --git a/src/app/commons/component/sidebar/menu-element.ts b/src/app/commons/component/sidebar/menu-element.ts index bf11e2a..f199a43 100644 --- a/src/app/commons/component/sidebar/menu-element.ts +++ b/src/app/commons/component/sidebar/menu-element.ts @@ -66,7 +66,7 @@ export const menus = [ { 'name': 'App.Alert', 'icon': 'warning', - 'link': '', + 'link': '/alert', 'open': true, }, { diff --git a/src/app/pages/alert/alert-page-routing.module.ts b/src/app/pages/alert/alert-page-routing.module.ts new file mode 100644 index 0000000..85497e8 --- /dev/null +++ b/src/app/pages/alert/alert-page-routing.module.ts @@ -0,0 +1,18 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { AlertPageComponent } from './alert-page.component'; + +const routes: Routes = [ + { + path: '', + component: AlertPageComponent, + children: [ + ] + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class AlertPageRoutingModule { } diff --git a/src/app/pages/alert/alert-page.component.html b/src/app/pages/alert/alert-page.component.html new file mode 100644 index 0000000..7062196 --- /dev/null +++ b/src/app/pages/alert/alert-page.component.html @@ -0,0 +1 @@ +
alert page
\ No newline at end of file diff --git a/src/app/pages/alert/alert-page.component.scss b/src/app/pages/alert/alert-page.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/alert/alert-page.component.spec.ts b/src/app/pages/alert/alert-page.component.spec.ts new file mode 100644 index 0000000..0d31af9 --- /dev/null +++ b/src/app/pages/alert/alert-page.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AlertPageComponent } from './alert-page.component'; + +describe('AlertPageComponent', () => { + let component: AlertPageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AlertPageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AlertPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/alert/alert-page.component.ts b/src/app/pages/alert/alert-page.component.ts new file mode 100644 index 0000000..9905da5 --- /dev/null +++ b/src/app/pages/alert/alert-page.component.ts @@ -0,0 +1,18 @@ +import { Component, OnInit } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; + +@Component({ + selector: 'of-pages-alert', + templateUrl: './alert-page.component.html', + styleUrls: ['./alert-page.component.scss'] +}) +export class AlertPageComponent implements OnInit { + + + constructor(private route: ActivatedRoute, private router: Router) { + } + + ngOnInit() { + } + +} diff --git a/src/app/pages/alert/alert-page.module.ts b/src/app/pages/alert/alert-page.module.ts new file mode 100644 index 0000000..c649316 --- /dev/null +++ b/src/app/pages/alert/alert-page.module.ts @@ -0,0 +1,18 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { AlertPageRoutingModule } from './alert-page-routing.module'; +import { MaterialModule } from 'app/commons/ui/material/material.module'; +import { AlertPageComponent } from './alert-page.component'; + +@NgModule({ + imports: [ + CommonModule, + AlertPageRoutingModule, + MaterialModule, + // NotificationModule, + ], + declarations: [ + AlertPageComponent, + ] +}) +export class AlertPageModule { } diff --git a/src/app/pages/pages-routing.module.ts b/src/app/pages/pages-routing.module.ts index 66fc7d5..8cfc7cb 100644 --- a/src/app/pages/pages-routing.module.ts +++ b/src/app/pages/pages-routing.module.ts @@ -21,6 +21,7 @@ const routes: Routes = [ { path: 'overview', loadChildren: './overview/overview-page.module#OverviewPageModule' }, { path: 'dashboard', loadChildren: './dashboard/dashboard-page.module#DashboardPageModule' }, { path: 'notification', loadChildren: './notification/notification-page.module#NotificationPageModule' }, + { path: 'alert', loadChildren: './alert/alert-page.module#AlertPageModule' }, { path: 'settings/member', loadChildren: './settings/member/member-page.module#MemberPageModule' }, ] } diff --git a/src/packages/probe/component/detail/detail.component.html b/src/packages/probe/component/detail/detail.component.html index e30254b..e77c76d 100644 --- a/src/packages/probe/component/detail/detail.component.html +++ b/src/packages/probe/component/detail/detail.component.html @@ -1,10 +1,10 @@ - -
aaa
\ No newline at end of file + \ No newline at end of file diff --git a/src/packages/probe/component/detail/detail.component.ts b/src/packages/probe/component/detail/detail.component.ts index e5b0596..d9a16fc 100644 --- a/src/packages/probe/component/detail/detail.component.ts +++ b/src/packages/probe/component/detail/detail.component.ts @@ -15,84 +15,27 @@ import { RPCError } from 'packages/core/rpc/error'; }) export class DetailComponent implements OnInit, AfterContentInit { - probe$ = this.store.pipe(select(DetailSelector.select('probe'))); + probe$ = this.detailStore.pipe(select(DetailSelector.select('probe'))); probe: Probe = null; + networkInfo = null; + deviceInfo = null; + probeInfo = null; - probeAlias = ''; - probeId = undefined; - isUpState = false; - - networkInfo = [ - { - key: 'IP', - value: '192.168.1.1' - }, - { - key: 'NIC', - value: 'enps30' - }, - { - key: 'Targets', - value: '12' - }, - ]; - - deviceInfo = [ - { - key: 'OS', - value: 'Linux' - }, - { - key: 'CPU', - value: 'intel7...' - }, - { - key: 'Memory', - value: '16GB' - }, - { - key: '...', - value: '...' - }, - ]; - - probeInfo = [ - { - key: 'Authorized at', - value: String(new Date()) - }, - { - key: 'Authorized by', - value: 'insanity' - }, - { - key: 'Installed at', - value: String(new Date()) - }, - ]; constructor( private route: ActivatedRoute, private router: Router, public dialog: MatDialog, - private store: Store + private detailStore: Store ) { } ngOnInit() { - this.probeId = this.route.snapshot.paramMap.get('id'); - this.probeAlias = 'Probe Alias 블라블라'; - } - - ngAfterContentInit() { - this.store.dispatch( - new DetailStore.Read( - { id: this.probeId } - ) - ); this.probe$.subscribe( (probe: Probe) => { - console.log(probe); - this.probe = probe; + if (probe != null) { + this.probe = probe; + this.arrangeInfo(); + } }, (error: RPCError) => { console.log(error.message); @@ -100,8 +43,66 @@ export class DetailComponent implements OnInit, AfterContentInit { ); } + ngAfterContentInit() { + const probeId = this.route.snapshot.paramMap.get('id'); + this.detailStore.dispatch( + new DetailStore.Read( + { id: probeId } + ) + ); + } + + arrangeInfo() { + this.networkInfo = [ + { + key: 'IP', + value: '192.168.1.1' + }, + { + key: 'NIC', + value: 'enps30' + }, + { + key: 'Targets', + value: '12' + }, + ]; + this.deviceInfo = [ + { + key: 'OS', + value: 'Linux' + }, + { + key: 'CPU', + value: 'intel7...' + }, + { + key: 'Memory', + value: '16GB' + }, + { + key: '...', + value: '...' + }, + ]; + this.probeInfo = [ + { + key: 'Authorized at', + value: String(new Date()) + }, + { + key: 'Authorized by', + value: 'insanity' + }, + { + key: 'Installed at', + value: String(new Date()) + }, + ]; + } + handleStartStop() { - this.isUpState = !this.isUpState; + // this.isUpState = !this.isUpState; } handleRemove() { diff --git a/src/packages/probe/service/probe.service.ts b/src/packages/probe/service/probe.service.ts index 0e008eb..f7ce961 100644 --- a/src/packages/probe/service/probe.service.ts +++ b/src/packages/probe/service/probe.service.ts @@ -24,9 +24,6 @@ export class ProbeService { } public read(id: string): Observable { - const param = { - id: id, - }; - return this.rpcClient.call('ProbeService.read', param); + return this.rpcClient.call('ProbeService.read', id); } }