Show/hide integrations properly based off config settings.

Этот коммит содержится в:
JoramWilander
2015-10-05 08:54:25 -04:00
родитель 5574151c85
Коммит 182e59f2c0
2 изменённых файлов: 55 добавлений и 51 удалений

Просмотреть файл

@@ -34,60 +34,64 @@ export default class UserSettingsIntegrationsTab extends React.Component {
let outgoingHooksSection; let outgoingHooksSection;
var inputs = []; var inputs = [];
if (this.props.activeSection === 'incoming-hooks') { if (global.window.config.EnableIncomingWebhooks === 'true') {
inputs.push( if (this.props.activeSection === 'incoming-hooks') {
<ManageIncomingHooks /> inputs.push(
); <ManageIncomingHooks />
);
incomingHooksSection = ( incomingHooksSection = (
<SettingItemMax <SettingItemMax
title='Incoming Webhooks' title='Incoming Webhooks'
width = 'full' width = 'full'
inputs={inputs} inputs={inputs}
updateSection={(e) => { updateSection={(e) => {
this.updateSection(''); this.updateSection('');
e.preventDefault(); e.preventDefault();
}} }}
/> />
); );
} else { } else {
incomingHooksSection = ( incomingHooksSection = (
<SettingItemMin <SettingItemMin
title='Incoming Webhooks' title='Incoming Webhooks'
width = 'full' width = 'full'
describe='Manage your incoming webhooks (Developer feature)' describe='Manage your incoming webhooks (Developer feature)'
updateSection={() => { updateSection={() => {
this.updateSection('incoming-hooks'); this.updateSection('incoming-hooks');
}} }}
/> />
); );
}
} }
if (this.props.activeSection === 'outgoing-hooks') { if (global.window.config.EnableOutgoingWebhooks === 'true') {
inputs.push( if (this.props.activeSection === 'outgoing-hooks') {
<ManageOutgoingHooks /> inputs.push(
); <ManageOutgoingHooks />
);
outgoingHooksSection = ( outgoingHooksSection = (
<SettingItemMax <SettingItemMax
title='Outgoing Webhooks' title='Outgoing Webhooks'
inputs={inputs} inputs={inputs}
updateSection={(e) => { updateSection={(e) => {
this.updateSection(''); this.updateSection('');
e.preventDefault(); e.preventDefault();
}} }}
/> />
); );
} else { } else {
outgoingHooksSection = ( outgoingHooksSection = (
<SettingItemMin <SettingItemMin
title='Outgoing Webhooks' title='Outgoing Webhooks'
describe='Manage your outgoing webhooks' describe='Manage your outgoing webhooks'
updateSection={() => { updateSection={() => {
this.updateSection('outgoing-hooks'); this.updateSection('outgoing-hooks');
}} }}
/> />
); );
}
} }
return ( return (

Просмотреть файл

@@ -38,7 +38,7 @@ export default class UserSettingsModal extends React.Component {
if (global.window.config.EnableOAuthServiceProvider === 'true') { if (global.window.config.EnableOAuthServiceProvider === 'true') {
tabs.push({name: 'developer', uiName: 'Developer', icon: 'glyphicon glyphicon-th'}); tabs.push({name: 'developer', uiName: 'Developer', icon: 'glyphicon glyphicon-th'});
} }
if (global.window.config.EnableIncomingWebhooks === 'true') { if (global.window.config.EnableIncomingWebhooks === 'true' || global.window.config.EnableOutgoingWebhooks === 'true') {
tabs.push({name: 'integrations', uiName: 'Integrations', icon: 'glyphicon glyphicon-transfer'}); tabs.push({name: 'integrations', uiName: 'Integrations', icon: 'glyphicon glyphicon-transfer'});
} }
tabs.push({name: 'display', uiName: 'Display', icon: 'glyphicon glyphicon-eye-open'}); tabs.push({name: 'display', uiName: 'Display', icon: 'glyphicon glyphicon-eye-open'});