blob: 1ca079bb747b0f87b17d8bdfc42e0b4d1c580c5a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import TeamStore from 'stores/team_store.jsx';
import {FormattedMessage} from 'react-intl';
import AddIntegrationOption from './add_integration_option.jsx';
import WebhookIcon from 'images/webhook_icon.jpg';
export default class AddIntegration extends React.Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
this.state = {
team: TeamStore.getCurrent()
};
}
componentDidMount() {
TeamStore.addChangeListener(this.handleChange);
}
componentWillUnmount() {
TeamStore.removeChangeListener(this.handleChange);
}
handleChange() {
this.setState({
team: TeamStore.getCurrent()
});
}
render() {
const team = TeamStore.getCurrent();
if (!team) {
return null;
}
const options = [];
if (window.mm_config.EnableIncomingWebhooks === 'true') {
options.push(
<AddIntegrationOption
key='incomingWebhook'
image={WebhookIcon}
title={
<FormattedMessage
id='add_integration.incomingWebhook.title'
defaultMessage='Incoming Webhook'
/>
}
description={
<FormattedMessage
id='add_integration.incomingWebhook.description'
defaultMessage='This is a webhook to which you can send stuff that will be posted'
/>
}
link={`/${team.name}/integrations/add/incoming_webhook`}
/>
);
}
if (window.mm_config.EnableOutgoingWebhooks === 'true') {
options.push(
<AddIntegrationOption
key='outgoingWebhook'
image={WebhookIcon}
title={
<FormattedMessage
id='add_integration.outgoingWebhook.title'
defaultMessage='Outgoing Webhook'
/>
}
description={
<FormattedMessage
id='add_integration.outgoingWebhook.description'
defaultMessage='This is a webhook that will send stuff to you when stuff is posted'
/>
}
link={`/${team.name}/integrations/add/outgoing_webhook`}
/>
);
}
return (
<div className='backstage row'>
<div className='add-integration'>
<div className='backstage__header'>
<h1 className='text'>
<FormattedMessage
id='add-integration.header'
defaultMessage='Add Integration'
/>
</h1>
</div>
</div>
<div className='add-integration__options'>
{options}
</div>
</div>
);
}
}
|