This commit is contained in:
snoop 2017-07-19 17:31:47 +09:00
parent 5f6f442cdf
commit 8e6970a216
4 changed files with 193 additions and 45 deletions

View File

@ -0,0 +1,12 @@
interface MetaProbeArchitecture {
id: number;
architecture: string;
createDate: Date;
}
export enum MetaProbeArchitecture_ID {
x86_64bit = 1,
}
export default MetaProbeArchitecture;

View File

@ -0,0 +1,13 @@
import MetaProbeArchitecture from './MetaProbeArchitecture';
import MetaSensorItemType from './MetaSensorItemType';
interface MetaSensorItem {
id: number;
metaSensorItemType: MetaSensorItemType;
key: string;
name: string;
createDate: Date;
}
export default MetaSensorItem;

View File

@ -0,0 +1,9 @@
interface MetaSensorItemType {
id: number;
name: string;
description: string;
createDate: Date;
}
export default MetaSensorItemType;

View File

@ -1,4 +1,10 @@
import * as React from 'react';
import update from 'immutability-helper';
import { Checkbox, Container, Label, Accordion, Icon, List, ListItemProps } from 'semantic-ui-react';
@ -7,16 +13,125 @@ import Host from '../../../@overflow/discovery/api/model/Host';
import Port from '../../../@overflow/discovery/api/model/Port';
import Service from '../../../@overflow/discovery/api/model/Service';
import MetaSensorItem from '../../../@overflow/meta/api/model/MetaSensorItem';
import * as Utils from '../../../components/Utils';
// import update from 'immutability-helper'
export class Tree extends React.Component<any, any> {
constructor(props: any, context: any) {
super(props, context);
this.state = {
portState: false,
};
}
render() {
return (
<Container>
<DiscoveryResult />
</Container>
);
}
}
export class SensorItemTree extends React.Component<any, any> {
constructor(props: any, context: any) {
super(props, context);
this.state = {
portState: [],
};
// fs.readFile('../../../../../dh.json', this.handlJSONFile);
}
render() {
return (
<Container>
<List selection>
{SensorJsonData.map((data: any, idx: number)=> {
})}
</List>
</Container>
);
}
}
const SensorTypeJsonData = [
{
"id" : 1,
"create_date" : "2017-06-26T10:49:39Z",
"description" : "CPU blah blah blah",
"name" : "CPU"
},
{
"id" : 2,
"create_date" : "2017-06-26T10:49:39Z",
"description" : "MEMORY blah blah blah",
"name" : "MEMORY"
},
{
"id" : 3,
"create_date" : "2017-06-26T10:49:39Z",
"description" : "DISK blah blah blah",
"name" : "DISK"
}
];
const SensorJsonData = [
{
"id": 1,
"create_date": "2017-06-26T11:10:08Z",
"key": "cpu.usage",
"name": "CPU USAGE",
"type_id": 1
},
{
"id": 2,
"create_date": "2017-06-26T11:10:08Z",
"key": "cpu.free",
"name": "CPU FREE",
"type_id": 1
},
{
"id": 3,
"create_date": "2017-06-26T11:10:08Z",
"key": "mem.usage",
"name": "MEMORY USAGE",
"type_id": 2
},
{
"id": 4,
"create_date": "2017-06-26T11:10:08Z",
"key": "mem.free",
"name": "MEMORY FREE",
"type_id": 2
}
];
export class DiscoveryResult extends React.Component<any, any> {
constructor(props: any, context: any) {
super(props, context);
this.state = {
portState: [],
};
@ -24,59 +139,63 @@ export class Tree extends React.Component<any, any> {
}
handlJSONFile = (err: any, data: any) => {
}
render() {
return (
<Container>
<List>
<List selection>
{
jsonData.map((data: any, index: number) => {
let hh: Host = data;
{/*this.state.portState[hh.ip] = false;*/}
this.state.portState[hh.ip] = false;
return (
<List.Item key={index}>
<List.Item key={index} >
<List.Icon name='folder' onClick={() => {
{/*this.state.portState[hh.ip] = !this.state.portState[hh.ip];*/}
console.log(this.state.portState)
this.setState({portState:!this.state.portState});
}}/>
const newPortState = update.newContext()(this.state.portState, {
[hh.ip]: !this.state.portState[hh.ip]
});
{/*this.setState({ portState: newPortState });*/ }
}} />
<List.Content>
<List.Header> <Checkbox label={Utils.int2ip(hh.ip) + ' ' + hh.os} /> </List.Header>
<List.Description>Host</List.Description>
{this.state.portState?
hh.ports ? hh.ports.map((port: Port, idx: number) => {
{this.state.portState[hh.ip] ?
hh.ports ? hh.ports.map((port: Port, idx: number) => {
return (
<List.List key={idx * 1000}>
<List.Item>
<List.Icon name='folder' />
<List.Content>
<List.Header> <Checkbox label={port.portNumber + ' ' + port.portType} /></List.Header>
<List.Description>Port</List.Description>
{port.services ? port.services.map((service: Service, sIdx: number) => {
return (
<List.List key={sIdx * 10000}>
<List.Item>
<List.Icon name='folder' />
<List.Content>
<List.Header><Checkbox label={service.serviceName + ' ' + service.portType} /></List.Header>
<List.Description>Service</List.Description>
</List.Content>
</List.Item>
</List.List>
);
}) : ''}
</List.Content>
</List.Item>
</List.List>
);
}) : '' :''}
return (
<List.List key={idx * 1000}>
<List.Item>
<List.Icon name='folder' />
<List.Content>
<List.Header> <Checkbox label={port.portNumber + ' ' + port.portType} /></List.Header>
<List.Description>Port</List.Description>
{port.services ? port.services.map((service: Service, sIdx: number) => {
return (
<List.List key={sIdx * 10000}>
<List.Item>
<List.Icon name='folder' />
<List.Content>
<List.Header><Checkbox label={service.serviceName + ' ' + service.portType} /></List.Header>
<List.Description>Service</List.Description>
</List.Content>
</List.Item>
</List.List>
);
}) : ''}
</List.Content>
</List.Item>
</List.List>
);
}) : '' : ''}
</List.Content>
</List.Item>
@ -103,13 +222,8 @@ export class Tree extends React.Component<any, any> {
</Container>
);
}
}
const jsonData = [{
"firstScanRange": 1,
"lastScanRange": 10000,