diff --git a/api/command.go b/api/command.go
index f017270622..9835790ec4 100644
--- a/api/command.go
+++ b/api/command.go
@@ -214,12 +214,12 @@ func handleResponse(c *Context, w http.ResponseWriter, response *model.CommandRe
c.Err = model.NewLocAppError("command", "api.command.execute_command.save.app_error", nil, "")
}
} else if response.ResponseType == model.COMMAND_RESPONSE_TYPE_EPHEMERAL {
- post := &model.Post{}
- post.ChannelId = channelId
- post.Message = "TODO_EPHEMERAL: " + response.Text
- if _, err := CreatePost(c, post, true); err != nil {
- c.Err = model.NewLocAppError("command", "api.command.execute_command.save.app_error", nil, "")
- }
+ // post := &model.Post{}
+ // post.ChannelId = channelId
+ // post.Message = "TODO_EPHEMERAL: " + response.Text
+ // if _, err := CreatePost(c, post, true); err != nil {
+ // c.Err = model.NewLocAppError("command", "api.command.execute_command.save.app_error", nil, "")
+ // }
}
w.Write([]byte(response.ToJson()))
diff --git a/web/react/components/user_settings/manage_command_hooks.jsx b/web/react/components/user_settings/manage_command_hooks.jsx
index 1fb3bf5991..bcf0a6c828 100644
--- a/web/react/components/user_settings/manage_command_hooks.jsx
+++ b/web/react/components/user_settings/manage_command_hooks.jsx
@@ -5,6 +5,43 @@ import LoadingScreen from '../loading_screen.jsx';
import * as Client from '../../utils/client.jsx';
+import {intlShape, injectIntl, defineMessages, FormattedMessage, FormattedHTMLMessage} from 'mm-intl';
+
+const holders = defineMessages({
+ requestTypePost: {
+ id: 'user.settings.cmds.request_type_post',
+ defaultMessage: 'POST'
+ },
+ requestTypeGet: {
+ id: 'user.settings.cmds.request_type_get',
+ defaultMessage: 'GET'
+ },
+ addDisplayNamePlaceholder: {
+ id: 'user.settings.cmds.add_display_name.placeholder',
+ defaultMessage: 'Display Name'
+ },
+ addUsernamePlaceholder: {
+ id: 'user.settings.cmds.add_username.placeholder',
+ defaultMessage: 'Username'
+ },
+ addTriggerPlaceholder: {
+ id: 'user.settings.cmds.add_trigger.placeholder',
+ defaultMessage: 'Command trigger e.g. "hello" not including the slash'
+ },
+ addAutoCompleteDescPlaceholder: {
+ id: 'user.settings.cmds.auto_complete_desc.placeholder',
+ defaultMessage: 'A short description of what this commands does.'
+ },
+ addAutoCompleteHintPlaceholder: {
+ id: 'user.settings.cmds.auto_complete_hint.placeholder',
+ defaultMessage: '[zipcode]'
+ },
+ adUrlPlaceholder: {
+ id: 'user.settings.cmds.url.placeholder',
+ defaultMessage: 'Must start with http:// or https://'
+ }
+});
+
export default class ManageCommandCmds extends React.Component {
constructor() {
super();
@@ -25,6 +62,12 @@ export default class ManageCommandCmds extends React.Component {
this.state = {cmds: [], cmd: this.emptyCmd(), getCmdsComplete: false};
}
+ static propTypes() {
+ return {
+ intl: intlShape.isRequired
+ };
+ }
+
emptyCmd() {
var cmd = {};
cmd.url = '';
@@ -207,7 +250,12 @@ export default class ManageCommandCmds extends React.Component {
if (cmd.trigger && cmd.trigger.length !== 0) {
triggerDiv = (
- {'Trigger: '}{cmd.trigger}
+
+
+ {cmd.trigger}
);
}
@@ -218,32 +266,90 @@ export default class ManageCommandCmds extends React.Component {
className='webcmd__item'
>
- {'Display Name: '}{cmd.display_name}
+
+
+ {cmd.display_name}
- {'Username: '}{cmd.username}
+
+
+ {cmd.username}
- {'Icon URL: '}{cmd.icon_url}
+
+
+ {cmd.icon_url}
- {'Auto Complete: '}{cmd.auto_complete ? 'yes' : 'no'}
+
+
+ {cmd.auto_complete ? 'yes' : 'no'}
- {'Auto Complete Description: '}{cmd.auto_complete_desc}
+
+
+ {cmd.auto_complete_desc}
- {'Auto Complete Hint: '}{cmd.auto_complete_hint}
+
+
+ {cmd.auto_complete_hint}
- {'Request Type: '}{cmd.method === 'P' ? 'POST' : 'GET'}
+
+
+
+
+ {
+ cmd.method === 'P' ?
+ :
+
+ }
+
- {'URL: '}{cmd.url}
+
+
+ {cmd.url}
{triggerDiv}
- {'Token: '}{cmd.token}
+
+
+ {cmd.token}
- {'Regen Token'}
+
0) {
displayCmds = cmds;
} else {
- displayCmds = {'None'}
;
+ displayCmds = (
+
+
+
+ );
}
const existingCmds = (
-
+
{displayCmds}
@@ -289,45 +410,61 @@ export default class ManageCommandCmds extends React.Component {
return (
- {'Create commands to send new message events to an external integration. Please see '}
-
- {'http://mattermost.org/commands'}
-
- {' to learn more.'}
+
-
+
{'Command display name.'}
-
+
+
+
+
-
{'The username to use when overriding the post.'}
-
+
-
{'URL to an icon'}
+
+
+
-
+
- {'/'}
-
{'Word to trigger on'}
+
+
+ {''}
-
+
-
{'Show this command in autocomplete list.'}
+
+
+
-
+
+
+
+
-
{'A short description of what this commands does.'}
-
+
+
+
+
-
{'List parameters to be passed to the command.'}
-
+
-
{'Command request type issued to the callback URL.'}
+
+
+
-
+
-
{'URL that will receive the HTTP POST or GET event'}
+
+
+
{addError}
@@ -440,3 +648,5 @@ export default class ManageCommandCmds extends React.Component {
);
}
}
+
+export default injectIntl(ManageCommandCmds);
diff --git a/web/react/components/user_settings/user_settings_integrations.jsx b/web/react/components/user_settings/user_settings_integrations.jsx
index cd9903878b..1a9edab037 100644
--- a/web/react/components/user_settings/user_settings_integrations.jsx
+++ b/web/react/components/user_settings/user_settings_integrations.jsx
@@ -25,6 +25,14 @@ const holders = defineMessages({
outDesc: {
id: 'user.settings.integrations.outWebhooksDescription',
defaultMessage: 'Manage your outgoing webhooks'
+ },
+ cmdName: {
+ id: 'user.settings.integrations.commands',
+ defaultMessage: 'Commands'
+ },
+ cmdDesc: {
+ id: 'user.settings.integrations.commandsDescription',
+ defaultMessage: 'Manage your commands'
}
});
@@ -116,7 +124,7 @@ class UserSettingsIntegrationsTab extends React.Component {
commandHooksSection = (
{
@@ -128,9 +136,9 @@ class UserSettingsIntegrationsTab extends React.Component {
} else {
commandHooksSection = (
{
this.updateSection('command-hooks');
}}
diff --git a/web/static/i18n/en.json b/web/static/i18n/en.json
index d6401ab6e9..1d875def12 100644
--- a/web/static/i18n/en.json
+++ b/web/static/i18n/en.json
@@ -990,7 +990,40 @@
"user.settings.integrations.incomingWebhooksDescription": "Manage your incoming webhooks",
"user.settings.integrations.outWebhooks": "Outgoing Webhooks",
"user.settings.integrations.outWebhooksDescription": "Manage your outgoing webhooks",
+ "user.settings.integrations.commands": "Commands",
+ "user.settings.integrations.commandsDescription": "Manage your commands",
"user.settings.integrations.title": "Integration Settings",
+ "user.settings.cmds.trigger": "Trigger: ",
+ "user.settings.cmds.display_name": "Display Name: ",
+ "user.settings.cmds.username": "Username: ",
+ "user.settings.cmds.icon_url": "Icon URL: ",
+ "user.settings.cmds.auto_complete": "Auto Complete: ",
+ "user.settings.cmds.auto_complete_desc": "Auto Complete Description: ",
+ "user.settings.cmds.auto_complete_hint": "Auto Complete Hint: ",
+ "user.settings.cmds.request_type": "Request Type: ",
+ "user.settings.cmds.request_type_post": "POST",
+ "user.settings.cmds.request_type_get": "GET",
+ "user.settings.cmds.url": "URL: ",
+ "user.settings.cmds.token": "Token: ",
+ "user.settings.cmds.regen": "Regen Token",
+ "user.settings.cmds.none": "None",
+ "Existing commands": "Existing commands",
+ "user.settings.cmds.add_desc": "Create commands to send message events to an external integration. Please see http://mattermost.org/commands to learn more.",
+ "user.settings.cmds.add_display_name.placeholder": "Display Name",
+ "user.settings.cmds.existing": "Existing commands",
+ "user.settings.cmds.add_username.placeholder": "Username",
+ "user.settings.cmds.username_desc": "The username to use when overriding the post.",
+ "user.settings.cmds.icon_url_desc": "URL to an icon",
+ "user.settings.cmds.trigger_desc": "Word to trigger on",
+ "user.settings.cmds.add_trigger.placeholder": "Command trigger e.g. \"hello\" not including the slash",
+ "user.settings.cmds.auto_complete_desc_desc": "A short description of what this commands does",
+ "user.settings.cmds.auto_complete_help": "Show this command in autocomplete list.",
+ "user.settings.cmds.auto_complete_desc.placeholder": "A short description of what this commands does.",
+ "user.settings.cmds.auto_complete_hint.placeholder": "[zipcode]",
+ "user.settings.cmds.auto_complete_hint_desc": "List parameters to be passed to the command.",
+ "user.settings.cmds.request_type_desc": "Command request type issued to the callback URL.",
+ "user.settings.cmds.url_desc": "URL that will receive the HTTP POST or GET event",
+ "user.settings.cmds.url.placeholder": "Must start with http:// or https://",
"user.settings.modal.general": "General",
"user.settings.modal.security": "Security",
"user.settings.modal.notifications": "Notifications",