tree ing
This commit is contained in:
parent
5f6f442cdf
commit
8e6970a216
12
src/ts/@overflow/meta/api/model/MetaProbeArchitecture.ts
Normal file
12
src/ts/@overflow/meta/api/model/MetaProbeArchitecture.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
interface MetaProbeArchitecture {
|
||||||
|
id: number;
|
||||||
|
architecture: string;
|
||||||
|
createDate: Date;
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum MetaProbeArchitecture_ID {
|
||||||
|
x86_64bit = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MetaProbeArchitecture;
|
13
src/ts/@overflow/meta/api/model/MetaSensorItem.ts
Normal file
13
src/ts/@overflow/meta/api/model/MetaSensorItem.ts
Normal 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;
|
9
src/ts/@overflow/meta/api/model/MetaSensorItemType.ts
Normal file
9
src/ts/@overflow/meta/api/model/MetaSensorItemType.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
interface MetaSensorItemType {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
createDate: Date;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MetaSensorItemType;
|
@ -1,4 +1,10 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import update from 'immutability-helper';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import { Checkbox, Container, Label, Accordion, Icon, List, ListItemProps } from 'semantic-ui-react';
|
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 Port from '../../../@overflow/discovery/api/model/Port';
|
||||||
import Service from '../../../@overflow/discovery/api/model/Service';
|
import Service from '../../../@overflow/discovery/api/model/Service';
|
||||||
|
|
||||||
|
import MetaSensorItem from '../../../@overflow/meta/api/model/MetaSensorItem';
|
||||||
|
|
||||||
import * as Utils from '../../../components/Utils';
|
import * as Utils from '../../../components/Utils';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// import update from 'immutability-helper'
|
||||||
|
|
||||||
export class Tree extends React.Component<any, any> {
|
export class Tree extends React.Component<any, any> {
|
||||||
|
|
||||||
constructor(props: any, context: any) {
|
constructor(props: any, context: any) {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
|
|
||||||
this.state = {
|
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() {
|
render() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<List>
|
<List selection>
|
||||||
{
|
{
|
||||||
|
|
||||||
jsonData.map((data: any, index: number) => {
|
jsonData.map((data: any, index: number) => {
|
||||||
let hh: Host = data;
|
let hh: Host = data;
|
||||||
{/*this.state.portState[hh.ip] = false;*/}
|
this.state.portState[hh.ip] = false;
|
||||||
return (
|
return (
|
||||||
<List.Item key={index}>
|
<List.Item key={index} >
|
||||||
|
|
||||||
<List.Icon name='folder' onClick={() => {
|
<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.Content>
|
||||||
|
|
||||||
<List.Header> <Checkbox label={Utils.int2ip(hh.ip) + ' ' + hh.os} /> </List.Header>
|
<List.Header> <Checkbox label={Utils.int2ip(hh.ip) + ' ' + hh.os} /> </List.Header>
|
||||||
<List.Description>Host</List.Description>
|
<List.Description>Host</List.Description>
|
||||||
{this.state.portState?
|
{this.state.portState[hh.ip] ?
|
||||||
hh.ports ? hh.ports.map((port: Port, idx: number) => {
|
hh.ports ? hh.ports.map((port: Port, idx: number) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List.List key={idx * 1000}>
|
<List.List key={idx * 1000}>
|
||||||
<List.Item>
|
<List.Item>
|
||||||
<List.Icon name='folder' />
|
<List.Icon name='folder' />
|
||||||
<List.Content>
|
<List.Content>
|
||||||
<List.Header> <Checkbox label={port.portNumber + ' ' + port.portType} /></List.Header>
|
<List.Header> <Checkbox label={port.portNumber + ' ' + port.portType} /></List.Header>
|
||||||
<List.Description>Port</List.Description>
|
<List.Description>Port</List.Description>
|
||||||
{port.services ? port.services.map((service: Service, sIdx: number) => {
|
{port.services ? port.services.map((service: Service, sIdx: number) => {
|
||||||
return (
|
return (
|
||||||
<List.List key={sIdx * 10000}>
|
<List.List key={sIdx * 10000}>
|
||||||
<List.Item>
|
<List.Item>
|
||||||
<List.Icon name='folder' />
|
<List.Icon name='folder' />
|
||||||
<List.Content>
|
<List.Content>
|
||||||
<List.Header><Checkbox label={service.serviceName + ' ' + service.portType} /></List.Header>
|
<List.Header><Checkbox label={service.serviceName + ' ' + service.portType} /></List.Header>
|
||||||
<List.Description>Service</List.Description>
|
<List.Description>Service</List.Description>
|
||||||
</List.Content>
|
</List.Content>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
</List.List>
|
</List.List>
|
||||||
);
|
);
|
||||||
}) : ''}
|
}) : ''}
|
||||||
</List.Content>
|
</List.Content>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
</List.List>
|
</List.List>
|
||||||
);
|
);
|
||||||
}) : '' :''}
|
}) : '' : ''}
|
||||||
|
|
||||||
</List.Content>
|
</List.Content>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
@ -103,13 +222,8 @@ export class Tree extends React.Component<any, any> {
|
|||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const jsonData = [{
|
const jsonData = [{
|
||||||
"firstScanRange": 1,
|
"firstScanRange": 1,
|
||||||
"lastScanRange": 10000,
|
"lastScanRange": 10000,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user