From 2ba7ecb8888e4b8988dd91f004f65e01df2bf29b Mon Sep 17 00:00:00 2001 From: insanity Date: Tue, 24 Apr 2018 14:31:20 +0900 Subject: [PATCH] noauth probe design --- .../noauth/component/list/list.component.html | 83 +++++++++++++++++-- .../noauth/component/list/list.component.ts | 72 +++++++++++----- .../notification/notification.component.html | 4 +- .../notification/notification.component.ts | 1 + .../probe/component/list/list.component.ts | 1 - 5 files changed, 130 insertions(+), 31 deletions(-) diff --git a/src/packages/noauth/component/list/list.component.html b/src/packages/noauth/component/list/list.component.html index 71c6271..9d276e8 100644 --- a/src/packages/noauth/component/list/list.component.html +++ b/src/packages/noauth/component/list/list.component.html @@ -1,5 +1,78 @@

Unauthorized

- + + + + + + Probe Key + Host Name + OS + Created at + + + + + + + + + + {{rowData.data.tempProbeKey}} + {{rowData.meta.host.name}} + {{rowData.meta.host.os}} + {{rowData.data.createDate | date: 'dd/MM/yyyy'}} + + + + + +
+ +
+
+ Platform: {{rowData.meta.host.platform}} +
+ +
+ Platform family: {{rowData.meta.host.platformFamily}} +
+
+ Kernel: {{rowData.meta.host.kernelVersion}} +
+
+ HostID: {{rowData.meta.host.hostID}} +
+
+ +
+
+
+ NIC: {{rowData.meta.network.name}} +
+
+ Network Address: {{rowData.meta.network.address}} +
+
+ Gateway: {{rowData.meta.network.gateway}} +
+
+ Mac Address: {{rowData.meta.network.macAddress}} +
+
+
+
+ + + + + + + + +
+
+ + \ No newline at end of file diff --git a/src/packages/noauth/component/list/list.component.ts b/src/packages/noauth/component/list/list.component.ts index 025cdd9..7f94a09 100644 --- a/src/packages/noauth/component/list/list.component.ts +++ b/src/packages/noauth/component/list/list.component.ts @@ -11,6 +11,31 @@ import { NoAuthProbe } from '../../model'; import { ConfirmationService, Message } from 'primeng/primeng'; import { MessageService } from 'primeng/components/common/messageservice'; +class NoauthProbeDesc { + host: { + name: string; + os: string; + platform: string; + platformFamily: string; + platformVersion: string; + kernelVersion: string; + hostID: string; + }; + network: { + name: string; + address: string; + gateway: string; + macAddress: string; + }; +} + +class NoauthProbeResult { + id: number; + data: NoAuthProbe; + meta: NoauthProbeDesc; +} + + @Component({ selector: 'of-noauth-list', templateUrl: './list.component.html', @@ -18,10 +43,11 @@ import { MessageService } from 'primeng/components/common/messageservice'; }) export class ListComponent implements OnInit, AfterContentInit { noAuthProbes$ = this.store.pipe(select(NoAuthProbeSelector.select('noAuthProbes'))); - noauthProbes: NoAuthProbe[]; + noauthProbes: NoauthProbeResult[]; selected: NoAuthProbe = null; msgs: Message[]; + constructor( private router: Router, private store: Store, @@ -30,17 +56,11 @@ export class ListComponent implements OnInit, AfterContentInit { ) { } - ngAfterContentInit() { - this.store.select(AuthSelector.select('domain')).subscribe( - (domain: Domain) => { - this.store.dispatch(new ListStore.ReadAllByDomain(domain)); - } - ); - + ngOnInit() { this.noAuthProbes$.subscribe( (result: NoAuthProbe[]) => { if (result) { - this.noauthProbes = result; + this.arrangeData(result); } }, (error: RPCClientError) => { @@ -49,22 +69,28 @@ export class ListComponent implements OnInit, AfterContentInit { ); } - ngOnInit() { - // Temporary Data - this.noauthProbes = new Array(); - for (let i = 0; i < 10; i++) { - const p: NoAuthProbe = { - id: i, - tempProbeKey: 'TempKey' + i, - createDate: new Date(), - description: 'Description' + i, - }; - this.noauthProbes.push(p); - } + ngAfterContentInit() { + this.store.select(AuthSelector.select('domain')).subscribe( + (domain: Domain) => { + this.store.dispatch(new ListStore.ReadAllByDomain(domain)); + } + ); } - handleSelect(selected: NoAuthProbe) { - this.selected = selected; + arrangeData(list) { + if (!list || list.length === 0) { + return; + } + this.noauthProbes = []; + for (const np of list) { + const desc: NoauthProbeDesc = JSON.parse(np.description); + const result: NoauthProbeResult = { + id: np.id, + data: np, + meta: desc + }; + this.noauthProbes.push(result); + } } onAcceptOrDeny(isAccept: boolean) { diff --git a/src/packages/notification/component/notification/notification.component.html b/src/packages/notification/component/notification/notification.component.html index b0ab03e..2d18724 100644 --- a/src/packages/notification/component/notification/notification.component.html +++ b/src/packages/notification/component/notification/notification.component.html @@ -1,9 +1,9 @@

Notifications

-
+ - + {{notification.createDate | date: 'dd/MM/yyyy'}} diff --git a/src/packages/notification/component/notification/notification.component.ts b/src/packages/notification/component/notification/notification.component.ts index e8cc131..d44611c 100644 --- a/src/packages/notification/component/notification/notification.component.ts +++ b/src/packages/notification/component/notification/notification.component.ts @@ -34,6 +34,7 @@ export class NotificationComponent implements OnInit, AfterContentInit { this.notification$.subscribe( (page: Page) => { if (page !== null) { + console.log(page); this.notifications = page.content; this.totalLength = page.totalElements; } diff --git a/src/packages/probe/component/list/list.component.ts b/src/packages/probe/component/list/list.component.ts index 1a5d642..72c4ca8 100644 --- a/src/packages/probe/component/list/list.component.ts +++ b/src/packages/probe/component/list/list.component.ts @@ -48,7 +48,6 @@ export class ListComponent implements OnInit, AfterContentInit { } - onRowSelect(event) { this.router.navigate(['probe', event.data.id, 'info']); }