Manage version configurations client versions (#7220)
* Add config values for client versions. Return client versions in ping response. * Manage client version through System Console. * Added client versions to diagnostics * Added translations messages en.json file. * Hide Client Versions on System Console.
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
9e95af7809
Коммит
510b1a18f5
@@ -45,7 +45,18 @@ func getSystemPing(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
actualGoroutines := runtime.NumGoroutine()
|
||||
if *utils.Cfg.ServiceSettings.GoroutineHealthThreshold <= 0 || actualGoroutines <= *utils.Cfg.ServiceSettings.GoroutineHealthThreshold {
|
||||
ReturnStatusOK(w)
|
||||
m := make(map[string]string)
|
||||
m[model.STATUS] = model.STATUS_OK
|
||||
|
||||
reqs := utils.Cfg.ClientRequirements
|
||||
m["AndroidLatestVersion"] = reqs.AndroidLatestVersion
|
||||
m["AndroidMinVersion"] = reqs.AndroidMinVersion
|
||||
m["DesktopLatestVersion"] = reqs.DesktopLatestVersion
|
||||
m["DesktopMinVersion"] = reqs.DesktopMinVersion
|
||||
m["IosLatestVersion"] = reqs.IosLatestVersion
|
||||
m["IosMinVersion"] = reqs.IosMinVersion
|
||||
|
||||
w.Write([]byte(model.MapToJson(m)))
|
||||
} else {
|
||||
rdata := map[string]string{}
|
||||
rdata["status"] = "unhealthy"
|
||||
|
||||
@@ -19,6 +19,7 @@ const (
|
||||
|
||||
TRACK_CONFIG_SERVICE = "config_service"
|
||||
TRACK_CONFIG_TEAM = "config_team"
|
||||
TRACK_CONFIG_CLIENT_REQ = "config_client_requirements"
|
||||
TRACK_CONFIG_SQL = "config_sql"
|
||||
TRACK_CONFIG_LOG = "config_log"
|
||||
TRACK_CONFIG_FILE = "config_file"
|
||||
@@ -244,6 +245,15 @@ func trackConfig() {
|
||||
"restrict_private_channel_manage_members": *utils.Cfg.TeamSettings.RestrictPrivateChannelManageMembers,
|
||||
})
|
||||
|
||||
SendDiagnostic(TRACK_CONFIG_CLIENT_REQ, map[string]interface{}{
|
||||
"android_latest_version": utils.Cfg.ClientRequirements.AndroidLatestVersion,
|
||||
"android_min_version": utils.Cfg.ClientRequirements.AndroidMinVersion,
|
||||
"desktop_latest_version": utils.Cfg.ClientRequirements.DesktopLatestVersion,
|
||||
"desktop_min_version": utils.Cfg.ClientRequirements.DesktopMinVersion,
|
||||
"ios_latest_version": utils.Cfg.ClientRequirements.IosLatestVersion,
|
||||
"ios_min_version": utils.Cfg.ClientRequirements.IosMinVersion,
|
||||
})
|
||||
|
||||
SendDiagnostic(TRACK_CONFIG_SQL, map[string]interface{}{
|
||||
"driver_name": utils.Cfg.SqlSettings.DriverName,
|
||||
"trace": utils.Cfg.SqlSettings.Trace,
|
||||
|
||||
@@ -76,6 +76,14 @@
|
||||
"MaxNotificationsPerChannel": 1000,
|
||||
"TeammateNameDisplay": "username"
|
||||
},
|
||||
"ClientRequirements": {
|
||||
"AndroidLatestVersion": "",
|
||||
"AndroidMinVersion": "",
|
||||
"DesktopLatestVersion": "",
|
||||
"DesktopMinVersion": "",
|
||||
"IosLatestVersion": "",
|
||||
"IosMinVersion": ""
|
||||
},
|
||||
"SqlSettings": {
|
||||
"DriverName": "mysql",
|
||||
"DataSource": "mmuser:mostest@tcp(dockerhost:3306)/mattermost_test?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s",
|
||||
|
||||
@@ -351,6 +351,15 @@ type TeamSettings struct {
|
||||
TeammateNameDisplay *string
|
||||
}
|
||||
|
||||
type ClientRequirements struct {
|
||||
AndroidLatestVersion string
|
||||
AndroidMinVersion string
|
||||
DesktopLatestVersion string
|
||||
DesktopMinVersion string
|
||||
IosLatestVersion string
|
||||
IosMinVersion string
|
||||
}
|
||||
|
||||
type LdapSettings struct {
|
||||
// Basic
|
||||
Enable *bool
|
||||
@@ -469,6 +478,7 @@ type PluginSettings struct {
|
||||
type Config struct {
|
||||
ServiceSettings ServiceSettings
|
||||
TeamSettings TeamSettings
|
||||
ClientRequirements ClientRequirements
|
||||
SqlSettings SqlSettings
|
||||
LogSettings LogSettings
|
||||
PasswordSettings PasswordSettings
|
||||
@@ -518,6 +528,10 @@ func (o *Config) GetSSOService(service string) *SSOSettings {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *Config) getClientRequirementsFromConfig() ClientRequirements {
|
||||
return o.ClientRequirements
|
||||
}
|
||||
|
||||
func ConfigFromJson(data io.Reader) *Config {
|
||||
decoder := json.NewDecoder(data)
|
||||
var o Config
|
||||
|
||||
@@ -437,6 +437,13 @@ func getClientConfig(c *model.Config) map[string]string {
|
||||
props["RestrictPrivateChannelManageMembers"] = *c.TeamSettings.RestrictPrivateChannelManageMembers
|
||||
props["TeammateNameDisplay"] = *c.TeamSettings.TeammateNameDisplay
|
||||
|
||||
props["AndroidLatestVersion"] = c.ClientRequirements.AndroidLatestVersion
|
||||
props["AndroidMinVersion"] = c.ClientRequirements.AndroidMinVersion
|
||||
props["DesktopLatestVersion"] = c.ClientRequirements.DesktopLatestVersion
|
||||
props["DesktopMinVersion"] = c.ClientRequirements.DesktopMinVersion
|
||||
props["IosLatestVersion"] = c.ClientRequirements.IosLatestVersion
|
||||
props["IosMinVersion"] = c.ClientRequirements.IosMinVersion
|
||||
|
||||
props["EnableOAuthServiceProvider"] = strconv.FormatBool(c.ServiceSettings.EnableOAuthServiceProvider)
|
||||
props["GoogleDeveloperKey"] = c.ServiceSettings.GoogleDeveloperKey
|
||||
props["EnableIncomingWebhooks"] = strconv.FormatBool(c.ServiceSettings.EnableIncomingWebhooks)
|
||||
|
||||
@@ -277,6 +277,22 @@ export default class AdminSidebar extends React.Component {
|
||||
);
|
||||
}
|
||||
|
||||
const SHOW_CLIENT_VERSIONS = false;
|
||||
let clientVersions = null;
|
||||
if (SHOW_CLIENT_VERSIONS) {
|
||||
clientVersions = (
|
||||
<AdminSidebarSection
|
||||
name='client_versions'
|
||||
title={
|
||||
<FormattedMessage
|
||||
id='admin.sidebar.client_versions'
|
||||
defaultMessage='Client Versions'
|
||||
/>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='admin-sidebar'>
|
||||
<AdminSidebarHeader/>
|
||||
@@ -477,6 +493,7 @@ export default class AdminSidebar extends React.Component {
|
||||
/>
|
||||
}
|
||||
/>
|
||||
{clientVersions}
|
||||
</AdminSidebarSection>
|
||||
<AdminSidebarSection
|
||||
name='notifications'
|
||||
|
||||
169
webapp/components/admin_console/client_versions_settings.jsx
Обычный файл
169
webapp/components/admin_console/client_versions_settings.jsx
Обычный файл
@@ -0,0 +1,169 @@
|
||||
// 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 {FormattedMessage} from 'react-intl';
|
||||
import SettingsGroup from './settings_group.jsx';
|
||||
import TextSetting from './text_setting.jsx';
|
||||
|
||||
export default class ClientVersionsSettings extends AdminSettings {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.getConfigFromState = this.getConfigFromState.bind(this);
|
||||
|
||||
this.renderSettings = this.renderSettings.bind(this);
|
||||
}
|
||||
|
||||
getConfigFromState(config) {
|
||||
config.ClientRequirements.AndroidLatestVersion = this.state.androidLatestVersion;
|
||||
config.ClientRequirements.AndroidMinVersion = this.state.androidMinVersion;
|
||||
config.ClientRequirements.DesktopLatestVersion = this.state.desktopLatestVersion;
|
||||
config.ClientRequirements.DesktopMinVersion = this.state.desktopMinVersion;
|
||||
config.ClientRequirements.IosLatestVersion = this.state.iosLatestVersion;
|
||||
config.ClientRequirements.IosMinVersion = this.state.iosMinVersion;
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
getStateFromConfig(config) {
|
||||
return {
|
||||
androidLatestVersion: config.ClientRequirements.AndroidLatestVersion,
|
||||
androidMinVersion: config.ClientRequirements.AndroidMinVersion,
|
||||
desktopLatestVersion: config.ClientRequirements.DesktopLatestVersion,
|
||||
desktopMinVersion: config.ClientRequirements.DesktopMinVersion,
|
||||
iosLatestVersion: config.ClientRequirements.IosLatestVersion,
|
||||
iosMinVersion: config.ClientRequirements.IosMinVersion
|
||||
};
|
||||
}
|
||||
|
||||
renderTitle() {
|
||||
return (
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id='admin.security.client_versions'
|
||||
defaultMessage='Client Versions'
|
||||
/>
|
||||
</h3>
|
||||
);
|
||||
}
|
||||
|
||||
renderSettings() {
|
||||
return (
|
||||
<SettingsGroup>
|
||||
<TextSetting
|
||||
id='androidLatestVersion'
|
||||
label={
|
||||
<FormattedMessage
|
||||
id='admin.client_versions.androidLatestVersion'
|
||||
defaultMessage='Latest Android Version'
|
||||
/>
|
||||
}
|
||||
placeholder={Utils.localizeMessage('admin.client_versions.androidLatestVersion', 'X.X.X')}
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
id='admin.client_versions.androidLatestVersionHelp'
|
||||
defaultMessage='The latest released Android version'
|
||||
/>
|
||||
}
|
||||
value={this.state.androidLatestVersion}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
<TextSetting
|
||||
id='androidMinVersion'
|
||||
label={
|
||||
<FormattedMessage
|
||||
id='admin.client_versions.androidMinVersion'
|
||||
defaultMessage='Minimum Android Version'
|
||||
/>
|
||||
}
|
||||
placeholder={Utils.localizeMessage('admin.client_versions.androidMinVersion', 'X.X.X')}
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
id='admin.client_versions.androidMinVersionHelp'
|
||||
defaultMessage='The minimum compliant Android version'
|
||||
/>
|
||||
}
|
||||
value={this.state.androidMinVersion}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
<TextSetting
|
||||
id='desktopLatestVersion'
|
||||
label={
|
||||
<FormattedMessage
|
||||
id='admin.client_versions.desktopLatestVersion'
|
||||
defaultMessage='Latest Desktop Version'
|
||||
/>
|
||||
}
|
||||
placeholder={Utils.localizeMessage('admin.client_versions.desktopLatestVersion', 'X.X.X')}
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
id='admin.client_versions.desktopLatestVersionHelp'
|
||||
defaultMessage='The latest released Desktop version'
|
||||
/>
|
||||
}
|
||||
value={this.state.desktopLatestVersion}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
<TextSetting
|
||||
id='desktopMinVersion'
|
||||
label={
|
||||
<FormattedMessage
|
||||
id='admin.client_versions.desktopMinVersion'
|
||||
defaultMessage='Minimum Destop Version'
|
||||
/>
|
||||
}
|
||||
placeholder={Utils.localizeMessage('admin.client_versions.desktopMinVersion', 'X.X.X')}
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
id='admin.client_versions.desktopMinVersionHelp'
|
||||
defaultMessage='The minimum compliant Desktop version'
|
||||
/>
|
||||
}
|
||||
value={this.state.desktopMinVersion}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
<TextSetting
|
||||
id='iosLatestVersion'
|
||||
label={
|
||||
<FormattedMessage
|
||||
id='admin.client_versions.iosLatestVersion'
|
||||
defaultMessage='Latest IOS Version'
|
||||
/>
|
||||
}
|
||||
placeholder={Utils.localizeMessage('admin.client_versions.iosLatestVersion', 'X.X.X')}
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
id='admin.client_versions.iosLatestVersionHelp'
|
||||
defaultMessage='The latest released IOS version'
|
||||
/>
|
||||
}
|
||||
value={this.state.iosLatestVersion}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
<TextSetting
|
||||
id='iosMinVersion'
|
||||
label={
|
||||
<FormattedMessage
|
||||
id='admin.client_versions.iosMinVersion'
|
||||
defaultMessage='Minimum IOS Version'
|
||||
/>
|
||||
}
|
||||
placeholder={Utils.localizeMessage('admin.client_versions.iosMinVersion', 'X.X.X')}
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
id='admin.client_versions.iosMinVersionHelp'
|
||||
defaultMessage='The minimum compliant IOS version'
|
||||
/>
|
||||
}
|
||||
value={this.state.iosMinVersion}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
</SettingsGroup>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -150,6 +150,18 @@
|
||||
"admin.authentication.oauth": "OAuth 2.0",
|
||||
"admin.authentication.saml": "SAML 2.0",
|
||||
"admin.banner.heading": "Note:",
|
||||
"admin.client_versions.androidLatestVersion": "Latest Android Version",
|
||||
"admin.client_versions.androidLatestVersionHelp": "The latest released Android version",
|
||||
"admin.client_versions.androidMinVersion": "Minimum Android Version",
|
||||
"admin.client_versions.androidMinVersionHelp": "The minimum compliant Android version",
|
||||
"admin.client_versions.desktopLatestVersion": "Latest Desktop Version",
|
||||
"admin.client_versions.desktopLatestVersionHelp": "The latest released Desktop version",
|
||||
"admin.client_versions.desktopMinVersion": "Minimum Destop Version",
|
||||
"admin.client_versions.desktopMinVersionHelp": "The minimum compliant Desktop version",
|
||||
"admin.client_versions.iosLatestVersion": "Latest IOS Version",
|
||||
"admin.client_versions.iosLatestVersionHelp": "The latest released IOS version",
|
||||
"admin.client_versions.iosMinVersion": "Minimum IOS Version",
|
||||
"admin.client_versions.iosMinVersionHelp": "The minimum compliant IOS version",
|
||||
"admin.cluster.enableDescription": "When true, Mattermost will run in High Availability mode. Please see <a href=\"http://docs.mattermost.com/deployment/cluster.html\" target='_blank'>documentation</a> to learn more about configuring High Availability for Mattermost.",
|
||||
"admin.cluster.enableTitle": "Enable High Availability Mode:",
|
||||
"admin.cluster.interNodeListenAddressDesc": "The address the server will listen on for communicating with other servers.",
|
||||
@@ -858,6 +870,7 @@
|
||||
"admin.sidebar.advanced": "Advanced",
|
||||
"admin.sidebar.audits": "Compliance and Auditing",
|
||||
"admin.sidebar.authentication": "Authentication",
|
||||
"admin.sidebar.client_versions": "Client Versions",
|
||||
"admin.sidebar.cluster": "High Availability",
|
||||
"admin.sidebar.compliance": "Compliance",
|
||||
"admin.sidebar.configuration": "Configuration",
|
||||
|
||||
@@ -25,6 +25,7 @@ import MfaSettings from 'components/admin_console/mfa_settings.jsx';
|
||||
import PublicLinkSettings from 'components/admin_console/public_link_settings.jsx';
|
||||
import SessionSettings from 'components/admin_console/session_settings.jsx';
|
||||
import ConnectionSettings from 'components/admin_console/connection_settings.jsx';
|
||||
import ClientVersionsSettings from 'components/admin_console/client_versions_settings.jsx';
|
||||
import EmailSettings from 'components/admin_console/email_settings.jsx';
|
||||
import PushSettings from 'components/admin_console/push_settings.jsx';
|
||||
import CustomIntegrationsSettings from 'components/admin_console/custom_integrations_settings.jsx';
|
||||
@@ -134,6 +135,10 @@ export default (
|
||||
path='connections'
|
||||
component={ConnectionSettings}
|
||||
/>
|
||||
<Route
|
||||
path='client_versions'
|
||||
component={ClientVersionsSettings}
|
||||
/>
|
||||
</Route>
|
||||
<Route path='notifications'>
|
||||
<IndexRedirect to='notifications_email'/>
|
||||
|
||||
Ссылка в новой задаче
Block a user