summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Duarte <csduarte@users.noreply.github.com>2017-08-28 09:22:54 -0700
committerHarrison Healey <harrisonmhealey@gmail.com>2017-08-28 12:22:54 -0400
commit510b1a18f5282981a70503c0cde474e121c9e651 (patch)
tree2d72de9607f55ab21e60ba92c604fee4961be3f0
parent9e95af7809f3f19f9b53c4a1e875672db5c4eb63 (diff)
downloadchat-510b1a18f5282981a70503c0cde474e121c9e651.tar.gz
chat-510b1a18f5282981a70503c0cde474e121c9e651.tar.bz2
chat-510b1a18f5282981a70503c0cde474e121c9e651.zip
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.
-rw-r--r--api4/system.go13
-rw-r--r--app/diagnostics.go10
-rw-r--r--config/default.json8
-rw-r--r--model/config.go14
-rw-r--r--utils/config.go7
-rw-r--r--webapp/components/admin_console/admin_sidebar.jsx17
-rw-r--r--webapp/components/admin_console/client_versions_settings.jsx169
-rwxr-xr-xwebapp/i18n/en.json13
-rw-r--r--webapp/routes/route_admin_console.jsx5
9 files changed, 255 insertions, 1 deletions
diff --git a/api4/system.go b/api4/system.go
index 0c0fc7d12..2ad408e13 100644
--- a/api4/system.go
+++ b/api4/system.go
@@ -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"
diff --git a/app/diagnostics.go b/app/diagnostics.go
index 1df5b1feb..9946ce9f1 100644
--- a/app/diagnostics.go
+++ b/app/diagnostics.go
@@ -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,
diff --git a/config/default.json b/config/default.json
index 7f03e035b..e0d3ec53c 100644
--- a/config/default.json
+++ b/config/default.json
@@ -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",
diff --git a/model/config.go b/model/config.go
index b3365a49a..7404e96be 100644
--- a/model/config.go
+++ b/model/config.go
@@ -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
diff --git a/utils/config.go b/utils/config.go
index 399e3a54c..14f827983 100644
--- a/utils/config.go
+++ b/utils/config.go
@@ -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)
diff --git a/webapp/components/admin_console/admin_sidebar.jsx b/webapp/components/admin_console/admin_sidebar.jsx
index 97b63e9c6..9a726c65c 100644
--- a/webapp/components/admin_console/admin_sidebar.jsx
+++ b/webapp/components/admin_console/admin_sidebar.jsx
@@ -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'
diff --git a/webapp/components/admin_console/client_versions_settings.jsx b/webapp/components/admin_console/client_versions_settings.jsx
new file mode 100644
index 000000000..0c9a5f58a
--- /dev/null
+++ b/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>
+ );
+ }
+}
diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json
index 7fefb188d..720a66317 100755
--- a/webapp/i18n/en.json
+++ b/webapp/i18n/en.json
@@ -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",
diff --git a/webapp/routes/route_admin_console.jsx b/webapp/routes/route_admin_console.jsx
index 15081a1d9..43245556f 100644
--- a/webapp/routes/route_admin_console.jsx
+++ b/webapp/routes/route_admin_console.jsx
@@ -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'/>