From 9d31903a6f6565c5b453ebb17c33af1a5d28703e Mon Sep 17 00:00:00 2001 From: snoop Date: Fri, 28 Jul 2017 17:34:19 +0900 Subject: [PATCH] added infra detail --- .../infra/react/components/InfraDetail.tsx | 266 +++++++++++------- 1 file changed, 166 insertions(+), 100 deletions(-) diff --git a/src/ts/@overflow/infra/react/components/InfraDetail.tsx b/src/ts/@overflow/infra/react/components/InfraDetail.tsx index a71f5b0..ba9c467 100644 --- a/src/ts/@overflow/infra/react/components/InfraDetail.tsx +++ b/src/ts/@overflow/infra/react/components/InfraDetail.tsx @@ -7,6 +7,8 @@ import Target from '@overflow/target/api/model/Target'; import MetaInfraType from '@overflow/meta/api/model/MetaInfraType'; import Infra from '@overflow/infra/api/model/Infra'; import InfraHost from '@overflow/infra/api/model/InfraHost'; +import InfraMachine from '@overflow/infra/api/model/InfraMachine'; +import InfraOS from '@overflow/infra/api/model/InfraOS'; import * as Utils from '@overflow/commons/utils/Utils'; @@ -69,6 +71,7 @@ export class InfraDetail extends React.Component { let type = this.state.testInfra.infraType.name; switch (type) { case 'MACHINE': + NewTableDatas = this.ConvertTableDataForMachine(this.state.childInfra); break; case 'HOST': NewTableDatas = this.ConvertTableDataForHost(this.state.childInfra); @@ -101,7 +104,13 @@ export class InfraDetail extends React.Component { public render(): JSX.Element { return ( - + {/**/} +

test - InfraHost

+ +

test - InfraHost

+ +

test - InfraOS

+
); } @@ -120,7 +129,37 @@ export class InfraDetail extends React.Component { }, ]; - // this.setState({ tableDatas: NewTableDatas }); + return NewTableDatas; + } + + private ConvertTableDataForMachine(infraChild: InfraMachine): Array { + + let NewTableDatas: Array; + + NewTableDatas = [{ + header: 'meta', + contents: infraChild.meta, + }, + ]; + + return NewTableDatas; + } + + private ConvertTableDataForOS(infraChild: InfraOS): Array { + + let NewTableDatas: Array; + + NewTableDatas = [ + { + header: 'meta', + contents: infraChild.meta, + }, + { + header: 'vendor', + contents: infraChild.vendor.name, + }, + ]; + return NewTableDatas; } @@ -175,106 +214,133 @@ export class InfraTable extends React.Component { const InfraJson: any = { - 'id': 3, - 'infraType': { - 'id': 2, - 'name': 'HOST', - 'createDate': 1498379502894, - }, - 'childId': 1, - 'createDate': 1501207730841, - 'probe': { - 'id': 1, - 'status': { - 'id': 1, - 'name': 'INITIAL', - }, - 'description': 'snoop probe', - 'createDate': 1501153288513, - 'domain': { - 'id': 1, - 'name': 'overFlow\'s domain', - 'createDate': 1498443944866, - }, - 'probeKey': '899fdd145bcc11e7b611080027658d13', - 'encryptionKey': '8c51fa9c5bcc11e7980a080027658d13', - 'targetCount': 0, - 'sensorCount': 0, - 'displayName': 'test probe', - 'cidr': '192.168.1.0/24', - 'authorizeDate': 1501153288513, - 'authorizeMember': { - 'id': 1, - 'email': 'overflow@loafle.com', - 'pw': 'qwer5795', - 'name': 'overFlow', - 'phone': '000-000-0000', - 'companyName': 'loafle', - 'createDate': 1498442847625, - 'status': { - 'id': 2, - 'name': 'NORMAL', - }, - }, - 'host': { - 'id': 1, - 'os': { - 'id': 1, - 'machine': { - 'id': 1, - 'meta': '', - 'createDate': 1501152866677, - }, - 'meta': '', - 'createDate': 1501152947326, - 'vendor': { - 'id': 26, - 'name': 'Windows', - 'createDate': 1501136812985, - 'infraType': { - 'id': 3, - 'name': 'OS', - 'createDate': 1498379502906, - }, - }, - }, - 'ip': 3232235980, - 'mac': 8796753988883, - 'createDate': 1501153030607, - } - }, - 'target': { - 'id': 1, - 'createDate': 1501154289555, - 'displayName': 'ghost target', - 'description': 'i am target', - }, + 'id': 3, + 'infraType': { + 'id': 2, + 'name': 'HOST', + 'createDate': 1498379502894, + }, + 'childId': 1, + 'createDate': 1501207730841, + 'probe': { + 'id': 1, + 'status': { + 'id': 1, + 'name': 'INITIAL', + }, + 'description': 'snoop probe', + 'createDate': 1501153288513, + 'domain': { + 'id': 1, + 'name': 'overFlow\'s domain', + 'createDate': 1498443944866, + }, + 'probeKey': '899fdd145bcc11e7b611080027658d13', + 'encryptionKey': '8c51fa9c5bcc11e7980a080027658d13', + 'targetCount': 0, + 'sensorCount': 0, + 'displayName': 'test probe', + 'cidr': '192.168.1.0/24', + 'authorizeDate': 1501153288513, + 'authorizeMember': { + 'id': 1, + 'email': 'overflow@loafle.com', + 'pw': 'qwer5795', + 'name': 'overFlow', + 'phone': '000-000-0000', + 'companyName': 'loafle', + 'createDate': 1498442847625, + 'status': { + 'id': 2, + 'name': 'NORMAL', + }, + }, + 'host': { + 'id': 1, + 'os': { + 'id': 1, + 'machine': { + 'id': 1, + 'meta': '', + 'createDate': 1501152866677, + }, + 'meta': '', + 'createDate': 1501152947326, + 'vendor': { + 'id': 26, + 'name': 'Windows', + 'createDate': 1501136812985, + 'infraType': { + 'id': 3, + 'name': 'OS', + 'createDate': 1498379502906, + }, + }, + }, + 'ip': 3232235980, + 'mac': 8796753988883, + 'createDate': 1501153030607, + }, + }, + 'target': { + 'id': 1, + 'createDate': 1501154289555, + 'displayName': 'ghost target', + 'description': 'i am target', + }, }; const InfraHostJson: any = { - 'id': 1, - 'os': { - 'id': 1, - 'machine': { - 'id': 1, - 'meta': '', - 'createDate': 1501152866677, - }, - 'meta': '', - 'createDate': 1501152947326, - 'vendor': { - 'id': 26, - 'name': 'Windows', - 'createDate': 1501136812985, - 'infraType': { - 'id': 3, - 'name': 'OS', - 'createDate': 1498379502906, - }, - }, - }, - 'ip': 3232235980, - 'mac': 8796753988883, - 'createDate': 1501153030607, + 'id': 1, + 'os': { + 'id': 1, + 'machine': { + 'id': 1, + 'meta': '', + 'createDate': 1501152866677, + }, + 'meta': '', + 'createDate': 1501152947326, + 'vendor': { + 'id': 26, + 'name': 'Windows', + 'createDate': 1501136812985, + 'infraType': { + 'id': 3, + 'name': 'OS', + 'createDate': 1498379502906, + }, + }, + }, + 'ip': 3232235980, + 'mac': 8796753988883, + 'createDate': 1501153030607, +}; + +const InfraMachineJson: any = { + 'id': 1, + 'meta': '', + 'createDate': 1501152866677, +}; + +const InfraOSJson: any = { + 'id': 1, + 'machine': { + 'id': 1, + 'meta': '', + 'createDate': 1501152866677, + }, + 'meta': '', + 'createDate': 1501152947326, + 'vendor': { + 'id': 26, + 'name': 'Windows', + 'createDate': 1501136812985, + 'infraType': { + 'id': 3, + 'name': 'OS', + 'createDate': 1498379502906, + }, + }, };