// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import SettingItemMin from '../setting_item_min.jsx'; import SettingItemMax from '../setting_item_max.jsx'; import ManageIncomingHooks from './manage_incoming_hooks.jsx'; import ManageOutgoingHooks from './manage_outgoing_hooks.jsx'; import ManageCommandHooks from './manage_command_hooks.jsx'; import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'mm-intl'; const holders = defineMessages({ inName: { id: 'user.settings.integrations.incomingWebhooks', defaultMessage: 'Incoming Webhooks' }, inDesc: { id: 'user.settings.integrations.incomingWebhooksDescription', defaultMessage: 'Manage your incoming webhooks' }, outName: { id: 'user.settings.integrations.outWebhooks', defaultMessage: 'Outgoing Webhooks' }, 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' } }); class UserSettingsIntegrationsTab extends React.Component { constructor(props) { super(props); this.updateSection = this.updateSection.bind(this); this.state = {}; } updateSection(section) { this.props.updateSection(section); } render() { let incomingHooksSection; let outgoingHooksSection; let commandHooksSection; var inputs = []; const {formatMessage} = this.props.intl; if (global.window.mm_config.EnableIncomingWebhooks === 'true') { if (this.props.activeSection === 'incoming-hooks') { inputs.push( ); incomingHooksSection = ( { this.updateSection(''); e.preventDefault(); }} /> ); } else { incomingHooksSection = ( { this.updateSection('incoming-hooks'); }} /> ); } } if (global.window.mm_config.EnableOutgoingWebhooks === 'true') { if (this.props.activeSection === 'outgoing-hooks') { inputs.push( ); outgoingHooksSection = ( { this.updateSection(''); e.preventDefault(); }} /> ); } else { outgoingHooksSection = ( { this.updateSection('outgoing-hooks'); }} /> ); } } if (global.window.mm_config.EnableCommands === 'true') { if (this.props.activeSection === 'command-hooks') { inputs.push( ); commandHooksSection = ( { this.updateSection(''); e.preventDefault(); }} /> ); } else { commandHooksSection = ( { this.updateSection('command-hooks'); }} /> ); } } return (

{incomingHooksSection}
{outgoingHooksSection}
{commandHooksSection}
); } } UserSettingsIntegrationsTab.propTypes = { intl: intlShape.isRequired, user: React.PropTypes.object, updateSection: React.PropTypes.func, updateTab: React.PropTypes.func, activeSection: React.PropTypes.string, closeModal: React.PropTypes.func.isRequired, collapseModal: React.PropTypes.func.isRequired }; export default injectIntl(UserSettingsIntegrationsTab);