Merge remote-tracking branch 'origin/master'

This commit is contained in:
geek 2017-08-25 17:38:44 +09:00
commit 2cf42fd09a
2 changed files with 63 additions and 2 deletions

View File

@ -150,9 +150,9 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
<List selection> <List selection>
{this.ViewSensorItemType()} {this.ViewSensorItemType()}
</List> </List>
<Button primary floated='right' onClick={() => { {/*<Button primary floated='right' onClick={() => {
console.log(this.selectedItemMap); console.log(this.selectedItemMap);
}}>Test</Button><br /><br /> }}>Test</Button><br /><br />*/}
</Container> </Container>
); );
} }

View File

@ -96,6 +96,13 @@ export class SensorConfigStepper extends React.Component<SensorConfigStepperProp
} }
public handleNext(event: React.SyntheticEvent<HTMLAnchorElement>, data: object): void { public handleNext(event: React.SyntheticEvent<HTMLAnchorElement>, data: object): void {
let step: number = this.state.currentStep; let step: number = this.state.currentStep;
let errorStr: string = this.checkSensorData();
if (errorStr.length > 0) {
alert('Choose ' + errorStr);
return;
}
if (step >= this.props.steps.length + 1) { if (step >= this.props.steps.length + 1) {
step = this.props.steps.length + 1; step = this.props.steps.length + 1;
} else { } else {
@ -111,6 +118,60 @@ export class SensorConfigStepper extends React.Component<SensorConfigStepperProp
} }
} }
public checkSensorData(): string {
let sd = this.props.getSensor();
switch (this.state.currentStep) {
case 1:
{
if (sd.infra === undefined || sd.infra === null) {
return 'Target';
}
if (sd.crawler === undefined || sd.crawler === null) {
return 'Crawler';
}
}
break;
case 2:
{
if (sd.sensorItemMap === undefined || sd.sensorItemMap === null || this.checkItemMapSize() === false) {
return 'Sensor Item';
}
}
break;
case 3:
{
if (sd.interval === undefined) {
return 'Interval';
}
}
break;
default:
break;
}
return '';
}
public checkItemMapSize(): boolean {
if (this.props.getSensor().sensorItemMap.size <= 0) {
return false;
}
let result: boolean = false;
this.props.getSensor().sensorItemMap.forEach((value: MetaSensorItem[], key: number) => {
if (value.length > 0) {
result = true;
}
});
return result;
}
public registSensor(): void { public registSensor(): void {
let sensorData = this.props.getSensor(); let sensorData = this.props.getSensor();
let sensor: Sensor = {}; let sensor: Sensor = {};