Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
Adds a flag to autocomplete users and channels using elasticsearch i…
Browse files Browse the repository at this point in the history
…n the config (#2403)

* Adds a flag to autocomplete users and channels using elasticsearch in the config

* Wording changes
  • Loading branch information
mgdelacroix authored Mar 15, 2019
1 parent 4520ff7 commit 5f71820
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 23 additions & 1 deletion components/admin_console/elasticsearch_settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default class ElasticsearchSettings extends AdminSettings {
config.ElasticsearchSettings.Sniff = this.state.sniff;
config.ElasticsearchSettings.EnableIndexing = this.state.enableIndexing;
config.ElasticsearchSettings.EnableSearching = this.state.enableSearching;
config.ElasticsearchSettings.EnableAutocomplete = this.state.enableAutocomplete;

return config;
}
Expand All @@ -48,6 +49,7 @@ export default class ElasticsearchSettings extends AdminSettings {
sniff: config.ElasticsearchSettings.Sniff,
enableIndexing: config.ElasticsearchSettings.EnableIndexing,
enableSearching: config.ElasticsearchSettings.EnableSearching,
enableAutocomplete: config.ElasticsearchSettings.EnableAutocomplete,
configTested: true,
canSave: true,
canPurgeAndIndex: config.ElasticsearchSettings.EnableIndexing,
Expand All @@ -59,6 +61,7 @@ export default class ElasticsearchSettings extends AdminSettings {
if (value === false) {
this.setState({
enableSearching: false,
enableAutocomplete: false,
});
} else {
this.setState({
Expand All @@ -75,7 +78,7 @@ export default class ElasticsearchSettings extends AdminSettings {
});
}

if (id !== 'enableSearching') {
if (id !== 'enableSearching' && id !== 'enableAutocomplete') {
this.setState({
canPurgeAndIndex: false,
});
Expand Down Expand Up @@ -369,6 +372,25 @@ export default class ElasticsearchSettings extends AdminSettings {
onChange={this.handleSettingChanged}
setByEnv={this.isSetByEnv('ElasticsearchSettings.EnableSearching')}
/>
<BooleanSetting
id='enableAutocomplete'
label={
<FormattedMessage
id='admin.elasticsearch.enableAutocompleteTitle'
defaultMessage='Enable Elasticsearch for autocomplete queries:'
/>
}
helpText={
<FormattedMessage
id='admin.elasticsearch.enableAutocompleteDescription'
defaultMessage='Requires a successful connection to the Elasticsearch server. When true, Elasticsearch will be used for all autocompletion queries on users and channels using the latest index. Autocompletion results may be incomplete until a bulk index of the existing users and channels database is finished. When false, database autocomplete is used.'
/>
}
value={this.state.enableAutocomplete}
disabled={!this.state.enableIndexing || !this.state.configTested}
onChange={this.handleSettingChanged}
setByEnv={this.isSetByEnv('ElasticsearchSettings.EnableAutocomplete')}
/>
</SettingsGroup>
);
}
Expand Down
2 changes: 2 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@
"admin.elasticsearch.enableIndexingTitle": "Enable Elasticsearch Indexing:",
"admin.elasticsearch.enableSearchingDescription": "Requires a successful connection to the Elasticsearch server. When true, Elasticsearch will be used for all search queries using the latest index. Search results may be incomplete until a bulk index of the existing post database is finished. When false, database search is used.",
"admin.elasticsearch.enableSearchingTitle": "Enable Elasticsearch for search queries:",
"admin.elasticsearch.enableAutocompleteDescription": "Requires a successful connection to the Elasticsearch server. When true, Elasticsearch will be used for all autocompletion queries on users and channels using the latest index. Autocompletion results may be incomplete until a bulk index of the existing users and channels database is finished. When false, database autocomplete is used.",
"admin.elasticsearch.enableAutocompleteTitle": "Enable Elasticsearch for autocomplete queries:",
"admin.elasticsearch.password": "E.g.: \"yourpassword\"",
"admin.elasticsearch.passwordDescription": "(Optional) The password to authenticate to the Elasticsearch server.",
"admin.elasticsearch.passwordTitle": "Server Password:",
Expand Down

0 comments on commit 5f71820

Please sign in to comment.