sensor regist after~

This commit is contained in:
snoop 2017-08-25 18:31:10 +09:00
parent fa5bb021af
commit fdaef45234
3 changed files with 16 additions and 1 deletions

View File

@ -52,7 +52,7 @@ export class CrawlerSelector extends React.Component<CrawlerSelectorProps, Crawl
} else {
target = { id: this.props.targetId };
}
this.selectOptions = [];
this.props.onCrawlerReadAllByTarget(target);
}

View File

@ -5,6 +5,7 @@ import {
SensorConfigStepperDispatchProps,
} from './components/SensorConfigStepper';
// import State from '../redux/state/ReadAllByTarget';
import { push as routerPush } from 'react-router-redux';
import Target from '@overflow/target/api/model/Target';
import Sensor from '@overflow/sensor/api/model/Sensor';
@ -32,6 +33,12 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): SensorConfigStepper
dispatch(asyncRequestActions.request('SensorService', 'registSensorConfig', RegistSensorConfigActions.REQUEST,
JSON.stringify(sensor), JSON.stringify(sensorItemList)));
},
onMoveSensors: () => {
dispatch(routerPush('/sensors'));
},
onMoveTargetSensors: (infraId: number) => {
dispatch(routerPush('/target/' + String(infraId) + '/sensor'));
},
};
}

View File

@ -48,6 +48,8 @@ export interface SensorConfigStepperStateProps {
export interface SensorConfigStepperDispatchProps {
onRegistSensorConfig?(sensor: Sensor, sensorItemList: SensorItem[]): void;
onMoveSensors?(): void;
onMoveTargetSensors?(targetId: number): void;
}
export type SensorConfigStepperProps = SensorConfigStepperStateProps & SensorConfigStepperDispatchProps;
@ -115,6 +117,12 @@ export class SensorConfigStepper extends React.Component<SensorConfigStepperProp
console.log('Done');
console.log(this.props.getSensor());
this.registSensor();
if (this.props.infraId === undefined) {
this.props.onMoveSensors();
} else {
this.props.onMoveTargetSensors(this.props.infraId);
}
}
}