fixed sensor config

This commit is contained in:
snoop 2018-01-03 19:01:41 +09:00
parent 6bb0e5a4e5
commit f1759540ec
4 changed files with 681 additions and 21 deletions

View File

@ -6,6 +6,7 @@ import { ListContainer } from '@overflow/commons/react/component/ListContainer';
import { InfraMapZoneTable } from './infra_map_zone_table';
import { InfraMapHostTable } from './infra_map_host_table';
import { SensorConfig} from '@overflow/sensor/react/components/sensor_config';
import {SensorConfigSetting} from '@overflow/sensor/react/components/sensor_config_setting';
export interface StateProps {
}
@ -21,6 +22,7 @@ export interface State {
export class InfraMap extends React.Component<Props, State> {
private panes: any = [
{ menuItem: 'sc Test2', render: () => <Tab.Pane attached={false}><SensorConfigSetting /></Tab.Pane> },
{ menuItem: 'sc Test', render: () => <Tab.Pane attached={false}><SensorConfig /></Tab.Pane> },
{ menuItem: 'Zone', render: () => <Tab.Pane attached={false}><InfraMapZoneTable /></Tab.Pane> },
{ menuItem: 'Host', render: () => <Tab.Pane attached={false}><InfraMapHostTable /></Tab.Pane> },

View File

@ -7,7 +7,8 @@ import { SensorConfigTarget } from './sensor_config_target';
import { SensorConfigCrawler } from './sensor_config_crawler';
import { SensorConfigAuthCrawler } from './sensor_config_auth_crawler';
import { SensorConfigItem } from './sensor_config_item';
import { SensorConfigSetting } from './sensor_config_setting';
export interface StateProps {
}
@ -56,11 +57,6 @@ export class SensorConfig extends React.Component<Props, State> {
</Grid.Column>
</Grid.Row>
</Grid>
Sensor Setting
<SensorConfigSetting />
<Button floated='left'>Cancel</Button>
<Button floated='right'>Next</Button>
</Container>
);
}

View File

@ -3,7 +3,8 @@ import {
Table, Header, Container, Form, Checkbox, Button, Rating,
List, Icon, Grid, Modal,
} from 'semantic-ui-react';
import {SensorConfig} from './sensor_config';
import { SensorConfig } from './sensor_config';
import { SensorConfigSetting } from './sensor_config_setting';
export interface StateProps {
open?: boolean;
@ -17,6 +18,7 @@ export type Props = StateProps & DispatchProps;
export interface State {
startPopup: boolean;
step: number;
}
export class SensorConfigPopup extends React.Component<Props, State> {
@ -26,6 +28,7 @@ export class SensorConfigPopup extends React.Component<Props, State> {
this.state = {
startPopup: false,
step: 1,
};
}
@ -36,7 +39,12 @@ export class SensorConfigPopup extends React.Component<Props, State> {
// public handleCancel = () => this.setState({ startPopup: false });
public handleSubmit(): void {
this.setState({ startPopup: false });
this.setState({ startPopup: false, step: 1 });
this.props.closeCallback();
}
public handleNext(): void {
this.setState({ step: 2 });
}
public render(): JSX.Element {
@ -46,25 +54,32 @@ export class SensorConfigPopup extends React.Component<Props, State> {
>
<Modal.Content>
<Container fluid>
<Header as='h3' dividing> Discovery Details</Header>
<Header as='h3' dividing>Sensor Config</Header>
<br />
<Modal size='small' open={this.props.open} onClose={this.handlePopupClose.bind(this)}>
<Modal.Header>Discovery</Modal.Header>
<Modal.Content >
<SensorConfig />
{this.state.step === 1 ?
<SensorConfig />
:
<SensorConfigSetting />
}
</Modal.Content>
<Modal.Actions>
<Button onClick={this.handlePopupClose}> Cancel </Button>
<Button onClick={this.handleSubmit.bind(this)} primary> Submit </Button>
<Button floated='left' onClick={this.handlePopupClose}>Cancel</Button>
{this.state.step === 1 ?
<Button floated='right' onClick={this.handleNext.bind(this)} primary>Next</Button>
:
<Button floated='right' onClick={this.handleSubmit.bind(this)} primary>Done</Button>
}
</Modal.Actions>
</Modal>
</Container>
</Modal.Content>
<Modal.Actions>
<Button onClick={this.handlePopupClose.bind(this)}>Cancel</Button>
{/* <Button primary >Done</Button> */}
</Modal.Actions>
</Modal>
);

View File

@ -2,8 +2,9 @@ import * as React from 'react';
import {
Table, Header, Container, Form, Checkbox, Button, Rating,
List, Icon, Radio, CheckboxProps, InputOnChangeData, Input,
Grid,
} from 'semantic-ui-react';
import {Infra} from '@overflow/infra/api/model/Infra';
@ -32,8 +33,27 @@ export class SensorConfigSetting extends React.Component<Props, State> {
public render(): JSX.Element {
return (
<Container>
Interval select
<Grid columns={2} divided>
<Grid.Row>
<Grid.Column >
Interval select
<SensorConfigSettingNameInterval />
</Grid.Column>
<Grid.Column>
Target Info
<SensorConfigSettingTargetInfo />
</Grid.Column>
</Grid.Row>
<Grid.Row>
<Grid.Column>
Sensor Item Info
<SensorConfigSettingSensorItemInfo />
</Grid.Column>
</Grid.Row>
</Grid>
</Container>
);
}
@ -73,10 +93,10 @@ export class SensorConfigSettingNameInterval extends React.Component<NameInterva
public render(): JSX.Element {
return (
<Container>
<Input label={'Name'} placeholder={'Sensor 1234'} key={0} onChange={
(event: React.SyntheticEvent<HTMLInputElement>, data: InputOnChangeData) => {
{/* this.onChangeAuth(item.name, data.value); */ }
}} />
<Input label={'Name'} placeholder={'Sensor 1234'} key={0} onChange={
(event: React.SyntheticEvent<HTMLInputElement>, data: InputOnChangeData) => {
{/* this.onChangeAuth(item.name, data.value); */ }
}} />
<Form>
<Form.Field>
<Radio
@ -123,7 +143,7 @@ export interface TargetInfoDispatchProps {
export type TargetInfoProps = TargetInfoStateProps & TargetInfoDispatchProps;
export interface TargetInfoState {
testInfraList: Array<Infra>;
}
export class SensorConfigSettingTargetInfo extends React.Component<TargetInfoProps, TargetInfoState> {
@ -131,6 +151,57 @@ export class SensorConfigSettingTargetInfo extends React.Component<TargetInfoPro
constructor(props: TargetInfoProps, context: TargetInfoState) {
super(props, context);
this.state = {
testInfraList: testInfraDataList,
};
}
public renderInfra(): JSX.Element[] {
let infraList: Array<Infra> = this.state.testInfraList;
if(infraList === undefined || infraList.length <= 0) {
return null;
}
let elems: Array<JSX.Element> = new Array();
infraList.map((infra: Infra, idx: number) => {
console.log('');
});
return elems;
}
public render(): JSX.Element {
return (
<Container>
{this.renderInfra()}
</Container>
);
}
}
export interface TargetInfoHostStateProps {
}
export interface TargetInfoHostDispatchProps {
}
export type TargetInfoHostProps = TargetInfoHostStateProps & TargetInfoHostDispatchProps;
export interface TargetInfoHostState {
}
export class SensorConfigSettingTargetInfoHost extends React.Component<TargetInfoHostProps, TargetInfoHostState> {
constructor(props: TargetInfoHostProps, context: TargetInfoHostState) {
super(props, context);
this.state = {
};
@ -178,3 +249,579 @@ export class SensorConfigSettingSensorItemInfo extends React.Component<SensorIte
}
}
const testInfraDataList: any[] = [
{
'id': 4,
'infraType': {
'id': 7,
'name': 'OS_SERVICE',
'createDate': 1498379502906,
},
'createDate': 1503293066525,
'probe': {
'id': 1,
'status': {
'id': 1,
'name': 'INITIAL',
},
'description': 'snoop probe',
'createDate': 1503294511563,
'domain': {
'id': 1,
'name': "overFlow's domain",
'createDate': 1498443944866,
},
'probeKey': '899fdd145bcc11e7b611080027658d13',
'encryptionKey': '8c51fa9c5bcc11e7980a080027658d13',
'displayName': 'test probe 111111',
'cidr': '192.168.1.0/24',
'authorizeDate': 1503294511563,
'authorizeMember': {
'id': 1,
'email': 'overflow@loafle.com',
'name': 'overFlow',
'phone': '000-000-0000',
'companyName': 'loafle',
'createDate': 1498442847625,
'status': {
'id': 2,
'name': 'NORMAL',
},
'signinFailCount': 0,
},
'targets': null,
},
'target': {
'id': 4,
'createDate': 1501154289555,
'displayName': 'ghost target',
'description': 'Service target',
'sensors': [{
'id': 3,
'createDate': 1503904625506,
'description': 'OS_SERVICE-MYSQL_CRAWLER',
'status': {
'id': 1,
'name': 'RUNNING',
},
'target': {
'id': 4,
'createDate': 1501154289555,
'displayName': 'ghost target',
'description': 'Service target',
'sensors': null,
},
'crawler': {
'id': 11,
'createDate': 1498794968791,
'name': 'MYSQL_CRAWLER',
'description': 'MYSQL',
},
'crawlerInputItems': null,
'itemCount': 2,
},
{
'id': 5,
'createDate': 1505100362738,
'description': 'SERVICE-JMX_CRAWLER',
'status': {
'id': 1,
'name': 'RUNNING',
},
'target': {
'id': 4,
'createDate': 1501154289555,
'displayName': 'ghost target',
'description': 'Service target',
'sensors': null,
},
'crawler': {
'id': 17,
'createDate': 1498794968791,
'name': 'JMX_CRAWLER',
'description': 'JMX',
},
'crawlerInputItems': null,
'itemCount': 4,
}],
},
'host': {
'id': 3,
'infraType': {
'id': 2,
'name': 'HOST',
'createDate': 1498379502894,
},
'createDate': 1503292801830,
'probe': {
'id': 1,
'status': {
'id': 1,
'name': 'INITIAL',
},
'description': 'snoop probe',
'createDate': 1503294511563,
'domain': {
'id': 1,
'name': "overFlow's domain",
'createDate': 1498443944866,
},
'probeKey': '899fdd145bcc11e7b611080027658d13',
'encryptionKey': '8c51fa9c5bcc11e7980a080027658d13',
'displayName': 'test probe 111111',
'cidr': '192.168.1.0/24',
'authorizeDate': 1503294511563,
'authorizeMember': {
'id': 1,
'email': 'overflow@loafle.com',
'name': 'overFlow',
'phone': '000-000-0000',
'companyName': 'loafle',
'createDate': 1498442847625,
'status': {
'id': 2,
'name': 'NORMAL',
},
'signinFailCount': 0,
},
'targets': null,
},
'target': {
'id': 3,
'createDate': 1501154289555,
'displayName': 'ghost target',
'description': 'Host target',
'sensors': [{
'id': 4,
'createDate': 1504581962738,
'description': 'HOST-WMI_CRAWLER',
'status': {
'id': 1,
'name': 'RUNNING',
},
'target': {
'id': 3,
'createDate': 1501154289555,
'displayName': 'ghost target',
'description': 'Host target',
'sensors': null,
},
'crawler': {
'id': 23,
'createDate': 1498794968791,
'name': 'WMI_CRAWLER',
'description': 'WMI',
},
'crawlerInputItems': null,
'itemCount': 1,
}],
},
'os': {
'id': 2,
'infraType': {
'id': 3,
'name': 'OS',
'createDate': 1498379502906,
},
'createDate': 1503288324883,
'probe': {
'id': 1,
'status': {
'id': 1,
'name': 'INITIAL',
},
'description': 'snoop probe',
'createDate': 1503294511563,
'domain': {
'id': 1,
'name': "overFlow's domain",
'createDate': 1498443944866,
},
'probeKey': '899fdd145bcc11e7b611080027658d13',
'encryptionKey': '8c51fa9c5bcc11e7980a080027658d13',
'displayName': 'test probe 111111',
'cidr': '192.168.1.0/24',
'authorizeDate': 1503294511563,
'authorizeMember': {
'id': 1,
'email': 'overflow@loafle.com',
'name': 'overFlow',
'phone': '000-000-0000',
'companyName': 'loafle',
'createDate': 1498442847625,
'status': {
'id': 2,
'name': 'NORMAL',
},
'signinFailCount': 0,
},
'targets': null,
},
'target': {
'id': 2,
'createDate': 1501154289555,
'displayName': 'ghost target',
'description': 'OS target',
'sensors': [],
},
'machine': {
'id': 1,
'infraType': {
'id': 1,
'name': 'MACHINE',
'createDate': 1498379502770,
},
'createDate': 1503287950244,
'probe': {
'id': 1,
'status': {
'id': 1,
'name': 'INITIAL',
},
'description': 'snoop probe',
'createDate': 1503294511563,
'domain': {
'id': 1,
'name': "overFlow's domain",
'createDate': 1498443944866,
},
'probeKey': '899fdd145bcc11e7b611080027658d13',
'encryptionKey': '8c51fa9c5bcc11e7980a080027658d13',
'displayName': 'test probe 111111',
'cidr': '192.168.1.0/24',
'authorizeDate': 1503294511563,
'authorizeMember': {
'id': 1,
'email': 'overflow@loafle.com',
'name': 'overFlow',
'phone': '000-000-0000',
'companyName': 'loafle',
'createDate': 1498442847625,
'status': {
'id': 2,
'name': 'NORMAL',
},
'signinFailCount': 0,
},
'targets': null,
},
'target': {
'id': 1,
'createDate': 1501154289555,
'displayName': 'ghost target',
'description': 'Machine Target',
'sensors': [{
'id': 1,
'createDate': 1498475947009,
'description': 'My sensor 11111',
'status': {
'id': 1,
'name': 'RUNNING',
},
'target': {
'id': 1,
'createDate': 1501154289555,
'displayName': 'ghost target',
'description': 'Machine Target',
'sensors': null,
},
'crawler': {
'id': 1,
'createDate': 1498794968791,
'name': 'ACTIVEDIRECTORY_CRAWLER',
'description': 'ACTIVEDIRECTORY',
},
'crawlerInputItems': null,
'itemCount': 3,
},
{
'id': 2,
'createDate': 1498475947074,
'description': 'My sensor 22222',
'status': {
'id': 2,
'name': 'STOPPED',
},
'target': {
'id': 1,
'createDate': 1501154289555,
'displayName': 'ghost target',
'description': 'Machine Target',
'sensors': null,
},
'crawler': {
'id': 1,
'createDate': 1498794968791,
'name': 'ACTIVEDIRECTORY_CRAWLER',
'description': 'ACTIVEDIRECTORY',
},
'crawlerInputItems': null,
'itemCount': 1,
}],
},
'meta': 'i am a infra machine',
},
'meta': '',
'vendor': {
'id': 24,
'name': 'UNKNOWN',
'createDate': 1501136812985,
'infraType': {
'id': 7,
'name': 'OS_SERVICE',
'createDate': 1498379502906,
},
},
},
'ip': 3232235980,
'mac': 8796753988883,
},
'portType': 'TCP',
'port': 80,
'vendor': {
'id': 24,
'name': 'UNKNOWN',
'createDate': 1501136812985,
'infraType': {
'id': 7,
'name': 'OS_SERVICE',
'createDate': 1498379502906,
},
},
'tlsType': false,
},
{
'id': 3,
'infraType': {
'id': 2,
'name': 'HOST',
'createDate': 1498379502894,
},
'createDate': 1503292801830,
'probe': {
'id': 1,
'status': {
'id': 1,
'name': 'INITIAL',
},
'description': 'snoop probe',
'createDate': 1503294511563,
'domain': {
'id': 1,
'name': "overFlow's domain",
'createDate': 1498443944866,
},
'probeKey': '899fdd145bcc11e7b611080027658d13',
'encryptionKey': '8c51fa9c5bcc11e7980a080027658d13',
'displayName': 'test probe 111111',
'cidr': '192.168.1.0/24',
'authorizeDate': 1503294511563,
'authorizeMember': {
'id': 1,
'email': 'overflow@loafle.com',
'name': 'overFlow',
'phone': '000-000-0000',
'companyName': 'loafle',
'createDate': 1498442847625,
'status': {
'id': 2,
'name': 'NORMAL',
},
'signinFailCount': 0,
},
'targets': null,
},
'target': {
'id': 3,
'createDate': 1501154289555,
'displayName': 'ghost target',
'description': 'Host target',
'sensors': [{
'id': 4,
'createDate': 1504581962738,
'description': 'HOST-WMI_CRAWLER',
'status': {
'id': 1,
'name': 'RUNNING',
},
'target': {
'id': 3,
'createDate': 1501154289555,
'displayName': 'ghost target',
'description': 'Host target',
'sensors': null,
},
'crawler': {
'id': 23,
'createDate': 1498794968791,
'name': 'WMI_CRAWLER',
'description': 'WMI',
},
'crawlerInputItems': null,
'itemCount': 1,
}],
},
'os': {
'id': 2,
'infraType': {
'id': 3,
'name': 'OS',
'createDate': 1498379502906,
},
'createDate': 1503288324883,
'probe': {
'id': 1,
'status': {
'id': 1,
'name': 'INITIAL',
},
'description': 'snoop probe',
'createDate': 1503294511563,
'domain': {
'id': 1,
'name': "overFlow's domain",
'createDate': 1498443944866,
},
'probeKey': '899fdd145bcc11e7b611080027658d13',
'encryptionKey': '8c51fa9c5bcc11e7980a080027658d13',
'displayName': 'test probe 111111',
'cidr': '192.168.1.0/24',
'authorizeDate': 1503294511563,
'authorizeMember': {
'id': 1,
'email': 'overflow@loafle.com',
'name': 'overFlow',
'phone': '000-000-0000',
'companyName': 'loafle',
'createDate': 1498442847625,
'status': {
'id': 2,
'name': 'NORMAL',
},
'signinFailCount': 0,
},
'targets': null,
},
'target': {
'id': 2,
'createDate': 1501154289555,
'displayName': 'ghost target',
'description': 'OS target',
'sensors': [],
},
'machine': {
'id': 1,
'infraType': {
'id': 1,
'name': 'MACHINE',
'createDate': 1498379502770,
},
'createDate': 1503287950244,
'probe': {
'id': 1,
'status': {
'id': 1,
'name': 'INITIAL',
},
'description': 'snoop probe',
'createDate': 1503294511563,
'domain': {
'id': 1,
'name': "overFlow's domain",
'createDate': 1498443944866,
},
'probeKey': '899fdd145bcc11e7b611080027658d13',
'encryptionKey': '8c51fa9c5bcc11e7980a080027658d13',
'displayName': 'test probe 111111',
'cidr': '192.168.1.0/24',
'authorizeDate': 1503294511563,
'authorizeMember': {
'id': 1,
'email': 'overflow@loafle.com',
'name': 'overFlow',
'phone': '000-000-0000',
'companyName': 'loafle',
'createDate': 1498442847625,
'status': {
'id': 2,
'name': 'NORMAL',
},
'signinFailCount': 0,
},
'targets': null,
},
'target': {
'id': 1,
'createDate': 1501154289555,
'displayName': 'ghost target',
'description': 'Machine Target',
'sensors': [{
'id': 1,
'createDate': 1498475947009,
'description': 'My sensor 11111',
'status': {
'id': 1,
'name': 'RUNNING',
},
'target': {
'id': 1,
'createDate': 1501154289555,
'displayName': 'ghost target',
'description': 'Machine Target',
'sensors': null,
},
'crawler': {
'id': 1,
'createDate': 1498794968791,
'name': 'ACTIVEDIRECTORY_CRAWLER',
'description': 'ACTIVEDIRECTORY',
},
'crawlerInputItems': null,
'itemCount': 3,
},
{
'id': 2,
'createDate': 1498475947074,
'description': 'My sensor 22222',
'status': {
'id': 2,
'name': 'STOPPED',
},
'target': {
'id': 1,
'createDate': 1501154289555,
'displayName': 'ghost target',
'description': 'Machine Target',
'sensors': null,
},
'crawler': {
'id': 1,
'createDate': 1498794968791,
'name': 'ACTIVEDIRECTORY_CRAWLER',
'description': 'ACTIVEDIRECTORY',
},
'crawlerInputItems': null,
'itemCount': 1,
}],
},
'meta': 'i am a infra machine',
},
'meta': '',
'vendor': {
'id': 24,
'name': 'UNKNOWN',
'createDate': 1501136812985,
'infraType': {
'id': 7,
'name': 'OS_SERVICE',
'createDate': 1498379502906,
},
},
},
'ip': 3232235980,
'mac': 8796753988883,
},
];