2015-10-08 12:27:09 -04:00
|
|
|
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
2015-09-21 14:22:23 -04:00
|
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
|
2015-11-19 21:12:56 -05:00
|
|
|
|
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';
|
2015-09-21 14:22:23 -04:00
|
|
|
|
|
|
|
|
|
|
export default 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;
|
2015-10-01 14:07:20 -04:00
|
|
|
|
let outgoingHooksSection;
|
2015-09-21 14:22:23 -04:00
|
|
|
|
var inputs = [];
|
|
|
|
|
|
|
2015-10-19 11:42:40 -07:00
|
|
|
|
if (global.window.mm_config.EnableIncomingWebhooks === 'true') {
|
2015-10-05 08:54:25 -04:00
|
|
|
|
if (this.props.activeSection === 'incoming-hooks') {
|
|
|
|
|
|
inputs.push(
|
2015-10-22 14:16:51 -04:00
|
|
|
|
<ManageIncomingHooks key='incoming-hook-ui' />
|
2015-10-05 08:54:25 -04:00
|
|
|
|
);
|
2015-09-21 14:22:23 -04:00
|
|
|
|
|
2015-10-05 08:54:25 -04:00
|
|
|
|
incomingHooksSection = (
|
|
|
|
|
|
<SettingItemMax
|
|
|
|
|
|
title='Incoming Webhooks'
|
2015-10-23 22:33:27 +05:00
|
|
|
|
width='medium'
|
2015-10-05 08:54:25 -04:00
|
|
|
|
inputs={inputs}
|
|
|
|
|
|
updateSection={(e) => {
|
|
|
|
|
|
this.updateSection('');
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
}}
|
|
|
|
|
|
/>
|
|
|
|
|
|
);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
incomingHooksSection = (
|
|
|
|
|
|
<SettingItemMin
|
|
|
|
|
|
title='Incoming Webhooks'
|
2015-10-23 22:33:27 +05:00
|
|
|
|
width='medium'
|
2015-10-30 13:36:51 -04:00
|
|
|
|
describe='Manage your incoming webhooks'
|
2015-10-05 08:54:25 -04:00
|
|
|
|
updateSection={() => {
|
|
|
|
|
|
this.updateSection('incoming-hooks');
|
|
|
|
|
|
}}
|
|
|
|
|
|
/>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2015-10-01 14:07:20 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-10-19 11:42:40 -07:00
|
|
|
|
if (global.window.mm_config.EnableOutgoingWebhooks === 'true') {
|
2015-10-05 08:54:25 -04:00
|
|
|
|
if (this.props.activeSection === 'outgoing-hooks') {
|
|
|
|
|
|
inputs.push(
|
2015-10-22 14:16:51 -04:00
|
|
|
|
<ManageOutgoingHooks key='outgoing-hook-ui' />
|
2015-10-05 08:54:25 -04:00
|
|
|
|
);
|
2015-10-01 14:07:20 -04:00
|
|
|
|
|
2015-10-05 08:54:25 -04:00
|
|
|
|
outgoingHooksSection = (
|
|
|
|
|
|
<SettingItemMax
|
|
|
|
|
|
title='Outgoing Webhooks'
|
2015-10-23 22:33:27 +05:00
|
|
|
|
width='medium'
|
2015-10-05 08:54:25 -04:00
|
|
|
|
inputs={inputs}
|
|
|
|
|
|
updateSection={(e) => {
|
|
|
|
|
|
this.updateSection('');
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
}}
|
|
|
|
|
|
/>
|
|
|
|
|
|
);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
outgoingHooksSection = (
|
|
|
|
|
|
<SettingItemMin
|
|
|
|
|
|
title='Outgoing Webhooks'
|
2015-10-23 22:33:27 +05:00
|
|
|
|
width='medium'
|
2015-10-05 08:54:25 -04:00
|
|
|
|
describe='Manage your outgoing webhooks'
|
|
|
|
|
|
updateSection={() => {
|
|
|
|
|
|
this.updateSection('outgoing-hooks');
|
|
|
|
|
|
}}
|
|
|
|
|
|
/>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2015-09-21 14:22:23 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<div className='modal-header'>
|
|
|
|
|
|
<button
|
|
|
|
|
|
type='button'
|
|
|
|
|
|
className='close'
|
|
|
|
|
|
data-dismiss='modal'
|
|
|
|
|
|
aria-label='Close'
|
2015-11-03 14:09:09 -05:00
|
|
|
|
onClick={this.props.closeModal}
|
2015-09-21 14:22:23 -04:00
|
|
|
|
>
|
|
|
|
|
|
<span aria-hidden='true'>{'×'}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<h4
|
|
|
|
|
|
className='modal-title'
|
|
|
|
|
|
ref='title'
|
|
|
|
|
|
>
|
2015-11-03 14:09:09 -05:00
|
|
|
|
<i
|
|
|
|
|
|
className='modal-back'
|
|
|
|
|
|
onClick={this.props.collapseModal}
|
|
|
|
|
|
/>
|
2015-09-21 14:22:23 -04:00
|
|
|
|
{'Integration Settings'}
|
|
|
|
|
|
</h4>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className='user-settings'>
|
|
|
|
|
|
<h3 className='tab-header'>{'Integration Settings'}</h3>
|
|
|
|
|
|
<div className='divider-dark first'/>
|
|
|
|
|
|
{incomingHooksSection}
|
2015-10-01 14:07:20 -04:00
|
|
|
|
<div className='divider-light'/>
|
|
|
|
|
|
{outgoingHooksSection}
|
2015-09-21 14:22:23 -04:00
|
|
|
|
<div className='divider-dark'/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
UserSettingsIntegrationsTab.propTypes = {
|
|
|
|
|
|
user: React.PropTypes.object,
|
|
|
|
|
|
updateSection: React.PropTypes.func,
|
|
|
|
|
|
updateTab: React.PropTypes.func,
|
2015-11-03 14:09:09 -05:00
|
|
|
|
activeSection: React.PropTypes.string,
|
|
|
|
|
|
closeModal: React.PropTypes.func.isRequired,
|
|
|
|
|
|
collapseModal: React.PropTypes.func.isRequired
|
2015-09-21 14:22:23 -04:00
|
|
|
|
};
|