added infra detail

This commit is contained in:
snoop 2017-07-28 17:34:19 +09:00
parent 5851e86ce0
commit 9d31903a6f

View File

@ -7,6 +7,8 @@ import Target from '@overflow/target/api/model/Target';
import MetaInfraType from '@overflow/meta/api/model/MetaInfraType'; import MetaInfraType from '@overflow/meta/api/model/MetaInfraType';
import Infra from '@overflow/infra/api/model/Infra'; import Infra from '@overflow/infra/api/model/Infra';
import InfraHost from '@overflow/infra/api/model/InfraHost'; 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'; import * as Utils from '@overflow/commons/utils/Utils';
@ -69,6 +71,7 @@ export class InfraDetail extends React.Component<Props, State> {
let type = this.state.testInfra.infraType.name; let type = this.state.testInfra.infraType.name;
switch (type) { switch (type) {
case 'MACHINE': case 'MACHINE':
NewTableDatas = this.ConvertTableDataForMachine(this.state.childInfra);
break; break;
case 'HOST': case 'HOST':
NewTableDatas = this.ConvertTableDataForHost(this.state.childInfra); NewTableDatas = this.ConvertTableDataForHost(this.state.childInfra);
@ -101,7 +104,13 @@ export class InfraDetail extends React.Component<Props, State> {
public render(): JSX.Element { public render(): JSX.Element {
return ( return (
<Container fluid> <Container fluid>
<InfraTable tableDatas={this.ConvertInfra()} /> {/*<InfraTable tableDatas={this.ConvertInfra()} />*/}
<h3>test - InfraHost</h3>
<InfraTable tableDatas={this.ConvertTableDataForHost(InfraHostJson)} />
<h3>test - InfraHost</h3>
<InfraTable tableDatas={this.ConvertTableDataForMachine(InfraMachineJson)} />
<h3>test - InfraOS</h3>
<InfraTable tableDatas={this.ConvertTableDataForOS(InfraOSJson)} />
</Container> </Container>
); );
} }
@ -120,7 +129,37 @@ export class InfraDetail extends React.Component<Props, State> {
}, },
]; ];
// this.setState({ tableDatas: NewTableDatas }); return NewTableDatas;
}
private ConvertTableDataForMachine(infraChild: InfraMachine): Array<TableData> {
let NewTableDatas: Array<TableData>;
NewTableDatas = [{
header: 'meta',
contents: infraChild.meta,
},
];
return NewTableDatas;
}
private ConvertTableDataForOS(infraChild: InfraOS): Array<TableData> {
let NewTableDatas: Array<TableData>;
NewTableDatas = [
{
header: 'meta',
contents: infraChild.meta,
},
{
header: 'vendor',
contents: infraChild.vendor.name,
},
];
return NewTableDatas; return NewTableDatas;
} }
@ -241,7 +280,7 @@ const InfraJson: any = {
'ip': 3232235980, 'ip': 3232235980,
'mac': 8796753988883, 'mac': 8796753988883,
'createDate': 1501153030607, 'createDate': 1501153030607,
} },
}, },
'target': { 'target': {
'id': 1, 'id': 1,
@ -278,3 +317,30 @@ const InfraHostJson: any = {
'mac': 8796753988883, 'mac': 8796753988883,
'createDate': 1501153030607, '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,
},
},
};