From dcdea9f30b419eeb8d55ed9be3f824aaf27de50c Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Thu, 24 Mar 2016 16:52:29 -0400 Subject: Added AddIntegration page --- webapp/components/backstage/add_integration.jsx | 110 +++++++++++++++++++++ .../backstage/add_integration_option.jsx | 39 ++++++++ .../backstage/installed_integrations.jsx | 2 +- 3 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 webapp/components/backstage/add_integration.jsx create mode 100644 webapp/components/backstage/add_integration_option.jsx (limited to 'webapp/components/backstage') diff --git a/webapp/components/backstage/add_integration.jsx b/webapp/components/backstage/add_integration.jsx new file mode 100644 index 000000000..1ca079bb7 --- /dev/null +++ b/webapp/components/backstage/add_integration.jsx @@ -0,0 +1,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( + + } + description={ + + } + link={`/${team.name}/integrations/add/incoming_webhook`} + /> + ); + } + + if (window.mm_config.EnableOutgoingWebhooks === 'true') { + options.push( + + } + description={ + + } + link={`/${team.name}/integrations/add/outgoing_webhook`} + /> + ); + } + + return ( +
+
+
+

+ +

+
+
+
+ {options} +
+
+ ); + } +} + diff --git a/webapp/components/backstage/add_integration_option.jsx b/webapp/components/backstage/add_integration_option.jsx new file mode 100644 index 000000000..3c3caf2f4 --- /dev/null +++ b/webapp/components/backstage/add_integration_option.jsx @@ -0,0 +1,39 @@ +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import React from 'react'; + +import {Link} from 'react-router'; + +export default class AddIntegrationOption extends React.Component { + static get propTypes() { + return { + image: React.PropTypes.string.isRequired, + title: React.PropTypes.node.isRequired, + description: React.PropTypes.node.isRequired, + link: React.PropTypes.string.isRequired + }; + } + + render() { + const {image, title, description, link} = this.props; + + return ( + + +
+ {title} +
+
+ {description} +
+ + ); + } +} diff --git a/webapp/components/backstage/installed_integrations.jsx b/webapp/components/backstage/installed_integrations.jsx index cfb68c660..8dae44295 100644 --- a/webapp/components/backstage/installed_integrations.jsx +++ b/webapp/components/backstage/installed_integrations.jsx @@ -198,7 +198,7 @@ export default class InstalledIntegrations extends React.Component { return (
-
+