// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import * as Utils from 'utils/utils.jsx';
import AdminSettings from './admin_settings.jsx';
import BooleanSetting from './boolean_setting.jsx';
import {FormattedHTMLMessage, FormattedMessage} from 'react-intl';
import SettingsGroup from './settings_group.jsx';
import TextSetting from './text_setting.jsx';
export default class GitLabSettings extends AdminSettings {
constructor(props) {
super(props);
this.getConfigFromState = this.getConfigFromState.bind(this);
this.renderSettings = this.renderSettings.bind(this);
}
getConfigFromState(config) {
config.GitLabSettings.Enable = this.state.enable;
config.GitLabSettings.Id = this.state.id;
config.GitLabSettings.Secret = this.state.secret;
config.GitLabSettings.UserApiEndpoint = this.state.userApiEndpoint;
config.GitLabSettings.AuthEndpoint = this.state.authEndpoint;
config.GitLabSettings.TokenEndpoint = this.state.tokenEndpoint;
return config;
}
getStateFromConfig(config) {
return {
enable: config.GitLabSettings.Enable,
id: config.GitLabSettings.Id,
secret: config.GitLabSettings.Secret,
userApiEndpoint: config.GitLabSettings.UserApiEndpoint,
authEndpoint: config.GitLabSettings.AuthEndpoint,
tokenEndpoint: config.GitLabSettings.TokenEndpoint
};
}
renderTitle() {
return (
);
}
renderSettings() {
return (
}
helpText={
}
value={this.state.enable}
onChange={this.handleChange}
/>
}
placeholder={Utils.localizeMessage('admin.gitlab.clientIdExample', 'Ex "jcuS8PuvcpGhpgHhlcpT1Mx42pnqMxQY"')}
helpText={
}
value={this.state.id}
onChange={this.handleChange}
disabled={!this.state.enable}
/>
}
placeholder={Utils.localizeMessage('admin.gitlab.clientSecretExample', 'Ex "jcuS8PuvcpGhpgHhlcpT1Mx42pnqMxQY"')}
helpText={
}
value={this.state.secret}
onChange={this.handleChange}
disabled={!this.state.enable}
/>
}
placeholder={Utils.localizeMessage('admin.gitlab.userExample', 'Ex "https:///api/v3/user"')}
helpText={
}
value={this.state.userApiEndpoint}
onChange={this.handleChange}
disabled={!this.state.enable}
/>
}
placeholder={Utils.localizeMessage('admin.gitlab.authExample', 'Ex "https:///oauth/authorize"')}
helpText={
}
value={this.state.authEndpoint}
onChange={this.handleChange}
disabled={!this.state.enable}
/>
}
placeholder={Utils.localizeMessage('admin.gitlab.tokenExample', 'Ex "https:///oauth/token"')}
helpText={
}
value={this.state.tokenEndpoint}
onChange={this.handleChange}
disabled={!this.state.enable}
/>
);
}
}