target 에서 sensor 등록시 자동 target 선택 되어있기

This commit is contained in:
snoop 2017-09-26 16:01:47 +09:00
parent 558797b755
commit 58b3fdc704
3 changed files with 20 additions and 5 deletions

View File

@ -42,6 +42,7 @@ export interface SensorConfigStepperStateProps {
infraId?: number;
setSensor?(data: SensorRegistInfo): void;
getSensor?(): SensorRegistInfo;
isTarget?: boolean;
}
export interface SensorConfigStepperDispatchProps {
@ -231,6 +232,12 @@ export class SensorConfigStepper extends React.Component<SensorConfigStepperProp
public render(): JSX.Element {
if(this.state.currentStep === 1
&& this.props.isTarget) {
this.setState({currentStep:2});
return null;
}
return (
<Container fluid>
<Step.Group fluid>

View File

@ -40,6 +40,7 @@ export interface StateProps {
infraId?: number;
setSensor?(data: SensorRegistInfo): void;
getSensor?(): SensorRegistInfo;
stepNext?(): void;
}
export interface DispatchProps {
@ -105,11 +106,12 @@ export class SensorConfigTargetSelect extends React.Component<Props, State> {
selectionOptions.push(this.createOption(this.props.infra));
this.selectOptions = selectionOptions;
// let sd = this.props.getSensor();
let sd = this.props.getSensor();
// sd.targetId = this.props.infra.target.id;
// sd.type = this.props.infra.infraType.name;
// sd.infra = this.props.infra;
// this.props.setSensor(sd);
sd.infra = this.props.infra;
this.props.setSensor(sd);
this.props.stepNext();
}
public createOption(infra: Infra): DropdownItemProps {

View File

@ -46,6 +46,7 @@ export interface SensorConfigurationDispatchProps {
export interface SensorConfigurationState {
selectedCrawlerId: number;
isTarget: boolean;
}
export type SensorConfigurationProps = SensorConfigurationStateProps & SensorConfigurationDispatchProps;
@ -58,6 +59,7 @@ export class SensorConfiguration extends React.Component<SensorConfigurationProp
super(props, context);
this.state = {
selectedCrawlerId: 0,
isTarget: false,
};
this.sensorData = {};
}
@ -78,11 +80,15 @@ export class SensorConfiguration extends React.Component<SensorConfigurationProp
return this.sensorData;
}
public stepNext = () => {
this.setState({isTarget:true});
}
public render(): JSX.Element {
let steps = [
<SensorConfigTargetSelectContainer setSensor={this.setSensor.bind(this)} getSensor={this.getSensor.bind(this)}
infraId={this.props.infraId} />,
infraId={this.props.infraId} stepNext={this.stepNext.bind(this)} />,
<CrawlerSelectorContainer onSelectCrawlerId={this.onSelectCrawlerId.bind(this)}
setSensor={this.setSensor.bind(this)} getSensor={this.getSensor.bind(this)} />,
<Segment vertical>
@ -93,7 +99,7 @@ export class SensorConfiguration extends React.Component<SensorConfigurationProp
return (
<SensorConfigStepperContainer steps={steps} infraId={this.props.infraId}
setSensor={this.setSensor.bind(this)} getSensor={this.getSensor.bind(this)} />
setSensor={this.setSensor.bind(this)} getSensor={this.getSensor.bind(this)} isTarget={this.state.isTarget} />
);
}
}