summaryrefslogtreecommitdiffstats
path: root/webapp/components/backstage/components
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/backstage/components')
-rw-r--r--webapp/components/backstage/components/backstage_category.jsx75
-rw-r--r--webapp/components/backstage/components/backstage_header.jsx41
-rw-r--r--webapp/components/backstage/components/backstage_list.jsx114
-rw-r--r--webapp/components/backstage/components/backstage_navbar.jsx43
-rw-r--r--webapp/components/backstage/components/backstage_section.jsx80
-rw-r--r--webapp/components/backstage/components/backstage_sidebar.jsx149
6 files changed, 0 insertions, 502 deletions
diff --git a/webapp/components/backstage/components/backstage_category.jsx b/webapp/components/backstage/components/backstage_category.jsx
deleted file mode 100644
index ee98e6b56..000000000
--- a/webapp/components/backstage/components/backstage_category.jsx
+++ /dev/null
@@ -1,75 +0,0 @@
-import PropTypes from 'prop-types';
-
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-
-import {Link} from 'react-router/es6';
-
-export default class BackstageCategory extends React.Component {
- static get propTypes() {
- return {
- name: PropTypes.string.isRequired,
- title: PropTypes.node.isRequired,
- icon: PropTypes.string.isRequired,
- parentLink: PropTypes.string,
- children: PropTypes.arrayOf(PropTypes.element)
- };
- }
-
- static get defaultProps() {
- return {
- parentLink: '',
- children: []
- };
- }
-
- static get contextTypes() {
- return {
- router: PropTypes.object.isRequired
- };
- }
-
- render() {
- const {name, title, icon, parentLink, children} = this.props;
-
- const link = parentLink + '/' + name;
-
- let clonedChildren = null;
- if (children.length > 0 && this.context.router.isActive(link)) {
- clonedChildren = (
- <ul className='sections'>
- {
- React.Children.map(children, (child) => {
- if (!child) {
- return child;
- }
-
- return React.cloneElement(child, {
- parentLink: link
- });
- })
- }
- </ul>
- );
- }
-
- return (
- <li className='backstage-sidebar__category'>
- <Link
- to={link}
- className='category-title'
- activeClassName='category-title--active'
- onlyActiveOnIndex={true}
- >
- <i className={'fa ' + icon}/>
- <span className='category-title__text'>
- {title}
- </span>
- </Link>
- {clonedChildren}
- </li>
- );
- }
-}
diff --git a/webapp/components/backstage/components/backstage_header.jsx b/webapp/components/backstage/components/backstage_header.jsx
deleted file mode 100644
index 68d5590a6..000000000
--- a/webapp/components/backstage/components/backstage_header.jsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import PropTypes from 'prop-types';
-
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-
-export default class BackstageHeader extends React.Component {
- static get propTypes() {
- return {
- children: PropTypes.node
- };
- }
-
- render() {
- const children = [];
-
- React.Children.forEach(this.props.children, (child, index) => {
- if (index !== 0) {
- children.push(
- <span
- key={'divider' + index}
- className='backstage-header__divider'
- >
- <i className='fa fa-angle-right'/>
- </span>
- );
- }
-
- children.push(child);
- });
-
- return (
- <div className='backstage-header'>
- <h1>
- {children}
- </h1>
- </div>
- );
- }
-}
diff --git a/webapp/components/backstage/components/backstage_list.jsx b/webapp/components/backstage/components/backstage_list.jsx
deleted file mode 100644
index d0a2426ec..000000000
--- a/webapp/components/backstage/components/backstage_list.jsx
+++ /dev/null
@@ -1,114 +0,0 @@
-import PropTypes from 'prop-types';
-
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-
-import * as Utils from 'utils/utils.jsx';
-
-import {Link} from 'react-router';
-import LoadingScreen from 'components/loading_screen.jsx';
-
-export default class BackstageList extends React.Component {
- static propTypes = {
- children: PropTypes.node,
- header: PropTypes.node.isRequired,
- addLink: PropTypes.string,
- addText: PropTypes.node,
- emptyText: PropTypes.node,
- helpText: PropTypes.node,
- loading: PropTypes.bool.isRequired,
- searchPlaceholder: PropTypes.string
- }
-
- static defaultProps = {
- searchPlaceholder: Utils.localizeMessage('backstage_list.search', 'Search')
- }
-
- constructor(props) {
- super(props);
-
- this.updateFilter = this.updateFilter.bind(this);
-
- this.state = {
- filter: ''
- };
- }
-
- updateFilter(e) {
- this.setState({
- filter: e.target.value
- });
- }
-
- render() {
- const filter = this.state.filter.toLowerCase();
-
- let children;
- if (this.props.loading) {
- children = <LoadingScreen/>;
- } else {
- children = React.Children.map(this.props.children, (child) => {
- return React.cloneElement(child, {filter});
- });
-
- if (children.length === 0 && this.props.emptyText) {
- children = (
- <span className='backstage-list__item backstage-list__empty'>
- {this.props.emptyText}
- </span>
- );
- }
- }
-
- let addLink = null;
- if (this.props.addLink && this.props.addText) {
- addLink = (
- <Link
- className='add-link'
- to={this.props.addLink}
- >
- <button
- type='button'
- className='btn btn-primary'
- >
- <span>
- {this.props.addText}
- </span>
- </button>
- </Link>
- );
- }
-
- return (
- <div className='backstage-content'>
- <div className='backstage-header'>
- <h1>
- {this.props.header}
- </h1>
- {addLink}
- </div>
- <div className='backstage-filters'>
- <div className='backstage-filter__search'>
- <i className='fa fa-search'/>
- <input
- type='search'
- className='form-control'
- placeholder={this.props.searchPlaceholder}
- value={this.state.filter}
- onChange={this.updateFilter}
- style={{flexGrow: 0, flexShrink: 0}}
- />
- </div>
- </div>
- <span className='backstage-list__help'>
- {this.props.helpText}
- </span>
- <div className='backstage-list'>
- {children}
- </div>
- </div>
- );
- }
-}
diff --git a/webapp/components/backstage/components/backstage_navbar.jsx b/webapp/components/backstage/components/backstage_navbar.jsx
deleted file mode 100644
index c3a9feec8..000000000
--- a/webapp/components/backstage/components/backstage_navbar.jsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import PropTypes from 'prop-types';
-
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-
-import {FormattedMessage} from 'react-intl';
-import {Link} from 'react-router/es6';
-
-export default class BackstageNavbar extends React.Component {
- static get propTypes() {
- return {
- team: PropTypes.object.isRequired
- };
- }
-
- render() {
- if (!this.props.team) {
- return null;
- }
-
- return (
- <div className='backstage-navbar'>
- <Link
- className='backstage-navbar__back'
- to={`/${this.props.team.name}/channels/town-square`}
- >
- <i className='fa fa-angle-left'/>
- <span>
- <FormattedMessage
- id='backstage_navbar.backToMattermost'
- defaultMessage='Back to {siteName}'
- values={{
- siteName: global.window.mm_config.SiteName
- }}
- />
- </span>
- </Link>
- </div>
- );
- }
-}
diff --git a/webapp/components/backstage/components/backstage_section.jsx b/webapp/components/backstage/components/backstage_section.jsx
deleted file mode 100644
index 6da53a6e6..000000000
--- a/webapp/components/backstage/components/backstage_section.jsx
+++ /dev/null
@@ -1,80 +0,0 @@
-import PropTypes from 'prop-types';
-
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-
-import {Link} from 'react-router/es6';
-
-export default class BackstageSection extends React.Component {
- static get propTypes() {
- return {
- name: PropTypes.string.isRequired,
- title: PropTypes.node.isRequired,
- parentLink: PropTypes.string,
- subsection: PropTypes.bool,
- children: PropTypes.arrayOf(PropTypes.element)
- };
- }
-
- static get defaultProps() {
- return {
- parentLink: '',
- subsection: false,
- children: []
- };
- }
-
- static get contextTypes() {
- return {
- router: PropTypes.object.isRequired
- };
- }
-
- getLink() {
- return this.props.parentLink + '/' + this.props.name;
- }
-
- render() {
- const {title, subsection, children} = this.props;
-
- const link = this.getLink();
-
- let clonedChildren = null;
- if (children.length > 0) {
- clonedChildren = (
- <ul className='subsections'>
- {
- React.Children.map(children, (child) => {
- return React.cloneElement(child, {
- parentLink: link,
- subsection: true
- });
- })
- }
- </ul>
- );
- }
-
- let className = 'section';
- if (subsection) {
- className = 'subsection';
- }
-
- return (
- <li className={className}>
- <Link
- className={`${className}-title`}
- activeClassName={`${className}-title--active`}
- to={link}
- >
- <span className={`${className}-title__text`}>
- {title}
- </span>
- </Link>
- {clonedChildren}
- </li>
- );
- }
-}
diff --git a/webapp/components/backstage/components/backstage_sidebar.jsx b/webapp/components/backstage/components/backstage_sidebar.jsx
deleted file mode 100644
index 00cd6b63e..000000000
--- a/webapp/components/backstage/components/backstage_sidebar.jsx
+++ /dev/null
@@ -1,149 +0,0 @@
-import PropTypes from 'prop-types';
-
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import React from 'react';
-
-import TeamStore from 'stores/team_store.jsx';
-import * as Utils from 'utils/utils.jsx';
-
-import BackstageCategory from './backstage_category.jsx';
-import BackstageSection from './backstage_section.jsx';
-import {FormattedMessage} from 'react-intl';
-
-export default class BackstageSidebar extends React.Component {
- static get propTypes() {
- return {
- team: PropTypes.object.isRequired,
- user: PropTypes.object.isRequired
- };
- }
-
- renderCustomEmoji() {
- if (window.mm_config.EnableCustomEmoji !== 'true' || !Utils.canCreateCustomEmoji(this.props.user)) {
- return null;
- }
-
- return (
- <BackstageCategory
- name='emoji'
- parentLink={'/' + this.props.team.name}
- icon='fa-smile-o'
- title={
- <FormattedMessage
- id='backstage_sidebar.emoji'
- defaultMessage='Custom Emoji'
- />
- }
- />
- );
- }
-
- renderIntegrations() {
- const config = window.mm_config;
- const isSystemAdmin = Utils.isSystemAdmin(this.props.user.roles);
- if (config.EnableIncomingWebhooks !== 'true' &&
- config.EnableOutgoingWebhooks !== 'true' &&
- config.EnableCommands !== 'true' &&
- config.EnableOAuthServiceProvider !== 'true') {
- return null;
- }
-
- if (config.EnableOnlyAdminIntegrations !== 'false' &&
- !isSystemAdmin &&
- !TeamStore.isTeamAdmin(this.props.user.id, this.props.team.id)) {
- return null;
- }
-
- let incomingWebhooks = null;
- if (config.EnableIncomingWebhooks === 'true') {
- incomingWebhooks = (
- <BackstageSection
- name='incoming_webhooks'
- title={(
- <FormattedMessage
- id='backstage_sidebar.integrations.incoming_webhooks'
- defaultMessage='Incoming Webhooks'
- />
- )}
- />
- );
- }
-
- let outgoingWebhooks = null;
- if (config.EnableOutgoingWebhooks === 'true') {
- outgoingWebhooks = (
- <BackstageSection
- name='outgoing_webhooks'
- title={(
- <FormattedMessage
- id='backstage_sidebar.integrations.outgoing_webhooks'
- defaultMessage='Outgoing Webhooks'
- />
- )}
- />
- );
- }
-
- let commands = null;
- if (config.EnableCommands === 'true') {
- commands = (
- <BackstageSection
- name='commands'
- title={(
- <FormattedMessage
- id='backstage_sidebar.integrations.commands'
- defaultMessage='Slash Commands'
- />
- )}
- />
- );
- }
-
- let oauthApps = null;
- if (config.EnableOAuthServiceProvider === 'true' && (isSystemAdmin || config.EnableOnlyAdminIntegrations !== 'true')) {
- oauthApps = (
- <BackstageSection
- name='oauth2-apps'
- title={
- <FormattedMessage
- id='backstage_sidebar.integrations.oauthApps'
- defaultMessage='OAuth 2.0 Applications'
- />
- }
- />
- );
- }
-
- return (
- <BackstageCategory
- name='integrations'
- parentLink={'/' + this.props.team.name}
- icon='fa-link'
- title={
- <FormattedMessage
- id='backstage_sidebar.integrations'
- defaultMessage='Integrations'
- />
- }
- >
- {incomingWebhooks}
- {outgoingWebhooks}
- {commands}
- {oauthApps}
- </BackstageCategory>
- );
- }
-
- render() {
- return (
- <div className='backstage-sidebar'>
- <ul>
- {this.renderCustomEmoji()}
- {this.renderIntegrations()}
- </ul>
- </div>
- );
- }
-}