diff --git a/src/ts/@overflow/infra/react/components/infra_map_zone_table.tsx b/src/ts/@overflow/infra/react/components/infra_map_zone_table.tsx index 6a9f664..03d6bed 100644 --- a/src/ts/@overflow/infra/react/components/infra_map_zone_table.tsx +++ b/src/ts/@overflow/infra/react/components/infra_map_zone_table.tsx @@ -18,13 +18,13 @@ export type Props = StateProps & DispatchProps; export interface State { } + export class InfraMapZoneTable extends React.Component { constructor(props: Props, context: State) { super(props, context); this.state = { - selected: null, }; } diff --git a/src/ts/@overflow/infra/react/components/infra_map_zone_table_row.tsx b/src/ts/@overflow/infra/react/components/infra_map_zone_table_row.tsx index 9dc0613..afd2f7c 100644 --- a/src/ts/@overflow/infra/react/components/infra_map_zone_table_row.tsx +++ b/src/ts/@overflow/infra/react/components/infra_map_zone_table_row.tsx @@ -1,9 +1,9 @@ import * as React from 'react'; import { Table, Header, Container, Form, Checkbox, Button, Rating, - List, Icon, + List, Icon, ButtonProps, } from 'semantic-ui-react'; - +import {SensorConfigPopup} from '@overflow/sensor/react/components/sensor_config_popup'; export interface StateProps { } @@ -14,6 +14,7 @@ export interface DispatchProps { export type Props = StateProps & DispatchProps; export interface State { + sensorConfigStart: boolean; } export class InfraMapZoneTableRow extends React.Component { @@ -22,10 +23,22 @@ export class InfraMapZoneTableRow extends React.Component { super(props, context); this.state = { - selected: null, + sensorConfigStart: false, }; } + public openSensorConfig(event: React.MouseEvent, data: ButtonProps): void { + this.setState({ + sensorConfigStart: true, + }); + } + + public closeSensorConfig(): void { + this.setState({ + sensorConfigStart: false, + }); + } + public render(): JSX.Element { return ( @@ -53,11 +66,12 @@ export class InfraMapZoneTableRow extends React.Component { - + + ); } diff --git a/src/ts/@overflow/sensor/react/components/sensor_config_auth_crawler.tsx b/src/ts/@overflow/sensor/react/components/sensor_config_auth_crawler.tsx index 93c7085..3abdde5 100644 --- a/src/ts/@overflow/sensor/react/components/sensor_config_auth_crawler.tsx +++ b/src/ts/@overflow/sensor/react/components/sensor_config_auth_crawler.tsx @@ -2,12 +2,16 @@ import * as React from 'react'; import { Table, Header, Container, Form, Checkbox, Button, Rating, List, Icon, Radio, CheckboxProps, Input, InputOnChangeData, - Label, + Label, Segment, } from 'semantic-ui-react'; - +import * as _ from 'lodash'; +import MetaCrawler from '@overflow/meta/api/model/MetaCrawler'; +import MetaCrawlerInputItem from '@overflow/meta/api/model/MetaCrawlerInputItem'; export interface StateProps { + metaCrawler?: MetaCrawler; + metaCrawlerInputItemList?: Array; } export interface DispatchProps { @@ -16,6 +20,9 @@ export interface DispatchProps { export type Props = StateProps & DispatchProps; export interface State { + isVerifying: boolean; + authJson: any; + testMetaCrawlerInputItemList?: Array; } export class SensorConfigAuthCrawler extends React.Component { @@ -24,45 +31,383 @@ export class SensorConfigAuthCrawler extends React.Component { super(props, context); this.state = { + isVerifying: false, + authJson: {}, + testMetaCrawlerInputItemList: testMeta, }; } - public render(): JSX.Element { - return ( - - - - , data: InputOnChangeData) => { - {/* this.onChangeAuth(item.name, data.value); */ } - }} /> - - - , data: InputOnChangeData) => { - {/* this.onChangeAuth(item.name, data.value); */ } - }} /> - - - + public onChangeAuth = (key: string, data: string) => { + let newJson: any = _.clone(this.state.authJson); + newJson[key] = data; + this.setState({ authJson: newJson }); + + console.log(newJson); + } + + public handleVerify(): void { + this.setState({ + isVerifying: true, + }); + + // this.props.onVerifyCrawler(sd.infra.id, sd.crawler, sd.crawlerAuth); + + // let authCrawler: AuthCrawler = { + // crawler: { id: sd.crawler.id }, + // target: { id: sd.infra.target.id }, + // authJson: JSON.stringify(sd.crawlerAuth), + // }; + + // this.props.onRegistAuthCrawler(authCrawler); + } + + + public renderRow(item: MetaCrawlerInputItem, index: number): JSX.Element { + let elem = new Array(); + if (item.inputType.name === 'TEXT_TYPE') { + elem.push(, data: InputOnChangeData) => { + this.onChangeAuth(item.name, data.value); + }} />); + } else if (item.inputType.name === 'PASSWORD_TYPE') { + elem.push(, data: InputOnChangeData) => { + this.onChangeAuth(item.name, data.value); + }} />); + } else if (item.inputType.name === 'SELECT_TYPE') { + let itemValues = item.keyValue.split('|'); + let idx = 0; + elem.push(); + + if(this.state.authJson[item.name] === undefined) { + // this.onChangeAuth(item.name, item.defaultValue); + } + + for (let itemValue of itemValues) { + elem.push( , data: CheckboxProps) => { {/* this.onChangeAuth(item.name, itemValue); */} } } - /> - - - + />); + } + } + + return ( + + {item.keyName} + + {elem} + + + ); + } + + public renderAuth(): JSX.Element[] { + + let mciil: Array = this.state.testMetaCrawlerInputItemList; + + if (mciil === undefined) { + return null; + } + + let elements: Array = new Array(); + let elem: JSX.Element; + for (let index: number = 0; index < mciil.length; ++index) { + elem = this.renderRow(mciil[index], index); + elements.push(elem); + } + + return elements; + } + + + public render(): JSX.Element { + return ( + + + + + {this.props.metaCrawler} 접속 정보 + + + + + {this.renderAuth()} + + + + + + {/*loading={this.state.isVerifying}*/} + + + + +
+
); } } + + + +const testMeta: any[] = [ + { + 'id' : 1, + 'create_date' : '2017-06-25T08:01:00Z', + 'default_value' : 'Loafle', + 'description' : 'Windows Account ID', + 'keyName' : '', + 'keyValue' : '', + 'name' : 'ID', + 'pattern' : '', + 'required' : true, + 'crawler_id' : 23, + 'type_id' : 1, + 'inputType' : { + 'id' : 1, + 'create_date' : '2017-06-25T08:00:53Z', + 'description' : 'TEXT', + 'name' : 'TEXT_TYPE', + }, + }, + { + 'id' : 2, + 'create_date' : '2017-06-25T08:01:00Z', + 'default_value' : '', + 'description' : 'Windows Account PW', + 'keyName' : '', + 'keyValue' : '', + 'name' : 'PassWord', + 'pattern' : '', + 'required' : true, + 'crawler_id' : 23, + 'type_id' : 2, + 'inputType' : { + 'id' : 2, + 'create_date' : '2017-06-25T08:00:53Z', + 'description' : 'PASSWORD', + 'name' : 'PASSWORD_TYPE', + }, + }, + { + 'id' : 3, + 'create_date' : '2017-06-25T08:01:00Z', + 'default_value' : 'public', + 'description' : 'SNMP V2 Community', + 'keyName' : '', + 'keyValue' : '', + 'name' : 'Community', + 'pattern' : '', + 'required' : true, + 'crawler_id' : 20, + 'type_id' : 1, + 'inputType' : { + 'id' : 1, + 'create_date' : '2017-06-25T08:00:53Z', + 'description' : 'TEXT', + 'name' : 'TEXT_TYPE', + }, + }, + { + 'id' : 4, + 'create_date' : '2017-06-25T08:01:00Z', + 'default_value' : 'mysqldb', + 'description' : 'MYSQL DB Name', + 'keyName' : '', + 'keyValue' : '', + 'name' : 'DB Name', + 'pattern' : '', + 'required' : true, + 'crawler_id' : 11, + 'type_id' : 1, + 'inputType' : { + 'id' : 1, + 'create_date' : '2017-06-25T08:00:53Z', + 'description' : 'TEXT', + 'name' : 'TEXT_TYPE', + }, + }, + { + 'id' : 5, + 'create_date' : '2017-06-25T08:01:00Z', + 'default_value' : 'Loafle', + 'description' : 'MYSQL Account ID', + 'keyName' : '', + 'keyValue' : '', + 'name' : 'ID', + 'pattern' : '', + 'required' : true, + 'crawler_id' : 11, + 'type_id' : 1, + 'inputType' : { + 'id' : 1, + 'create_date' : '2017-06-25T08:00:53Z', + 'description' : 'TEXT', + 'name' : 'TEXT_TYPE', + }, + }, + { + 'id' : 6, + 'create_date' : '2017-06-25T08:01:00Z', + 'default_value' : '', + 'description' : 'MYSQL Account PW', + 'keyName' : '', + 'keyValue' : '', + 'name' : 'PassWord', + 'pattern' : '', + 'required' : true, + 'crawler_id' : 11, + 'type_id' : 2, + 'inputType' : { + 'id' : 2, + 'create_date' : '2017-06-25T08:00:53Z', + 'description' : 'PASSWORD', + 'name' : 'PASSWORD_TYPE', + }, + }, + { + 'id' : 7, + 'create_date' : '2017-06-25T08:01:00Z', + 'default_value' : 'Loafle', + 'description' : 'JMX Account ID', + 'keyName' : '', + 'keyValue' : '', + 'name' : 'ID', + 'pattern' : '', + 'required' : true, + 'crawler_id' : 17, + 'type_id' : 1, + 'inputType' : { + 'id' : 1, + 'create_date' : '2017-06-25T08:00:53Z', + 'description' : 'TEXT', + 'name' : 'TEXT_TYPE', + }, + }, + { + 'id' : 8, + 'create_date' : '2017-06-25T08:01:00Z', + 'default_value' : '', + 'description' : 'JMX Account PW', + 'keyName' : '', + 'keyValue' : '', + 'name' : 'PassWord', + 'pattern' : '', + 'required' : true, + 'crawler_id' : 17, + 'type_id' : 2, + 'inputType' : { + 'id' : 2, + 'create_date' : '2017-06-25T08:00:53Z', + 'description' : 'PASSWORD', + 'name' : 'PASSWORD_TYPE', + }, + }, + { + 'id' : 9, + 'create_date' : '2017-09-11T09:41:00Z', + 'default_value' : 'MD5', + 'description' : 'SNMP V3 Auth Type', + 'keyName' : '', + 'keyValue' : 'MD5|SHA', + 'name' : 'AuthType', + 'pattern' : '', + 'required' : true, + 'crawler_id' : 25, + 'type_id' : 5, + 'inputType' : { + 'id' : 5, + 'create_date' : '2017-06-25T08:00:53Z', + 'description' : 'SELECT', + 'name' : 'SELECT_TYPE', + }, + }, + { + 'id' : 10, + 'create_date' : '2017-09-11T09:41:00Z', + 'default_value' : 'Loafle', + 'description' : 'SNMP V3 User ID', + 'keyName' : '', + 'keyValue' : '', + 'name' : 'ID', + 'pattern' : '', + 'required' : true, + 'crawler_id' : 25, + 'type_id' : 1, + 'inputType' : { + 'id' : 1, + 'create_date' : '2017-06-25T08:00:53Z', + 'description' : 'TEXT', + 'name' : 'TEXT_TYPE', + }, + }, + { + 'id' : 11, + 'create_date' : '2017-09-11T09:41:00Z', + 'default_value' : '', + 'description' : 'SNMP V3 PassWord', + 'keyName' : '', + 'keyValue' : '', + 'name' : 'PassWord', + 'pattern' : '', + 'required' : true, + 'crawler_id' : 25, + 'type_id' : 2, + 'inputType' : { + 'id' : 2, + 'create_date' : '2017-06-25T08:00:53Z', + 'description' : 'PASSWORD', + 'name' : 'PASSWORD_TYPE', + }, + }, + { + 'id' : 12, + 'create_date' : '2017-09-11T09:41:00Z', + 'default_value' : 'DES', + 'description' : 'SNMP V3 Encryption Type', + 'keyName' : '', + 'keyValue' : 'DES|AES', + 'name' : 'Encryption Type', + 'pattern' : '', + 'required' : true, + 'crawler_id' : 25, + 'type_id' : 5, + 'inputType' : { + 'id' : 5, + 'create_date' : '2017-06-25T08:00:53Z', + 'description' : 'SELECT', + 'name' : 'SELECT_TYPE', + }, + }, + { + 'id' : 13, + 'create_date' : '2017-09-11T09:41:00Z', + 'default_value' : 'Loafle', + 'description' : 'SNMP V3 Encryption Key', + 'keyName' : '', + 'keyValue' : '', + 'name' : 'Encryption Key', + 'pattern' : '', + 'required' : true, + 'crawler_id' : 25, + 'type_id' : 1, + 'inputType' : { + 'id' : 1, + 'create_date' : '2017-06-25T08:00:53Z', + 'description' : 'TEXT', + 'name' : 'TEXT_TYPE', + }, + }, +]; diff --git a/src/ts/@overflow/sensor/react/components/sensor_config_crawler.tsx b/src/ts/@overflow/sensor/react/components/sensor_config_crawler.tsx index 3bee240..26cbf13 100644 --- a/src/ts/@overflow/sensor/react/components/sensor_config_crawler.tsx +++ b/src/ts/@overflow/sensor/react/components/sensor_config_crawler.tsx @@ -3,10 +3,12 @@ import { Table, Header, Container, Form, Checkbox, Button, Rating, List, Icon, Radio, CheckboxProps, } from 'semantic-ui-react'; +import MetaCrawler from '@overflow/meta/api/model/MetaCrawler'; export interface StateProps { + metaCrawlerList?: Array; } export interface DispatchProps { @@ -15,7 +17,8 @@ export interface DispatchProps { export type Props = StateProps & DispatchProps; export interface State { - selectedValue: number|string; + selectedValue: number | string; + testMetaCrawlerList: Array; } export class SensorConfigCrawler extends React.Component { @@ -25,6 +28,7 @@ export class SensorConfigCrawler extends React.Component { this.state = { selectedValue: null, + testMetaCrawlerList: testMetaCrawler, }; } @@ -33,34 +37,194 @@ export class SensorConfigCrawler extends React.Component { } + public renderCrawler(): JSX.Element[] { + + let mcl: Array = this.state.testMetaCrawlerList; + + + let elems: JSX.Element[] = new Array(); + + let mc: MetaCrawler = null; + for(let idx: number = 0; idx < mcl.length; idx++) { + mc = mcl[idx]; + + elems.push( + + + , + ); + } + + return elems; + } + public render(): JSX.Element { return ( - -
+ Selected Crawler : {this.state.selectedValue} - - - - - - + {this.renderCrawler()}
-
); } } + + +const testMetaCrawler: any[] = [{ + 'id': 1, + 'createDate': 1498794968791, + 'name': 'ACTIVEDIRECTORY_CRAWLER', + 'description': 'ACTIVEDIRECTORY', +}, +{ + 'id': 2, + 'createDate': 1498794968791, + 'name': 'CASSANDRA_CRAWLER', + 'description': 'CASSANDRA', +}, +{ + 'id': 3, + 'createDate': 1498794968791, + 'name': 'DHCP_CRAWLER', + 'description': 'DHCP', +}, +{ + 'id': 4, + 'createDate': 1498794968791, + 'name': 'DNS_CRAWLER', + 'description': 'DNS', +}, +{ + 'id': 5, + 'createDate': 1498794968791, + 'name': 'FTP_CRAWLER', + 'description': 'FTP', +}, +{ + 'id': 6, + 'createDate': 1498794968791, + 'name': 'HTTP_CRAWLER', + 'description': 'HTTP', +}, +{ + 'id': 7, + 'createDate': 1498794968791, + 'name': 'IMAP_CRAWLER', + 'description': 'IMAP', +}, +{ + 'id': 8, + 'createDate': 1498794968791, + 'name': 'LDAP_CRAWLER', + 'description': 'LDAP', +}, +{ + 'id': 9, + 'createDate': 1498794968791, + 'name': 'MONGODB_CRAWLER', + 'description': 'MONGODB', +}, +{ + 'id': 10, + 'createDate': 1498794968791, + 'name': 'MSSQL_CRAWLER', + 'description': 'MSSQL', +}, +{ + 'id': 11, + 'createDate': 1498794968791, + 'name': 'MYSQL_CRAWLER', + 'description': 'MYSQL', +}, +{ + 'id': 12, + 'createDate': 1498794968791, + 'name': 'NETBIOS_CRAWLER', + 'description': 'NETBIOS', +}, +{ + 'id': 13, + 'createDate': 1498794968791, + 'name': 'ORACLE_CRAWLER', + 'description': 'ORACLE', +}, +{ + 'id': 14, + 'createDate': 1498794968791, + 'name': 'POP_CRAWLER', + 'description': 'POP', +}, +{ + 'id': 15, + 'createDate': 1498794968791, + 'name': 'POSTGRESQL_CRAWLER', + 'description': 'POSTGRESQL', +}, +{ + 'id': 16, + 'createDate': 1498794968791, + 'name': 'REDIS_CRAWLER', + 'description': 'REDIS', +}, +{ + 'id': 17, + 'createDate': 1498794968791, + 'name': 'JMX_CRAWLER', + 'description': 'JMX', +}, +{ + 'id': 18, + 'createDate': 1498794968791, + 'name': 'SMB_CRAWLER', + 'description': 'SMB', +}, +{ + 'id': 19, + 'createDate': 1498794968791, + 'name': 'SMTP_CRAWLER', + 'description': 'SMTP', +}, +{ + 'id': 20, + 'createDate': 1498794968791, + 'name': 'SNMP_CRAWLER', + 'description': 'SNMP', +}, +{ + 'id': 21, + 'createDate': 1498794968791, + 'name': 'SSH_CRAWLER', + 'description': 'SSH', +}, +{ + 'id': 22, + 'createDate': 1498794968791, + 'name': 'TELNET_CRAWLER', + 'description': 'TELNET', +}, +{ + 'id': 23, + 'createDate': 1498794968791, + 'name': 'WMI_CRAWLER', + 'description': 'WMI', +}, +{ + 'id': 24, + 'createDate': 1498794968791, + 'name': 'UNKNOWN_CRAWLER', + 'description': 'UNKNOWN', +}, +{ + 'id': 25, + 'createDate': 1498794968791, + 'name': 'SNMPV3_CRAWLER', + 'description': 'SNMP V3', +}]; diff --git a/src/ts/@overflow/sensor/react/components/sensor_config_popup.tsx b/src/ts/@overflow/sensor/react/components/sensor_config_popup.tsx new file mode 100644 index 0000000..a8d14e9 --- /dev/null +++ b/src/ts/@overflow/sensor/react/components/sensor_config_popup.tsx @@ -0,0 +1,73 @@ +import * as React from 'react'; +import { + Table, Header, Container, Form, Checkbox, Button, Rating, + List, Icon, Grid, Modal, +} from 'semantic-ui-react'; +import {SensorConfig} from './sensor_config'; + +export interface StateProps { + open?: boolean; + closeCallback?(): void; +} + +export interface DispatchProps { +} + +export type Props = StateProps & DispatchProps; + +export interface State { + startPopup: boolean; +} + +export class SensorConfigPopup extends React.Component { + + constructor(props: Props, context: State) { + super(props, context); + + this.state = { + startPopup: false, + }; + } + + public handlePopupClose = () => { + this.props.closeCallback(); + } + + // public handleCancel = () => this.setState({ startPopup: false }); + + public handleSubmit(): void { + this.setState({ startPopup: false }); + } + + public render(): JSX.Element { + return ( + + + +
Discovery Details
+
+ + + Discovery + + + + + + + + + +
+
+ + + {/* */} + +
+ ); + } + +}