mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-14 11:49:26 +00:00
demo_data
docs
gulp
js
automation-editor
common
component
condition
script
action_edit.js
action_row.js
call_service.js
condition.js
delay.js
event.js
index.js
wait.js
json_textarea.js
util
script-editor
compatibility.js
core.js
panels
src
test
.eslintrc
.gitignore
.gitmodules
.hound.yml
.nvmrc
.travis.yml
CLA.md
CODE_OF_CONDUCT.md
LICENSE.md
README.md
bower.json
gulpfile.js
package.json
polymer.json
rollup.config.js
wct.conf.json
yarn.lock
47 lines
999 B
JavaScript
47 lines
999 B
JavaScript
import { h, Component } from 'preact';
|
|
|
|
import JSONTextArea from '../json_textarea';
|
|
import { onChangeEvent } from '../../util/event';
|
|
|
|
export default class EventAction extends Component {
|
|
constructor() {
|
|
super();
|
|
|
|
this.onChange = onChangeEvent.bind(this, 'action');
|
|
this.serviceDataChanged = this.serviceDataChanged.bind(this);
|
|
}
|
|
|
|
serviceDataChanged(data) {
|
|
this.props.onChange(this.props.index, {
|
|
...this.props.action,
|
|
data,
|
|
});
|
|
}
|
|
|
|
render({ action }) {
|
|
/* eslint-disable camelcase */
|
|
const { event, event_data } = action;
|
|
return (
|
|
<div>
|
|
<paper-input
|
|
label="Event"
|
|
name="event"
|
|
value={event}
|
|
onChange={this.onChange}
|
|
/>
|
|
<JSONTextArea
|
|
label="Service Data"
|
|
value={event_data}
|
|
onChange={this.serviceDataChanged}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
EventAction.configKey = 'event';
|
|
EventAction.defaultConfig = {
|
|
event: '',
|
|
event_data: {},
|
|
};
|