mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-20 02:38:53 +00:00
* Ignore hass changes while dropdown is open * Upgrade vaadin-combo-box * Fix styling on dev-service panel * Fix styling for ha-entity-dropdown * Fix height vaadin-combo-box dropdown * Rename ha-entity-dropdown to ha-entity-picker * More entity improvement (#675) * Update script and automation editor to use entity picker * Add entity and service picker to service dev panel * Lint
53 lines
1.0 KiB
JavaScript
53 lines
1.0 KiB
JavaScript
import { h, Component } from 'preact';
|
|
|
|
import JSONTextArea from '../json_textarea.js';
|
|
|
|
export default class CallServiceAction extends Component {
|
|
constructor() {
|
|
super();
|
|
|
|
this.serviceChanged = this.serviceChanged.bind(this);
|
|
this.serviceDataChanged = this.serviceDataChanged.bind(this);
|
|
}
|
|
|
|
serviceChanged(ev) {
|
|
this.props.onChange(this.props.index, {
|
|
...this.props.action,
|
|
service: ev.target.value,
|
|
});
|
|
}
|
|
|
|
serviceDataChanged(data) {
|
|
this.props.onChange(this.props.index, {
|
|
...this.props.action,
|
|
data,
|
|
});
|
|
}
|
|
|
|
render({ action, hass }) {
|
|
const { service, data } = action;
|
|
|
|
return (
|
|
<div>
|
|
<ha-service-picker
|
|
hass={hass}
|
|
value={service}
|
|
onChange={this.serviceChanged}
|
|
/>
|
|
<JSONTextArea
|
|
label="Service Data"
|
|
value={data}
|
|
onChange={this.serviceDataChanged}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
CallServiceAction.configKey = 'service';
|
|
CallServiceAction.defaultConfig = {
|
|
alias: '',
|
|
service: '',
|
|
data: {}
|
|
};
|