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

View File

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

View File

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