added discovery result

This commit is contained in:
snoop 2017-08-22 21:09:23 +09:00
parent 11c538ff8b
commit c53bc7961c
7 changed files with 75 additions and 9 deletions

View File

@ -33,6 +33,8 @@ import CrawlerAuthInputsReducer from '@overflow/meta/redux/reducer/crawler_auth_
import MetaSensorItemReadAllReducer from '@overflow/meta/redux/reducer/sensor_item_read_all';
import MetaSensorItemTypeReadAllReducer from '@overflow/meta/redux/reducer/sensor_item_type_read_all';
import DiscoveryInfraTargetRegistAllReducer from '@overflow/discovery/redux/reducer/infra_target_regist_all';
import AsyncRequest from '@overflow/app/redux/saga/AsyncRequest';
// Container Configuration
@ -91,6 +93,7 @@ const reduxConfig: ReduxConfig = {
noauthAcceptReducer,
noauthDenyReducer,
modifyProbeReducer,
DiscoveryInfraTargetRegistAllReducer,
],
sagaWatchers: [
AsyncRequest,

View File

@ -5,7 +5,7 @@ interface DiscoveryStartInfo {
excludeIp: string;
startPort: string;
endPort: string;
selectedServices: Array<number | string>;
services: Array<number | string>;
}
export default DiscoveryStartInfo;

View File

@ -5,6 +5,11 @@ import {
DispatchProps as DiscoveryDispatchProps,
} from './components/Discovery';
import Host from '@overflow/discovery/api/model/Host';
import Probe from '@overflow/probe/api/model/Probe';
import * as InfraTargetRegistAllActionTypes from '../redux/action/infra_target_regist_all';
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
export function mapStateToProps(state: any, props: any): DiscoveryStateProps {
return {
@ -14,7 +19,6 @@ export function mapStateToProps(state: any, props: any): DiscoveryStateProps {
export function mapDispatchToProps(dispatch: Dispatch<any>): DiscoveryDispatchProps {
return {
};
}

View File

@ -16,6 +16,7 @@ import * as asyncRequestActions from '@overflow/commons/redux/action/asyncReques
export function mapStateToProps(state: any, props: any): DiscoveryTreeStateProps {
return {
probeId: props.probeId,
isSuccess: state.isSuccess,
};
}

View File

@ -11,12 +11,14 @@ import DiscoveryTableContainer from '../DiscoveryTable';
import DiscoveryTreeContainer from '../DiscoveryTree';
import Probe from '@overflow/probe/api/model/Probe';
import Host from '@overflow/discovery/api/model/Host';
export interface StateProps {
probeId?: Number;
}
export interface DispatchProps {
}
export type Props = StateProps & DispatchProps;
@ -74,6 +76,10 @@ export class Discovery extends React.Component<Props, State> {
console.log(this.submitData);
}
// public onPropsCreateTarget = (hosts: Host[], probe: Probe) => {
// this.props.onCreateTarget(hosts, probe);
// }
public handleCancel= () => this.setState({ startPopup: false });
public handlePopupClose = () => this.setState({ startPopup: false });
@ -90,7 +96,7 @@ export class Discovery extends React.Component<Props, State> {
<Modal.Header>Discovery</Modal.Header>
<Modal.Content >
{/*<Checkbox label='IP' />*/}
<DiscoveryTreeContainer probeId={this.props.probeId}/>
<DiscoveryTreeContainer probeId={this.props.probeId} />
</Modal.Content>
<Modal.Actions>
<Button onClick={this.handleCancel}> Cancel </Button>

View File

@ -25,10 +25,11 @@ import * as Utils from '@overflow/commons/util/Utils';
export interface DiscoveryTreeStateProps {
probeId: number;
isSuccess: boolean;
}
export interface DiscoveryTreeDispatchProps {
onCreateTarget?(hosts: Host[], probe: Probe): void;
onCreateTarget?(hosts: Host[], probe: Probe): void;
}
export type DiscoveryTreeProps = DiscoveryTreeStateProps & DiscoveryTreeDispatchProps;
@ -64,7 +65,7 @@ export class DiscoveryTree extends React.Component<DiscoveryTreeProps, Discovery
this.selectedHostState = new Map;
this.selectedPortState = new Map;
this.selectedServiceState = new Map;
this.discoveryHosts = hostListJson;
this.discoveryHosts = hostListJsonMini;
// fs.readFile('../../../../../dh.json', this.handlJSONFile);
}
@ -198,6 +199,10 @@ export class DiscoveryTree extends React.Component<DiscoveryTreeProps, Discovery
public render(): JSX.Element {
if(this.props.isSuccess !== undefined) {
alert('infra created');
}
return (
<Container fluid>
<List selection>
@ -227,7 +232,8 @@ export class DiscoveryTree extends React.Component<DiscoveryTreeProps, Discovery
const hostListJson: any = [{
const hostListJson: any = [
{
'firstScanRange': 1,
'lastScanRange': 10000,
'name': '',
@ -401,4 +407,46 @@ const hostListJson: any = [{
];
const jsonData = hostListJson;
const hostListJsonMini: any = [
{
'firstScanRange': 1,
'lastScanRange': 10000,
'name': '',
'ip': 3232235797,
'mac': 91754662913,
'os': 'Windows',
'target': true,
'ports': [
{
'createDate': -62135596800000,
'updateDate': -62135596800000,
'services': [{
'createDate': -62135596800000,
'updateDate': -62135596800000,
'portType': 'TCP',
'serviceName': 'HTTP',
}],
'portType': 'TCP',
'portNumber': 3343,
},
{
'createDate': -62135596800000,
'updateDate': -62135596800000,
'services': [{
'createDate': -62135596800000,
'updateDate': -62135596800000,
'portType': 'TCP',
'serviceName': 'HTTP',
}],
'portType': 'TCP',
'portNumber': 443,
}],
'createDate': 1498470178000,
'updateDate': 1498470178000,
},
];

View File

@ -5,7 +5,8 @@ import Infra from '@overflow/infra/api/model/Infra';
import Probe from '@overflow/probe/api/model/Probe';
import Domain from '@overflow/domain/api/model/Domain';
import { ListContainer } from '@overflow/commons/react/component/ListContainer';
import DiscoveryContainer from '../../../discovery/react/Discovery';
import DiscoveryContainer from '@overflow/discovery/react/Discovery';
import Host from '@overflow/discovery/api/model/Host';
import * as Utils from '@overflow/commons/util/Utils';
@ -14,6 +15,9 @@ export interface StateProps {
infraList?: Infra[];
}
export interface DispatchProps {
onReadAllByProbe?(probe: Probe): void;
onReadAllByDomain?(domain: Domain): void;
@ -133,7 +137,7 @@ export class TargetList extends React.Component<Props, State> {
{/*Adding a Target*/}
{/*</Modal.Header>*/}
<Modal.Content>
<DiscoveryContainer probeId={Number(this.props.probeId)}/>
<DiscoveryContainer probeId={1}/>
</Modal.Content>
<Modal.Actions>
<Button onClick={() => this.setState({ openAddTarget: false })}>Cancel</Button>