// 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 DropdownSetting from './dropdown_setting.jsx'; import {FormattedMessage} from 'react-intl'; import SettingsGroup from './settings_group.jsx'; import TextSetting from './text_setting.jsx'; const DRIVER_LOCAL = 'local'; const DRIVER_S3 = 'amazons3'; export default class StorageSettings extends AdminSettings { constructor(props) { super(props); this.getConfigFromState = this.getConfigFromState.bind(this); this.renderSettings = this.renderSettings.bind(this); this.state = Object.assign(this.state, { maxFileSize: props.config.FileSettings.MaxFileSize / 1024 / 1024, driverName: props.config.FileSettings.DriverName, directory: props.config.FileSettings.Directory, amazonS3AccessKeyId: props.config.FileSettings.AmazonS3AccessKeyId, amazonS3SecretAccessKey: props.config.FileSettings.AmazonS3SecretAccessKey, amazonS3Bucket: props.config.FileSettings.AmazonS3Bucket, amazonS3Region: props.config.FileSettings.AmazonS3Region }); } getConfigFromState(config) { config.FileSettings.MaxFileSize = this.parseInt(this.state.maxFileSize) * 1024 * 1024; config.FileSettings.DriverName = this.state.driverName; config.FileSettings.Directory = this.state.directory; config.FileSettings.AmazonS3AccessKeyId = this.state.amazonS3AccessKeyId; config.FileSettings.AmazonS3SecretAccessKey = this.state.amazonS3SecretAccessKey; config.FileSettings.AmazonS3Bucket = this.state.amazonS3Bucket; config.FileSettings.AmazonS3Region = this.state.amazonS3Region; return config; } renderTitle() { return (