fixed sensor

This commit is contained in:
snoop 2017-07-26 16:22:59 +09:00
parent 763db4283f
commit ed11bb6619
3 changed files with 7 additions and 7 deletions

View File

@ -39,10 +39,6 @@ class SensorDetailLayout extends React.Component<Props, State> {
'name': 'Setup', 'name': 'Setup',
'path': this.state.currUrl + '/setup', 'path': this.state.currUrl + '/setup',
}, },
{
'name': 'Tree',
'path': this.state.currUrl + '/tree',
},
]; ];
return ( return (
<Container fluid> <Container fluid>
@ -57,6 +53,7 @@ class SensorDetailLayout extends React.Component<Props, State> {
<Route exact={true} path={`${this.props.match.url}/:id/items`} component={SensorDetailItems} /> <Route exact={true} path={`${this.props.match.url}/:id/items`} component={SensorDetailItems} />
{/*<Route path={`${this.props.match.url}/:id/history/`} component={EmailConfirm}/>*/} {/*<Route path={`${this.props.match.url}/:id/history/`} component={EmailConfirm}/>*/}
<Route exact={true} path={`${this.props.match.url}/:id/setup`} component={SensorSetup} /> <Route exact={true} path={`${this.props.match.url}/:id/setup`} component={SensorSetup} />
<Route exact={true} path={`${this.props.match.url}/setup`} component={SensorSetup} />
<Route exact={true} path={`${this.props.match.url}/:id/tree`} component={SensorItemTree} /> <Route exact={true} path={`${this.props.match.url}/:id/tree`} component={SensorItemTree} />
</Switch> </Switch>
<Footer /> <Footer />

View File

@ -37,7 +37,7 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): SensorListDispatchP
dispatch(routerPush('/sensor/' + String(id))); dispatch(routerPush('/sensor/' + String(id)));
}, },
onAddSensor: (target: Target) => { onAddSensor: (target: Target) => {
dispatch(routerPush('/sensor/' + String(11))); dispatch(routerPush('/sensor/setup'));
}, },
}; };
} }

View File

@ -116,7 +116,7 @@ export class SensorList extends React.Component<SensorListProps, SensorListState
console.log(event); console.log(event);
} }
public handleAddSensor(): void { public handleAddSensor(): void {
console.log('adding a sensor'); this.props.onAddSensor(this.props.target);
} }
public render(): JSX.Element { public render(): JSX.Element {
@ -148,8 +148,11 @@ export class SensorList extends React.Component<SensorListProps, SensorListState
</Table.Row> </Table.Row>
))} ))}
</Table.Body> </Table.Body>
<Table.Footer>
<Button content='Add' icon='add' labelPosition='left' floated='right' positive onClick={this.handleAddSensor.bind(this)} />
</Table.Footer>
</Table> </Table>
<Button content='Add' icon='add' labelPosition='left' floated='right' positive onClick={this.handleAddSensor.bind(this)} />
</Container> </Container>
); );
} }