mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
Use docLinks service for ui settings in Discover and Data plugins (#124302)
This commit is contained in:
parent
cfaa08f47e
commit
2446d11d66
5 changed files with 22 additions and 16 deletions
|
@ -64,6 +64,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
|
|||
},
|
||||
discover: {
|
||||
guide: `${KIBANA_DOCS}discover.html`,
|
||||
fieldStatistics: `${KIBANA_DOCS}show-field-statistics.html`,
|
||||
},
|
||||
filebeat: {
|
||||
base: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}`,
|
||||
|
@ -234,6 +235,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
|
|||
asyncSearch: `${ELASTICSEARCH_DOCS}async-search-intro.html`,
|
||||
dataStreams: `${ELASTICSEARCH_DOCS}data-streams.html`,
|
||||
deprecationLogging: `${ELASTICSEARCH_DOCS}logging.html#deprecation-logging`,
|
||||
frozenIndices: `${ELASTICSEARCH_DOCS}frozen-indices.html`,
|
||||
hiddenIndices: `${ELASTICSEARCH_DOCS}multi-index.html#hidden`,
|
||||
ilm: `${ELASTICSEARCH_DOCS}index-lifecycle-management.html`,
|
||||
ilmForceMerge: `${ELASTICSEARCH_DOCS}ilm-forcemerge.html`,
|
||||
|
|
|
@ -94,7 +94,7 @@ export class DataServerPlugin
|
|||
this.autocompleteService.setup(core);
|
||||
this.kqlTelemetryService.setup(core, { usageCollection });
|
||||
|
||||
core.uiSettings.register(getUiSettings());
|
||||
core.uiSettings.register(getUiSettings(core.docLinks));
|
||||
|
||||
const searchSetup = this.searchService.setup(core, {
|
||||
bfetch,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { UiSettingsParams } from 'kibana/server';
|
||||
import type { DocLinksServiceSetup, UiSettingsParams } from 'kibana/server';
|
||||
import { DEFAULT_QUERY_LANGUAGE, UI_SETTINGS } from '../common';
|
||||
|
||||
const luceneQueryLanguageLabel = i18n.translate('data.advancedSettings.searchQueryLanguageLucene', {
|
||||
|
@ -31,7 +31,9 @@ const requestPreferenceOptionLabels = {
|
|||
}),
|
||||
};
|
||||
|
||||
export function getUiSettings(): Record<string, UiSettingsParams<unknown>> {
|
||||
export function getUiSettings(
|
||||
docLinks: DocLinksServiceSetup
|
||||
): Record<string, UiSettingsParams<unknown>> {
|
||||
return {
|
||||
[UI_SETTINGS.META_FIELDS]: {
|
||||
name: i18n.translate('data.advancedSettings.metaFieldsTitle', {
|
||||
|
@ -71,7 +73,7 @@ export function getUiSettings(): Record<string, UiSettingsParams<unknown>> {
|
|||
'data.advancedSettings.query.queryStringOptionsText',
|
||||
values: {
|
||||
optionsLink:
|
||||
'<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html" target="_blank" rel="noopener">' +
|
||||
`<a href=${docLinks.links.query.luceneQuery} target="_blank" rel="noopener">` +
|
||||
i18n.translate('data.advancedSettings.query.queryStringOptions.optionsLinkText', {
|
||||
defaultMessage: 'Options',
|
||||
}) +
|
||||
|
@ -150,7 +152,7 @@ export function getUiSettings(): Record<string, UiSettingsParams<unknown>> {
|
|||
'data.advancedSettings.sortOptionsText',
|
||||
values: {
|
||||
optionsLink:
|
||||
'<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-sort.html" target="_blank" rel="noopener">' +
|
||||
`<a href=${docLinks?.links.elasticsearch.sortSearch} target="_blank" rel="noopener">` +
|
||||
i18n.translate('data.advancedSettings.sortOptions.optionsLinkText', {
|
||||
defaultMessage: 'Options',
|
||||
}) +
|
||||
|
@ -232,7 +234,7 @@ export function getUiSettings(): Record<string, UiSettingsParams<unknown>> {
|
|||
setRequestReferenceSetting: `<strong>${UI_SETTINGS.COURIER_SET_REQUEST_PREFERENCE}</strong>`,
|
||||
customSettingValue: '"custom"',
|
||||
requestPreferenceLink:
|
||||
'<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-preference.html" target="_blank" rel="noopener">' +
|
||||
`<a href=${docLinks.links.apis.searchPreference} target="_blank" rel="noopener">` +
|
||||
i18n.translate(
|
||||
'data.advancedSettings.courier.customRequestPreference.requestPreferenceLinkText',
|
||||
{
|
||||
|
@ -256,7 +258,7 @@ export function getUiSettings(): Record<string, UiSettingsParams<unknown>> {
|
|||
'Controls the {maxRequestsLink} setting used for _msearch requests sent by Kibana. ' +
|
||||
'Set to 0 to disable this config and use the Elasticsearch default.',
|
||||
values: {
|
||||
maxRequestsLink: `<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html"
|
||||
maxRequestsLink: `<a href=${docLinks.links.apis.multiSearch}
|
||||
target="_blank" rel="noopener" >max_concurrent_shard_requests</a>`,
|
||||
},
|
||||
}),
|
||||
|
@ -265,7 +267,7 @@ export function getUiSettings(): Record<string, UiSettingsParams<unknown>> {
|
|||
},
|
||||
[UI_SETTINGS.SEARCH_INCLUDE_FROZEN]: {
|
||||
name: 'Search in frozen indices',
|
||||
description: `Will include <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen-indices.html"
|
||||
description: `Will include <a href=${docLinks.links.elasticsearch.frozenIndices}
|
||||
target="_blank" rel="noopener">frozen indices</a> in results if enabled. Searching through frozen indices
|
||||
might increase the search time.`,
|
||||
value: false,
|
||||
|
@ -444,7 +446,7 @@ export function getUiSettings(): Record<string, UiSettingsParams<unknown>> {
|
|||
'data.advancedSettings.timepicker.quickRanges.acceptedFormatsLinkText',
|
||||
values: {
|
||||
acceptedFormatsLink:
|
||||
`<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#date-math"
|
||||
`<a href=${docLinks.links.date.dateMath}
|
||||
target="_blank" rel="noopener">` +
|
||||
i18n.translate('data.advancedSettings.timepicker.quickRanges.acceptedFormatsLinkText', {
|
||||
defaultMessage: 'accepted formats',
|
||||
|
@ -495,7 +497,7 @@ export function getUiSettings(): Record<string, UiSettingsParams<unknown>> {
|
|||
'Elasticsearch terms aggregation. {learnMoreLink}',
|
||||
values: {
|
||||
learnMoreLink:
|
||||
'<a href="https://www.elastic.co/guide/en/kibana/current/kibana-concepts-analysts.html#autocomplete-suggestions" target="_blank" rel="noopener">' +
|
||||
`<a href=${docLinks.links.kibana.autocompleteSuggestions} target="_blank" rel="noopener">` +
|
||||
i18n.translate('data.advancedSettings.autocompleteValueSuggestionMethodLink', {
|
||||
defaultMessage: 'Learn more.',
|
||||
}) +
|
||||
|
@ -517,7 +519,7 @@ export function getUiSettings(): Record<string, UiSettingsParams<unknown>> {
|
|||
'Disable this property to get autocomplete suggestions from your full dataset, rather than from the current time range. {learnMoreLink}',
|
||||
values: {
|
||||
learnMoreLink:
|
||||
'<a href="https://www.elastic.co/guide/en/kibana/current/kibana-concepts-analysts.html#autocomplete-suggestions" target="_blank" rel="noopener">' +
|
||||
`<a href=${docLinks.links.kibana.autocompleteSuggestions} target="_blank" rel="noopener">` +
|
||||
i18n.translate('data.advancedSettings.autocompleteValueSuggestionMethodLearnMoreLink', {
|
||||
defaultMessage: 'Learn more.',
|
||||
}) +
|
||||
|
|
|
@ -14,7 +14,7 @@ import { searchSavedObjectType } from './saved_objects';
|
|||
export class DiscoverServerPlugin implements Plugin<object, object> {
|
||||
public setup(core: CoreSetup) {
|
||||
core.capabilities.registerProvider(capabilitiesProvider);
|
||||
core.uiSettings.register(getUiSettings());
|
||||
core.uiSettings.register(getUiSettings(core.docLinks));
|
||||
core.savedObjects.registerType(searchSavedObjectType);
|
||||
|
||||
return {};
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
import { UiSettingsParams } from 'kibana/server';
|
||||
import type { DocLinksServiceSetup, UiSettingsParams } from 'kibana/server';
|
||||
import { METRIC_TYPE } from '@kbn/analytics';
|
||||
import {
|
||||
DEFAULT_COLUMNS_SETTING,
|
||||
|
@ -31,7 +31,9 @@ import {
|
|||
ROW_HEIGHT_OPTION,
|
||||
} from '../common';
|
||||
|
||||
export const getUiSettings: () => Record<string, UiSettingsParams> = () => ({
|
||||
export const getUiSettings: (docLinks: DocLinksServiceSetup) => Record<string, UiSettingsParams> = (
|
||||
docLinks: DocLinksServiceSetup
|
||||
) => ({
|
||||
[DEFAULT_COLUMNS_SETTING]: {
|
||||
name: i18n.translate('discover.advancedSettings.defaultColumnsTitle', {
|
||||
defaultMessage: 'Default columns',
|
||||
|
@ -215,7 +217,7 @@ export const getUiSettings: () => Record<string, UiSettingsParams> = () => ({
|
|||
defaultMessage: `Enable the {fieldStatisticsDocs} to show details such as the minimum and maximum values of a numeric field or a map of a geo field. This functionality is in beta and is subject to change.`,
|
||||
values: {
|
||||
fieldStatisticsDocs:
|
||||
`<a href="https://www.elastic.co/guide/en/kibana/current/show-field-statistics.html"
|
||||
`<a href=${docLinks.links.discover.fieldStatistics}
|
||||
target="_blank" rel="noopener">` +
|
||||
i18n.translate('discover.advancedSettings.discover.fieldStatisticsLinkText', {
|
||||
defaultMessage: 'Field statistics view',
|
||||
|
@ -240,7 +242,7 @@ export const getUiSettings: () => Record<string, UiSettingsParams> = () => ({
|
|||
defaultMessage: `Controls whether {multiFields} display in the expanded document view. In most cases, multi-fields are the same as the original field. This option is only available when \`searchFieldsFromSource\` is off.`,
|
||||
values: {
|
||||
multiFields:
|
||||
`<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html"
|
||||
`<a href=${docLinks.links.elasticsearch.mappingMultifields}
|
||||
target="_blank" rel="noopener">` +
|
||||
i18n.translate('discover.advancedSettings.discover.multiFieldsLinkText', {
|
||||
defaultMessage: 'multi-fields',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue