// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import AdminSettings from './admin_settings.jsx';
import BooleanSetting from './boolean_setting.jsx';
import TextSetting from './text_setting.jsx';
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
import SettingsGroup from './settings_group.jsx';
import ClusterTableContainer from './cluster_table_container.jsx';
import AdminStore from 'stores/admin_store.jsx';
import * as Utils from 'utils/utils.jsx';
export default class ClusterSettings extends AdminSettings {
constructor(props) {
super(props);
this.getConfigFromState = this.getConfigFromState.bind(this);
this.renderSettings = this.renderSettings.bind(this);
}
getConfigFromState(config) {
config.ClusterSettings.Enable = this.state.enable;
config.ClusterSettings.InterNodeListenAddress = this.state.interNodeListenAddress;
config.ClusterSettings.InterNodeUrls = this.state.interNodeUrls.split(',');
config.ClusterSettings.InterNodeUrls = config.ClusterSettings.InterNodeUrls.map((url) => {
return url.trim();
});
if (config.ClusterSettings.InterNodeUrls.length === 1 && config.ClusterSettings.InterNodeUrls[0] === '') {
config.ClusterSettings.InterNodeUrls = [];
}
return config;
}
getStateFromConfig(config) {
const settings = config.ClusterSettings;
return {
enable: settings.Enable,
interNodeUrls: settings.InterNodeUrls.join(', '),
interNodeListenAddress: settings.InterNodeListenAddress,
showWarning: false
};
}
renderTitle() {
return (