apply scene in host
This commit is contained in:
parent
c1898ffa6c
commit
d1cd93afe5
3 changed files with 13 additions and 2 deletions
|
@ -16,6 +16,13 @@ class HostsPanel extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyHostScene(id) {
|
||||||
|
this.props
|
||||||
|
.sceneApply(id, this.props.activeHost)
|
||||||
|
.then(() => console.log("SCCUESS"))
|
||||||
|
.catch((err) => console.error("sceneApply update error", err));
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.props.isActiveDefaultHost) {
|
if (this.props.isActiveDefaultHost) {
|
||||||
return (
|
return (
|
||||||
|
@ -48,7 +55,7 @@ class HostsPanel extends Component {
|
||||||
</Card.Header>
|
</Card.Header>
|
||||||
<Card.Content extras>
|
<Card.Content extras>
|
||||||
<div className="ui two buttons">
|
<div className="ui two buttons">
|
||||||
<Button>Apply</Button>
|
<Button onClick={this.applyHostScene(scene.id)}>Apply</Button>
|
||||||
</div>
|
</div>
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
|
@ -549,9 +549,12 @@ export const RemoteService = {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
sceneApply: (id) => {
|
sceneApply: (id, hostId = null) => {
|
||||||
return (dispatch) => {
|
return (dispatch) => {
|
||||||
let url = `/scene/${id}/apply`;
|
let url = `/scene/${id}/apply`;
|
||||||
|
if (hostId) {
|
||||||
|
url = url + "?hostId=" + hostId;
|
||||||
|
}
|
||||||
|
|
||||||
return Endpoint.post(url)
|
return Endpoint.post(url)
|
||||||
.then((res) => dispatch(actions.deviceOperationUpdate(res.data)))
|
.then((res) => dispatch(actions.deviceOperationUpdate(res.data)))
|
||||||
|
|
|
@ -49,6 +49,7 @@ function reducer(previousState, action) {
|
||||||
[scene.id]: {
|
[scene.id]: {
|
||||||
name: { $set: scene.name },
|
name: { $set: scene.name },
|
||||||
icon: { $set: scene.icon },
|
icon: { $set: scene.icon },
|
||||||
|
guestAccessEnabled: { $set: scene.guestAccessEnabled },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue