From 5e2596598f97e318f1e4e8bd835b08a011fa0b60 Mon Sep 17 00:00:00 2001 From: Nicolas Clerc Date: Mon, 15 Feb 2016 09:11:35 +0100 Subject: add external slashcommands management --- .../user_settings/manage_command_hooks.jsx | 43 +++++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'webapp/components/user_settings/manage_command_hooks.jsx') diff --git a/webapp/components/user_settings/manage_command_hooks.jsx b/webapp/components/user_settings/manage_command_hooks.jsx index ce353ad64..4053a62aa 100644 --- a/webapp/components/user_settings/manage_command_hooks.jsx +++ b/webapp/components/user_settings/manage_command_hooks.jsx @@ -59,6 +59,7 @@ export default class ManageCommandCmds extends React.Component { this.getCmds = this.getCmds.bind(this); this.addNewCmd = this.addNewCmd.bind(this); this.emptyCmd = this.emptyCmd.bind(this); + this.updateExternalManagement = this.updateExternalManagement.bind(this); this.updateTrigger = this.updateTrigger.bind(this); this.updateURL = this.updateURL.bind(this); this.updateMethod = this.updateMethod.bind(this); @@ -99,7 +100,7 @@ export default class ManageCommandCmds extends React.Component { addNewCmd(e) { e.preventDefault(); - if (this.state.cmd.trigger === '' || this.state.cmd.url === '') { + if (this.state.cmd.url === '' || (this.state.cmd.trigger === '' && !this.state.external_management)) { return; } @@ -189,6 +190,12 @@ export default class ManageCommandCmds extends React.Component { ); } + updateExternalManagement(e) { + var cmd = this.state.cmd; + cmd.external_management = e.target.checked; + this.setState(cmd); + } + updateTrigger(e) { var cmd = this.state.cmd; cmd.trigger = e.target.value; @@ -275,6 +282,14 @@ export default class ManageCommandCmds extends React.Component { key={cmd.id} className='webhook__item webcmd__item' > +
+ + + {cmd.external_management ? this.props.intl.formatMessage(holders.autocompleteYes) : this.props.intl.formatMessage(holders.autocompleteNo)} +
{triggerDiv}
@@ -416,7 +431,7 @@ export default class ManageCommandCmds extends React.Component {
); - const disableButton = this.state.cmd.trigger === '' || this.state.cmd.url === ''; + const disableButton = this.state.cmd.url === '' || (this.state.cmd.trigger === '' && !this.state.external_management); return (
@@ -433,6 +448,30 @@ export default class ManageCommandCmds extends React.Component {
+
+ +
+
+ +
+
+
+