// Copyright (c) 2016 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 {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; import SettingsGroup from './settings_group.jsx'; import BooleanSetting from './boolean_setting.jsx'; import TextSetting from './text_setting.jsx'; export default class WebrtcSettings extends AdminSettings { constructor(props) { super(props); this.canSave = this.canSave.bind(this); this.handleAgreeChange = this.handleAgreeChange.bind(this); this.getConfigFromState = this.getConfigFromState.bind(this); this.renderSettings = this.renderSettings.bind(this); } canSave() { return !this.state.enableWebrtc || this.state.agree; } handleAgreeChange(e) { this.setState({ agree: e.target.checked }); } getConfigFromState(config) { config.WebrtcSettings.Enable = this.state.enableWebrtc; config.WebrtcSettings.GatewayWebsocketUrl = this.state.gatewayWebsocketUrl; config.WebrtcSettings.GatewayAdminUrl = this.state.gatewayAdminUrl; config.WebrtcSettings.GatewayAdminSecret = this.state.gatewayAdminSecret; config.WebrtcSettings.StunURI = this.state.stunURI; config.WebrtcSettings.TurnURI = this.state.turnURI; config.WebrtcSettings.TurnUsername = this.state.turnUsername; config.WebrtcSettings.TurnSharedKey = this.state.turnSharedKey; return config; } getStateFromConfig(config) { const settings = config.WebrtcSettings; return { hasErrors: false, enableWebrtc: settings.Enable, gatewayWebsocketUrl: settings.GatewayWebsocketUrl, gatewayAdminUrl: settings.GatewayAdminUrl, gatewayAdminSecret: settings.GatewayAdminSecret, stunURI: settings.StunURI, turnURI: settings.TurnURI, turnUsername: settings.TurnUsername, turnSharedKey: settings.TurnSharedKey, agree: settings.Enable }; } renderTitle() { return (