// Copyright (c) 2015 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 {FormattedMessage} from 'react-intl'; import GeneratedSetting from './generated_setting.jsx'; import SettingsGroup from './settings_group.jsx'; import TextSetting from './text_setting.jsx'; import RecycleDbButton from './recycle_db.jsx'; export default class DatabaseSettings extends AdminSettings { constructor(props) { super(props); this.getConfigFromState = this.getConfigFromState.bind(this); this.renderSettings = this.renderSettings.bind(this); this.state = Object.assign(this.state, { driverName: this.props.config.SqlSettings.DriverName, dataSource: this.props.config.SqlSettings.DataSource, maxIdleConns: props.config.SqlSettings.MaxIdleConns, maxOpenConns: props.config.SqlSettings.MaxOpenConns, atRestEncryptKey: props.config.SqlSettings.AtRestEncryptKey, trace: props.config.SqlSettings.Trace }); } getConfigFromState(config) { // driverName and dataSource are read-only from the UI config.SqlSettings.MaxIdleConns = this.parseIntNonZero(this.state.maxIdleConns); config.SqlSettings.MaxOpenConns = this.parseIntNonZero(this.state.maxOpenConns); config.SqlSettings.AtRestEncryptKey = this.state.atRestEncryptKey; config.SqlSettings.Trace = this.state.trace; return config; } renderTitle() { return (
{this.state.driverName}
{dataSource}