From d8bd57901e33a7057e26e782e295099ffcc0da89 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 6 Sep 2017 23:04:13 -0700 Subject: Removing webapp --- webapp/plugins/jira/components/settings.jsx | 252 ---------------------------- webapp/plugins/jira/components/style.scss | 45 ----- 2 files changed, 297 deletions(-) delete mode 100644 webapp/plugins/jira/components/settings.jsx delete mode 100644 webapp/plugins/jira/components/style.scss (limited to 'webapp/plugins/jira/components') diff --git a/webapp/plugins/jira/components/settings.jsx b/webapp/plugins/jira/components/settings.jsx deleted file mode 100644 index 4e9a479f5..000000000 --- a/webapp/plugins/jira/components/settings.jsx +++ /dev/null @@ -1,252 +0,0 @@ -// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import React from 'react'; - -import crypto from 'crypto'; - -import Suggestion from 'components/suggestion/suggestion.jsx'; -import Provider from 'components/suggestion/provider.jsx'; -import SuggestionBox from 'components/suggestion/suggestion_box.jsx'; -import SuggestionList from 'components/suggestion/suggestion_list.jsx'; -import {autocompleteUsersInTeam} from 'actions/user_actions.jsx'; - -import AppDispatcher from 'dispatcher/app_dispatcher.jsx'; -import {Client4} from 'mattermost-redux/client'; -import {ActionTypes} from 'utils/constants.jsx'; -import * as Utils from 'utils/utils.jsx'; - -import AdminSettings from 'components/admin_console/admin_settings.jsx'; -import {FormattedMessage} from 'react-intl'; -import SettingsGroup from 'components/admin_console/settings_group.jsx'; -import BooleanSetting from 'components/admin_console/boolean_setting.jsx'; -import GeneratedSetting from 'components/admin_console/generated_setting.jsx'; -import Setting from 'components/admin_console/setting.jsx'; - -import './style.scss'; - -class UserSuggestion extends Suggestion { - render() { - const {item, isSelection} = this.props; - - let className = 'suggestion-list__item mentions__name'; - if (isSelection) { - className += ' suggestion--selected'; - } - - const username = item.username; - let description = ''; - - if ((item.first_name || item.last_name) && item.nickname) { - description = `- ${Utils.getFullName(item)} (${item.nickname})`; - } else if (item.nickname) { - description = `- (${item.nickname})`; - } else if (item.first_name || item.last_name) { - description = `- ${Utils.getFullName(item)}`; - } - - return ( -
-
- - - {'@' + username} - - - {' '} - {description} - -
-
- ); - } -} - -class UserProvider extends Provider { - handlePretextChanged(suggestionId, pretext) { - const normalizedPretext = pretext.toLowerCase(); - this.startNewRequest(suggestionId, normalizedPretext); - - autocompleteUsersInTeam( - normalizedPretext, - (data) => { - if (this.shouldCancelDispatch(normalizedPretext)) { - return; - } - - const users = Object.assign([], data.users); - - AppDispatcher.handleServerAction({ - type: ActionTypes.SUGGESTION_RECEIVED_SUGGESTIONS, - id: suggestionId, - matchedPretext: normalizedPretext, - terms: users.map((user) => user.username), - items: users, - component: UserSuggestion - }); - } - ); - - return true; - } -} - -export default class JIRASettings extends AdminSettings { - constructor(props) { - super(props); - - this.getConfigFromState = this.getConfigFromState.bind(this); - this.renderSettings = this.renderSettings.bind(this); - this.handleSecretChange = this.handleSecretChange.bind(this); - this.handleEnabledChange = this.handleEnabledChange.bind(this); - this.handleUserSelected = this.handleUserSelected.bind(this); - - this.userSuggestionProviders = [new UserProvider()]; - } - - getConfigFromState(config) { - config.PluginSettings.Plugins = { - jira: { - Enabled: this.state.enabled, - Secret: this.state.secret, - UserName: this.state.userName - } - }; - - return config; - } - - getStateFromConfig(config) { - const settings = config.PluginSettings; - - const ret = { - enabled: false, - secret: '', - userName: '', - siteURL: config.ServiceSettings.SiteURL - }; - - if (typeof settings.Plugins !== 'undefined' && typeof settings.Plugins.jira !== 'undefined') { - ret.enabled = settings.Plugins.jira.Enabled || settings.Plugins.jira.enabled || false; - ret.secret = settings.Plugins.jira.Secret || settings.Plugins.jira.secret || ''; - ret.userName = settings.Plugins.jira.UserName || settings.Plugins.jira.username || ''; - } - - return ret; - } - - handleSecretChange(id, secret) { - this.handleChange(id, secret.replace('+', '-').replace('/', '_')); - } - - handleEnabledChange(enabled) { - if (enabled && this.state.secret === '') { - this.handleSecretChange('secret', crypto.randomBytes(256).toString('base64').substring(0, 32)); - } - this.handleChange('enabled', enabled); - } - - handleUserSelected(user) { - this.handleChange('userName', user.username); - } - - renderTitle() { - return Utils.localizeMessage('admin.plugins.jira', 'JIRA (Beta)'); - } - - renderSettings() { - var webhookDocsLink = ( - - - - ); - - return ( - - this.handleEnabledChange(value)} - /> - -
- this.handleChange('userName', e.target.value)} - onItemSelected={this.handleUserSelected} - listComponent={SuggestionList} - listStyle='bottom' - providers={this.userSuggestionProviders} - disabled={!this.state.enabled} - type='input' - requiredCharacters={0} - openOnFocus={true} - /> -
-
- -
-
-

- -

-
- ' + Utils.localizeMessage('admin.plugins.jira.secretParamPlaceholder', 'secret') + '')) + - '&team=' + - Utils.localizeMessage('admin.plugins.jira.teamParamPlaceholder', 'teamurl') + - '&channel=' + - Utils.localizeMessage('admin.plugins.jira.channelParamNamePlaceholder', 'channelurl') + - '' - }} - /> -
-
-
-
- ); - } -} diff --git a/webapp/plugins/jira/components/style.scss b/webapp/plugins/jira/components/style.scss deleted file mode 100644 index 46dd58427..000000000 --- a/webapp/plugins/jira/components/style.scss +++ /dev/null @@ -1,45 +0,0 @@ -@charset 'UTF-8'; - -@import 'compass/utilities'; -@import 'compass/css3'; - -.jirabots__dropdown { - position: relative; - - &:before { - border-color: #999 transparent transparent; - border-style: solid; - border-width: 5px 5px 2.5px; - content: ''; - height: 0; - pointer-events: none; - position: absolute; - right: 11px; - top: 15px; - width: 0; - } -} - -.jirabot__image { - @include border-radius(20px); - display: block; - font-size: 15px; - height: 16px; - line-height: 16px; - margin-right: 7px; - margin-top: 3px; - text-align: center; - width: 16px; - - .jirabot--align { - display: inline-block; - max-width: 80%; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } -} - -.jirabot__fullname { - @include opacity(.5); -} -- cgit v1.2.3-1-g7c22