Files
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
frontend/js/common/component/script/event.js
Paulus Schoutsen faf576d43d Add script editor ()
* Add script editor

* Cleanup
2017-08-15 22:09:43 -07:00

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: {},
};