Commands backend, saving to file

This commit is contained in:
James Barnsley
2018-10-12 16:10:29 +13:00
parent 74a77ed5b0
commit 49aa6df033
12 changed files with 568 additions and 311 deletions

View File

@ -161,19 +161,25 @@ class Settings extends React.Component {
}
return (
<div className="list">
<div className="list commands">
{
commands.map(command => {
return (
<Link className="list__item command__item commands-setup__item" key={command.id} to={global.baseURL+'edit-command/'+command.id}>
<span className="col col--w30">
<div className="list__item commands__item commands-setup__item" key={command.id}>
<span className="col col--w90">
<Icon name={command.icon} />
{command.icon}
</span>
<span className="col col--w70">
&nbsp;&nbsp;
{command.command && command.command.url ? command.command.url : "-"}
</span>
</Link>
<div className="commands__item__actions">
<a className="commands__item__trigger-button action" onClick={e => this.props.pusherActions.sendCommand(command.id, true)}>
<Icon name="send" />
</a>
<Link className="commands__item__edit-button action" to={global.baseURL+'edit-command/'+command.id}>
<Icon name="edit" />
</Link>
</div>
</div>
);
})
}

View File

@ -18,7 +18,7 @@ class EditCommand extends React.Component{
this.state = {
id: helpers.generateGuid(),
icon: 'power_settings_new',
command: '{"url":"https://myserver.local:8080/sendCommand/power"}'
command: '{"url":"https://'+window.location.hostname+'/sendCommand/power"}'
}
}