From ff54da2e4a1095a6f96f285aa218a5d162b68b51 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 2 Feb 2016 08:42:36 -0800 Subject: Adding loc to front-end --- .../user_settings/manage_command_hooks.jsx | 306 +++++++++++++++++---- .../user_settings/user_settings_integrations.jsx | 14 +- 2 files changed, 269 insertions(+), 51 deletions(-) (limited to 'web/react/components/user_settings') diff --git a/web/react/components/user_settings/manage_command_hooks.jsx b/web/react/components/user_settings/manage_command_hooks.jsx index 1fb3bf599..bcf0a6c82 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 cd9903878..1a9edab03 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'); }} -- cgit v1.2.3-1-g7c22