From d8bd57901e33a7057e26e782e295099ffcc0da89 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 6 Sep 2017 23:04:13 -0700 Subject: Removing webapp --- .../components/backstage/backstage_controller.jsx | 82 ------------ .../backstage/components/backstage_category.jsx | 75 ----------- .../backstage/components/backstage_header.jsx | 41 ------ .../backstage/components/backstage_list.jsx | 114 ---------------- .../backstage/components/backstage_navbar.jsx | 43 ------ .../backstage/components/backstage_section.jsx | 80 ----------- .../backstage/components/backstage_sidebar.jsx | 149 --------------------- 7 files changed, 584 deletions(-) delete mode 100644 webapp/components/backstage/backstage_controller.jsx delete mode 100644 webapp/components/backstage/components/backstage_category.jsx delete mode 100644 webapp/components/backstage/components/backstage_header.jsx delete mode 100644 webapp/components/backstage/components/backstage_list.jsx delete mode 100644 webapp/components/backstage/components/backstage_navbar.jsx delete mode 100644 webapp/components/backstage/components/backstage_section.jsx delete mode 100644 webapp/components/backstage/components/backstage_sidebar.jsx (limited to 'webapp/components/backstage') diff --git a/webapp/components/backstage/backstage_controller.jsx b/webapp/components/backstage/backstage_controller.jsx deleted file mode 100644 index 795fb0e95..000000000 --- a/webapp/components/backstage/backstage_controller.jsx +++ /dev/null @@ -1,82 +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 UserStore from 'stores/user_store.jsx'; - -import BackstageSidebar from './components/backstage_sidebar.jsx'; -import BackstageNavbar from './components/backstage_navbar.jsx'; -import AnnouncementBar from 'components/announcement_bar'; - -export default class BackstageController extends React.Component { - static get propTypes() { - return { - user: PropTypes.object, - children: PropTypes.node.isRequired - }; - } - - constructor(props) { - super(props); - - this.onTeamChange = this.onTeamChange.bind(this); - - const team = TeamStore.getCurrent(); - - this.state = { - team, - isAdmin: UserStore.isSystemAdminForCurrentUser(this.props.user) || - TeamStore.isTeamAdminForCurrentTeam(team) - }; - } - - componentDidMount() { - TeamStore.addChangeListener(this.onTeamChange); - } - - componentWillUnmount() { - TeamStore.removeChangeListener(this.onTeamChange); - } - - onTeamChange() { - const team = TeamStore.getCurrent(); - - this.state = { - team, - isAdmin: UserStore.isSystemAdminForCurrentUser(this.props.user) || - TeamStore.isTeamAdminForCurrentTeam(team) - }; - } - - render() { - return ( -
- - -
- - { - React.Children.map(this.props.children, (child) => { - if (!child) { - return child; - } - - return React.cloneElement(child, { - team: this.state.team, - user: this.props.user, - isAdmin: this.state.isAdmin - }); - }) - } -
-
- ); - } -} 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 = ( - - ); - } - - return ( -
  • - - - - {title} - - - {clonedChildren} -
  • - ); - } -} 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( - - - - ); - } - - children.push(child); - }); - - return ( -
    -

    - {children} -

    -
    - ); - } -} 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 = ; - } else { - children = React.Children.map(this.props.children, (child) => { - return React.cloneElement(child, {filter}); - }); - - if (children.length === 0 && this.props.emptyText) { - children = ( - - {this.props.emptyText} - - ); - } - } - - let addLink = null; - if (this.props.addLink && this.props.addText) { - addLink = ( - - - - ); - } - - return ( -
    -
    -

    - {this.props.header} -

    - {addLink} -
    -
    -
    - - -
    -
    - - {this.props.helpText} - -
    - {children} -
    -
    - ); - } -} 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 ( -
    - - - - - - -
    - ); - } -} 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 = ( -
      - { - React.Children.map(children, (child) => { - return React.cloneElement(child, { - parentLink: link, - subsection: true - }); - }) - } -
    - ); - } - - let className = 'section'; - if (subsection) { - className = 'subsection'; - } - - return ( -
  • - - - {title} - - - {clonedChildren} -
  • - ); - } -} 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 ( - - } - /> - ); - } - - 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 = ( - - )} - /> - ); - } - - let outgoingWebhooks = null; - if (config.EnableOutgoingWebhooks === 'true') { - outgoingWebhooks = ( - - )} - /> - ); - } - - let commands = null; - if (config.EnableCommands === 'true') { - commands = ( - - )} - /> - ); - } - - let oauthApps = null; - if (config.EnableOAuthServiceProvider === 'true' && (isSystemAdmin || config.EnableOnlyAdminIntegrations !== 'true')) { - oauthApps = ( - - } - /> - ); - } - - return ( - - } - > - {incomingWebhooks} - {outgoingWebhooks} - {commands} - {oauthApps} - - ); - } - - render() { - return ( -
    -
      - {this.renderCustomEmoji()} - {this.renderIntegrations()} -
    -
    - ); - } -} -- cgit v1.2.3-1-g7c22