Discovery
This commit is contained in:
parent
d4ea194612
commit
bd89cfdae6
|
@ -13,12 +13,19 @@ import * as asyncRequestActions from '@overflow/commons/redux/action/asyncReques
|
|||
|
||||
export function mapStateToProps(state: any, props: any): DiscoveryStateProps {
|
||||
return {
|
||||
probeId: props.probeId,
|
||||
// probeId: props.probeId,
|
||||
isSuccess: state.isSuccess,
|
||||
// onRefreshList: props.onRefreshList,
|
||||
};
|
||||
}
|
||||
|
||||
export function mapDispatchToProps(dispatch: Dispatch<any>): DiscoveryDispatchProps {
|
||||
return {
|
||||
onCreateTarget: (hosts: Host[], probe: Probe) => {
|
||||
console.log('hosts size : ' + JSON.stringify(hosts).length);
|
||||
dispatch(asyncRequestActions.request('TargetDiscoveryService', 'saveAllTarget',
|
||||
InfraTargetRegistAllActionTypes.REQUEST, JSON.stringify(hosts), JSON.stringify(probe)));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -16,16 +16,13 @@ import * as asyncRequestActions from '@overflow/commons/redux/action/asyncReques
|
|||
export function mapStateToProps(state: any, props: any): DiscoveryTreeStateProps {
|
||||
return {
|
||||
probeId: props.probeId,
|
||||
isSuccess: state.isSuccess,
|
||||
onSetTargetList: props.onSetTargetList,
|
||||
};
|
||||
}
|
||||
|
||||
export function mapDispatchToProps(dispatch: Dispatch<any>): DiscoveryTreeDispatchProps {
|
||||
return {
|
||||
onCreateTarget: (hosts: Host[], probe: Probe) => {
|
||||
dispatch(asyncRequestActions.request('TargetDiscoveryService', 'saveAllTarget',
|
||||
InfraTargetRegistAllActionTypes.REQUEST, JSON.stringify(hosts), JSON.stringify(probe)));
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -15,96 +15,101 @@ import Host from '@overflow/discovery/api/model/Host';
|
|||
|
||||
export interface StateProps {
|
||||
probeId?: Number;
|
||||
open?: boolean;
|
||||
isSuccess?: boolean;
|
||||
onClosePopup?(bool: boolean): void;
|
||||
onRefreshList?(): void;
|
||||
}
|
||||
|
||||
export interface DispatchProps {
|
||||
|
||||
onCreateTarget?(hosts: Host[], probe: Probe): void;
|
||||
}
|
||||
|
||||
export type Props = StateProps & DispatchProps;
|
||||
|
||||
export interface State {
|
||||
startPopup:boolean;
|
||||
probeTemp: any;
|
||||
startPopup: boolean;
|
||||
// probeTemp: any;
|
||||
}
|
||||
|
||||
const probeTemp:Object = {
|
||||
'id': '11',
|
||||
'metaProbeStatus': {
|
||||
'name': 'STARTED',
|
||||
},
|
||||
'domain': {
|
||||
'name': 'overFlow\'s domain111',
|
||||
},
|
||||
'host': {
|
||||
'ip': '192.168.1.103',
|
||||
'mac': '44:8a:5b:44:8c:e8',
|
||||
'os': 'Ubuntu 17.04',
|
||||
'name': '?????',
|
||||
},
|
||||
'createAt': '2017-07-12',
|
||||
'probeKey': 'AGBLKDFJ2452ASDGFL2KWJLKSDJ',
|
||||
'description': 'description1111111111',
|
||||
'lastPollingAt': '2017-07-12 14:20',
|
||||
'nextPollingAt': '2017-07-12 14:30',
|
||||
};
|
||||
|
||||
export class Discovery extends React.Component<Props, State> {
|
||||
|
||||
private submitData: any;
|
||||
private discoveryHosts: Array<Host>;
|
||||
|
||||
public constructor(props: Props, context: State) {
|
||||
super(props, context);
|
||||
this.handleProbeChange.bind(this);
|
||||
this.state = {
|
||||
startPopup:false,
|
||||
probeTemp:null,
|
||||
startPopup: false,
|
||||
};
|
||||
}
|
||||
|
||||
public componentWillMount():void {
|
||||
this.setState({probeTemp:probeTemp});
|
||||
public componentWillMount(): void {
|
||||
// this.setState({probeTemp:probeTemp});
|
||||
}
|
||||
|
||||
public componentWillReceiveProps?(nextProps: Readonly<Props>, nextContext: any): void {
|
||||
if (this.props.isSuccess === undefined || this.props.isSuccess === false) {
|
||||
if (nextProps.isSuccess === true) {
|
||||
// this.props.onClosePopup(false);
|
||||
this.props.onRefreshList();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public handleProbeChange(obj: Object): void {
|
||||
console.log(obj);
|
||||
this.setState({ startPopup:true });
|
||||
this.submitData = obj;
|
||||
this.setState({ startPopup: true });
|
||||
// this.submitData = obj;
|
||||
}
|
||||
|
||||
public handleSubmit(): void {
|
||||
console.log(this.submitData);
|
||||
// console.log(this.discoveryHosts);
|
||||
this.setState({startPopup:false});
|
||||
this.props.onCreateTarget(this.discoveryHosts, { id: Number(this.props.probeId) });
|
||||
}
|
||||
|
||||
// public onPropsCreateTarget = (hosts: Host[], probe: Probe) => {
|
||||
// this.props.onCreateTarget(hosts, probe);
|
||||
// }
|
||||
public onSetTargetList = (discoveryHosts: Array<Host>) => {
|
||||
this.discoveryHosts = discoveryHosts;
|
||||
}
|
||||
|
||||
public handleCancel= () => this.setState({ startPopup: false });
|
||||
public handleCancel = () => this.setState({ startPopup: false });
|
||||
|
||||
public handlePopupClose = () => this.setState({ startPopup: false });
|
||||
|
||||
public render(): JSX.Element {
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<Container fluid>
|
||||
<Header as='h3' dividing> Discovery Details</Header>
|
||||
{/*<DiscoveryProbe probe={this.state.probeTemp}/>*/}
|
||||
<br />
|
||||
<DiscoveryTableContainer onProbeChange={this.handleProbeChange.bind(this)} />
|
||||
<Modal
|
||||
open={this.props.open}
|
||||
>
|
||||
<Modal.Content>
|
||||
<Container fluid>
|
||||
<Header as='h3' dividing> Discovery Details</Header>
|
||||
<br />
|
||||
<DiscoveryTableContainer onProbeChange={this.handleProbeChange.bind(this)} />
|
||||
|
||||
<Modal size='small' open={this.state.startPopup} onClose={this.handlePopupClose}>
|
||||
<Modal.Header>Discovery</Modal.Header>
|
||||
<Modal.Content >
|
||||
{/*<Checkbox label='IP' />*/}
|
||||
<DiscoveryTreeContainer probeId={this.props.probeId} />
|
||||
</Modal.Content>
|
||||
<Modal.Actions>
|
||||
<Button onClick={this.handleCancel}> Cancel </Button>
|
||||
<Button onClick={this.handleSubmit.bind(this)} primary> Submit </Button>
|
||||
</Modal.Actions>
|
||||
</Modal>
|
||||
<Modal size='small' open={this.state.startPopup} onClose={this.handlePopupClose}>
|
||||
<Modal.Header>Discovery</Modal.Header>
|
||||
<Modal.Content >
|
||||
<DiscoveryTreeContainer probeId={this.props.probeId} onSetTargetList={this.onSetTargetList.bind(this)} />
|
||||
</Modal.Content>
|
||||
<Modal.Actions>
|
||||
<Button onClick={this.handleCancel}> Cancel </Button>
|
||||
<Button onClick={this.handleSubmit.bind(this)} primary> Submit </Button>
|
||||
</Modal.Actions>
|
||||
</Modal>
|
||||
|
||||
</Container>
|
||||
</Modal.Content>
|
||||
<Modal.Actions>
|
||||
<Button onClick={() => this.props.onClosePopup(false)}>Cancel</Button>
|
||||
<Button primary >Done</Button>
|
||||
</Modal.Actions>
|
||||
</Modal>
|
||||
|
||||
</Container>
|
||||
|
||||
);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
Container,
|
||||
Label,
|
||||
Accordion,
|
||||
Icon,
|
||||
Icon, Header,
|
||||
List, Button,
|
||||
ListItemProps,
|
||||
CheckboxProps,
|
||||
|
@ -25,11 +25,11 @@ import * as Utils from '@overflow/commons/util/Utils';
|
|||
|
||||
export interface DiscoveryTreeStateProps {
|
||||
probeId: number;
|
||||
isSuccess: boolean;
|
||||
onSetTargetList(discoveryHosts: Array<Host>): void;
|
||||
}
|
||||
|
||||
export interface DiscoveryTreeDispatchProps {
|
||||
onCreateTarget?(hosts: Host[], probe: Probe): void;
|
||||
|
||||
}
|
||||
|
||||
export type DiscoveryTreeProps = DiscoveryTreeStateProps & DiscoveryTreeDispatchProps;
|
||||
|
@ -65,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 = hostListJsonMini;
|
||||
this.discoveryHosts = hostListJson;
|
||||
// fs.readFile('../../../../../dh.json', this.handlJSONFile);
|
||||
}
|
||||
|
||||
|
@ -94,11 +94,11 @@ export class DiscoveryTree extends React.Component<DiscoveryTreeProps, Discovery
|
|||
// } else {
|
||||
// delete selectedMap[key];
|
||||
// }
|
||||
if(stateKey !== 'checkPortState') {
|
||||
if (stateKey !== 'checkPortState') {
|
||||
let checkObj: any = selectedObj;
|
||||
checkObj.target = checkProps.checked;
|
||||
}
|
||||
|
||||
this.props.onSetTargetList(this.discoveryHosts);
|
||||
// if(selectedObj instanceof Host) {
|
||||
// console.log(selectedObj);
|
||||
// }
|
||||
|
@ -199,21 +199,12 @@ export class DiscoveryTree extends React.Component<DiscoveryTreeProps, Discovery
|
|||
|
||||
public render(): JSX.Element {
|
||||
|
||||
if(this.props.isSuccess !== undefined) {
|
||||
alert('infra created');
|
||||
}
|
||||
|
||||
return (
|
||||
<Container fluid>
|
||||
{/*<Header as='h3' dividing> Discovery Result</Header>*/}
|
||||
<List selection>
|
||||
{this.renderDiscovery()}
|
||||
</List>
|
||||
<Button primary floated='right' onClick={() => {
|
||||
this.props.onCreateTarget(this.discoveryHosts, {id: this.props.probeId});
|
||||
{/*console.log(this.selectedHostState);
|
||||
console.log(this.selectedPortState);
|
||||
console.log(this.selectedServiceState);*/}
|
||||
}}>Test</Button><br /><br />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
@ -234,53 +225,223 @@ export class DiscoveryTree extends React.Component<DiscoveryTreeProps, Discovery
|
|||
|
||||
const hostListJson: any = [
|
||||
{
|
||||
'firstScanRange': 1,
|
||||
'lastScanRange': 10000,
|
||||
'name': '',
|
||||
'ip': 3232235818,
|
||||
'mac': 91754662925,
|
||||
'os': 'Windows',
|
||||
'ports': [{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'services': [{
|
||||
'firstScanRange': 1,
|
||||
'lastScanRange': 10000,
|
||||
'name': '',
|
||||
'ip': 3232235818,
|
||||
'mac': 91754662925,
|
||||
'os': 'Windows',
|
||||
'ports': [{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'services': [{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'portType': 'TCP',
|
||||
'serviceName': 'SSH',
|
||||
'target': true,
|
||||
}],
|
||||
'portType': 'TCP',
|
||||
'serviceName': 'SSH',
|
||||
'target': true,
|
||||
'portNumber': 22,
|
||||
},
|
||||
{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'services': [{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'portType': 'TCP',
|
||||
'serviceName': 'HTTP',
|
||||
}],
|
||||
'portType': 'TCP',
|
||||
'portNumber': 443,
|
||||
},
|
||||
{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'services': [{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'portType': 'TCP',
|
||||
'serviceName': 'HTTP',
|
||||
}],
|
||||
'portType': 'TCP',
|
||||
'portNumber': 80,
|
||||
}],
|
||||
'portType': 'TCP',
|
||||
'portNumber': 22,
|
||||
'createDate': 1498470178000,
|
||||
'updateDate': 1498470178000,
|
||||
},
|
||||
{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'services': [{
|
||||
'firstScanRange': 1,
|
||||
'lastScanRange': 10000,
|
||||
'name': '',
|
||||
'ip': 3232235781,
|
||||
'mac': 91754660625,
|
||||
'os': 'Windows',
|
||||
'ports': [{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'services': [{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'portType': 'TCP',
|
||||
'serviceName': 'SSH',
|
||||
}],
|
||||
'portType': 'TCP',
|
||||
'serviceName': 'HTTP',
|
||||
'portNumber': 22,
|
||||
},
|
||||
{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'services': [{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'portType': 'TCP',
|
||||
'serviceName': 'HTTP',
|
||||
}],
|
||||
'portType': 'TCP',
|
||||
'portNumber': 80,
|
||||
},
|
||||
{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'services': [{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'portType': 'TCP',
|
||||
'serviceName': 'HTTP',
|
||||
}],
|
||||
'portType': 'TCP',
|
||||
'portNumber': 1936,
|
||||
},
|
||||
{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'services': null,
|
||||
'portType': 'TCP',
|
||||
'portNumber': 443,
|
||||
}],
|
||||
'portType': 'TCP',
|
||||
'portNumber': 443,
|
||||
'createDate': 1498470178000,
|
||||
'updateDate': 1498470178000,
|
||||
},
|
||||
{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'services': [{
|
||||
'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',
|
||||
'serviceName': 'HTTP',
|
||||
'portNumber': 80,
|
||||
},
|
||||
{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'services': [{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'portType': 'TCP',
|
||||
'serviceName': 'SSH',
|
||||
}],
|
||||
'portType': 'TCP',
|
||||
'portNumber': 22,
|
||||
},
|
||||
{
|
||||
'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,
|
||||
}],
|
||||
'portType': 'TCP',
|
||||
'portNumber': 80,
|
||||
}],
|
||||
'createDate': 1498470178000,
|
||||
'updateDate': 1498470178000,
|
||||
},
|
||||
{
|
||||
'createDate': 1498470178000,
|
||||
'updateDate': 1498470178000,
|
||||
},
|
||||
{
|
||||
'firstScanRange': 1,
|
||||
'lastScanRange': 10000,
|
||||
'name': '',
|
||||
'ip': 3232235877,
|
||||
'mac': 75361038758387,
|
||||
'os': 'Windows',
|
||||
'ports': null,
|
||||
'createDate': 1498470179000,
|
||||
'updateDate': 1498470179000,
|
||||
},
|
||||
|
||||
|
||||
];
|
||||
|
||||
|
||||
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,
|
||||
},
|
||||
|
||||
|
||||
];
|
||||
|
||||
|
||||
const hostListJsonMini2: any = [{
|
||||
'firstScanRange': 1,
|
||||
'lastScanRange': 10000,
|
||||
'name': '',
|
||||
|
@ -333,120 +494,4 @@ const hostListJson: any = [
|
|||
'createDate': 1498470178000,
|
||||
'updateDate': 1498470178000,
|
||||
},
|
||||
{
|
||||
'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': 80,
|
||||
},
|
||||
{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'services': [{
|
||||
'createDate': -62135596800000,
|
||||
'updateDate': -62135596800000,
|
||||
'portType': 'TCP',
|
||||
'serviceName': 'SSH',
|
||||
}],
|
||||
'portType': 'TCP',
|
||||
'portNumber': 22,
|
||||
},
|
||||
{
|
||||
'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,
|
||||
},
|
||||
{
|
||||
'firstScanRange': 1,
|
||||
'lastScanRange': 10000,
|
||||
'name': '',
|
||||
'ip': 3232235877,
|
||||
'mac': 75361038758387,
|
||||
'os': 'Windows',
|
||||
'ports': null,
|
||||
'createDate': 1498470179000,
|
||||
'updateDate': 1498470179000,
|
||||
},
|
||||
|
||||
|
||||
];
|
||||
|
||||
|
||||
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,
|
||||
},
|
||||
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@ import InfraTargetRegistAllState, { defaultState as infraTargetRegistAllDefaultS
|
|||
|
||||
const reducer: ReducersMapObject = {
|
||||
[InfraTargetRegistAllActionTypes.REQUEST_SUCCESS]: (state: InfraTargetRegistAllState = infraTargetRegistAllDefaultState,
|
||||
action: Action<void>): InfraTargetRegistAllState => {
|
||||
action: Action<boolean>): InfraTargetRegistAllState => {
|
||||
return {
|
||||
...state,
|
||||
isSuccess: true,
|
||||
isSuccess: action.payload,
|
||||
};
|
||||
},
|
||||
[InfraTargetRegistAllActionTypes.REQUEST_FAILURE]: (state: InfraTargetRegistAllState = infraTargetRegistAllDefaultState,
|
||||
|
|
|
@ -33,10 +33,10 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): SensorConfiguration
|
|||
},
|
||||
// FIXME::how to sensor item?
|
||||
onReadMetaSensorItem: () => {
|
||||
dispatch(SensorItemReadAllActions.request());
|
||||
// dispatch(SensorItemReadAllActions.request());
|
||||
},
|
||||
onSaveSensor: (sensor: Sensor) => {
|
||||
dispatch(RegistActions.request(sensor));
|
||||
// dispatch(RegistActions.request(sensor));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@ export class TargetChild extends React.Component<Props, State> {
|
|||
NewTableDatas = [
|
||||
{
|
||||
header: 'Host',
|
||||
contents: infraChild.host.ip,
|
||||
contents: Utils.int2ip(infraChild.host.ip),
|
||||
},
|
||||
{
|
||||
header: 'Port',
|
||||
|
|
|
@ -15,9 +15,6 @@ export interface StateProps {
|
|||
infraList?: Infra[];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export interface DispatchProps {
|
||||
onReadAllByProbe?(probe: Probe): void;
|
||||
onReadAllByDomain?(domain: Domain): void;
|
||||
|
@ -42,7 +39,10 @@ export class TargetList extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
public componentWillMount(): void {
|
||||
this.getTargetList();
|
||||
}
|
||||
|
||||
public getTargetList(): void {
|
||||
if (this.props.probeId === undefined) {
|
||||
// FIXME: get domain
|
||||
let domain: Domain = {
|
||||
|
@ -55,8 +55,6 @@ export class TargetList extends React.Component<Props, State> {
|
|||
};
|
||||
this.props.onReadAllByProbe(probe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public handleSelect(selectedTarget: any): void {
|
||||
|
@ -81,6 +79,16 @@ export class TargetList extends React.Component<Props, State> {
|
|||
// });
|
||||
}
|
||||
|
||||
public onClosePopup = (bool: boolean) => {
|
||||
this.setState({ openAddTarget: bool });
|
||||
}
|
||||
|
||||
public onRefreshList = () => {
|
||||
console.log('onRefreshList');
|
||||
// this.setState({openAddTarget: false});
|
||||
this.getTargetList();
|
||||
}
|
||||
|
||||
public handleFilter(filterStr: string): void {
|
||||
// if (filterStr === null) {
|
||||
// this.setState({
|
||||
|
@ -130,20 +138,10 @@ export class TargetList extends React.Component<Props, State> {
|
|||
))}
|
||||
</Table.Body>
|
||||
</Table>
|
||||
<Modal
|
||||
open={this.state.openAddTarget}
|
||||
>
|
||||
{/*<Modal.Header>*/}
|
||||
{/*Adding a Target*/}
|
||||
{/*</Modal.Header>*/}
|
||||
<Modal.Content>
|
||||
<DiscoveryContainer probeId={1}/>
|
||||
</Modal.Content>
|
||||
<Modal.Actions>
|
||||
<Button onClick={() => this.setState({ openAddTarget: false })}>Cancel</Button>
|
||||
<Button primary >Done</Button>
|
||||
</Modal.Actions>
|
||||
</Modal>
|
||||
|
||||
<DiscoveryContainer probeId={1} open={this.state.openAddTarget}
|
||||
onClosePopup={this.onClosePopup.bind(this)} onRefreshList={this.onRefreshList} />
|
||||
|
||||
</Container>;
|
||||
return (
|
||||
<ListContainer
|
||||
|
|
Loading…
Reference in New Issue
Block a user