diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md index 02cc34baf7c45d..75d3abefc74b90 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md @@ -114,6 +114,7 @@ | [SearchBar](./kibana-plugin-plugins-data-public.searchbar.md) | | | [SYNC\_SEARCH\_STRATEGY](./kibana-plugin-plugins-data-public.sync_search_strategy.md) | | | [syncQueryStateWithUrl](./kibana-plugin-plugins-data-public.syncquerystatewithurl.md) | Helper to setup syncing of global data with the URL | +| [UI\_SETTINGS](./kibana-plugin-plugins-data-public.ui_settings.md) | | ## Type Aliases diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ui_settings.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ui_settings.md new file mode 100644 index 00000000000000..a48f4920b3d264 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ui_settings.md @@ -0,0 +1,39 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [UI\_SETTINGS](./kibana-plugin-plugins-data-public.ui_settings.md) + +## UI\_SETTINGS variable + +Signature: + +```typescript +UI_SETTINGS: { + META_FIELDS: string; + DOC_HIGHLIGHT: string; + QUERY_STRING_OPTIONS: string; + QUERY_ALLOW_LEADING_WILDCARDS: string; + SEARCH_QUERY_LANGUAGE: string; + SORT_OPTIONS: string; + COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX: string; + COURIER_SET_REQUEST_PREFERENCE: string; + COURIER_CUSTOM_REQUEST_PREFERENCE: string; + COURIER_MAX_CONCURRENT_SHARD_REQUESTS: string; + COURIER_BATCH_SEARCHES: string; + SEARCH_INCLUDE_FROZEN: string; + HISTOGRAM_BAR_TARGET: string; + HISTOGRAM_MAX_BARS: string; + HISTORY_LIMIT: string; + SHORT_DOTS_ENABLE: string; + FORMAT_DEFAULT_TYPE_MAP: string; + FORMAT_NUMBER_DEFAULT_PATTERN: string; + FORMAT_PERCENT_DEFAULT_PATTERN: string; + FORMAT_BYTES_DEFAULT_PATTERN: string; + FORMAT_CURRENCY_DEFAULT_PATTERN: string; + FORMAT_NUMBER_DEFAULT_LOCALE: string; + TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: string; + TIMEPICKER_QUICK_RANGES: string; + INDEXPATTERN_PLACEHOLDER: string; + FILTERS_PINNED_BY_DEFAULT: string; + FILTERS_EDITOR_SUGGEST_VALUES: string; +} +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md index 5f4bb8742c1d14..0efbe8ed4ed643 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md @@ -62,6 +62,7 @@ | [fieldFormats](./kibana-plugin-plugins-data-server.fieldformats.md) | | | [indexPatterns](./kibana-plugin-plugins-data-server.indexpatterns.md) | | | [search](./kibana-plugin-plugins-data-server.search.md) | | +| [UI\_SETTINGS](./kibana-plugin-plugins-data-server.ui_settings.md) | | ## Type Aliases diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ui_settings.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ui_settings.md new file mode 100644 index 00000000000000..855cfd11d00ea8 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ui_settings.md @@ -0,0 +1,39 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [UI\_SETTINGS](./kibana-plugin-plugins-data-server.ui_settings.md) + +## UI\_SETTINGS variable + +Signature: + +```typescript +UI_SETTINGS: { + META_FIELDS: string; + DOC_HIGHLIGHT: string; + QUERY_STRING_OPTIONS: string; + QUERY_ALLOW_LEADING_WILDCARDS: string; + SEARCH_QUERY_LANGUAGE: string; + SORT_OPTIONS: string; + COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX: string; + COURIER_SET_REQUEST_PREFERENCE: string; + COURIER_CUSTOM_REQUEST_PREFERENCE: string; + COURIER_MAX_CONCURRENT_SHARD_REQUESTS: string; + COURIER_BATCH_SEARCHES: string; + SEARCH_INCLUDE_FROZEN: string; + HISTOGRAM_BAR_TARGET: string; + HISTOGRAM_MAX_BARS: string; + HISTORY_LIMIT: string; + SHORT_DOTS_ENABLE: string; + FORMAT_DEFAULT_TYPE_MAP: string; + FORMAT_NUMBER_DEFAULT_PATTERN: string; + FORMAT_PERCENT_DEFAULT_PATTERN: string; + FORMAT_BYTES_DEFAULT_PATTERN: string; + FORMAT_CURRENCY_DEFAULT_PATTERN: string; + FORMAT_NUMBER_DEFAULT_LOCALE: string; + TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: string; + TIMEPICKER_QUICK_RANGES: string; + INDEXPATTERN_PLACEHOLDER: string; + FILTERS_PINNED_BY_DEFAULT: string; + FILTERS_EDITOR_SUGGEST_VALUES: string; +} +``` diff --git a/src/legacy/core_plugins/kibana/server/ui_setting_defaults.js b/src/legacy/core_plugins/kibana/server/ui_setting_defaults.js index 0d1b69778263c3..b7af6a73e1bc18 100644 --- a/src/legacy/core_plugins/kibana/server/ui_setting_defaults.js +++ b/src/legacy/core_plugins/kibana/server/ui_setting_defaults.js @@ -18,53 +18,32 @@ */ import moment from 'moment-timezone'; -import numeralLanguages from '@elastic/numeral/languages'; import { i18n } from '@kbn/i18n'; import { schema } from '@kbn/config-schema'; import { isRelativeUrl } from '../../../../core/server'; -import { DEFAULT_QUERY_LANGUAGE } from '../../../../plugins/data/common'; export function getUiSettingDefaults() { const weekdays = moment.weekdays().slice(); const [defaultWeekday] = weekdays; - // We add the `en` key manually here, since that's not a real numeral locale, but the - // default fallback in case the locale is not found. - const numeralLanguageIds = [ - 'en', - ...numeralLanguages.map(function (numeralLanguage) { - return numeralLanguage.id; - }), - ]; - - const luceneQueryLanguageLabel = i18n.translate( - 'kbn.advancedSettings.searchQueryLanguageLucene', - { - defaultMessage: 'Lucene', - } - ); - - const queryLanguageSettingName = i18n.translate('kbn.advancedSettings.searchQueryLanguageTitle', { - defaultMessage: 'Query language', - }); - - const requestPreferenceOptionLabels = { - sessionId: i18n.translate('kbn.advancedSettings.courier.requestPreferenceSessionId', { - defaultMessage: 'Session ID', - }), - custom: i18n.translate('kbn.advancedSettings.courier.requestPreferenceCustom', { - defaultMessage: 'Custom', - }), - none: i18n.translate('kbn.advancedSettings.courier.requestPreferenceNone', { - defaultMessage: 'None', - }), - }; // wrapped in provider so that a new instance is given to each app/test return { buildNum: { readonly: true, }, + 'state:storeInSessionStorage': { + name: i18n.translate('kbn.advancedSettings.storeUrlTitle', { + defaultMessage: 'Store URLs in session storage', + }), + value: false, + description: i18n.translate('kbn.advancedSettings.storeUrlText', { + defaultMessage: + 'The URL can sometimes grow to be too large for some browsers to handle. ' + + 'To counter-act this we are testing if storing parts of the URL in session storage could help. ' + + 'Please let us know how it goes!', + }), + }, defaultRoute: { name: i18n.translate('kbn.advancedSettings.defaultRoute.defaultRouteTitle', { defaultMessage: 'Default route', @@ -89,83 +68,6 @@ export function getUiSettingDefaults() { 'The route must be a relative URL.', }), }, - 'query:queryString:options': { - name: i18n.translate('kbn.advancedSettings.query.queryStringOptionsTitle', { - defaultMessage: 'Query string options', - }), - value: '{ "analyze_wildcard": true }', - description: i18n.translate('kbn.advancedSettings.query.queryStringOptionsText', { - defaultMessage: - '{optionsLink} for the lucene query string parser. Is only used when "{queryLanguage}" is set ' + - 'to {luceneLanguage}.', - description: - 'Part of composite text: kbn.advancedSettings.query.queryStringOptions.optionsLinkText + ' + - 'kbn.advancedSettings.query.queryStringOptionsText', - values: { - optionsLink: - '' + - i18n.translate('kbn.advancedSettings.query.queryStringOptions.optionsLinkText', { - defaultMessage: 'Options', - }) + - '', - luceneLanguage: luceneQueryLanguageLabel, - queryLanguage: queryLanguageSettingName, - }, - }), - type: 'json', - }, - 'query:allowLeadingWildcards': { - name: i18n.translate('kbn.advancedSettings.query.allowWildcardsTitle', { - defaultMessage: 'Allow leading wildcards in query', - }), - value: true, - description: i18n.translate('kbn.advancedSettings.query.allowWildcardsText', { - defaultMessage: - 'When set, * is allowed as the first character in a query clause. ' + - 'Currently only applies when experimental query features are enabled in the query bar. ' + - 'To disallow leading wildcards in basic lucene queries, use {queryStringOptionsPattern}.', - values: { - queryStringOptionsPattern: 'query:queryString:options', - }, - }), - }, - 'search:queryLanguage': { - name: queryLanguageSettingName, - value: DEFAULT_QUERY_LANGUAGE, - description: i18n.translate('kbn.advancedSettings.searchQueryLanguageText', { - defaultMessage: - 'Query language used by the query bar. KQL is a new language built specifically for Kibana.', - }), - type: 'select', - options: ['lucene', 'kuery'], - optionLabels: { - lucene: luceneQueryLanguageLabel, - kuery: i18n.translate('kbn.advancedSettings.searchQueryLanguageKql', { - defaultMessage: 'KQL', - }), - }, - }, - 'sort:options': { - name: i18n.translate('kbn.advancedSettings.sortOptionsTitle', { - defaultMessage: 'Sort options', - }), - value: '{ "unmapped_type": "boolean" }', - description: i18n.translate('kbn.advancedSettings.sortOptionsText', { - defaultMessage: '{optionsLink} for the Elasticsearch sort parameter', - description: - 'Part of composite text: kbn.advancedSettings.sortOptions.optionsLinkText + ' + - 'kbn.advancedSettings.sortOptionsText', - values: { - optionsLink: - '' + - i18n.translate('kbn.advancedSettings.sortOptions.optionsLinkText', { - defaultMessage: 'Options', - }) + - '', - }, - }), - type: 'json', - }, dateFormat: { name: i18n.translate('kbn.advancedSettings.dateFormatTitle', { defaultMessage: 'Date format', @@ -261,160 +163,6 @@ export function getUiSettingDefaults() { }, }), }, - defaultIndex: { - name: i18n.translate('kbn.advancedSettings.defaultIndexTitle', { - defaultMessage: 'Default index', - }), - value: null, - type: 'string', - description: i18n.translate('kbn.advancedSettings.defaultIndexText', { - defaultMessage: 'The index to access if no index is set', - }), - }, - 'courier:ignoreFilterIfFieldNotInIndex': { - name: i18n.translate('kbn.advancedSettings.courier.ignoreFilterTitle', { - defaultMessage: 'Ignore filter(s)', - }), - value: false, - description: i18n.translate('kbn.advancedSettings.courier.ignoreFilterText', { - defaultMessage: - 'This configuration enhances support for dashboards containing visualizations accessing dissimilar indexes. ' + - 'When disabled, all filters are applied to all visualizations. ' + - 'When enabled, filter(s) will be ignored for a visualization ' + - `when the visualization's index does not contain the filtering field.`, - }), - category: ['search'], - }, - 'courier:setRequestPreference': { - name: i18n.translate('kbn.advancedSettings.courier.requestPreferenceTitle', { - defaultMessage: 'Request preference', - }), - value: 'sessionId', - options: ['sessionId', 'custom', 'none'], - optionLabels: requestPreferenceOptionLabels, - type: 'select', - description: i18n.translate('kbn.advancedSettings.courier.requestPreferenceText', { - defaultMessage: `Allows you to set which shards handle your search requests. - `, - values: { - sessionId: requestPreferenceOptionLabels.sessionId, - custom: requestPreferenceOptionLabels.custom, - none: requestPreferenceOptionLabels.none, - }, - }), - category: ['search'], - }, - 'courier:customRequestPreference': { - name: i18n.translate('kbn.advancedSettings.courier.customRequestPreferenceTitle', { - defaultMessage: 'Custom request preference', - }), - value: '_local', - type: 'string', - description: i18n.translate('kbn.advancedSettings.courier.customRequestPreferenceText', { - defaultMessage: - '{requestPreferenceLink} used when {setRequestReferenceSetting} is set to {customSettingValue}.', - description: - 'Part of composite text: kbn.advancedSettings.courier.customRequestPreference.requestPreferenceLinkText + ' + - 'kbn.advancedSettings.courier.customRequestPreferenceText', - values: { - setRequestReferenceSetting: 'courier:setRequestPreference', - customSettingValue: '"custom"', - requestPreferenceLink: - '' + - i18n.translate( - 'kbn.advancedSettings.courier.customRequestPreference.requestPreferenceLinkText', - { - defaultMessage: 'Request Preference', - } - ) + - '', - }, - }), - category: ['search'], - }, - 'courier:maxConcurrentShardRequests': { - name: i18n.translate('kbn.advancedSettings.courier.maxRequestsTitle', { - defaultMessage: 'Max Concurrent Shard Requests', - }), - value: 0, - type: 'number', - description: i18n.translate('kbn.advancedSettings.courier.maxRequestsText', { - defaultMessage: - '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: `max_concurrent_shard_requests`, - }, - }), - category: ['search'], - }, - 'courier:batchSearches': { - name: i18n.translate('kbn.advancedSettings.courier.batchSearchesTitle', { - defaultMessage: 'Batch concurrent searches', - }), - value: false, - type: 'boolean', - description: i18n.translate('kbn.advancedSettings.courier.batchSearchesText', { - defaultMessage: `When disabled, dashboard panels will load individually, and search requests will terminate when users navigate - away or update the query. When enabled, dashboard panels will load together when all of the data is loaded, and - searches will not terminate.`, - }), - deprecation: { - message: i18n.translate('kbn.advancedSettings.courier.batchSearchesTextDeprecation', { - defaultMessage: 'This setting is deprecated and will be removed in Kibana 8.0.', - }), - docLinksKey: 'kibanaSearchSettings', - }, - category: ['search'], - }, - 'search:includeFrozen': { - name: 'Search in frozen indices', - description: `Will include frozen indices in results if enabled. Searching through frozen indices - might increase the search time.`, - value: false, - category: ['search'], - }, - 'histogram:barTarget': { - name: i18n.translate('kbn.advancedSettings.histogram.barTargetTitle', { - defaultMessage: 'Target bars', - }), - value: 50, - description: i18n.translate('kbn.advancedSettings.histogram.barTargetText', { - defaultMessage: - 'Attempt to generate around this many bars when using "auto" interval in date histograms', - }), - }, - 'histogram:maxBars': { - name: i18n.translate('kbn.advancedSettings.histogram.maxBarsTitle', { - defaultMessage: 'Maximum bars', - }), - value: 100, - description: i18n.translate('kbn.advancedSettings.histogram.maxBarsText', { - defaultMessage: - 'Never show more than this many bars in date histograms, scale values if needed', - }), - }, - 'visualize:enableLabs': { - name: i18n.translate('kbn.advancedSettings.visualizeEnableLabsTitle', { - defaultMessage: 'Enable experimental visualizations', - }), - value: true, - description: i18n.translate('kbn.advancedSettings.visualizeEnableLabsText', { - defaultMessage: `Allows users to create, view, and edit experimental visualizations. If disabled, - only visualizations that are considered production-ready are available to the user.`, - }), - category: ['visualization'], - }, 'visualization:tileMap:maxPrecision': { name: i18n.translate('kbn.advancedSettings.visualization.tileMap.maxPrecisionTitle', { defaultMessage: 'Maximum tile map precision', @@ -493,43 +241,6 @@ export function getUiSettingDefaults() { }), category: ['visualization'], }, - 'csv:separator': { - name: i18n.translate('kbn.advancedSettings.csv.separatorTitle', { - defaultMessage: 'CSV separator', - }), - value: ',', - description: i18n.translate('kbn.advancedSettings.csv.separatorText', { - defaultMessage: 'Separate exported values with this string', - }), - }, - 'csv:quoteValues': { - name: i18n.translate('kbn.advancedSettings.csv.quoteValuesTitle', { - defaultMessage: 'Quote CSV values', - }), - value: true, - description: i18n.translate('kbn.advancedSettings.csv.quoteValuesText', { - defaultMessage: 'Should values be quoted in csv exports?', - }), - }, - 'history:limit': { - name: i18n.translate('kbn.advancedSettings.historyLimitTitle', { - defaultMessage: 'History limit', - }), - value: 10, - description: i18n.translate('kbn.advancedSettings.historyLimitText', { - defaultMessage: - 'In fields that have history (e.g. query inputs), show this many recent values', - }), - }, - 'shortDots:enable': { - name: i18n.translate('kbn.advancedSettings.shortenFieldsTitle', { - defaultMessage: 'Shorten fields', - }), - value: false, - description: i18n.translate('kbn.advancedSettings.shortenFieldsText', { - defaultMessage: 'Shorten long fields, for example, instead of foo.bar.baz, show f.b.baz', - }), - }, 'truncate:maxHeight': { name: i18n.translate('kbn.advancedSettings.maxCellHeightTitle', { defaultMessage: 'Maximum table cell height', @@ -540,138 +251,6 @@ export function getUiSettingDefaults() { 'The maximum height that a cell in a table should occupy. Set to 0 to disable truncation', }), }, - 'format:defaultTypeMap': { - name: i18n.translate('kbn.advancedSettings.format.defaultTypeMapTitle', { - defaultMessage: 'Field type format name', - }), - value: `{ - "ip": { "id": "ip", "params": {} }, - "date": { "id": "date", "params": {} }, - "date_nanos": { "id": "date_nanos", "params": {}, "es": true }, - "number": { "id": "number", "params": {} }, - "boolean": { "id": "boolean", "params": {} }, - "_source": { "id": "_source", "params": {} }, - "_default_": { "id": "string", "params": {} } -}`, - type: 'json', - description: i18n.translate('kbn.advancedSettings.format.defaultTypeMapText', { - defaultMessage: - 'Map of the format name to use by default for each field type. ' + - '{defaultFormat} is used if the field type is not mentioned explicitly', - values: { - defaultFormat: '"_default_"', - }, - }), - }, - 'format:number:defaultPattern': { - name: i18n.translate('kbn.advancedSettings.format.numberFormatTitle', { - defaultMessage: 'Number format', - }), - value: '0,0.[000]', - type: 'string', - description: i18n.translate('kbn.advancedSettings.format.numberFormatText', { - defaultMessage: 'Default {numeralFormatLink} for the "number" format', - description: - 'Part of composite text: kbn.advancedSettings.format.numberFormatText + ' + - 'kbn.advancedSettings.format.numberFormat.numeralFormatLinkText', - values: { - numeralFormatLink: - '' + - i18n.translate('kbn.advancedSettings.format.numberFormat.numeralFormatLinkText', { - defaultMessage: 'numeral format', - }) + - '', - }, - }), - }, - 'format:bytes:defaultPattern': { - name: i18n.translate('kbn.advancedSettings.format.bytesFormatTitle', { - defaultMessage: 'Bytes format', - }), - value: '0,0.[0]b', - type: 'string', - description: i18n.translate('kbn.advancedSettings.format.bytesFormatText', { - defaultMessage: 'Default {numeralFormatLink} for the "bytes" format', - description: - 'Part of composite text: kbn.advancedSettings.format.bytesFormatText + ' + - 'kbn.advancedSettings.format.bytesFormat.numeralFormatLinkText', - values: { - numeralFormatLink: - '' + - i18n.translate('kbn.advancedSettings.format.bytesFormat.numeralFormatLinkText', { - defaultMessage: 'numeral format', - }) + - '', - }, - }), - }, - 'format:percent:defaultPattern': { - name: i18n.translate('kbn.advancedSettings.format.percentFormatTitle', { - defaultMessage: 'Percent format', - }), - value: '0,0.[000]%', - type: 'string', - description: i18n.translate('kbn.advancedSettings.format.percentFormatText', { - defaultMessage: 'Default {numeralFormatLink} for the "percent" format', - description: - 'Part of composite text: kbn.advancedSettings.format.percentFormatText + ' + - 'kbn.advancedSettings.format.percentFormat.numeralFormatLinkText', - values: { - numeralFormatLink: - '' + - i18n.translate('kbn.advancedSettings.format.percentFormat.numeralFormatLinkText', { - defaultMessage: 'numeral format', - }) + - '', - }, - }), - }, - 'format:currency:defaultPattern': { - name: i18n.translate('kbn.advancedSettings.format.currencyFormatTitle', { - defaultMessage: 'Currency format', - }), - value: '($0,0.[00])', - type: 'string', - description: i18n.translate('kbn.advancedSettings.format.currencyFormatText', { - defaultMessage: 'Default {numeralFormatLink} for the "currency" format', - description: - 'Part of composite text: kbn.advancedSettings.format.currencyFormatText + ' + - 'kbn.advancedSettings.format.currencyFormat.numeralFormatLinkText', - values: { - numeralFormatLink: - '' + - i18n.translate('kbn.advancedSettings.format.currencyFormat.numeralFormatLinkText', { - defaultMessage: 'numeral format', - }) + - '', - }, - }), - }, - 'format:number:defaultLocale': { - name: i18n.translate('kbn.advancedSettings.format.formattingLocaleTitle', { - defaultMessage: 'Formatting locale', - }), - value: 'en', - type: 'select', - options: numeralLanguageIds, - optionLabels: Object.fromEntries( - numeralLanguages.map((language) => [language.id, language.name]) - ), - description: i18n.translate('kbn.advancedSettings.format.formattingLocaleText', { - defaultMessage: `{numeralLanguageLink} locale`, - description: - 'Part of composite text: kbn.advancedSettings.format.formattingLocale.numeralLanguageLinkText + ' + - 'kbn.advancedSettings.format.formattingLocaleText', - values: { - numeralLanguageLink: - '' + - i18n.translate('kbn.advancedSettings.format.formattingLocale.numeralLanguageLinkText', { - defaultMessage: 'Numeral language', - }) + - '', - }, - }), - }, 'timepicker:timeDefaults': { name: i18n.translate('kbn.advancedSettings.timepicker.timeDefaultsTitle', { defaultMessage: 'Time filter defaults', @@ -686,120 +265,6 @@ export function getUiSettingDefaults() { }), requiresPageReload: true, }, - 'timepicker:refreshIntervalDefaults': { - name: i18n.translate('kbn.advancedSettings.timepicker.refreshIntervalDefaultsTitle', { - defaultMessage: 'Time filter refresh interval', - }), - value: `{ - "pause": false, - "value": 0 -}`, - type: 'json', - description: i18n.translate('kbn.advancedSettings.timepicker.refreshIntervalDefaultsText', { - defaultMessage: `The timefilter's default refresh interval`, - }), - requiresPageReload: true, - }, - 'timepicker:quickRanges': { - name: i18n.translate('kbn.advancedSettings.timepicker.quickRangesTitle', { - defaultMessage: 'Time filter quick ranges', - }), - value: JSON.stringify( - [ - { - from: 'now/d', - to: 'now/d', - display: i18n.translate('kbn.advancedSettings.timepicker.today', { - defaultMessage: 'Today', - }), - }, - { - from: 'now/w', - to: 'now/w', - display: i18n.translate('kbn.advancedSettings.timepicker.thisWeek', { - defaultMessage: 'This week', - }), - }, - { - from: 'now-15m', - to: 'now', - display: i18n.translate('kbn.advancedSettings.timepicker.last15Minutes', { - defaultMessage: 'Last 15 minutes', - }), - }, - { - from: 'now-30m', - to: 'now', - display: i18n.translate('kbn.advancedSettings.timepicker.last30Minutes', { - defaultMessage: 'Last 30 minutes', - }), - }, - { - from: 'now-1h', - to: 'now', - display: i18n.translate('kbn.advancedSettings.timepicker.last1Hour', { - defaultMessage: 'Last 1 hour', - }), - }, - { - from: 'now-24h', - to: 'now', - display: i18n.translate('kbn.advancedSettings.timepicker.last24Hours', { - defaultMessage: 'Last 24 hours', - }), - }, - { - from: 'now-7d', - to: 'now', - display: i18n.translate('kbn.advancedSettings.timepicker.last7Days', { - defaultMessage: 'Last 7 days', - }), - }, - { - from: 'now-30d', - to: 'now', - display: i18n.translate('kbn.advancedSettings.timepicker.last30Days', { - defaultMessage: 'Last 30 days', - }), - }, - { - from: 'now-90d', - to: 'now', - display: i18n.translate('kbn.advancedSettings.timepicker.last90Days', { - defaultMessage: 'Last 90 days', - }), - }, - { - from: 'now-1y', - to: 'now', - display: i18n.translate('kbn.advancedSettings.timepicker.last1Year', { - defaultMessage: 'Last 1 year', - }), - }, - ], - null, - 2 - ), - type: 'json', - description: i18n.translate('kbn.advancedSettings.timepicker.quickRangesText', { - defaultMessage: - 'The list of ranges to show in the Quick section of the time filter. This should be an array of objects, ' + - 'with each object containing "from", "to" (see {acceptedFormatsLink}), and ' + - '"display" (the title to be displayed).', - description: - 'Part of composite text: kbn.advancedSettings.timepicker.quickRangesText + ' + - 'kbn.advancedSettings.timepicker.quickRanges.acceptedFormatsLinkText', - values: { - acceptedFormatsLink: - `` + - i18n.translate('kbn.advancedSettings.timepicker.quickRanges.acceptedFormatsLinkText', { - defaultMessage: 'accepted formats', - }) + - '', - }, - }), - }, 'theme:darkMode': { name: i18n.translate('kbn.advancedSettings.darkModeTitle', { defaultMessage: 'Dark mode', @@ -822,26 +287,6 @@ export function getUiSettingDefaults() { }), requiresPageReload: true, }, - 'filters:pinnedByDefault': { - name: i18n.translate('kbn.advancedSettings.pinFiltersTitle', { - defaultMessage: 'Pin filters by default', - }), - value: false, - description: i18n.translate('kbn.advancedSettings.pinFiltersText', { - defaultMessage: 'Whether the filters should have a global state (be pinned) by default', - }), - }, - 'filterEditor:suggestValues': { - name: i18n.translate('kbn.advancedSettings.suggestFilterValuesTitle', { - defaultMessage: 'Filter editor suggest values', - description: '"Filter editor" refers to the UI you create filters in.', - }), - value: true, - description: i18n.translate('kbn.advancedSettings.suggestFilterValuesText', { - defaultMessage: - 'Set this property to false to prevent the filter editor from suggesting values for fields.', - }), - }, 'notifications:banner': { name: i18n.translate('kbn.advancedSettings.notifications.bannerTitle', { defaultMessage: 'Custom banner notification', @@ -930,28 +375,6 @@ export function getUiSettingDefaults() { type: 'number', category: ['notifications'], }, - 'state:storeInSessionStorage': { - name: i18n.translate('kbn.advancedSettings.storeUrlTitle', { - defaultMessage: 'Store URLs in session storage', - }), - value: false, - description: i18n.translate('kbn.advancedSettings.storeUrlText', { - defaultMessage: - 'The URL can sometimes grow to be too large for some browsers to handle. ' + - 'To counter-act this we are testing if storing parts of the URL in session storage could help. ' + - 'Please let us know how it goes!', - }), - }, - 'indexPattern:placeholder': { - name: i18n.translate('kbn.advancedSettings.indexPatternPlaceholderTitle', { - defaultMessage: 'Index pattern placeholder', - }), - value: '', - description: i18n.translate('kbn.advancedSettings.indexPatternPlaceholderText', { - defaultMessage: - 'The placeholder for the "Index pattern name" field in "Management > Index Patterns > Create Index Pattern".', - }), - }, 'accessibility:disableAnimations': { name: i18n.translate('kbn.advancedSettings.disableAnimationsTitle', { defaultMessage: 'Disable Animations', diff --git a/src/legacy/core_plugins/timelion/public/directives/saved_object_finder.js b/src/legacy/core_plugins/timelion/public/directives/saved_object_finder.js index 08a347fbf72959..879fab206b99df 100644 --- a/src/legacy/core_plugins/timelion/public/directives/saved_object_finder.js +++ b/src/legacy/core_plugins/timelion/public/directives/saved_object_finder.js @@ -29,6 +29,7 @@ import { PaginateDirectiveProvider, } from '../../../../../plugins/kibana_legacy/public'; import { PER_PAGE_SETTING } from '../../../../../plugins/saved_objects/common'; +import { VISUALIZE_ENABLE_LABS_SETTING } from '../../../../../plugins/visualizations/public'; const module = uiModules.get('kibana'); @@ -294,7 +295,7 @@ module prevSearch = filter; - const isLabsEnabled = config.get('visualize:enableLabs'); + const isLabsEnabled = config.get(VISUALIZE_ENABLE_LABS_SETTING); self.service.find(filter).then(function (hits) { hits.hits = hits.hits.filter( (hit) => isLabsEnabled || _.get(hit, 'type.stage') !== 'experimental' diff --git a/src/legacy/ui/public/new_platform/new_platform.karma_mock.js b/src/legacy/ui/public/new_platform/new_platform.karma_mock.js index 229bfb1978a4ef..9c2ab0819776ba 100644 --- a/src/legacy/ui/public/new_platform/new_platform.karma_mock.js +++ b/src/legacy/ui/public/new_platform/new_platform.karma_mock.js @@ -28,6 +28,11 @@ import { // eslint-disable-next-line @kbn/eslint/no-restricted-paths } from '../../../../../src/plugins/data/public/search/aggs'; import { ComponentRegistry } from '../../../../../src/plugins/advanced_settings/public/'; +import { UI_SETTINGS } from '../../../../../src/plugins/data/public/'; +import { + CSV_SEPARATOR_SETTING, + CSV_QUOTE_VALUES_SETTING, +} from '../../../../../src/plugins/share/public'; const mockObservable = () => { return { @@ -49,18 +54,31 @@ let isTimeRangeSelectorEnabled = true; let isAutoRefreshSelectorEnabled = true; export const mockUiSettings = { - get: (item) => { - return mockUiSettings[item]; + get: (item, defaultValue) => { + const defaultValues = { + dateFormat: 'MMM D, YYYY @ HH:mm:ss.SSS', + 'dateFormat:tz': 'UTC', + [UI_SETTINGS.SHORT_DOTS_ENABLE]: true, + [UI_SETTINGS.COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX]: true, + [UI_SETTINGS.QUERY_ALLOW_LEADING_WILDCARDS]: true, + [UI_SETTINGS.QUERY_STRING_OPTIONS]: {}, + [UI_SETTINGS.FORMAT_CURRENCY_DEFAULT_PATTERN]: '($0,0.[00])', + [UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN]: '0,0.[000]', + [UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN]: '0,0.[000]%', + [UI_SETTINGS.FORMAT_NUMBER_DEFAULT_LOCALE]: 'en', + [UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP]: {}, + [CSV_SEPARATOR_SETTING]: ',', + [CSV_QUOTE_VALUES_SETTING]: true, + [UI_SETTINGS.SEARCH_QUERY_LANGUAGE]: 'kuery', + 'state:storeInSessionStorage': false, + }; + + return defaultValues[item] || defaultValue; }, getUpdate$: () => ({ subscribe: sinon.fake(), }), isDefault: sinon.fake(), - 'query:allowLeadingWildcards': true, - 'query:queryString:options': {}, - 'courier:ignoreFilterIfFieldNotInIndex': true, - 'dateFormat:tz': 'Browser', - 'format:defaultTypeMap': {}, }; const mockCoreSetup = { @@ -524,6 +542,8 @@ export function __setup__(coreSetup) { // bootstrap an LP plugin outside of tests) npSetup.core.application.register = () => {}; + npSetup.core.uiSettings.get = mockUiSettings.get; + // Services that need to be set in the legacy platform since the legacy data // & vis plugins which previously provided them have been removed. setSetupServices(npSetup); @@ -532,6 +552,8 @@ export function __setup__(coreSetup) { export function __start__(coreStart) { npStart.core = coreStart; + npStart.core.uiSettings.get = mockUiSettings.get; + // Services that need to be set in the legacy platform since the legacy data // & vis plugins which previously provided them have been removed. setStartServices(npStart); diff --git a/src/legacy/ui/public/timefilter/setup_router.ts b/src/legacy/ui/public/timefilter/setup_router.ts index a7492e538b3af1..7c25c6aa3166e3 100644 --- a/src/legacy/ui/public/timefilter/setup_router.ts +++ b/src/legacy/ui/public/timefilter/setup_router.ts @@ -21,10 +21,15 @@ import _ from 'lodash'; import { IScope } from 'angular'; import moment from 'moment'; import chrome from 'ui/chrome'; -import { RefreshInterval, TimeRange, TimefilterContract } from 'src/plugins/data/public'; import { Subscription } from 'rxjs'; import { fatalError } from 'ui/notify/fatal_error'; import { subscribeWithScope } from '../../../../plugins/kibana_legacy/public'; +import { + RefreshInterval, + TimeRange, + TimefilterContract, + UI_SETTINGS, +} from '../../../../plugins/data/public'; // TODO // remove everything underneath once globalState is no longer an angular service @@ -38,7 +43,7 @@ export function getTimefilterConfig() { const settings = chrome.getUiSettingsClient(); return { timeDefaults: settings.get('timepicker:timeDefaults'), - refreshIntervalDefaults: settings.get('timepicker:refreshIntervalDefaults'), + refreshIntervalDefaults: settings.get(UI_SETTINGS.TIMEPICKER_REFRESH_INTERVAL_DEFAULTS), }; } diff --git a/src/plugins/dashboard/public/application/dashboard_app_controller.tsx b/src/plugins/dashboard/public/application/dashboard_app_controller.tsx index 8dd0a766da97b7..a59d1e8c546d4b 100644 --- a/src/plugins/dashboard/public/application/dashboard_app_controller.tsx +++ b/src/plugins/dashboard/public/application/dashboard_app_controller.tsx @@ -41,6 +41,7 @@ import { QueryState, SavedQuery, syncQueryStateWithUrl, + UI_SETTINGS, } from '../../../data/public'; import { getSavedObjectFinder, SaveResult, showSaveModal } from '../../../saved_objects/public'; @@ -430,7 +431,8 @@ export class DashboardAppController { dashboardStateManager.getQuery() || { query: '', language: - localStorage.get('kibana.userQueryLanguage') || uiSettings.get('search:queryLanguage'), + localStorage.get('kibana.userQueryLanguage') || + uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE), }, queryFilter.getFilters() ); diff --git a/src/plugins/data/common/constants.ts b/src/plugins/data/common/constants.ts index 66a96e3e6e1293..8ec72dc1f9a744 100644 --- a/src/plugins/data/common/constants.ts +++ b/src/plugins/data/common/constants.ts @@ -18,5 +18,33 @@ */ export const DEFAULT_QUERY_LANGUAGE = 'kuery'; -export const META_FIELDS_SETTING = 'metaFields'; -export const DOC_HIGHLIGHT_SETTING = 'doc_table:highlight'; + +export const UI_SETTINGS = { + META_FIELDS: 'metaFields', + DOC_HIGHLIGHT: 'doc_table:highlight', + QUERY_STRING_OPTIONS: 'query:queryString:options', + QUERY_ALLOW_LEADING_WILDCARDS: 'query:allowLeadingWildcards', + SEARCH_QUERY_LANGUAGE: 'search:queryLanguage', + SORT_OPTIONS: 'sort:options', + COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX: 'courier:ignoreFilterIfFieldNotInIndex', + COURIER_SET_REQUEST_PREFERENCE: 'courier:setRequestPreference', + COURIER_CUSTOM_REQUEST_PREFERENCE: 'courier:customRequestPreference', + COURIER_MAX_CONCURRENT_SHARD_REQUESTS: 'courier:maxConcurrentShardRequests', + COURIER_BATCH_SEARCHES: 'courier:batchSearches', + SEARCH_INCLUDE_FROZEN: 'search:includeFrozen', + HISTOGRAM_BAR_TARGET: 'histogram:barTarget', + HISTOGRAM_MAX_BARS: 'histogram:maxBars', + HISTORY_LIMIT: 'history:limit', + SHORT_DOTS_ENABLE: 'shortDots:enable', + FORMAT_DEFAULT_TYPE_MAP: 'format:defaultTypeMap', + FORMAT_NUMBER_DEFAULT_PATTERN: 'format:number:defaultPattern', + FORMAT_PERCENT_DEFAULT_PATTERN: 'format:percent:defaultPattern', + FORMAT_BYTES_DEFAULT_PATTERN: 'format:bytes:defaultPattern', + FORMAT_CURRENCY_DEFAULT_PATTERN: 'format:currency:defaultPattern', + FORMAT_NUMBER_DEFAULT_LOCALE: 'format:number:defaultLocale', + TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: 'timepicker:refreshIntervalDefaults', + TIMEPICKER_QUICK_RANGES: 'timepicker:quickRanges', + INDEXPATTERN_PLACEHOLDER: 'indexPattern:placeholder', + FILTERS_PINNED_BY_DEFAULT: 'filters:pinnedByDefault', + FILTERS_EDITOR_SUGGEST_VALUES: 'filterEditor:suggestValues', +}; diff --git a/src/plugins/data/common/es_query/es_query/get_es_query_config.test.ts b/src/plugins/data/common/es_query/es_query/get_es_query_config.test.ts index d146d81973d0d7..5fa3c67dea400c 100644 --- a/src/plugins/data/common/es_query/es_query/get_es_query_config.test.ts +++ b/src/plugins/data/common/es_query/es_query/get_es_query_config.test.ts @@ -19,18 +19,19 @@ import { get } from 'lodash'; import { getEsQueryConfig } from './get_es_query_config'; import { IUiSettingsClient } from 'kibana/public'; +import { UI_SETTINGS } from '../../'; const config = ({ get(item: string) { return get(config, item); }, - 'query:allowLeadingWildcards': { + [UI_SETTINGS.QUERY_ALLOW_LEADING_WILDCARDS]: { allowLeadingWildcards: true, }, - 'query:queryString:options': { + [UI_SETTINGS.QUERY_STRING_OPTIONS]: { queryStringOptions: {}, }, - 'courier:ignoreFilterIfFieldNotInIndex': { + [UI_SETTINGS.COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX]: { ignoreFilterIfFieldNotInIndex: true, }, 'dateFormat:tz': { diff --git a/src/plugins/data/common/es_query/es_query/get_es_query_config.ts b/src/plugins/data/common/es_query/es_query/get_es_query_config.ts index 0a82cf03bdb445..ff8fc5b11b26e8 100644 --- a/src/plugins/data/common/es_query/es_query/get_es_query_config.ts +++ b/src/plugins/data/common/es_query/es_query/get_es_query_config.ts @@ -18,15 +18,18 @@ */ import { EsQueryConfig } from './build_es_query'; +import { UI_SETTINGS } from '../../'; interface KibanaConfig { get(key: string): T; } export function getEsQueryConfig(config: KibanaConfig) { - const allowLeadingWildcards = config.get('query:allowLeadingWildcards'); - const queryStringOptions = config.get('query:queryString:options'); - const ignoreFilterIfFieldNotInIndex = config.get('courier:ignoreFilterIfFieldNotInIndex'); + const allowLeadingWildcards = config.get(UI_SETTINGS.QUERY_ALLOW_LEADING_WILDCARDS); + const queryStringOptions = config.get(UI_SETTINGS.QUERY_STRING_OPTIONS); + const ignoreFilterIfFieldNotInIndex = config.get( + UI_SETTINGS.COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX + ); const dateFormatTZ = config.get('dateFormat:tz'); return { diff --git a/src/plugins/data/common/field_formats/converters/bytes.test.ts b/src/plugins/data/common/field_formats/converters/bytes.test.ts index 8dad9fc206e721..e0c26170c29075 100644 --- a/src/plugins/data/common/field_formats/converters/bytes.test.ts +++ b/src/plugins/data/common/field_formats/converters/bytes.test.ts @@ -18,11 +18,12 @@ */ import { BytesFormat } from './bytes'; +import { UI_SETTINGS } from '../../constants'; describe('BytesFormat', () => { const config: Record = {}; - config['format:bytes:defaultPattern'] = '0,0.[000]b'; + config[UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN] = '0,0.[000]b'; const getConfig = (key: string) => config[key]; diff --git a/src/plugins/data/common/field_formats/converters/number.test.ts b/src/plugins/data/common/field_formats/converters/number.test.ts index fe36d5b12e8736..31c5ea41bf5afd 100644 --- a/src/plugins/data/common/field_formats/converters/number.test.ts +++ b/src/plugins/data/common/field_formats/converters/number.test.ts @@ -18,11 +18,12 @@ */ import { NumberFormat } from './number'; +import { UI_SETTINGS } from '../../constants'; describe('NumberFormat', () => { const config: Record = {}; - config['format:number:defaultPattern'] = '0,0.[000]'; + config[UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN] = '0,0.[000]'; const getConfig = (key: string) => config[key]; diff --git a/src/plugins/data/common/field_formats/converters/numeral.ts b/src/plugins/data/common/field_formats/converters/numeral.ts index a483b5a1e4f99a..1d844bca3f89ac 100644 --- a/src/plugins/data/common/field_formats/converters/numeral.ts +++ b/src/plugins/data/common/field_formats/converters/numeral.ts @@ -24,6 +24,7 @@ import numeralLanguages from '@elastic/numeral/languages'; import { KBN_FIELD_TYPES } from '../../kbn_field_types/types'; import { FieldFormat } from '../field_format'; import { TextContextTypeConvert } from '../types'; +import { UI_SETTINGS } from '../../constants'; const numeralInst = numeral(); @@ -51,7 +52,8 @@ export abstract class NumeralFormat extends FieldFormat { if (isNaN(val)) return ''; const previousLocale = numeral.language(); - const defaultLocale = (this.getConfig && this.getConfig('format:number:defaultLocale')) || 'en'; + const defaultLocale = + (this.getConfig && this.getConfig(UI_SETTINGS.FORMAT_NUMBER_DEFAULT_LOCALE)) || 'en'; numeral.language(defaultLocale); const formatted = numeralInst.set(val).format(this.param('pattern')); diff --git a/src/plugins/data/common/field_formats/converters/percent.test.ts b/src/plugins/data/common/field_formats/converters/percent.test.ts index 8b26564814af3d..754234bdeb78b4 100644 --- a/src/plugins/data/common/field_formats/converters/percent.test.ts +++ b/src/plugins/data/common/field_formats/converters/percent.test.ts @@ -18,11 +18,12 @@ */ import { PercentFormat } from './percent'; +import { UI_SETTINGS } from '../../constants'; describe('PercentFormat', () => { const config: Record = {}; - config['format:percent:defaultPattern'] = '0,0.[000]%'; + config[UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN] = '0,0.[000]%'; const getConfig = (key: string) => config[key]; diff --git a/src/plugins/data/common/field_formats/converters/percent.ts b/src/plugins/data/common/field_formats/converters/percent.ts index ef3b0a1503a981..ecf9c7d19108d9 100644 --- a/src/plugins/data/common/field_formats/converters/percent.ts +++ b/src/plugins/data/common/field_formats/converters/percent.ts @@ -20,6 +20,7 @@ import { i18n } from '@kbn/i18n'; import { NumeralFormat } from './numeral'; import { TextContextTypeConvert, FIELD_FORMAT_IDS } from '../types'; +import { UI_SETTINGS } from '../../constants'; export class PercentFormat extends NumeralFormat { static id = FIELD_FORMAT_IDS.PERCENT; @@ -32,7 +33,7 @@ export class PercentFormat extends NumeralFormat { allowsNumericalAggregations = true; getParamDefaults = () => ({ - pattern: this.getConfig!('format:percent:defaultPattern'), + pattern: this.getConfig!(UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN), fractional: true, }); diff --git a/src/plugins/data/common/field_formats/converters/source.ts b/src/plugins/data/common/field_formats/converters/source.ts index 9e50d47bb2624b..f00261e00971aa 100644 --- a/src/plugins/data/common/field_formats/converters/source.ts +++ b/src/plugins/data/common/field_formats/converters/source.ts @@ -22,6 +22,7 @@ import { shortenDottedString } from '../../utils'; import { KBN_FIELD_TYPES } from '../../kbn_field_types/types'; import { FieldFormat } from '../field_format'; import { TextContextTypeConvert, HtmlContextTypeConvert, FIELD_FORMAT_IDS } from '../types'; +import { UI_SETTINGS } from '../../'; /** * Remove all of the whitespace between html tags @@ -71,7 +72,7 @@ export class SourceFormat extends FieldFormat { const formatted = field.indexPattern.formatHit(hit); const highlightPairs: any[] = []; const sourcePairs: any[] = []; - const isShortDots = this.getConfig!('shortDots:enable'); + const isShortDots = this.getConfig!(UI_SETTINGS.SHORT_DOTS_ENABLE); keys(formatted).forEach((key) => { const pairs = highlights[key] ? highlightPairs : sourcePairs; diff --git a/src/plugins/data/common/field_formats/field_formats_registry.ts b/src/plugins/data/common/field_formats/field_formats_registry.ts index c04a371066de33..9325485bce75d6 100644 --- a/src/plugins/data/common/field_formats/field_formats_registry.ts +++ b/src/plugins/data/common/field_formats/field_formats_registry.ts @@ -33,6 +33,7 @@ import { baseFormatters } from './constants/base_formatters'; import { FieldFormat } from './field_format'; import { SerializedFieldFormat } from '../../../expressions/common/types'; import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '../types'; +import { UI_SETTINGS } from '../'; export class FieldFormatsRegistry { protected fieldFormats: Map = new Map(); @@ -49,7 +50,7 @@ export class FieldFormatsRegistry { metaParamsOptions: Record = {}, defaultFieldConverters: FieldFormatInstanceType[] = baseFormatters ) { - const defaultTypeMap = getConfig('format:defaultTypeMap'); + const defaultTypeMap = getConfig(UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP); this.register(defaultFieldConverters); this.parseDefaultTypeMap(defaultTypeMap); this.getConfig = getConfig; diff --git a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts b/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts index ef7a0e8c3a5ad0..a6a45a26f06b39 100644 --- a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts +++ b/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts @@ -19,7 +19,7 @@ import { memoize } from 'lodash'; import { CoreSetup } from 'src/core/public'; -import { IIndexPattern, IFieldType } from '../../../common'; +import { IIndexPattern, IFieldType, UI_SETTINGS } from '../../../common'; function resolver(title: string, field: IFieldType, query: string, boolFilter: any) { // Only cache results for a minute @@ -58,7 +58,9 @@ export const setupValueSuggestionProvider = (core: CoreSetup): ValueSuggestionsG boolFilter, signal, }: ValueSuggestionsGetFnArgs): Promise => { - const shouldSuggestValues = core!.uiSettings.get('filterEditor:suggestValues'); + const shouldSuggestValues = core!.uiSettings.get( + UI_SETTINGS.FILTERS_EDITOR_SUGGEST_VALUES + ); const { title } = indexPattern; if (field.type === 'boolean') { diff --git a/src/plugins/data/public/field_formats/field_formats_service.ts b/src/plugins/data/public/field_formats/field_formats_service.ts index 22c7e90c06130b..3ddc8d0b68a5bb 100644 --- a/src/plugins/data/public/field_formats/field_formats_service.ts +++ b/src/plugins/data/public/field_formats/field_formats_service.ts @@ -18,7 +18,7 @@ */ import { CoreSetup } from 'src/core/public'; -import { FieldFormatsRegistry } from '../../common'; +import { FieldFormatsRegistry, UI_SETTINGS } from '../../common'; import { deserializeFieldFormat } from './utils/deserialize'; import { FormatFactory } from '../../common/field_formats/utils'; import { baseFormattersPublic } from './constants'; @@ -28,7 +28,7 @@ export class FieldFormatsService { public setup(core: CoreSetup) { core.uiSettings.getUpdate$().subscribe(({ key, newValue }) => { - if (key === 'format:defaultTypeMap') { + if (key === UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP) { this.fieldFormatsRegistry.parseDefaultTypeMap(newValue); } }); diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index 0c946fc6e1858b..55400393237567 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -17,8 +17,6 @@ * under the License. */ -import './index.scss'; - import { PluginInitializerContext } from '../../../core/public'; import { ConfigSchema } from '../config'; @@ -267,6 +265,7 @@ export { ES_FIELD_TYPES, KBN_FIELD_TYPES, IndexPatternAttributes, + UI_SETTINGS, } from '../common'; /* diff --git a/src/plugins/data/public/index_patterns/index_patterns/index_pattern.ts b/src/plugins/data/public/index_patterns/index_patterns/index_pattern.ts index 43404c32cb3d4f..3d54009d0fdcab 100644 --- a/src/plugins/data/public/index_patterns/index_patterns/index_pattern.ts +++ b/src/plugins/data/public/index_patterns/index_patterns/index_pattern.ts @@ -33,7 +33,7 @@ import { KBN_FIELD_TYPES, IIndexPattern, IFieldType, - META_FIELDS_SETTING, + UI_SETTINGS, } from '../../../common'; import { findByTitle } from '../utils'; import { IndexPatternMissingIndices } from '../lib'; @@ -108,8 +108,8 @@ export class IndexPattern implements IIndexPattern { // which cause problems when being consumed from angular this.getConfig = getConfig; - this.shortDotsEnable = this.getConfig('shortDots:enable'); - this.metaFields = this.getConfig(META_FIELDS_SETTING); + this.shortDotsEnable = this.getConfig(UI_SETTINGS.SHORT_DOTS_ENABLE); + this.metaFields = this.getConfig(UI_SETTINGS.META_FIELDS); this.createFieldList = getIndexPatternFieldListCreator({ fieldFormats: getFieldFormats(), @@ -117,8 +117,12 @@ export class IndexPattern implements IIndexPattern { }); this.fields = this.createFieldList(this, [], this.shortDotsEnable); - this.fieldsFetcher = createFieldsFetcher(this, apiClient, this.getConfig(META_FIELDS_SETTING)); - this.flattenHit = flattenHitWrapper(this, this.getConfig(META_FIELDS_SETTING)); + this.fieldsFetcher = createFieldsFetcher( + this, + apiClient, + this.getConfig(UI_SETTINGS.META_FIELDS) + ); + this.flattenHit = flattenHitWrapper(this, this.getConfig(UI_SETTINGS.META_FIELDS)); this.formatHit = formatHitProvider( this, getFieldFormats().getDefaultInstance(KBN_FIELD_TYPES.STRING) diff --git a/src/plugins/data/public/plugin.ts b/src/plugins/data/public/plugin.ts index 66e8d5a6e739a1..06b5cbdfdfdfb5 100644 --- a/src/plugins/data/public/plugin.ts +++ b/src/plugins/data/public/plugin.ts @@ -17,6 +17,8 @@ * under the License. */ +import './index.scss'; + import { PluginInitializerContext, CoreSetup, diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index ebb4e9d583bc0e..dcdb528ac8b7d5 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -1792,6 +1792,39 @@ export interface TimeRange { // @public export type TSearchStrategyProvider = (context: ISearchContext) => ISearchStrategy; +// Warning: (ae-missing-release-tag) "UI_SETTINGS" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const UI_SETTINGS: { + META_FIELDS: string; + DOC_HIGHLIGHT: string; + QUERY_STRING_OPTIONS: string; + QUERY_ALLOW_LEADING_WILDCARDS: string; + SEARCH_QUERY_LANGUAGE: string; + SORT_OPTIONS: string; + COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX: string; + COURIER_SET_REQUEST_PREFERENCE: string; + COURIER_CUSTOM_REQUEST_PREFERENCE: string; + COURIER_MAX_CONCURRENT_SHARD_REQUESTS: string; + COURIER_BATCH_SEARCHES: string; + SEARCH_INCLUDE_FROZEN: string; + HISTOGRAM_BAR_TARGET: string; + HISTOGRAM_MAX_BARS: string; + HISTORY_LIMIT: string; + SHORT_DOTS_ENABLE: string; + FORMAT_DEFAULT_TYPE_MAP: string; + FORMAT_NUMBER_DEFAULT_PATTERN: string; + FORMAT_PERCENT_DEFAULT_PATTERN: string; + FORMAT_BYTES_DEFAULT_PATTERN: string; + FORMAT_CURRENCY_DEFAULT_PATTERN: string; + FORMAT_NUMBER_DEFAULT_LOCALE: string; + TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: string; + TIMEPICKER_QUICK_RANGES: string; + INDEXPATTERN_PLACEHOLDER: string; + FILTERS_PINNED_BY_DEFAULT: string; + FILTERS_EDITOR_SUGGEST_VALUES: string; +}; + // Warnings were encountered during analysis: // @@ -1800,52 +1833,52 @@ export type TSearchStrategyProvider = (context: ISearc // src/plugins/data/common/es_query/filters/match_all_filter.ts:28:3 - (ae-forgotten-export) The symbol "MatchAllFilterMeta" needs to be exported by the entry point index.d.ts // src/plugins/data/common/es_query/filters/phrase_filter.ts:33:3 - (ae-forgotten-export) The symbol "PhraseFilterMeta" needs to be exported by the entry point index.d.ts // src/plugins/data/common/es_query/filters/phrases_filter.ts:31:3 - (ae-forgotten-export) The symbol "PhrasesFilterMeta" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "FilterLabel" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "FILTERS" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "getDisplayValueFromFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "generateFilters" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "changeTimeFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "convertRangeFilterToTimeRangeString" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:67:23 - (ae-forgotten-export) The symbol "extractTimeFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:138:21 - (ae-forgotten-export) The symbol "buildEsQuery" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:138:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:138:21 - (ae-forgotten-export) The symbol "luceneStringToDsl" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:138:21 - (ae-forgotten-export) The symbol "decorateQuery" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:180:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:180:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:180:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:180:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:180:26 - (ae-forgotten-export) The symbol "DateNanosFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:180:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:180:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:180:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:180:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:180:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:180:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:180:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:180:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:180:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:180:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "getFromSavedObject" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:378:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:378:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:378:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:378:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:380:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:381:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:390:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:391:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:392:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:396:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:397:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:400:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:401:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:404:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "FilterLabel" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "FILTERS" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "getDisplayValueFromFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "generateFilters" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "changeTimeFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "convertRangeFilterToTimeRangeString" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "extractTimeFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:136:21 - (ae-forgotten-export) The symbol "buildEsQuery" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:136:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:136:21 - (ae-forgotten-export) The symbol "luceneStringToDsl" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:136:21 - (ae-forgotten-export) The symbol "decorateQuery" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "DateNanosFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:178:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "getFromSavedObject" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:379:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:380:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:390:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:391:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:395:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:396:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:399:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:400:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:403:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts // src/plugins/data/public/query/state_sync/connect_to_query_state.ts:33:33 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts // src/plugins/data/public/query/state_sync/connect_to_query_state.ts:37:1 - (ae-forgotten-export) The symbol "QueryStateChange" needs to be exported by the entry point index.d.ts // src/plugins/data/public/types.ts:52:5 - (ae-forgotten-export) The symbol "createFiltersFromValueClickAction" needs to be exported by the entry point index.d.ts diff --git a/src/plugins/data/public/query/filter_manager/filter_manager.test.ts b/src/plugins/data/public/query/filter_manager/filter_manager.test.ts index 3c69a498e74cd3..878142906f54bd 100644 --- a/src/plugins/data/public/query/filter_manager/filter_manager.test.ts +++ b/src/plugins/data/public/query/filter_manager/filter_manager.test.ts @@ -24,14 +24,14 @@ import { Subscription } from 'rxjs'; import { FilterManager } from './filter_manager'; import { getFilter } from './test_helpers/get_stub_filter'; import { getFiltersArray } from './test_helpers/get_filters_array'; -import { Filter, FilterStateStore } from '../../../common'; +import { Filter, FilterStateStore, UI_SETTINGS } from '../../../common'; import { coreMock } from '../../../../../core/public/mocks'; const setupMock = coreMock.createSetup(); const uiSettingsMock = (pinnedByDefault: boolean) => (key: string) => { switch (key) { - case 'filters:pinnedByDefault': + case UI_SETTINGS.FILTERS_PINNED_BY_DEFAULT: return pinnedByDefault; default: throw new Error(`Unexpected uiSettings key in FilterManager mock: ${key}`); diff --git a/src/plugins/data/public/query/filter_manager/filter_manager.ts b/src/plugins/data/public/query/filter_manager/filter_manager.ts index d58a0eb45c04f7..60a49a4bd50f4a 100644 --- a/src/plugins/data/public/query/filter_manager/filter_manager.ts +++ b/src/plugins/data/public/query/filter_manager/filter_manager.ts @@ -34,6 +34,7 @@ import { isFilterPinned, compareFilters, COMPARE_ALL_OPTIONS, + UI_SETTINGS, } from '../../../common'; export class FilterManager { @@ -129,7 +130,7 @@ export class FilterManager { public addFilters( filters: Filter[] | Filter, - pinFilterStatus: boolean = this.uiSettings.get('filters:pinnedByDefault') + pinFilterStatus: boolean = this.uiSettings.get(UI_SETTINGS.FILTERS_PINNED_BY_DEFAULT) ) { if (!Array.isArray(filters)) { filters = [filters]; @@ -157,7 +158,7 @@ export class FilterManager { public setFilters( newFilters: Filter[], - pinFilterStatus: boolean = this.uiSettings.get('filters:pinnedByDefault') + pinFilterStatus: boolean = this.uiSettings.get(UI_SETTINGS.FILTERS_PINNED_BY_DEFAULT) ) { const store = pinFilterStatus ? FilterStateStore.GLOBAL_STATE : FilterStateStore.APP_STATE; diff --git a/src/plugins/data/public/query/lib/get_query_log.ts b/src/plugins/data/public/query/lib/get_query_log.ts index a71eb7580cf07e..b7827d2c8de021 100644 --- a/src/plugins/data/public/query/lib/get_query_log.ts +++ b/src/plugins/data/public/query/lib/get_query_log.ts @@ -20,6 +20,7 @@ import { IUiSettingsClient } from 'src/core/public'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; import { PersistedLog } from '../persisted_log'; +import { UI_SETTINGS } from '../../../common'; export function getQueryLog( uiSettings: IUiSettingsClient, @@ -30,7 +31,7 @@ export function getQueryLog( return new PersistedLog( `typeahead:${appName}-${language}`, { - maxLength: uiSettings.get('history:limit'), + maxLength: uiSettings.get(UI_SETTINGS.HISTORY_LIMIT), filterDuplicates: true, }, storage diff --git a/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts b/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts index 06e4c1c8be6d5d..4e394445b75ae3 100644 --- a/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts +++ b/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts @@ -20,7 +20,7 @@ import { Subscription } from 'rxjs'; import { FilterManager } from '../filter_manager'; import { getFilter } from '../filter_manager/test_helpers/get_stub_filter'; -import { Filter, FilterStateStore } from '../../../common'; +import { Filter, FilterStateStore, UI_SETTINGS } from '../../../common'; import { coreMock } from '../../../../../core/public/mocks'; import { BaseStateContainer, createStateContainer, Storage } from '../../../../kibana_utils/public'; import { QueryService, QueryStart } from '../query_service'; @@ -46,11 +46,11 @@ const startMock = coreMock.createStart(); setupMock.uiSettings.get.mockImplementation((key: string) => { switch (key) { - case 'filters:pinnedByDefault': + case UI_SETTINGS.FILTERS_PINNED_BY_DEFAULT: return true; case 'timepicker:timeDefaults': return { from: 'now-15m', to: 'now' }; - case 'timepicker:refreshIntervalDefaults': + case UI_SETTINGS.TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: return { pause: false, value: 0 }; default: throw new Error(`sync_query test: not mocked uiSetting: ${key}`); diff --git a/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts b/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts index 50dc35ea955ee3..77271535372579 100644 --- a/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts +++ b/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts @@ -21,7 +21,7 @@ import { Subscription } from 'rxjs'; import { createBrowserHistory, History } from 'history'; import { FilterManager } from '../filter_manager'; import { getFilter } from '../filter_manager/test_helpers/get_stub_filter'; -import { Filter, FilterStateStore } from '../../../common'; +import { Filter, FilterStateStore, UI_SETTINGS } from '../../../common'; import { coreMock } from '../../../../../core/public/mocks'; import { createKbnUrlStateStorage, @@ -39,11 +39,11 @@ const startMock = coreMock.createStart(); setupMock.uiSettings.get.mockImplementation((key: string) => { switch (key) { - case 'filters:pinnedByDefault': + case UI_SETTINGS.FILTERS_PINNED_BY_DEFAULT: return true; case 'timepicker:timeDefaults': return { from: 'now-15m', to: 'now' }; - case 'timepicker:refreshIntervalDefaults': + case UI_SETTINGS.TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: return { pause: false, value: 0 }; default: throw new Error(`sync_query test: not mocked uiSetting: ${key}`); diff --git a/src/plugins/data/public/query/timefilter/timefilter_service.ts b/src/plugins/data/public/query/timefilter/timefilter_service.ts index 413163ed059ad4..df2fbc8e5a8f3e 100644 --- a/src/plugins/data/public/query/timefilter/timefilter_service.ts +++ b/src/plugins/data/public/query/timefilter/timefilter_service.ts @@ -20,6 +20,7 @@ import { IUiSettingsClient } from 'src/core/public'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; import { TimeHistory, Timefilter, TimeHistoryContract, TimefilterContract } from './index'; +import { UI_SETTINGS } from '../../../common'; /** * Filter Service @@ -35,7 +36,7 @@ export class TimefilterService { public setup({ uiSettings, storage }: TimeFilterServiceDependencies): TimefilterSetup { const timefilterConfig = { timeDefaults: uiSettings.get('timepicker:timeDefaults'), - refreshIntervalDefaults: uiSettings.get('timepicker:refreshIntervalDefaults'), + refreshIntervalDefaults: uiSettings.get(UI_SETTINGS.TIMEPICKER_REFRESH_INTERVAL_DEFAULTS), }; const history = new TimeHistory(storage); const timefilter = new Timefilter(timefilterConfig, history); diff --git a/src/plugins/data/public/search/aggs/buckets/date_histogram.ts b/src/plugins/data/public/search/aggs/buckets/date_histogram.ts index d5c97d0c95c5cf..8a5596f669cb78 100644 --- a/src/plugins/data/public/search/aggs/buckets/date_histogram.ts +++ b/src/plugins/data/public/search/aggs/buckets/date_histogram.ts @@ -31,7 +31,7 @@ import { dateHistogramInterval, TimeRange } from '../../../../common'; import { writeParams } from '../agg_params'; import { isMetricAggType } from '../metrics/metric_agg_type'; -import { FIELD_FORMAT_IDS, KBN_FIELD_TYPES } from '../../../../common'; +import { FIELD_FORMAT_IDS, KBN_FIELD_TYPES, UI_SETTINGS } from '../../../../common'; import { TimefilterContract } from '../../../query'; import { QuerySetup } from '../../../query/query_service'; import { GetInternalStartServicesFn } from '../../../types'; @@ -125,8 +125,8 @@ export const getDateHistogramBucketAgg = ({ const { timefilter } = query.timefilter; buckets = new TimeBuckets({ - 'histogram:maxBars': uiSettings.get('histogram:maxBars'), - 'histogram:barTarget': uiSettings.get('histogram:barTarget'), + 'histogram:maxBars': uiSettings.get(UI_SETTINGS.HISTOGRAM_MAX_BARS), + 'histogram:barTarget': uiSettings.get(UI_SETTINGS.HISTOGRAM_BAR_TARGET), dateFormat: uiSettings.get('dateFormat'), 'dateFormat:scaled': uiSettings.get('dateFormat:scaled'), }); diff --git a/src/plugins/data/public/search/aggs/buckets/filters.ts b/src/plugins/data/public/search/aggs/buckets/filters.ts index 3f3f13bb955c18..4052c0b3901556 100644 --- a/src/plugins/data/public/search/aggs/buckets/filters.ts +++ b/src/plugins/data/public/search/aggs/buckets/filters.ts @@ -26,7 +26,7 @@ import { toAngularJSON } from '../utils'; import { BucketAggType } from './bucket_agg_type'; import { BUCKET_TYPES } from './bucket_agg_types'; import { Storage } from '../../../../../../plugins/kibana_utils/public'; -import { getEsQueryConfig, buildEsQuery, Query } from '../../../../common'; +import { getEsQueryConfig, buildEsQuery, Query, UI_SETTINGS } from '../../../../common'; import { getQueryLog } from '../../../query'; import { GetInternalStartServicesFn } from '../../../types'; import { BaseAggParams } from '../types'; @@ -69,7 +69,10 @@ export const getFiltersBucketAgg = ({ { name: 'filters', default: [ - { input: { query: '', language: uiSettings.get('search:queryLanguage') }, label: '' }, + { + input: { query: '', language: uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE) }, + label: '', + }, ], write(aggConfig, output) { const inFilters: FilterValue[] = aggConfig.params.filters; diff --git a/src/plugins/data/public/search/aggs/buckets/histogram.ts b/src/plugins/data/public/search/aggs/buckets/histogram.ts index d04df4f8aac6ba..c1fad17f488db2 100644 --- a/src/plugins/data/public/search/aggs/buckets/histogram.ts +++ b/src/plugins/data/public/search/aggs/buckets/histogram.ts @@ -24,7 +24,7 @@ import { IUiSettingsClient } from 'src/core/public'; import { BucketAggType, IBucketAggConfig } from './bucket_agg_type'; import { createFilterHistogram } from './create_filter/histogram'; import { BUCKET_TYPES } from './bucket_agg_types'; -import { KBN_FIELD_TYPES } from '../../../../common'; +import { KBN_FIELD_TYPES, UI_SETTINGS } from '../../../../common'; import { GetInternalStartServicesFn } from '../../../types'; import { BaseAggParams } from '../types'; import { ExtendedBounds } from './lib/extended_bounds'; @@ -155,8 +155,8 @@ export const getHistogramBucketAgg = ({ const range = autoBounds.max - autoBounds.min; const bars = range / interval; - if (bars > uiSettings.get('histogram:maxBars')) { - const minInterval = range / uiSettings.get('histogram:maxBars'); + if (bars > uiSettings.get(UI_SETTINGS.HISTOGRAM_MAX_BARS)) { + const minInterval = range / uiSettings.get(UI_SETTINGS.HISTOGRAM_MAX_BARS); // Round interval by order of magnitude to provide clean intervals // Always round interval up so there will always be less buckets than histogram:maxBars diff --git a/src/plugins/data/public/search/aggs/utils/calculate_auto_time_expression.ts b/src/plugins/data/public/search/aggs/utils/calculate_auto_time_expression.ts index 9d976784329ccf..30fcdd9d83a389 100644 --- a/src/plugins/data/public/search/aggs/utils/calculate_auto_time_expression.ts +++ b/src/plugins/data/public/search/aggs/utils/calculate_auto_time_expression.ts @@ -19,7 +19,7 @@ import moment from 'moment'; import { IUiSettingsClient } from 'src/core/public'; import { TimeBuckets } from '../buckets/lib/time_buckets'; -import { toAbsoluteDates, TimeRange } from '../../../../common'; +import { toAbsoluteDates, TimeRange, UI_SETTINGS } from '../../../../common'; export function getCalculateAutoTimeExpression(uiSettings: IUiSettingsClient) { return function calculateAutoTimeExpression(range: TimeRange) { @@ -29,8 +29,8 @@ export function getCalculateAutoTimeExpression(uiSettings: IUiSettingsClient) { } const buckets = new TimeBuckets({ - 'histogram:maxBars': uiSettings.get('histogram:maxBars'), - 'histogram:barTarget': uiSettings.get('histogram:barTarget'), + 'histogram:maxBars': uiSettings.get(UI_SETTINGS.HISTOGRAM_MAX_BARS), + 'histogram:barTarget': uiSettings.get(UI_SETTINGS.HISTOGRAM_BAR_TARGET), dateFormat: uiSettings.get('dateFormat'), 'dateFormat:scaled': uiSettings.get('dateFormat:scaled'), }); diff --git a/src/plugins/data/public/search/es_search/get_es_preference.test.ts b/src/plugins/data/public/search/es_search/get_es_preference.test.ts index 8b8156b4519d64..05a74b3e6205ac 100644 --- a/src/plugins/data/public/search/es_search/get_es_preference.test.ts +++ b/src/plugins/data/public/search/es_search/get_es_preference.test.ts @@ -20,6 +20,7 @@ import { getEsPreference } from './get_es_preference'; import { CoreStart } from '../../../../../core/public'; import { coreMock } from '../../../../../core/public/mocks'; +import { UI_SETTINGS } from '../../../common'; describe('Get ES preference', () => { let mockCoreStart: MockedKeys; @@ -30,8 +31,8 @@ describe('Get ES preference', () => { test('returns the session ID if set to sessionId', () => { mockCoreStart.uiSettings.get.mockImplementation((key: string) => { - if (key === 'courier:setRequestPreference') return 'sessionId'; - if (key === 'courier:customRequestPreference') return 'foobar'; + if (key === UI_SETTINGS.COURIER_SET_REQUEST_PREFERENCE) return 'sessionId'; + if (key === UI_SETTINGS.COURIER_CUSTOM_REQUEST_PREFERENCE) return 'foobar'; }); const preference = getEsPreference(mockCoreStart.uiSettings, 'my_session_id'); expect(preference).toBe('my_session_id'); @@ -39,8 +40,8 @@ describe('Get ES preference', () => { test('returns the custom preference if set to custom', () => { mockCoreStart.uiSettings.get.mockImplementation((key: string) => { - if (key === 'courier:setRequestPreference') return 'custom'; - if (key === 'courier:customRequestPreference') return 'foobar'; + if (key === UI_SETTINGS.COURIER_SET_REQUEST_PREFERENCE) return 'custom'; + if (key === UI_SETTINGS.COURIER_CUSTOM_REQUEST_PREFERENCE) return 'foobar'; }); const preference = getEsPreference(mockCoreStart.uiSettings); expect(preference).toBe('foobar'); @@ -48,8 +49,8 @@ describe('Get ES preference', () => { test('returns undefined if set to none', () => { mockCoreStart.uiSettings.get.mockImplementation((key: string) => { - if (key === 'courier:setRequestPreference') return 'none'; - if (key === 'courier:customRequestPreference') return 'foobar'; + if (key === UI_SETTINGS.COURIER_SET_REQUEST_PREFERENCE) return 'none'; + if (key === UI_SETTINGS.COURIER_CUSTOM_REQUEST_PREFERENCE) return 'foobar'; }); const preference = getEsPreference(mockCoreStart.uiSettings); expect(preference).toBe(undefined); diff --git a/src/plugins/data/public/search/es_search/get_es_preference.ts b/src/plugins/data/public/search/es_search/get_es_preference.ts index 3f1c2b9b3b7369..5e40712067bb02 100644 --- a/src/plugins/data/public/search/es_search/get_es_preference.ts +++ b/src/plugins/data/public/search/es_search/get_es_preference.ts @@ -18,12 +18,13 @@ */ import { IUiSettingsClient } from '../../../../../core/public'; +import { UI_SETTINGS } from '../../../common'; const defaultSessionId = `${Date.now()}`; export function getEsPreference(uiSettings: IUiSettingsClient, sessionId = defaultSessionId) { - const setPreference = uiSettings.get('courier:setRequestPreference'); + const setPreference = uiSettings.get(UI_SETTINGS.COURIER_SET_REQUEST_PREFERENCE); if (setPreference === 'sessionId') return `${sessionId}`; - const customPreference = uiSettings.get('courier:customRequestPreference'); + const customPreference = uiSettings.get(UI_SETTINGS.COURIER_CUSTOM_REQUEST_PREFERENCE); return setPreference === 'custom' ? customPreference : undefined; } diff --git a/src/plugins/data/public/search/fetch/get_search_params.test.ts b/src/plugins/data/public/search/fetch/get_search_params.test.ts index 4809d76a46f59f..f9b62fdd4fc613 100644 --- a/src/plugins/data/public/search/fetch/get_search_params.test.ts +++ b/src/plugins/data/public/search/fetch/get_search_params.test.ts @@ -19,6 +19,7 @@ import { getSearchParams } from './get_search_params'; import { IUiSettingsClient } from 'kibana/public'; +import { UI_SETTINGS } from '../../../common'; function getConfigStub(config: any = {}) { return { @@ -40,21 +41,21 @@ describe('getSearchParams', () => { }); test('includes ignore_throttled according to search:includeFrozen', () => { - let config = getConfigStub({ 'search:includeFrozen': true }); + let config = getConfigStub({ [UI_SETTINGS.SEARCH_INCLUDE_FROZEN]: true }); let searchParams = getSearchParams(config); expect(searchParams.ignore_throttled).toBe(false); - config = getConfigStub({ 'search:includeFrozen': false }); + config = getConfigStub({ [UI_SETTINGS.SEARCH_INCLUDE_FROZEN]: false }); searchParams = getSearchParams(config); expect(searchParams.ignore_throttled).toBe(true); }); test('includes max_concurrent_shard_requests according to courier:maxConcurrentShardRequests', () => { - let config = getConfigStub({ 'courier:maxConcurrentShardRequests': 0 }); + let config = getConfigStub({ [UI_SETTINGS.COURIER_MAX_CONCURRENT_SHARD_REQUESTS]: 0 }); let searchParams = getSearchParams(config); expect(searchParams.max_concurrent_shard_requests).toBe(undefined); - config = getConfigStub({ 'courier:maxConcurrentShardRequests': 5 }); + config = getConfigStub({ [UI_SETTINGS.COURIER_MAX_CONCURRENT_SHARD_REQUESTS]: 5 }); searchParams = getSearchParams(config); expect(searchParams.max_concurrent_shard_requests).toBe(5); }); diff --git a/src/plugins/data/public/search/fetch/get_search_params.ts b/src/plugins/data/public/search/fetch/get_search_params.ts index f0c43bd2e74cd1..60bdc9ed6473ad 100644 --- a/src/plugins/data/public/search/fetch/get_search_params.ts +++ b/src/plugins/data/public/search/fetch/get_search_params.ts @@ -18,6 +18,7 @@ */ import { IUiSettingsClient } from 'kibana/public'; +import { UI_SETTINGS } from '../../../common'; const sessionId = Date.now(); @@ -33,19 +34,19 @@ export function getSearchParams(config: IUiSettingsClient, esShardTimeout: numbe } export function getIgnoreThrottled(config: IUiSettingsClient) { - return !config.get('search:includeFrozen'); + return !config.get(UI_SETTINGS.SEARCH_INCLUDE_FROZEN); } export function getMaxConcurrentShardRequests(config: IUiSettingsClient) { - const maxConcurrentShardRequests = config.get('courier:maxConcurrentShardRequests'); + const maxConcurrentShardRequests = config.get(UI_SETTINGS.COURIER_MAX_CONCURRENT_SHARD_REQUESTS); return maxConcurrentShardRequests > 0 ? maxConcurrentShardRequests : undefined; } export function getPreference(config: IUiSettingsClient) { - const setRequestPreference = config.get('courier:setRequestPreference'); + const setRequestPreference = config.get(UI_SETTINGS.COURIER_SET_REQUEST_PREFERENCE); if (setRequestPreference === 'sessionId') return sessionId; return setRequestPreference === 'custom' - ? config.get('courier:customRequestPreference') + ? config.get(UI_SETTINGS.COURIER_CUSTOM_REQUEST_PREFERENCE) : undefined; } diff --git a/src/plugins/data/public/search/legacy/default_search_strategy.test.ts b/src/plugins/data/public/search/legacy/default_search_strategy.test.ts index c619c9b17d9a84..436b522744622d 100644 --- a/src/plugins/data/public/search/legacy/default_search_strategy.test.ts +++ b/src/plugins/data/public/search/legacy/default_search_strategy.test.ts @@ -21,6 +21,7 @@ import { IUiSettingsClient } from 'kibana/public'; import { defaultSearchStrategy } from './default_search_strategy'; import { searchStartMock } from '../mocks'; import { SearchStrategySearchParams } from './types'; +import { UI_SETTINGS } from '../../../common'; const { search } = defaultSearchStrategy; @@ -69,30 +70,30 @@ describe('defaultSearchStrategy', function () { }); test('does not send max_concurrent_shard_requests by default', async () => { - const config = getConfigStub({ 'courier:batchSearches': true }); + const config = getConfigStub({ [UI_SETTINGS.COURIER_BATCH_SEARCHES]: true }); await search({ ...searchArgs, config }); expect(es.msearch.mock.calls[0][0].max_concurrent_shard_requests).toBe(undefined); }); test('allows configuration of max_concurrent_shard_requests', async () => { const config = getConfigStub({ - 'courier:batchSearches': true, - 'courier:maxConcurrentShardRequests': 42, + [UI_SETTINGS.COURIER_BATCH_SEARCHES]: true, + [UI_SETTINGS.COURIER_MAX_CONCURRENT_SHARD_REQUESTS]: 42, }); await search({ ...searchArgs, config }); expect(es.msearch.mock.calls[0][0].max_concurrent_shard_requests).toBe(42); }); test('should set rest_total_hits_as_int to true on a request', async () => { - const config = getConfigStub({ 'courier:batchSearches': true }); + const config = getConfigStub({ [UI_SETTINGS.COURIER_BATCH_SEARCHES]: true }); await search({ ...searchArgs, config }); expect(es.msearch.mock.calls[0][0]).toHaveProperty('rest_total_hits_as_int', true); }); test('should set ignore_throttled=false when including frozen indices', async () => { const config = getConfigStub({ - 'courier:batchSearches': true, - 'search:includeFrozen': true, + [UI_SETTINGS.COURIER_BATCH_SEARCHES]: true, + [UI_SETTINGS.SEARCH_INCLUDE_FROZEN]: true, }); await search({ ...searchArgs, config }); expect(es.msearch.mock.calls[0][0]).toHaveProperty('ignore_throttled', false); @@ -100,7 +101,7 @@ describe('defaultSearchStrategy', function () { test('should properly call abort with msearch', () => { const config = getConfigStub({ - 'courier:batchSearches': true, + [UI_SETTINGS.COURIER_BATCH_SEARCHES]: true, }); search({ ...searchArgs, config }).abort(); expect(msearchMockResponse.abort).toHaveBeenCalled(); diff --git a/src/plugins/data/public/search/legacy/fetch_soon.test.ts b/src/plugins/data/public/search/legacy/fetch_soon.test.ts index e99e13ba33d1a6..61d3568350b6b1 100644 --- a/src/plugins/data/public/search/legacy/fetch_soon.test.ts +++ b/src/plugins/data/public/search/legacy/fetch_soon.test.ts @@ -22,6 +22,7 @@ import { callClient } from './call_client'; import { IUiSettingsClient } from 'kibana/public'; import { FetchHandlers, FetchOptions } from '../fetch/types'; import { SearchRequest, SearchResponse } from '../index'; +import { UI_SETTINGS } from '../../../common'; function getConfigStub(config: any = {}) { return { @@ -60,7 +61,7 @@ describe('fetchSoon', () => { test('should execute asap if config is set to not batch searches', () => { const config = getConfigStub({ - 'courier:batchSearches': false, + [UI_SETTINGS.COURIER_BATCH_SEARCHES]: false, }); const request = {}; const options = {}; @@ -72,7 +73,7 @@ describe('fetchSoon', () => { test('should delay by 50ms if config is set to batch searches', () => { const config = getConfigStub({ - 'courier:batchSearches': true, + [UI_SETTINGS.COURIER_BATCH_SEARCHES]: true, }); const request = {}; const options = {}; @@ -88,7 +89,7 @@ describe('fetchSoon', () => { test('should send a batch of requests to callClient', () => { const config = getConfigStub({ - 'courier:batchSearches': true, + [UI_SETTINGS.COURIER_BATCH_SEARCHES]: true, }); const requests = [{ foo: 1 }, { foo: 2 }]; const options = [{ bar: 1 }, { bar: 2 }]; @@ -105,7 +106,7 @@ describe('fetchSoon', () => { test('should return the response to the corresponding call for multiple batched requests', async () => { const config = getConfigStub({ - 'courier:batchSearches': true, + [UI_SETTINGS.COURIER_BATCH_SEARCHES]: true, }); const requests = [{ _mockResponseId: 'foo' }, { _mockResponseId: 'bar' }]; @@ -120,7 +121,7 @@ describe('fetchSoon', () => { test('should wait for the previous batch to start before starting a new batch', () => { const config = getConfigStub({ - 'courier:batchSearches': true, + [UI_SETTINGS.COURIER_BATCH_SEARCHES]: true, }); const firstBatch = [{ foo: 1 }, { foo: 2 }]; const secondBatch = [{ bar: 1 }, { bar: 2 }]; diff --git a/src/plugins/data/public/search/legacy/fetch_soon.ts b/src/plugins/data/public/search/legacy/fetch_soon.ts index 304c1c4d63f5bb..fed2c52bc491f8 100644 --- a/src/plugins/data/public/search/legacy/fetch_soon.ts +++ b/src/plugins/data/public/search/legacy/fetch_soon.ts @@ -20,6 +20,7 @@ import { callClient } from './call_client'; import { FetchHandlers, FetchOptions } from '../fetch/types'; import { SearchRequest, SearchResponse } from '../index'; +import { UI_SETTINGS } from '../../../common'; /** * This function introduces a slight delay in the request process to allow multiple requests to queue @@ -30,7 +31,7 @@ export async function fetchSoon( options: FetchOptions, fetchHandlers: FetchHandlers ) { - const msToDelay = fetchHandlers.config.get('courier:batchSearches') ? 50 : 0; + const msToDelay = fetchHandlers.config.get(UI_SETTINGS.COURIER_BATCH_SEARCHES) ? 50 : 0; return delayedFetch(request, options, fetchHandlers, msToDelay); } diff --git a/src/plugins/data/public/search/legacy/get_msearch_params.test.ts b/src/plugins/data/public/search/legacy/get_msearch_params.test.ts index ce98f6ab2a7bbc..dc61e194066314 100644 --- a/src/plugins/data/public/search/legacy/get_msearch_params.test.ts +++ b/src/plugins/data/public/search/legacy/get_msearch_params.test.ts @@ -19,6 +19,7 @@ import { getMSearchParams } from './get_msearch_params'; import { IUiSettingsClient } from '../../../../../core/public'; +import { UI_SETTINGS } from '../../../common'; function getConfigStub(config: any = {}) { return { @@ -34,29 +35,29 @@ describe('getMSearchParams', () => { }); test('includes ignore_throttled according to search:includeFrozen', () => { - let config = getConfigStub({ 'search:includeFrozen': true }); + let config = getConfigStub({ [UI_SETTINGS.SEARCH_INCLUDE_FROZEN]: true }); let msearchParams = getMSearchParams(config); expect(msearchParams.ignore_throttled).toBe(false); - config = getConfigStub({ 'search:includeFrozen': false }); + config = getConfigStub({ [UI_SETTINGS.SEARCH_INCLUDE_FROZEN]: false }); msearchParams = getMSearchParams(config); expect(msearchParams.ignore_throttled).toBe(true); }); test('includes max_concurrent_shard_requests according to courier:maxConcurrentShardRequests if greater than 0', () => { - let config = getConfigStub({ 'courier:maxConcurrentShardRequests': 0 }); + let config = getConfigStub({ [UI_SETTINGS.COURIER_MAX_CONCURRENT_SHARD_REQUESTS]: 0 }); let msearchParams = getMSearchParams(config); expect(msearchParams.max_concurrent_shard_requests).toBe(undefined); - config = getConfigStub({ 'courier:maxConcurrentShardRequests': 5 }); + config = getConfigStub({ [UI_SETTINGS.COURIER_MAX_CONCURRENT_SHARD_REQUESTS]: 5 }); msearchParams = getMSearchParams(config); expect(msearchParams.max_concurrent_shard_requests).toBe(5); }); test('does not include other search params that are included in the msearch header or body', () => { const config = getConfigStub({ - 'search:includeFrozen': false, - 'courier:maxConcurrentShardRequests': 5, + [UI_SETTINGS.SEARCH_INCLUDE_FROZEN]: false, + [UI_SETTINGS.COURIER_MAX_CONCURRENT_SHARD_REQUESTS]: 5, }); const msearchParams = getMSearchParams(config); expect(msearchParams.hasOwnProperty('ignore_unavailable')).toBe(false); diff --git a/src/plugins/data/public/search/search_source/search_source.ts b/src/plugins/data/public/search/search_source/search_source.ts index 38f4ce73713c88..b926739112e0e8 100644 --- a/src/plugins/data/public/search/search_source/search_source.ts +++ b/src/plugins/data/public/search/search_source/search_source.ts @@ -75,12 +75,11 @@ import { CoreStart } from 'kibana/public'; import { normalizeSortRequest } from './normalize_sort_request'; import { filterDocvalueFields } from './filter_docvalue_fields'; import { fieldWildcardFilter } from '../../../../kibana_utils/public'; -import { META_FIELDS_SETTING, DOC_HIGHLIGHT_SETTING } from '../../../common'; import { IIndexPattern, ISearchGeneric, SearchRequest } from '../..'; import { SearchSourceOptions, SearchSourceFields } from './types'; import { FetchOptions, RequestFailure, getSearchParams, handleResponse } from '../fetch'; -import { getEsQueryConfig, buildEsQuery, Filter } from '../../../common'; +import { getEsQueryConfig, buildEsQuery, Filter, UI_SETTINGS } from '../../../common'; import { getHighlightRequest } from '../../../common/field_formats'; import { fetchSoon } from '../legacy'; import { extractReferences } from './extract_references'; @@ -251,7 +250,7 @@ export class SearchSource { this.history = [searchRequest]; let response; - if (uiSettings.get('courier:batchSearches')) { + if (uiSettings.get(UI_SETTINGS.COURIER_BATCH_SEARCHES)) { response = await this.legacyFetch(searchRequest, options); } else { response = this.fetch$(searchRequest, options.abortSignal).toPromise(); @@ -365,7 +364,7 @@ export class SearchSource { const sort = normalizeSortRequest( val, this.getField('index'), - uiSettings.get('sort:options') + uiSettings.get(UI_SETTINGS.SORT_OPTIONS) ); return addToBody(key, sort); default: @@ -425,7 +424,7 @@ export class SearchSource { // exclude source fields for this index pattern specified by the user const filter = fieldWildcardFilter( body._source.excludes, - uiSettings.get(META_FIELDS_SETTING) + uiSettings.get(UI_SETTINGS.META_FIELDS) ); body.docvalue_fields = body.docvalue_fields.filter((docvalueField: any) => filter(docvalueField.field) @@ -448,7 +447,7 @@ export class SearchSource { body.query = buildEsQuery(index, query, filters, esQueryConfigs); if (highlightAll && body.query) { - body.highlight = getHighlightRequest(body.query, uiSettings.get(DOC_HIGHLIGHT_SETTING)); + body.highlight = getHighlightRequest(body.query, uiSettings.get(UI_SETTINGS.DOC_HIGHLIGHT)); delete searchRequest.highlightAll; } diff --git a/src/plugins/data/public/ui/filter_bar/filter_bar.tsx b/src/plugins/data/public/ui/filter_bar/filter_bar.tsx index a54a25acc59134..43dba150bf8d44 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_bar.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_bar.tsx @@ -36,6 +36,7 @@ import { toggleFilterDisabled, toggleFilterNegated, unpinFilter, + UI_SETTINGS, } from '../../../common'; interface Props { @@ -76,7 +77,7 @@ function FilterBarUI(props: Props) { } function renderAddFilter() { - const isPinned = uiSettings!.get('filters:pinnedByDefault'); + const isPinned = uiSettings!.get(UI_SETTINGS.FILTERS_PINNED_BY_DEFAULT); const [indexPattern] = props.indexPatterns; const index = indexPattern && indexPattern.id; const newFilter = buildEmptyFilter(isPinned, index); diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx index 546365b89d9be1..94138f60b52b1f 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx @@ -22,6 +22,7 @@ import { debounce } from 'lodash'; import { withKibana, KibanaReactContextValue } from '../../../../../kibana_react/public'; import { IDataPluginServices, IIndexPattern, IFieldType } from '../../..'; +import { UI_SETTINGS } from '../../../../common'; export interface PhraseSuggestorProps { kibana: KibanaReactContextValue; @@ -54,7 +55,9 @@ export class PhraseSuggestorUI extends React.Com } protected isSuggestingValues() { - const shouldSuggestValues = this.services.uiSettings.get('filterEditor:suggestValues'); + const shouldSuggestValues = this.services.uiSettings.get( + UI_SETTINGS.FILTERS_EDITOR_SUGGEST_VALUES + ); const { field } = this.props; return shouldSuggestValues && field && field.aggregatable && field.type === 'string'; } diff --git a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.test.tsx b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.test.tsx index f579adbc0c7e27..5f2d4c00cd6b6f 100644 --- a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.test.tsx +++ b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.test.tsx @@ -28,6 +28,7 @@ import { dataPluginMock } from '../../mocks'; import { KibanaContextProvider } from 'src/plugins/kibana_react/public'; import { I18nProvider } from '@kbn/i18n/react'; import { stubIndexPatternWithFields } from '../../stubs'; +import { UI_SETTINGS } from '../../../common'; const startMock = coreMock.createStart(); const mockTimeHistory = { @@ -38,7 +39,7 @@ const mockTimeHistory = { startMock.uiSettings.get.mockImplementation((key: string) => { switch (key) { - case 'timepicker:quickRanges': + case UI_SETTINGS.TIMEPICKER_QUICK_RANGES: return [ { from: 'now/d', @@ -48,7 +49,7 @@ startMock.uiSettings.get.mockImplementation((key: string) => { ]; case 'dateFormat': return 'MMM D, YYYY @ HH:mm:ss.SSS'; - case 'history:limit': + case UI_SETTINGS.HISTORY_LIMIT: return 10; case 'timepicker:timeDefaults': return { diff --git a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx index 433cb652ee5ce6..f65bf97e391e22 100644 --- a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx +++ b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx @@ -38,7 +38,7 @@ import { Toast } from 'src/core/public'; import { IDataPluginServices, IIndexPattern, TimeRange, TimeHistoryContract, Query } from '../..'; import { useKibana, toMountPoint } from '../../../../kibana_react/public'; import { QueryStringInput } from './query_string_input'; -import { doesKueryExpressionHaveLuceneSyntaxError } from '../../../common'; +import { doesKueryExpressionHaveLuceneSyntaxError, UI_SETTINGS } from '../../../common'; import { PersistedLog, getQueryLog } from '../../query'; interface Props { @@ -255,7 +255,7 @@ export function QueryBarTopRow(props: Props) { } const commonlyUsedRanges = uiSettings! - .get('timepicker:quickRanges') + .get(UI_SETTINGS.TIMEPICKER_QUICK_RANGES) .map(({ from, to, display }: { from: string; to: string; display: string }) => { return { start: from, diff --git a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx index 7723254f3aa51e..18ed632e0a8ecc 100644 --- a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx +++ b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx @@ -27,7 +27,7 @@ import { useFilterManager } from './lib/use_filter_manager'; import { useTimefilter } from './lib/use_timefilter'; import { useSavedQuery } from './lib/use_saved_query'; import { DataPublicPluginStart } from '../../types'; -import { Filter, Query, TimeRange } from '../../../common'; +import { Filter, Query, TimeRange, UI_SETTINGS } from '../../../common'; interface StatefulSearchBarDeps { core: CoreStart; @@ -125,7 +125,8 @@ export function createSearchBar({ core, storage, data }: StatefulSearchBarDeps) const defaultQuery = { query: '', language: - storage.get('kibana.userQueryLanguage') || core.uiSettings.get('search:queryLanguage'), + storage.get('kibana.userQueryLanguage') || + core.uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE), }; const [query, setQuery] = useState(props.query || defaultQuery); diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts index 72a29e377ac54e..831d23864d2287 100644 --- a/src/plugins/data/server/index.ts +++ b/src/plugins/data/server/index.ts @@ -146,6 +146,7 @@ export { ES_FIELD_TYPES, KBN_FIELD_TYPES, IndexPatternAttributes, + UI_SETTINGS, } from '../common'; /** diff --git a/src/plugins/data/server/kql_telemetry/usage_collector/fetch.test.ts b/src/plugins/data/server/kql_telemetry/usage_collector/fetch.test.ts index 446320b09757a5..81e352fea51b26 100644 --- a/src/plugins/data/server/kql_telemetry/usage_collector/fetch.test.ts +++ b/src/plugins/data/server/kql_telemetry/usage_collector/fetch.test.ts @@ -22,6 +22,9 @@ import { APICaller } from 'kibana/server'; jest.mock('../../../common', () => ({ DEFAULT_QUERY_LANGUAGE: 'lucene', + UI_SETTINGS: { + SEARCH_QUERY_LANGUAGE: 'search:queryLanguage', + }, })); let fetch: ReturnType; diff --git a/src/plugins/data/server/kql_telemetry/usage_collector/fetch.ts b/src/plugins/data/server/kql_telemetry/usage_collector/fetch.ts index 9f3437161541f1..157716b38f5234 100644 --- a/src/plugins/data/server/kql_telemetry/usage_collector/fetch.ts +++ b/src/plugins/data/server/kql_telemetry/usage_collector/fetch.ts @@ -19,7 +19,7 @@ import { get } from 'lodash'; import { APICaller } from 'kibana/server'; -import { DEFAULT_QUERY_LANGUAGE } from '../../../common'; +import { DEFAULT_QUERY_LANGUAGE, UI_SETTINGS } from '../../../common'; const defaultSearchQueryLanguageSetting = DEFAULT_QUERY_LANGUAGE; @@ -40,7 +40,7 @@ export function fetchProvider(index: string) { const queryLanguageConfigValue = get( config, - 'hits.hits[0]._source.config.search:queryLanguage' + `hits.hits[0]._source.config.${UI_SETTINGS.SEARCH_QUERY_LANGUAGE}` ); // search:queryLanguage can potentially be in four states in the .kibana index: diff --git a/src/plugins/data/server/plugin.ts b/src/plugins/data/server/plugin.ts index df7a7b9cf4d011..8c9d0df2ed8947 100644 --- a/src/plugins/data/server/plugin.ts +++ b/src/plugins/data/server/plugin.ts @@ -28,7 +28,7 @@ import { KqlTelemetryService } from './kql_telemetry'; import { UsageCollectionSetup } from '../../usage_collection/server'; import { AutocompleteService } from './autocomplete'; import { FieldFormatsService, FieldFormatsSetup, FieldFormatsStart } from './field_formats'; -import { uiSettings } from './ui_settings'; +import { getUiSettings } from './ui_settings'; export interface DataPluginSetup { search: ISearchSetup; @@ -65,7 +65,8 @@ export class DataServerPlugin implements Plugin = (context: ISearchContext, caller: APICaller_2, search: ISearchGeneric) => ISearchStrategy; +// Warning: (ae-missing-release-tag) "UI_SETTINGS" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const UI_SETTINGS: { + META_FIELDS: string; + DOC_HIGHLIGHT: string; + QUERY_STRING_OPTIONS: string; + QUERY_ALLOW_LEADING_WILDCARDS: string; + SEARCH_QUERY_LANGUAGE: string; + SORT_OPTIONS: string; + COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX: string; + COURIER_SET_REQUEST_PREFERENCE: string; + COURIER_CUSTOM_REQUEST_PREFERENCE: string; + COURIER_MAX_CONCURRENT_SHARD_REQUESTS: string; + COURIER_BATCH_SEARCHES: string; + SEARCH_INCLUDE_FROZEN: string; + HISTOGRAM_BAR_TARGET: string; + HISTOGRAM_MAX_BARS: string; + HISTORY_LIMIT: string; + SHORT_DOTS_ENABLE: string; + FORMAT_DEFAULT_TYPE_MAP: string; + FORMAT_NUMBER_DEFAULT_PATTERN: string; + FORMAT_PERCENT_DEFAULT_PATTERN: string; + FORMAT_BYTES_DEFAULT_PATTERN: string; + FORMAT_CURRENCY_DEFAULT_PATTERN: string; + FORMAT_NUMBER_DEFAULT_LOCALE: string; + TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: string; + TIMEPICKER_QUICK_RANGES: string; + INDEXPATTERN_PLACEHOLDER: string; + FILTERS_PINNED_BY_DEFAULT: string; + FILTERS_EDITOR_SUGGEST_VALUES: string; +}; + // Warnings were encountered during analysis: // @@ -745,12 +778,12 @@ export type TSearchStrategyProvider = (context: ISearc // src/plugins/data/server/index.ts:103:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts // src/plugins/data/server/index.ts:131:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts // src/plugins/data/server/index.ts:131:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:183:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:184:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:185:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:186:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:187:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:190:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:184:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:185:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:186:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:187:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:188:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:191:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts // src/plugins/data/server/plugin.ts:66:14 - (ae-forgotten-export) The symbol "ISearchSetup" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/src/plugins/data/server/ui_settings.ts b/src/plugins/data/server/ui_settings.ts index 5af62be2952011..de978c7968aee5 100644 --- a/src/plugins/data/server/ui_settings.ts +++ b/src/plugins/data/server/ui_settings.ts @@ -19,33 +19,652 @@ import { i18n } from '@kbn/i18n'; import { schema } from '@kbn/config-schema'; - import { UiSettingsParams } from 'kibana/server'; -import { META_FIELDS_SETTING, DOC_HIGHLIGHT_SETTING } from '../common'; +// @ts-ignore untyped module +import numeralLanguages from '@elastic/numeral/languages'; +import { DEFAULT_QUERY_LANGUAGE, UI_SETTINGS } from '../common'; + +const luceneQueryLanguageLabel = i18n.translate('data.advancedSettings.searchQueryLanguageLucene', { + defaultMessage: 'Lucene', +}); + +const queryLanguageSettingName = i18n.translate('data.advancedSettings.searchQueryLanguageTitle', { + defaultMessage: 'Query language', +}); -export const uiSettings: Record = { - [META_FIELDS_SETTING]: { - name: i18n.translate('data.advancedSettings.metaFieldsTitle', { - defaultMessage: 'Meta fields', - }), - value: ['_source', '_id', '_type', '_index', '_score'], - description: i18n.translate('data.advancedSettings.metaFieldsText', { - defaultMessage: - 'Fields that exist outside of _source to merge into our document when displaying it', - }), - schema: schema.arrayOf(schema.string()), - }, - [DOC_HIGHLIGHT_SETTING]: { - name: i18n.translate('data.advancedSettings.docTableHighlightTitle', { - defaultMessage: 'Highlight results', - }), - value: true, - description: i18n.translate('data.advancedSettings.docTableHighlightText', { - defaultMessage: - 'Highlight results in Discover and Saved Searches Dashboard. ' + - 'Highlighting makes requests slow when working on big documents.', - }), - category: ['discover'], - schema: schema.boolean(), - }, +const requestPreferenceOptionLabels = { + sessionId: i18n.translate('data.advancedSettings.courier.requestPreferenceSessionId', { + defaultMessage: 'Session ID', + }), + custom: i18n.translate('data.advancedSettings.courier.requestPreferenceCustom', { + defaultMessage: 'Custom', + }), + none: i18n.translate('data.advancedSettings.courier.requestPreferenceNone', { + defaultMessage: 'None', + }), }; + +// We add the `en` key manually here, since that's not a real numeral locale, but the +// default fallback in case the locale is not found. +const numeralLanguageIds = [ + 'en', + ...numeralLanguages.map((numeralLanguage: any) => { + return numeralLanguage.id; + }), +]; + +export function getUiSettings(): Record> { + return { + [UI_SETTINGS.META_FIELDS]: { + name: i18n.translate('data.advancedSettings.metaFieldsTitle', { + defaultMessage: 'Meta fields', + }), + value: ['_source', '_id', '_type', '_index', '_score'], + description: i18n.translate('data.advancedSettings.metaFieldsText', { + defaultMessage: + 'Fields that exist outside of _source to merge into our document when displaying it', + }), + schema: schema.arrayOf(schema.string()), + }, + [UI_SETTINGS.DOC_HIGHLIGHT]: { + name: i18n.translate('data.advancedSettings.docTableHighlightTitle', { + defaultMessage: 'Highlight results', + }), + value: true, + description: i18n.translate('data.advancedSettings.docTableHighlightText', { + defaultMessage: + 'Highlight results in Discover and Saved Searches Dashboard. ' + + 'Highlighting makes requests slow when working on big documents.', + }), + category: ['discover'], + schema: schema.boolean(), + }, + [UI_SETTINGS.QUERY_STRING_OPTIONS]: { + name: i18n.translate('data.advancedSettings.query.queryStringOptionsTitle', { + defaultMessage: 'Query string options', + }), + value: '{ "analyze_wildcard": true }', + description: i18n.translate('data.advancedSettings.query.queryStringOptionsText', { + defaultMessage: + '{optionsLink} for the lucene query string parser. Is only used when "{queryLanguage}" is set ' + + 'to {luceneLanguage}.', + description: + 'Part of composite text: data.advancedSettings.query.queryStringOptions.optionsLinkText + ' + + 'data.advancedSettings.query.queryStringOptionsText', + values: { + optionsLink: + '' + + i18n.translate('data.advancedSettings.query.queryStringOptions.optionsLinkText', { + defaultMessage: 'Options', + }) + + '', + luceneLanguage: luceneQueryLanguageLabel, + queryLanguage: queryLanguageSettingName, + }, + }), + type: 'json', + schema: schema.object({ + analyze_wildcard: schema.boolean(), + }), + }, + [UI_SETTINGS.QUERY_ALLOW_LEADING_WILDCARDS]: { + name: i18n.translate('data.advancedSettings.query.allowWildcardsTitle', { + defaultMessage: 'Allow leading wildcards in query', + }), + value: true, + description: i18n.translate('data.advancedSettings.query.allowWildcardsText', { + defaultMessage: + 'When set, * is allowed as the first character in a query clause. ' + + 'Currently only applies when experimental query features are enabled in the query bar. ' + + 'To disallow leading wildcards in basic lucene queries, use {queryStringOptionsPattern}.', + values: { + queryStringOptionsPattern: UI_SETTINGS.QUERY_STRING_OPTIONS, + }, + }), + schema: schema.boolean(), + }, + [UI_SETTINGS.SEARCH_QUERY_LANGUAGE]: { + name: queryLanguageSettingName, + value: DEFAULT_QUERY_LANGUAGE, + description: i18n.translate('data.advancedSettings.searchQueryLanguageText', { + defaultMessage: + 'Query language used by the query bar. KQL is a new language built specifically for Kibana.', + }), + type: 'select', + options: ['lucene', 'kuery'], + optionLabels: { + lucene: luceneQueryLanguageLabel, + kuery: i18n.translate('data.advancedSettings.searchQueryLanguageKql', { + defaultMessage: 'KQL', + }), + }, + schema: schema.string(), + }, + [UI_SETTINGS.SORT_OPTIONS]: { + name: i18n.translate('data.advancedSettings.sortOptionsTitle', { + defaultMessage: 'Sort options', + }), + value: '{ "unmapped_type": "boolean" }', + description: i18n.translate('data.advancedSettings.sortOptionsText', { + defaultMessage: '{optionsLink} for the Elasticsearch sort parameter', + description: + 'Part of composite text: data.advancedSettings.sortOptions.optionsLinkText + ' + + 'data.advancedSettings.sortOptionsText', + values: { + optionsLink: + '' + + i18n.translate('data.advancedSettings.sortOptions.optionsLinkText', { + defaultMessage: 'Options', + }) + + '', + }, + }), + type: 'json', + schema: schema.object({ + unmapped_type: schema.string(), + }), + }, + defaultIndex: { + name: i18n.translate('data.advancedSettings.defaultIndexTitle', { + defaultMessage: 'Default index', + }), + value: null, + type: 'string', + description: i18n.translate('data.advancedSettings.defaultIndexText', { + defaultMessage: 'The index to access if no index is set', + }), + schema: schema.nullable(schema.string()), + }, + [UI_SETTINGS.COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX]: { + name: i18n.translate('data.advancedSettings.courier.ignoreFilterTitle', { + defaultMessage: 'Ignore filter(s)', + }), + value: false, + description: i18n.translate('data.advancedSettings.courier.ignoreFilterText', { + defaultMessage: + 'This configuration enhances support for dashboards containing visualizations accessing dissimilar indexes. ' + + 'When disabled, all filters are applied to all visualizations. ' + + 'When enabled, filter(s) will be ignored for a visualization ' + + `when the visualization's index does not contain the filtering field.`, + }), + category: ['search'], + schema: schema.boolean(), + }, + [UI_SETTINGS.COURIER_SET_REQUEST_PREFERENCE]: { + name: i18n.translate('data.advancedSettings.courier.requestPreferenceTitle', { + defaultMessage: 'Request preference', + }), + value: 'sessionId', + options: ['sessionId', 'custom', 'none'], + optionLabels: requestPreferenceOptionLabels, + type: 'select', + description: i18n.translate('data.advancedSettings.courier.requestPreferenceText', { + defaultMessage: `Allows you to set which shards handle your search requests. +
    +
  • {sessionId}: restricts operations to execute all search requests on the same shards. + This has the benefit of reusing shard caches across requests.
  • +
  • {custom}: allows you to define a your own preference. + Use 'courier:customRequestPreference' to customize your preference value.
  • +
  • {none}: means do not set a preference. + This might provide better performance because requests can be spread across all shard copies. + However, results might be inconsistent because different shards might be in different refresh states.
  • +
`, + values: { + sessionId: requestPreferenceOptionLabels.sessionId, + custom: requestPreferenceOptionLabels.custom, + none: requestPreferenceOptionLabels.none, + }, + }), + category: ['search'], + schema: schema.string(), + }, + [UI_SETTINGS.COURIER_CUSTOM_REQUEST_PREFERENCE]: { + name: i18n.translate('data.advancedSettings.courier.customRequestPreferenceTitle', { + defaultMessage: 'Custom request preference', + }), + value: '_local', + type: 'string', + description: i18n.translate('data.advancedSettings.courier.customRequestPreferenceText', { + defaultMessage: + '{requestPreferenceLink} used when {setRequestReferenceSetting} is set to {customSettingValue}.', + description: + 'Part of composite text: data.advancedSettings.courier.customRequestPreference.requestPreferenceLinkText + ' + + 'data.advancedSettings.courier.customRequestPreferenceText', + values: { + setRequestReferenceSetting: `${UI_SETTINGS.COURIER_SET_REQUEST_PREFERENCE}`, + customSettingValue: '"custom"', + requestPreferenceLink: + '' + + i18n.translate( + 'data.advancedSettings.courier.customRequestPreference.requestPreferenceLinkText', + { + defaultMessage: 'Request Preference', + } + ) + + '', + }, + }), + category: ['search'], + schema: schema.string(), + }, + [UI_SETTINGS.COURIER_MAX_CONCURRENT_SHARD_REQUESTS]: { + name: i18n.translate('data.advancedSettings.courier.maxRequestsTitle', { + defaultMessage: 'Max Concurrent Shard Requests', + }), + value: 0, + type: 'number', + description: i18n.translate('data.advancedSettings.courier.maxRequestsText', { + defaultMessage: + '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: `max_concurrent_shard_requests`, + }, + }), + category: ['search'], + schema: schema.number(), + }, + [UI_SETTINGS.COURIER_BATCH_SEARCHES]: { + name: i18n.translate('data.advancedSettings.courier.batchSearchesTitle', { + defaultMessage: 'Batch concurrent searches', + }), + value: false, + type: 'boolean', + description: i18n.translate('data.advancedSettings.courier.batchSearchesText', { + defaultMessage: `When disabled, dashboard panels will load individually, and search requests will terminate when users navigate + away or update the query. When enabled, dashboard panels will load together when all of the data is loaded, and + searches will not terminate.`, + }), + deprecation: { + message: i18n.translate('data.advancedSettings.courier.batchSearchesTextDeprecation', { + defaultMessage: 'This setting is deprecated and will be removed in Kibana 8.0.', + }), + docLinksKey: 'kibanaSearchSettings', + }, + category: ['search'], + schema: schema.boolean(), + }, + [UI_SETTINGS.SEARCH_INCLUDE_FROZEN]: { + name: 'Search in frozen indices', + description: `Will include frozen indices in results if enabled. Searching through frozen indices + might increase the search time.`, + value: false, + category: ['search'], + schema: schema.boolean(), + }, + [UI_SETTINGS.HISTOGRAM_BAR_TARGET]: { + name: i18n.translate('data.advancedSettings.histogram.barTargetTitle', { + defaultMessage: 'Target bars', + }), + value: 50, + description: i18n.translate('data.advancedSettings.histogram.barTargetText', { + defaultMessage: + 'Attempt to generate around this many bars when using "auto" interval in date histograms', + }), + schema: schema.number(), + }, + [UI_SETTINGS.HISTOGRAM_MAX_BARS]: { + name: i18n.translate('data.advancedSettings.histogram.maxBarsTitle', { + defaultMessage: 'Maximum bars', + }), + value: 100, + description: i18n.translate('data.advancedSettings.histogram.maxBarsText', { + defaultMessage: + 'Never show more than this many bars in date histograms, scale values if needed', + }), + schema: schema.number(), + }, + [UI_SETTINGS.HISTORY_LIMIT]: { + name: i18n.translate('data.advancedSettings.historyLimitTitle', { + defaultMessage: 'History limit', + }), + value: 10, + description: i18n.translate('data.advancedSettings.historyLimitText', { + defaultMessage: + 'In fields that have history (e.g. query inputs), show this many recent values', + }), + schema: schema.number(), + }, + [UI_SETTINGS.SHORT_DOTS_ENABLE]: { + name: i18n.translate('data.advancedSettings.shortenFieldsTitle', { + defaultMessage: 'Shorten fields', + }), + value: false, + description: i18n.translate('data.advancedSettings.shortenFieldsText', { + defaultMessage: 'Shorten long fields, for example, instead of foo.bar.baz, show f.b.baz', + }), + schema: schema.boolean(), + }, + [UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP]: { + name: i18n.translate('data.advancedSettings.format.defaultTypeMapTitle', { + defaultMessage: 'Field type format name', + }), + value: `{ + "ip": { "id": "ip", "params": {} }, + "date": { "id": "date", "params": {} }, + "date_nanos": { "id": "date_nanos", "params": {}, "es": true }, + "number": { "id": "number", "params": {} }, + "boolean": { "id": "boolean", "params": {} }, + "_source": { "id": "_source", "params": {} }, + "_default_": { "id": "string", "params": {} } +}`, + type: 'json', + description: i18n.translate('data.advancedSettings.format.defaultTypeMapText', { + defaultMessage: + 'Map of the format name to use by default for each field type. ' + + '{defaultFormat} is used if the field type is not mentioned explicitly', + values: { + defaultFormat: '"_default_"', + }, + }), + schema: schema.object({ + ip: schema.object({ + id: schema.string(), + params: schema.object({}), + }), + date: schema.object({ + id: schema.string(), + params: schema.object({}), + }), + date_nanos: schema.object({ + id: schema.string(), + params: schema.object({}), + es: schema.boolean(), + }), + number: schema.object({ + id: schema.string(), + params: schema.object({}), + }), + boolean: schema.object({ + id: schema.string(), + params: schema.object({}), + }), + _source: schema.object({ + id: schema.string(), + params: schema.object({}), + }), + _default_: schema.object({ + id: schema.string(), + params: schema.object({}), + }), + }), + }, + [UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN]: { + name: i18n.translate('data.advancedSettings.format.numberFormatTitle', { + defaultMessage: 'Number format', + }), + value: '0,0.[000]', + type: 'string', + description: i18n.translate('data.advancedSettings.format.numberFormatText', { + defaultMessage: 'Default {numeralFormatLink} for the "number" format', + description: + 'Part of composite text: data.advancedSettings.format.numberFormatText + ' + + 'data.advancedSettings.format.numberFormat.numeralFormatLinkText', + values: { + numeralFormatLink: + '' + + i18n.translate('data.advancedSettings.format.numberFormat.numeralFormatLinkText', { + defaultMessage: 'numeral format', + }) + + '', + }, + }), + schema: schema.string(), + }, + [UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN]: { + name: i18n.translate('data.advancedSettings.format.percentFormatTitle', { + defaultMessage: 'Percent format', + }), + value: '0,0.[000]%', + type: 'string', + description: i18n.translate('data.advancedSettings.format.percentFormatText', { + defaultMessage: 'Default {numeralFormatLink} for the "percent" format', + description: + 'Part of composite text: data.advancedSettings.format.percentFormatText + ' + + 'data.advancedSettings.format.percentFormat.numeralFormatLinkText', + values: { + numeralFormatLink: + '' + + i18n.translate('data.advancedSettings.format.percentFormat.numeralFormatLinkText', { + defaultMessage: 'numeral format', + }) + + '', + }, + }), + schema: schema.string(), + }, + [UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: { + name: i18n.translate('data.advancedSettings.format.bytesFormatTitle', { + defaultMessage: 'Bytes format', + }), + value: '0,0.[0]b', + type: 'string', + description: i18n.translate('data.advancedSettings.format.bytesFormatText', { + defaultMessage: 'Default {numeralFormatLink} for the "bytes" format', + description: + 'Part of composite text: data.advancedSettings.format.bytesFormatText + ' + + 'data.advancedSettings.format.bytesFormat.numeralFormatLinkText', + values: { + numeralFormatLink: + '' + + i18n.translate('data.advancedSettings.format.bytesFormat.numeralFormatLinkText', { + defaultMessage: 'numeral format', + }) + + '', + }, + }), + schema: schema.string(), + }, + [UI_SETTINGS.FORMAT_CURRENCY_DEFAULT_PATTERN]: { + name: i18n.translate('data.advancedSettings.format.currencyFormatTitle', { + defaultMessage: 'Currency format', + }), + value: '($0,0.[00])', + type: 'string', + description: i18n.translate('data.advancedSettings.format.currencyFormatText', { + defaultMessage: 'Default {numeralFormatLink} for the "currency" format', + description: + 'Part of composite text: data.advancedSettings.format.currencyFormatText + ' + + 'data.advancedSettings.format.currencyFormat.numeralFormatLinkText', + values: { + numeralFormatLink: + '' + + i18n.translate('data.advancedSettings.format.currencyFormat.numeralFormatLinkText', { + defaultMessage: 'numeral format', + }) + + '', + }, + }), + schema: schema.string(), + }, + [UI_SETTINGS.FORMAT_NUMBER_DEFAULT_LOCALE]: { + name: i18n.translate('data.advancedSettings.format.formattingLocaleTitle', { + defaultMessage: 'Formatting locale', + }), + value: 'en', + type: 'select', + options: numeralLanguageIds, + optionLabels: Object.fromEntries( + numeralLanguages.map((language: Record) => [language.id, language.name]) + ), + description: i18n.translate('data.advancedSettings.format.formattingLocaleText', { + defaultMessage: `{numeralLanguageLink} locale`, + description: + 'Part of composite text: data.advancedSettings.format.formattingLocale.numeralLanguageLinkText + ' + + 'data.advancedSettings.format.formattingLocaleText', + values: { + numeralLanguageLink: + '' + + i18n.translate( + 'data.advancedSettings.format.formattingLocale.numeralLanguageLinkText', + { + defaultMessage: 'Numeral language', + } + ) + + '', + }, + }), + schema: schema.string(), + }, + [UI_SETTINGS.TIMEPICKER_REFRESH_INTERVAL_DEFAULTS]: { + name: i18n.translate('data.advancedSettings.timepicker.refreshIntervalDefaultsTitle', { + defaultMessage: 'Time filter refresh interval', + }), + value: `{ + "pause": false, + "value": 0 +}`, + type: 'json', + description: i18n.translate('data.advancedSettings.timepicker.refreshIntervalDefaultsText', { + defaultMessage: `The timefilter's default refresh interval`, + }), + requiresPageReload: true, + schema: schema.object({ + pause: schema.boolean(), + value: schema.number(), + }), + }, + [UI_SETTINGS.TIMEPICKER_QUICK_RANGES]: { + name: i18n.translate('data.advancedSettings.timepicker.quickRangesTitle', { + defaultMessage: 'Time filter quick ranges', + }), + value: JSON.stringify( + [ + { + from: 'now/d', + to: 'now/d', + display: i18n.translate('data.advancedSettings.timepicker.today', { + defaultMessage: 'Today', + }), + }, + { + from: 'now/w', + to: 'now/w', + display: i18n.translate('data.advancedSettings.timepicker.thisWeek', { + defaultMessage: 'This week', + }), + }, + { + from: 'now-15m', + to: 'now', + display: i18n.translate('data.advancedSettings.timepicker.last15Minutes', { + defaultMessage: 'Last 15 minutes', + }), + }, + { + from: 'now-30m', + to: 'now', + display: i18n.translate('data.advancedSettings.timepicker.last30Minutes', { + defaultMessage: 'Last 30 minutes', + }), + }, + { + from: 'now-1h', + to: 'now', + display: i18n.translate('data.advancedSettings.timepicker.last1Hour', { + defaultMessage: 'Last 1 hour', + }), + }, + { + from: 'now-24h', + to: 'now', + display: i18n.translate('data.advancedSettings.timepicker.last24Hours', { + defaultMessage: 'Last 24 hours', + }), + }, + { + from: 'now-7d', + to: 'now', + display: i18n.translate('data.advancedSettings.timepicker.last7Days', { + defaultMessage: 'Last 7 days', + }), + }, + { + from: 'now-30d', + to: 'now', + display: i18n.translate('data.advancedSettings.timepicker.last30Days', { + defaultMessage: 'Last 30 days', + }), + }, + { + from: 'now-90d', + to: 'now', + display: i18n.translate('data.advancedSettings.timepicker.last90Days', { + defaultMessage: 'Last 90 days', + }), + }, + { + from: 'now-1y', + to: 'now', + display: i18n.translate('data.advancedSettings.timepicker.last1Year', { + defaultMessage: 'Last 1 year', + }), + }, + ], + null, + 2 + ), + type: 'json', + description: i18n.translate('data.advancedSettings.timepicker.quickRangesText', { + defaultMessage: + 'The list of ranges to show in the Quick section of the time filter. This should be an array of objects, ' + + 'with each object containing "from", "to" (see {acceptedFormatsLink}), and ' + + '"display" (the title to be displayed).', + description: + 'Part of composite text: data.advancedSettings.timepicker.quickRangesText + ' + + 'data.advancedSettings.timepicker.quickRanges.acceptedFormatsLinkText', + values: { + acceptedFormatsLink: + `` + + i18n.translate('data.advancedSettings.timepicker.quickRanges.acceptedFormatsLinkText', { + defaultMessage: 'accepted formats', + }) + + '', + }, + }), + schema: schema.arrayOf( + schema.object({ + from: schema.string(), + to: schema.string(), + display: schema.string(), + }) + ), + }, + [UI_SETTINGS.INDEXPATTERN_PLACEHOLDER]: { + name: i18n.translate('data.advancedSettings.indexPatternPlaceholderTitle', { + defaultMessage: 'Index pattern placeholder', + }), + value: '', + description: i18n.translate('data.advancedSettings.indexPatternPlaceholderText', { + defaultMessage: + 'The placeholder for the "Index pattern name" field in "Management > Index Patterns > Create Index Pattern".', + }), + schema: schema.string(), + }, + [UI_SETTINGS.FILTERS_PINNED_BY_DEFAULT]: { + name: i18n.translate('data.advancedSettings.pinFiltersTitle', { + defaultMessage: 'Pin filters by default', + }), + value: false, + description: i18n.translate('data.advancedSettings.pinFiltersText', { + defaultMessage: 'Whether the filters should have a global state (be pinned) by default', + }), + schema: schema.boolean(), + }, + [UI_SETTINGS.FILTERS_EDITOR_SUGGEST_VALUES]: { + name: i18n.translate('data.advancedSettings.suggestFilterValuesTitle', { + defaultMessage: 'Filter editor suggest values', + description: '"Filter editor" refers to the UI you create filters in.', + }), + value: true, + description: i18n.translate('data.advancedSettings.suggestFilterValuesText', { + defaultMessage: + 'Set this property to false to prevent the filter editor from suggesting values for fields.', + }), + schema: schema.boolean(), + }, + }; +} diff --git a/src/plugins/discover/public/application/angular/discover.js b/src/plugins/discover/public/application/angular/discover.js index caba094bd0984e..88885b3eb211ba 100644 --- a/src/plugins/discover/public/application/angular/discover.js +++ b/src/plugins/discover/public/application/angular/discover.js @@ -72,6 +72,7 @@ import { syncQueryStateWithUrl, getDefaultQuery, search, + UI_SETTINGS, } from '../../../../data/public'; import { getIndexPatternId } from '../helpers/get_index_pattern_id'; import { addFatalError } from '../../../../kibana_legacy/public'; @@ -592,7 +593,8 @@ function discoverController( const query = $scope.searchSource.getField('query') || getDefaultQuery( - localStorage.get('kibana.userQueryLanguage') || config.get('search:queryLanguage') + localStorage.get('kibana.userQueryLanguage') || + config.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE) ); return { query, diff --git a/src/plugins/discover/public/application/angular/doc_table/components/table_header.ts b/src/plugins/discover/public/application/angular/doc_table/components/table_header.ts index 60dfb69e85e74b..82bfcc8bc42f97 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/table_header.ts +++ b/src/plugins/discover/public/application/angular/doc_table/components/table_header.ts @@ -19,6 +19,7 @@ import { TableHeader } from './table_header/table_header'; import { getServices } from '../../../../kibana_services'; import { SORT_DEFAULT_ORDER_SETTING, DOC_HIDE_TIME_COLUMN_SETTING } from '../../../../../common'; +import { UI_SETTINGS } from '../../../../../../data/public'; export function createTableHeaderDirective(reactDirective: any) { const { uiSettings: config } = getServices(); @@ -38,7 +39,7 @@ export function createTableHeaderDirective(reactDirective: any) { { restrict: 'A' }, { hideTimeColumn: config.get(DOC_HIDE_TIME_COLUMN_SETTING, false), - isShortDots: config.get('shortDots:enable'), + isShortDots: config.get(UI_SETTINGS.SHORT_DOTS_ENABLE), defaultSortOrder: config.get(SORT_DEFAULT_ORDER_SETTING, 'desc'), } ); diff --git a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx index 99a5547ed0760b..5a319d30b2515a 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx @@ -33,6 +33,7 @@ import { IIndexPatternFieldList, IndexPatternField, IndexPattern, + UI_SETTINGS, } from '../../../../../data/public'; import { AppState } from '../../angular/discover_state'; import { getDetails } from './lib/get_details'; @@ -133,7 +134,7 @@ export function DiscoverSidebar({ ); const popularLimit = services.uiSettings.get(FIELDS_LIMIT_SETTING); - const useShortDots = services.uiSettings.get('shortDots:enable'); + const useShortDots = services.uiSettings.get(UI_SETTINGS.SHORT_DOTS_ENABLE); const { selected: selectedFields, diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx index edb96f119385ec..b6205a8731dfa9 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx @@ -21,7 +21,11 @@ import React, { Component } from 'react'; import { EuiPanel, EuiSpacer, EuiCallOut } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { indexPatterns, IndexPatternAttributes } from '../../../../../../../plugins/data/public'; +import { + indexPatterns, + IndexPatternAttributes, + UI_SETTINGS, +} from '../../../../../../../plugins/data/public'; import { MAX_SEARCH_SIZE } from '../../constants'; import { getIndices, @@ -82,7 +86,8 @@ export class StepIndexPattern extends Component fieldWildcardMatcher(filters, uiSettings.get('metaFields')), + (filters: string[]) => fieldWildcardMatcher(filters, uiSettings.get(UI_SETTINGS.META_FIELDS)), [uiSettings] ); diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx index a1b7289efee210..c97f19f59d340d 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_help/test_script.tsx @@ -35,7 +35,12 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { esQuery, IndexPattern, Query } from '../../../../../../../plugins/data/public'; +import { + esQuery, + IndexPattern, + Query, + UI_SETTINGS, +} from '../../../../../../../plugins/data/public'; import { context as contextType } from '../../../../../../kibana_react/public'; import { IndexPatternManagmentContextValue } from '../../../../types'; import { ExecuteScript } from '../../types'; @@ -244,7 +249,7 @@ export class TestScript extends Component { showDatePicker={false} showQueryInput={true} query={{ - language: this.context.services.uiSettings.get('search:queryLanguage'), + language: this.context.services.uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE), query: '', }} onQuerySubmit={this.previewScript} diff --git a/src/plugins/inspector/public/views/data/components/data_table.tsx b/src/plugins/inspector/public/views/data/components/data_table.tsx index 69be069272f79c..0fdf3d9b13e333 100644 --- a/src/plugins/inspector/public/views/data/components/data_table.tsx +++ b/src/plugins/inspector/public/views/data/components/data_table.tsx @@ -37,6 +37,7 @@ import { DataDownloadOptions } from './download_options'; import { DataViewRow, DataViewColumn } from '../types'; import { TabularData } from '../../../../common/adapters/data/types'; import { IUiSettingsClient } from '../../../../../../core/public'; +import { CSV_SEPARATOR_SETTING, CSV_QUOTE_VALUES_SETTING } from '../../../../../share/public'; interface DataTableFormatState { columns: DataViewColumn[]; @@ -58,8 +59,8 @@ export class DataTableFormat extends Component } type="questionInCircle" diff --git a/src/plugins/vis_type_table/public/agg_table/agg_table.js b/src/plugins/vis_type_table/public/agg_table/agg_table.js index f67dcf42adff6c..bd7626a493338e 100644 --- a/src/plugins/vis_type_table/public/agg_table/agg_table.js +++ b/src/plugins/vis_type_table/public/agg_table/agg_table.js @@ -17,6 +17,7 @@ * under the License. */ import _ from 'lodash'; +import { CSV_SEPARATOR_SETTING, CSV_QUOTE_VALUES_SETTING } from '../../../share/public'; import aggTableTemplate from './agg_table.html'; import { getFormatService } from '../services'; import { i18n } from '@kbn/i18n'; @@ -47,8 +48,8 @@ export function KbnAggTable(config, RecursionHelper) { self._saveAs = require('@elastic/filesaver').saveAs; self.csv = { - separator: config.get('csv:separator'), - quoteValues: config.get('csv:quoteValues'), + separator: config.get(CSV_SEPARATOR_SETTING), + quoteValues: config.get(CSV_QUOTE_VALUES_SETTING), }; self.exportAsCsv = function (formatted) { diff --git a/src/plugins/vis_type_timelion/server/series_functions/es/es.test.js b/src/plugins/vis_type_timelion/server/series_functions/es/es.test.js index 1bc979399b1b16..a624ff72ead699 100644 --- a/src/plugins/vis_type_timelion/server/series_functions/es/es.test.js +++ b/src/plugins/vis_type_timelion/server/series_functions/es/es.test.js @@ -30,6 +30,7 @@ import _ from 'lodash'; import { expect } from 'chai'; import sinon from 'sinon'; import invoke from '../helpers/invoke_series_fn.js'; +import { UI_SETTINGS } from '../../../../data/server'; function stubRequestAndServer(response, indexPatternSavedObjects = []) { return { @@ -216,14 +217,14 @@ describe('es', () => { it('sets ignore_throttled=true on the request', () => { config.index = 'beer'; - tlConfig.settings['search:includeFrozen'] = false; + tlConfig.settings[UI_SETTINGS.SEARCH_INCLUDE_FROZEN] = false; const request = fn(config, tlConfig, emptyScriptedFields); expect(request.ignore_throttled).to.equal(true); }); it('sets no timeout if elasticsearch.shardTimeout is set to 0', () => { - tlConfig.settings['search:includeFrozen'] = true; + tlConfig.settings[UI_SETTINGS.SEARCH_INCLUDE_FROZEN] = true; config.index = 'beer'; const request = fn(config, tlConfig, emptyScriptedFields); diff --git a/src/plugins/vis_type_timelion/server/series_functions/es/lib/build_request.js b/src/plugins/vis_type_timelion/server/series_functions/es/lib/build_request.js index 65b28fb833279a..bc0e368fbdab17 100644 --- a/src/plugins/vis_type_timelion/server/series_functions/es/lib/build_request.js +++ b/src/plugins/vis_type_timelion/server/series_functions/es/lib/build_request.js @@ -21,6 +21,7 @@ import _ from 'lodash'; import moment from 'moment'; import { buildAggBody } from './agg_body'; import createDateAgg from './create_date_agg'; +import { UI_SETTINGS } from '../../../../../data/server'; export default function buildRequest(config, tlConfig, scriptedFields, timeout) { const bool = { must: [] }; @@ -78,7 +79,7 @@ export default function buildRequest(config, tlConfig, scriptedFields, timeout) const request = { index: config.index, - ignore_throttled: !tlConfig.settings['search:includeFrozen'], + ignore_throttled: !tlConfig.settings[UI_SETTINGS.SEARCH_INCLUDE_FROZEN], body: { query: { bool: bool, diff --git a/src/plugins/vis_type_timeseries/public/application/components/lib/get_default_query_language.js b/src/plugins/vis_type_timeseries/public/application/components/lib/get_default_query_language.js index 972f937ad109d5..84da28718e3235 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/lib/get_default_query_language.js +++ b/src/plugins/vis_type_timeseries/public/application/components/lib/get_default_query_language.js @@ -18,7 +18,8 @@ */ import { getUISettings } from '../../../services'; +import { UI_SETTINGS } from '../../../../../data/public'; export function getDefaultQueryLanguage() { - return getUISettings().get('search:queryLanguage'); + return getUISettings().get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE); } diff --git a/src/plugins/vis_type_timeseries/public/application/components/lib/tick_formatter.test.js b/src/plugins/vis_type_timeseries/public/application/components/lib/tick_formatter.test.js index 71e82770bfa03e..308579126eeb1d 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/lib/tick_formatter.test.js +++ b/src/plugins/vis_type_timeseries/public/application/components/lib/tick_formatter.test.js @@ -20,6 +20,7 @@ import { createTickFormatter } from './tick_formatter'; import { getFieldFormatsRegistry } from '../../../../../../test_utils/public/stub_field_formats'; import { setFieldFormats } from '../../../services'; +import { UI_SETTINGS } from '../../../../../data/public'; const mockUiSettings = { get: (item) => { @@ -28,11 +29,11 @@ const mockUiSettings = { getUpdate$: () => ({ subscribe: jest.fn(), }), - 'query:allowLeadingWildcards': true, - 'query:queryString:options': {}, - 'courier:ignoreFilterIfFieldNotInIndex': true, + [UI_SETTINGS.QUERY_ALLOW_LEADING_WILDCARDS]: true, + [UI_SETTINGS.QUERY_STRING_OPTIONS]: {}, + [UI_SETTINGS.COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX]: true, 'dateFormat:tz': 'Browser', - 'format:defaultTypeMap': {}, + [UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP]: {}, }; const mockCore = { @@ -55,7 +56,7 @@ describe('createTickFormatter(format, template)', () => { test('returns a percent with percent formatter', () => { const config = { - 'format:percent:defaultPattern': '0.[00]%', + [UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN]: '0.[00]%', }; const fn = createTickFormatter('percent', null, (key) => config[key]); expect(fn(0.5556)).toEqual('55.56%'); @@ -63,7 +64,7 @@ describe('createTickFormatter(format, template)', () => { test('returns a byte formatted string with byte formatter', () => { const config = { - 'format:bytes:defaultPattern': '0.0b', + [UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0.0b', }; const fn = createTickFormatter('bytes', null, (key) => config[key]); expect(fn(1500 ^ 10)).toEqual('1.5KB'); @@ -76,7 +77,7 @@ describe('createTickFormatter(format, template)', () => { test('returns a located string with custom locale setting', () => { const config = { - 'format:number:defaultLocale': 'fr', + [UI_SETTINGS.FORMAT_NUMBER_DEFAULT_LOCALE]: 'fr', }; const fn = createTickFormatter('0,0.0', null, (key) => config[key]); expect(fn(1500)).toEqual('1 500,0'); @@ -99,7 +100,7 @@ describe('createTickFormatter(format, template)', () => { test('returns formatted value if passed a bad template', () => { const config = { - 'format:number:defaultPattern': '0,0.[00]', + [UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN]: '0,0.[00]', }; const fn = createTickFormatter('number', '{{value', (key) => config[key]); expect(fn(1.5556)).toEqual('1.56'); diff --git a/src/plugins/vis_type_timeseries/public/application/components/vis_editor.js b/src/plugins/vis_type_timeseries/public/application/components/vis_editor.js index 0c53ddd3f0ba82..a96890d4d15029 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/vis_editor.js +++ b/src/plugins/vis_type_timeseries/public/application/components/vis_editor.js @@ -29,7 +29,7 @@ import { PanelConfig } from './panel_config'; import { createBrushHandler } from '../lib/create_brush_handler'; import { fetchFields } from '../lib/fetch_fields'; import { extractIndexPatterns } from '../../../../../plugins/vis_type_timeseries/common/extract_index_patterns'; -import { esKuery } from '../../../../../plugins/data/public'; +import { esKuery, UI_SETTINGS } from '../../../../../plugins/data/public'; import { getSavedObjectsClient, getUISettings, getDataStart, getCoreStart } from '../../services'; import { CoreStartContextProvider } from '../contexts/query_input_bar_context'; @@ -89,7 +89,9 @@ export class VisEditor extends Component { isValidKueryQuery = (filterQuery) => { if (filterQuery && filterQuery.language === 'kuery') { try { - const queryOptions = this.coreContext.uiSettings.get('query:allowLeadingWildcards'); + const queryOptions = this.coreContext.uiSettings.get( + UI_SETTINGS.QUERY_ALLOW_LEADING_WILDCARDS + ); esKuery.fromKueryExpression(filterQuery.query, { allowLeadingWildcards: queryOptions }); } catch (error) { return false; diff --git a/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/multi_search_request.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/multi_search_request.js index 93a4eaba4ad9ec..9ada39e3595890 100644 --- a/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/multi_search_request.js +++ b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/multi_search_request.js @@ -17,12 +17,15 @@ * under the License. */ import { AbstractSearchRequest } from './abstract_request'; +import { UI_SETTINGS } from '../../../../../data/server'; const SEARCH_METHOD = 'msearch'; export class MultiSearchRequest extends AbstractSearchRequest { async search(searches) { - const includeFrozen = await this.req.getUiSettingsService().get('search:includeFrozen'); + const includeFrozen = await this.req + .getUiSettingsService() + .get(UI_SETTINGS.SEARCH_INCLUDE_FROZEN); const multiSearchBody = searches.reduce( (acc, { body, index }) => [ ...acc, diff --git a/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/multi_search_request.test.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/multi_search_request.test.js index 1e28965a35793f..c113db76332b76 100644 --- a/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/multi_search_request.test.js +++ b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/multi_search_request.test.js @@ -17,6 +17,7 @@ * under the License. */ import { MultiSearchRequest } from './multi_search_request'; +import { UI_SETTINGS } from '../../../../../data/server'; describe('MultiSearchRequest', () => { let searchRequest; @@ -51,7 +52,7 @@ describe('MultiSearchRequest', () => { expect(responses).toEqual([]); expect(req.getUiSettingsService).toHaveBeenCalled(); - expect(getServiceMock).toHaveBeenCalledWith('search:includeFrozen'); + expect(getServiceMock).toHaveBeenCalledWith(UI_SETTINGS.SEARCH_INCLUDE_FROZEN); expect(callWithRequest).toHaveBeenCalledWith(req, 'msearch', { body: [ { ignoreUnavailable: true, index: 'index' }, diff --git a/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/single_search_request.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/single_search_request.js index 110deb6a9bc1b6..7d8b60a7e45957 100644 --- a/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/single_search_request.js +++ b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/single_search_request.js @@ -17,12 +17,15 @@ * under the License. */ import { AbstractSearchRequest } from './abstract_request'; +import { UI_SETTINGS } from '../../../../../data/server'; const SEARCH_METHOD = 'search'; export class SingleSearchRequest extends AbstractSearchRequest { async search([{ body, index }]) { - const includeFrozen = await this.req.getUiSettingsService().get('search:includeFrozen'); + const includeFrozen = await this.req + .getUiSettingsService() + .get(UI_SETTINGS.SEARCH_INCLUDE_FROZEN); const resp = await this.callWithRequest(this.req, SEARCH_METHOD, { ignore_throttled: !includeFrozen, body, diff --git a/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/single_search_request.test.js b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/single_search_request.test.js index 043bd52d87aad5..b899814f2fe133 100644 --- a/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/single_search_request.test.js +++ b/src/plugins/vis_type_timeseries/server/lib/search_strategies/search_requests/single_search_request.test.js @@ -17,6 +17,7 @@ * under the License. */ import { SingleSearchRequest } from './single_search_request'; +import { UI_SETTINGS } from '../../../../../data/server'; describe('SingleSearchRequest', () => { let searchRequest; @@ -48,7 +49,7 @@ describe('SingleSearchRequest', () => { expect(responses).toEqual([{}]); expect(req.getUiSettingsService).toHaveBeenCalled(); - expect(getServiceMock).toHaveBeenCalledWith('search:includeFrozen'); + expect(getServiceMock).toHaveBeenCalledWith(UI_SETTINGS.SEARCH_INCLUDE_FROZEN); expect(callWithRequest).toHaveBeenCalledWith(req, 'search', { body: 'body', index: 'index', diff --git a/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_query_uisettings.js b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_query_uisettings.js index 42b8681f142e05..b427e5f12cadc9 100644 --- a/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_query_uisettings.js +++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_query_uisettings.js @@ -17,12 +17,14 @@ * under the License. */ +import { UI_SETTINGS } from '../../../../../data/server'; + export async function getEsQueryConfig(req) { const uiSettings = req.getUiSettingsService(); - const allowLeadingWildcards = await uiSettings.get('query:allowLeadingWildcards'); - const queryStringOptions = await uiSettings.get('query:queryString:options'); + const allowLeadingWildcards = await uiSettings.get(UI_SETTINGS.QUERY_ALLOW_LEADING_WILDCARDS); + const queryStringOptions = await uiSettings.get(UI_SETTINGS.QUERY_STRING_OPTIONS); const ignoreFilterIfFieldNotInIndex = await uiSettings.get( - 'courier:ignoreFilterIfFieldNotInIndex' + UI_SETTINGS.COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX ); return { allowLeadingWildcards, diff --git a/src/plugins/visualizations/common/constants.ts b/src/plugins/visualizations/common/constants.ts new file mode 100644 index 00000000000000..9129f060c5eef4 --- /dev/null +++ b/src/plugins/visualizations/common/constants.ts @@ -0,0 +1,20 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export const VISUALIZE_ENABLE_LABS_SETTING = 'visualize:enableLabs'; diff --git a/src/plugins/visualizations/public/embeddable/create_vis_embeddable_from_object.ts b/src/plugins/visualizations/public/embeddable/create_vis_embeddable_from_object.ts index 81794c31527adb..45c750de05ae17 100644 --- a/src/plugins/visualizations/public/embeddable/create_vis_embeddable_from_object.ts +++ b/src/plugins/visualizations/public/embeddable/create_vis_embeddable_from_object.ts @@ -29,6 +29,7 @@ import { getCapabilities, } from '../services'; import { VisualizeEmbeddableFactoryDeps } from './visualize_embeddable_factory'; +import { VISUALIZE_ENABLE_LABS_SETTING } from '../../common/constants'; export const createVisEmbeddableFromObject = (deps: VisualizeEmbeddableFactoryDeps) => async ( vis: Vis, @@ -44,7 +45,7 @@ export const createVisEmbeddableFromObject = (deps: VisualizeEmbeddableFactoryDe const editUrl = visId ? getHttp().basePath.prepend(`/app/visualize${savedVisualizations.urlFor(visId)}`) : ''; - const isLabsEnabled = getUISettings().get('visualize:enableLabs'); + const isLabsEnabled = getUISettings().get(VISUALIZE_ENABLE_LABS_SETTING); if (!isLabsEnabled && vis.type.stage === 'experimental') { return new DisabledLabEmbeddable(vis.title, input); diff --git a/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx b/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx index c4aa4c262edb06..c4267c9a36f784 100644 --- a/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx +++ b/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx @@ -43,6 +43,7 @@ import { convertToSerializedVis } from '../saved_visualizations/_saved_vis'; import { createVisEmbeddableFromObject } from './create_vis_embeddable_from_object'; import { StartServicesGetter } from '../../../kibana_utils/public'; import { VisualizationsStartDeps } from '../plugin'; +import { VISUALIZE_ENABLE_LABS_SETTING } from '../../common/constants'; interface VisualizationAttributes extends SavedObjectAttributes { visState: string; @@ -82,7 +83,7 @@ export class VisualizeEmbeddableFactory if (!visType) { return false; } - if (getUISettings().get('visualize:enableLabs')) { + if (getUISettings().get(VISUALIZE_ENABLE_LABS_SETTING)) { return true; } return visType.stage !== 'experimental'; diff --git a/src/plugins/visualizations/public/index.ts b/src/plugins/visualizations/public/index.ts index e475684ed5934d..0bbf862216ed5b 100644 --- a/src/plugins/visualizations/public/index.ts +++ b/src/plugins/visualizations/public/index.ts @@ -17,8 +17,6 @@ * under the License. */ -import './index.scss'; - import { PublicContract } from '@kbn/utility-types'; import { PluginInitializerContext } from 'src/core/public'; import { VisualizationsPlugin, VisualizationsSetup, VisualizationsStart } from './plugin'; @@ -53,3 +51,4 @@ export { VisSavedObject, VisResponseValue, } from './types'; +export { VISUALIZE_ENABLE_LABS_SETTING } from '../common/constants'; diff --git a/src/plugins/visualizations/public/plugin.ts b/src/plugins/visualizations/public/plugin.ts index ef64eccfea31f2..04ce5a1a07c754 100644 --- a/src/plugins/visualizations/public/plugin.ts +++ b/src/plugins/visualizations/public/plugin.ts @@ -17,6 +17,8 @@ * under the License. */ +import './index.scss'; + import { PluginInitializerContext, CoreSetup, diff --git a/src/plugins/visualizations/public/wizard/new_vis_modal.tsx b/src/plugins/visualizations/public/wizard/new_vis_modal.tsx index cea92b1db93aad..1a970e505b7c71 100644 --- a/src/plugins/visualizations/public/wizard/new_vis_modal.tsx +++ b/src/plugins/visualizations/public/wizard/new_vis_modal.tsx @@ -29,6 +29,7 @@ import { TypeSelection } from './type_selection'; import { TypesStart, VisType, VisTypeAlias } from '../vis_types'; import { UsageCollectionSetup } from '../../../../plugins/usage_collection/public'; import { EMBEDDABLE_ORIGINATING_APP_PARAM } from '../../../embeddable/public'; +import { VISUALIZE_ENABLE_LABS_SETTING } from '../../common/constants'; interface TypeSelectionProps { isOpen: boolean; @@ -65,7 +66,7 @@ class NewVisModal extends React.Component { - const isLabsEnabled = uiSettings.get('visualize:enableLabs'); + const isLabsEnabled = uiSettings.get(VISUALIZE_ENABLE_LABS_SETTING); return savedVisualizations .findListItems(filter, savedObjectsPublic.settings.getListingLimit()) .then((result) => { diff --git a/test/functional/apps/dashboard/create_and_add_embeddables.js b/test/functional/apps/dashboard/create_and_add_embeddables.js index ba715f3472b98d..f5c2496a9a5aaf 100644 --- a/test/functional/apps/dashboard/create_and_add_embeddables.js +++ b/test/functional/apps/dashboard/create_and_add_embeddables.js @@ -20,6 +20,7 @@ import expect from '@kbn/expect'; import { VisualizeConstants } from '../../../../src/plugins/visualize/public/application/visualize_constants'; +import { VISUALIZE_ENABLE_LABS_SETTING } from '../../../../src/plugins/visualizations/common/constants'; export default function ({ getService, getPageObjects }) { const retry = getService('retry'); @@ -102,7 +103,7 @@ export default function ({ getService, getPageObjects }) { before(async () => { await PageObjects.header.clickStackManagement(); await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.toggleAdvancedSettingCheckbox('visualize:enableLabs'); + await PageObjects.settings.toggleAdvancedSettingCheckbox(VISUALIZE_ENABLE_LABS_SETTING); }); it('should not display lab visualizations in add panel', async () => { @@ -117,7 +118,7 @@ export default function ({ getService, getPageObjects }) { after(async () => { await PageObjects.header.clickStackManagement(); await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.clearAdvancedSettings('visualize:enableLabs'); + await PageObjects.settings.clearAdvancedSettings(VISUALIZE_ENABLE_LABS_SETTING); await PageObjects.header.clickDashboard(); }); }); diff --git a/test/functional/apps/visualize/_lab_mode.js b/test/functional/apps/visualize/_lab_mode.js index b356d01cdb63bc..27c149b9e0e0a1 100644 --- a/test/functional/apps/visualize/_lab_mode.js +++ b/test/functional/apps/visualize/_lab_mode.js @@ -18,6 +18,7 @@ */ import expect from '@kbn/expect'; +import { VISUALIZE_ENABLE_LABS_SETTING } from '../../../../src/plugins/visualizations/common/constants'; export default function ({ getService, getPageObjects }) { const log = getService('log'); @@ -37,7 +38,7 @@ export default function ({ getService, getPageObjects }) { // Navigate to advanced setting and disable lab mode await PageObjects.header.clickStackManagement(); await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.toggleAdvancedSettingCheckbox('visualize:enableLabs'); + await PageObjects.settings.toggleAdvancedSettingCheckbox(VISUALIZE_ENABLE_LABS_SETTING); // Expect the discover still to list that saved visualization in the open list await PageObjects.header.clickDiscover(); @@ -51,7 +52,7 @@ export default function ({ getService, getPageObjects }) { await PageObjects.discover.closeLoadSaveSearchPanel(); await PageObjects.header.clickStackManagement(); await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.clearAdvancedSettings('visualize:enableLabs'); + await PageObjects.settings.clearAdvancedSettings(VISUALIZE_ENABLE_LABS_SETTING); }); }); } diff --git a/test/functional/apps/visualize/index.ts b/test/functional/apps/visualize/index.ts index bd427577cd7877..42b82486dc13f7 100644 --- a/test/functional/apps/visualize/index.ts +++ b/test/functional/apps/visualize/index.ts @@ -18,6 +18,7 @@ */ import { FtrProviderContext } from '../../ftr_provider_context.d'; +import { UI_SETTINGS } from '../../../../src/plugins/data/common'; // eslint-disable-next-line @typescript-eslint/no-namespace, import/no-default-export export default function ({ getService, getPageObjects, loadTestFile }: FtrProviderContext) { @@ -37,7 +38,7 @@ export default function ({ getService, getPageObjects, loadTestFile }: FtrProvid await esArchiver.load('visualize'); await kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*', - 'format:bytes:defaultPattern': '0,0.[000]b', + [UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0,0.[000]b', }); isOss = await PageObjects.common.isOss(); }); diff --git a/x-pack/plugins/advanced_ui_actions/public/plugin.ts b/x-pack/plugins/advanced_ui_actions/public/plugin.ts index f042130158aecf..d79996d5ecc1b4 100644 --- a/x-pack/plugins/advanced_ui_actions/public/plugin.ts +++ b/x-pack/plugins/advanced_ui_actions/public/plugin.ts @@ -11,6 +11,7 @@ import { Plugin, } from '../../../../src/core/public'; import { createReactOverlays } from '../../../../src/plugins/kibana_react/public'; +import { UI_SETTINGS } from '../../../../src/plugins/data/public'; import { UiActionsSetup, UiActionsStart } from '../../../../src/plugins/ui_actions/public'; import { CONTEXT_MENU_TRIGGER, @@ -72,7 +73,9 @@ export class AdvancedUiActionsPublicPlugin public start(core: CoreStart, { uiActions }: StartDependencies): StartContract { const dateFormat = core.uiSettings.get('dateFormat') as string; - const commonlyUsedRanges = core.uiSettings.get('timepicker:quickRanges') as CommonlyUsedRange[]; + const commonlyUsedRanges = core.uiSettings.get( + UI_SETTINGS.TIMEPICKER_QUICK_RANGES + ) as CommonlyUsedRange[]; const { openModal } = createReactOverlays(core); const timeRangeAction = new CustomTimeRangeAction({ openModal, diff --git a/x-pack/plugins/apm/server/lib/helpers/es_client.ts b/x-pack/plugins/apm/server/lib/helpers/es_client.ts index c7a17197ca7787..892f8f0ddd1051 100644 --- a/x-pack/plugins/apm/server/lib/helpers/es_client.ts +++ b/x-pack/plugins/apm/server/lib/helpers/es_client.ts @@ -19,6 +19,7 @@ import { ESSearchRequest, ESSearchResponse, } from '../../../typings/elasticsearch'; +import { UI_SETTINGS } from '../../../../../../src/plugins/data/server'; import { OBSERVER_VERSION_MAJOR } from '../../../common/elasticsearch_fieldnames'; import { pickKeys } from '../../../common/utils/pick_keys'; import { APMRequestHandlerContext } from '../../routes/typings'; @@ -95,7 +96,7 @@ async function getParamsForSearchRequest( savedObjectsClient: context.core.savedObjects.client, config: context.config, }), - uiSettings.client.get('search:includeFrozen'), + uiSettings.client.get(UI_SETTINGS.SEARCH_INCLUDE_FROZEN), ]); // Get indices for legacy data filter (only those which apply) diff --git a/x-pack/plugins/canvas/canvas_plugin_src/elements/metric/index.ts b/x-pack/plugins/canvas/canvas_plugin_src/elements/metric/index.ts index 7256657903aab0..14409ae166a840 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/elements/metric/index.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/elements/metric/index.ts @@ -7,6 +7,7 @@ import { openSans } from '../../../common/lib/fonts'; import { ElementFactory } from '../../../types'; import { SetupInitializer } from '../../plugin'; +import { UI_SETTINGS } from '../../../../../../src/plugins/data/public'; export const metricElementInitializer: SetupInitializer = (core, setup) => { return () => ({ @@ -23,7 +24,7 @@ export const metricElementInitializer: SetupInitializer = (core, | metric "Countries" metricFont={font size=48 family="${openSans.value}" color="#000000" align="center" lHeight=48} labelFont={font size=14 family="${openSans.value}" color="#000000" align="center"} - metricFormat="${core.uiSettings.get('format:number:defaultPattern')}" + metricFormat="${core.uiSettings.get(UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN)}" | render`, }); }; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/time_filter/index.tsx b/x-pack/plugins/canvas/canvas_plugin_src/renderers/time_filter/index.tsx index ef5bfb70d4b3db..25278adcf45297 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/time_filter/index.tsx +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/time_filter/index.tsx @@ -7,6 +7,7 @@ import ReactDOM from 'react-dom'; import React from 'react'; import { toExpression } from '@kbn/interpreter/common'; +import { UI_SETTINGS } from '../../../../../../src/plugins/data/public'; import { syncFilterExpression } from '../../../public/lib/sync_filter_expression'; import { RendererStrings } from '../../../i18n'; import { TimeFilter } from './components'; @@ -20,7 +21,7 @@ const { timeFilter: strings } = RendererStrings; export const timeFilterFactory: StartInitializer> = (core, plugins) => { const { uiSettings } = core; - const customQuickRanges = (uiSettings.get('timepicker:quickRanges') || []).map( + const customQuickRanges = (uiSettings.get(UI_SETTINGS.TIMEPICKER_QUICK_RANGES) || []).map( ({ from, to, display }: { from: string; to: string; display: string }) => ({ start: from, end: to, diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/number_format/index.ts b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/number_format/index.ts index 4025d4deaf997f..5a3e3904f4f234 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/number_format/index.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/number_format/index.ts @@ -11,6 +11,7 @@ import { templateFromReactComponent } from '../../../../public/lib/template_from import { ArgumentFactory } from '../../../../types/arguments'; import { ArgumentStrings } from '../../../../i18n'; import { SetupInitializer } from '../../../plugin'; +import { UI_SETTINGS } from '../../../../../../../src/plugins/data/public'; const { NumberFormat: strings } = ArgumentStrings; @@ -19,11 +20,11 @@ export const numberFormatInitializer: SetupInitializer { const formatMap = { - NUMBER: core.uiSettings.get('format:number:defaultPattern'), - PERCENT: core.uiSettings.get('format:percent:defaultPattern'), - CURRENCY: core.uiSettings.get('format:currency:defaultPattern'), + NUMBER: core.uiSettings.get(UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN), + PERCENT: core.uiSettings.get(UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN), + CURRENCY: core.uiSettings.get(UI_SETTINGS.FORMAT_CURRENCY_DEFAULT_PATTERN), DURATION: '00:00:00', - BYTES: core.uiSettings.get('format:bytes:defaultPattern'), + BYTES: core.uiSettings.get(UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN), }; const numberFormats = [ diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/views/metric.ts b/x-pack/plugins/canvas/canvas_plugin_src/uis/views/metric.ts index 93912b7b0517f5..11bee46088576e 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/uis/views/metric.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/views/metric.ts @@ -7,6 +7,7 @@ import { openSans } from '../../../common/lib/fonts'; import { ViewStrings } from '../../../i18n'; import { SetupInitializer } from '../../plugin'; +import { UI_SETTINGS } from '../../../../../../src/plugins/data/public'; const { Metric: strings } = ViewStrings; @@ -22,7 +23,7 @@ export const metricInitializer: SetupInitializer = (core, plugin) => { displayName: strings.getMetricFormatDisplayName(), help: strings.getMetricFormatHelp(), argType: 'numberFormat', - default: `"${core.uiSettings.get('format:number:defaultPattern')}"`, + default: `"${core.uiSettings.get(UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN)}"`, }, { name: '_', diff --git a/x-pack/plugins/data_enhanced/public/search/es_search_strategy.ts b/x-pack/plugins/data_enhanced/public/search/es_search_strategy.ts index c493e8ce86781b..3a511c7b5a1767 100644 --- a/x-pack/plugins/data_enhanced/public/search/es_search_strategy.ts +++ b/x-pack/plugins/data_enhanced/public/search/es_search_strategy.ts @@ -11,6 +11,7 @@ import { ISearchContext, ISearch, getEsPreference, + UI_SETTINGS, } from '../../../../../src/plugins/data/public'; import { IEnhancedEsSearchRequest, EnhancedSearchParams } from '../../common'; import { ASYNC_SEARCH_STRATEGY } from './async_search_strategy'; @@ -27,7 +28,7 @@ export const enhancedEsSearchStrategyProvider: TSearchStrategyProvider { const params: EnhancedSearchParams = { - ignoreThrottled: !context.core.uiSettings.get('search:includeFrozen'), + ignoreThrottled: !context.core.uiSettings.get(UI_SETTINGS.SEARCH_INCLUDE_FROZEN), preference: getEsPreference(context.core.uiSettings), ...request.params, }; diff --git a/x-pack/plugins/graph/server/routes/search.ts b/x-pack/plugins/graph/server/routes/search.ts index ffca273d66c71a..645e6b520013fd 100644 --- a/x-pack/plugins/graph/server/routes/search.ts +++ b/x-pack/plugins/graph/server/routes/search.ts @@ -7,6 +7,7 @@ import { IRouter } from 'kibana/server'; import { schema } from '@kbn/config-schema'; import { LicenseState, verifyApiAccess } from '../lib/license_state'; +import { UI_SETTINGS } from '../../../../../src/plugins/data/server'; export function registerSearchRoute({ router, @@ -41,7 +42,7 @@ export function registerSearchRoute({ response ) => { verifyApiAccess(licenseState); - const includeFrozen = await uiSettings.get('search:includeFrozen'); + const includeFrozen = await uiSettings.get(UI_SETTINGS.SEARCH_INCLUDE_FROZEN); try { return response.ok({ body: { diff --git a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/time_controls.tsx b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/time_controls.tsx index ef6486eac0fdb1..afee0c0498187f 100644 --- a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/time_controls.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/time_controls.tsx @@ -6,6 +6,7 @@ import { EuiSuperDatePicker, OnRefreshChangeProps, OnTimeChangeProps } from '@elastic/eui'; import React, { useCallback } from 'react'; +import { UI_SETTINGS } from '../../../../../../../../src/plugins/data/public'; import { euiStyled } from '../../../../../../observability/public'; import { MetricsTimeInput } from '../hooks/use_metrics_time'; import { useKibanaUiSetting } from '../../../../utils/use_kibana_ui_setting'; @@ -22,7 +23,7 @@ interface MetricsTimeControlsProps { } export const MetricsTimeControls = (props: MetricsTimeControlsProps) => { - const [timepickerQuickRanges] = useKibanaUiSetting('timepicker:quickRanges'); + const [timepickerQuickRanges] = useKibanaUiSetting(UI_SETTINGS.TIMEPICKER_QUICK_RANGES); const { onChangeTimeRange, onRefresh, diff --git a/x-pack/plugins/infra/public/pages/metrics/metrics_explorer/components/toolbar.tsx b/x-pack/plugins/infra/public/pages/metrics/metrics_explorer/components/toolbar.tsx index 7ad1d943a98969..1471efbd21e18a 100644 --- a/x-pack/plugins/infra/public/pages/metrics/metrics_explorer/components/toolbar.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/metrics_explorer/components/toolbar.tsx @@ -7,7 +7,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiSuperDatePicker, EuiText } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; -import { IIndexPattern } from 'src/plugins/data/public'; +import { IIndexPattern, UI_SETTINGS } from '../../../../../../../../src/plugins/data/public'; import { MetricsExplorerMetric, MetricsExplorerAggregation, @@ -61,7 +61,7 @@ export const MetricsExplorerToolbar = ({ onViewStateChange, }: Props) => { const isDefaultOptions = options.aggregation === 'avg' && options.metrics.length === 0; - const [timepickerQuickRanges] = useKibanaUiSetting('timepicker:quickRanges'); + const [timepickerQuickRanges] = useKibanaUiSetting(UI_SETTINGS.TIMEPICKER_QUICK_RANGES); const commonlyUsedRanges = mapKibanaQuickRangesToDatePickerRanges(timepickerQuickRanges); return ( diff --git a/x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts b/x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts index 7c0c535795638f..79c276a1e58f7e 100644 --- a/x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts +++ b/x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts @@ -32,7 +32,7 @@ import { } from '../../../../../../../src/core/server'; import { RequestHandler } from '../../../../../../../src/core/server'; import { InfraConfig } from '../../../plugin'; -import { IndexPatternsFetcher } from '../../../../../../../src/plugins/data/server'; +import { IndexPatternsFetcher, UI_SETTINGS } from '../../../../../../../src/plugins/data/server'; export class KibanaFramework { public router: IRouter; @@ -197,10 +197,10 @@ export class KibanaFramework { ) { const { elasticsearch, uiSettings } = requestContext.core; - const includeFrozen = await uiSettings.client.get('search:includeFrozen'); + const includeFrozen = await uiSettings.client.get(UI_SETTINGS.SEARCH_INCLUDE_FROZEN); if (endpoint === 'msearch') { const maxConcurrentShardRequests = await uiSettings.client.get( - 'courier:maxConcurrentShardRequests' + UI_SETTINGS.COURIER_MAX_CONCURRENT_SHARD_REQUESTS ); if (maxConcurrentShardRequests > 0) { params = { ...params, max_concurrent_shard_requests: maxConcurrentShardRequests }; diff --git a/x-pack/plugins/lens/public/app_plugin/app.test.tsx b/x-pack/plugins/lens/public/app_plugin/app.test.tsx index f1a2edd2d554f7..33f4f46681a283 100644 --- a/x-pack/plugins/lens/public/app_plugin/app.test.tsx +++ b/x-pack/plugins/lens/public/app_plugin/app.test.tsx @@ -19,6 +19,7 @@ import { FilterManager, IFieldType, IIndexPattern, + UI_SETTINGS, } from '../../../../../src/plugins/data/public'; import { dataPluginMock } from '../../../../../src/plugins/data/public/mocks'; const dataStartMock = dataPluginMock.createStartContract(); @@ -183,7 +184,7 @@ describe('Lens App', () => { jest.fn((type) => { if (type === 'timepicker:timeDefaults') { return { from: 'now-7d', to: 'now' }; - } else if (type === 'search:queryLanguage') { + } else if (type === UI_SETTINGS.SEARCH_QUERY_LANGUAGE) { return 'kuery'; } else { return []; diff --git a/x-pack/plugins/lens/public/app_plugin/app.tsx b/x-pack/plugins/lens/public/app_plugin/app.tsx index ffa59a6fb6bc98..1349d33983fcd0 100644 --- a/x-pack/plugins/lens/public/app_plugin/app.tsx +++ b/x-pack/plugins/lens/public/app_plugin/app.tsx @@ -27,6 +27,7 @@ import { IndexPattern as IndexPatternInstance, IndexPatternsContract, SavedQuery, + UI_SETTINGS, } from '../../../../../src/plugins/data/public'; interface State { @@ -76,7 +77,8 @@ export function App({ onAppLeave: AppMountParameters['onAppLeave']; }) { const language = - storage.get('kibana.userQueryLanguage') || core.uiSettings.get('search:queryLanguage'); + storage.get('kibana.userQueryLanguage') || + core.uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE); const [state, setState] = useState(() => { const currentRange = data.query.timefilter.timefilter.getTime(); @@ -413,7 +415,7 @@ export function App({ query: '', language: storage.get('kibana.userQueryLanguage') || - core.uiSettings.get('search:queryLanguage'), + core.uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE), }, })); }} diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.test.tsx index e665e8b8dd326a..defc142d4976ea 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.test.tsx @@ -12,6 +12,7 @@ import { EuiSwitch, EuiSwitchEvent } from '@elastic/eui'; import { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from 'kibana/public'; import { coreMock } from 'src/core/public/mocks'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; +import { UI_SETTINGS } from '../../../../../../../src/plugins/data/public'; import { dataPluginMock, getCalculateAutoTimeExpression, @@ -23,7 +24,7 @@ const dataStart = dataPluginMock.createStartContract(); dataStart.search.aggs.calculateAutoTimeExpression = getCalculateAutoTimeExpression({ ...coreMock.createStart().uiSettings, get: (path: string) => { - if (path === 'histogram:maxBars') { + if (path === UI_SETTINGS.HISTOGRAM_MAX_BARS) { return 10; } }, diff --git a/x-pack/plugins/lens/public/xy_visualization/index.ts b/x-pack/plugins/lens/public/xy_visualization/index.ts index 23cf9e7ff818fc..cd25cb57295115 100644 --- a/x-pack/plugins/lens/public/xy_visualization/index.ts +++ b/x-pack/plugins/lens/public/xy_visualization/index.ts @@ -8,6 +8,7 @@ import { EUI_CHARTS_THEME_DARK, EUI_CHARTS_THEME_LIGHT } from '@elastic/eui/dist import { CoreSetup, IUiSettingsClient } from 'kibana/public'; import moment from 'moment-timezone'; import { ExpressionsSetup } from '../../../../../src/plugins/expressions/public'; +import { UI_SETTINGS } from '../../../../../src/plugins/data/public'; import { xyVisualization } from './xy_visualization'; import { xyChart, getXyChartRenderer } from './xy_expression'; import { legendConfig, xConfig, layerConfig } from './types'; @@ -47,7 +48,7 @@ export class XyVisualization { ? EUI_CHARTS_THEME_DARK.theme : EUI_CHARTS_THEME_LIGHT.theme, timeZone: getTimeZone(core.uiSettings), - histogramBarTarget: core.uiSettings.get('histogram:barTarget'), + histogramBarTarget: core.uiSettings.get(UI_SETTINGS.HISTOGRAM_BAR_TARGET), }) ); diff --git a/x-pack/plugins/maps/public/angular/get_initial_query.js b/x-pack/plugins/maps/public/angular/get_initial_query.js index 4f61142413671d..84f431cf2b3b63 100644 --- a/x-pack/plugins/maps/public/angular/get_initial_query.js +++ b/x-pack/plugins/maps/public/angular/get_initial_query.js @@ -5,6 +5,7 @@ */ import { getUiSettings } from '../kibana_services'; +import { UI_SETTINGS } from '../../../../../src/plugins/data/public'; export function getInitialQuery({ mapStateJSON, appState = {}, userQueryLanguage }) { const settings = getUiSettings(); @@ -22,6 +23,6 @@ export function getInitialQuery({ mapStateJSON, appState = {}, userQueryLanguage return { query: '', - language: userQueryLanguage || settings.get('search:queryLanguage'), + language: userQueryLanguage || settings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE), }; } diff --git a/x-pack/plugins/maps/public/angular/get_initial_refresh_config.js b/x-pack/plugins/maps/public/angular/get_initial_refresh_config.js index f13e435cd1d5cf..17a50c6c5f6852 100644 --- a/x-pack/plugins/maps/public/angular/get_initial_refresh_config.js +++ b/x-pack/plugins/maps/public/angular/get_initial_refresh_config.js @@ -5,6 +5,7 @@ */ import { getUiSettings } from '../kibana_services'; +import { UI_SETTINGS } from '../../../../../src/plugins/data/public'; export function getInitialRefreshConfig({ mapStateJSON, globalState = {} }) { const uiSettings = getUiSettings(); @@ -16,7 +17,7 @@ export function getInitialRefreshConfig({ mapStateJSON, globalState = {} }) { } } - const defaultRefreshConfig = uiSettings.get('timepicker:refreshIntervalDefaults'); + const defaultRefreshConfig = uiSettings.get(UI_SETTINGS.TIMEPICKER_REFRESH_INTERVAL_DEFAULTS); const refreshInterval = { ...defaultRefreshConfig, ...globalState.refreshInterval }; return { isPaused: refreshInterval.pause, diff --git a/x-pack/plugins/maps/public/connected_components/layer_panel/filter_editor/filter_editor.js b/x-pack/plugins/maps/public/connected_components/layer_panel/filter_editor/filter_editor.js index 75b6b5d66f1de6..45c7507160e980 100644 --- a/x-pack/plugins/maps/public/connected_components/layer_panel/filter_editor/filter_editor.js +++ b/x-pack/plugins/maps/public/connected_components/layer_panel/filter_editor/filter_editor.js @@ -20,6 +20,7 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; +import { UI_SETTINGS } from '../../../../../../../src/plugins/data/public'; import { getIndexPatternService, getUiSettings, getData } from '../../../kibana_services'; import { GlobalFilterCheckbox } from '../../../components/global_filter_checkbox'; @@ -101,7 +102,7 @@ export class FilterEditor extends Component { query={ layerQuery ? layerQuery - : { language: uiSettings.get('search:queryLanguage'), query: '' } + : { language: uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE), query: '' } } onQuerySubmit={this._onQueryChange} indexPatterns={this.state.indexPatterns} diff --git a/x-pack/plugins/maps/public/connected_components/layer_panel/join_editor/resources/where_expression.js b/x-pack/plugins/maps/public/connected_components/layer_panel/join_editor/resources/where_expression.js index d87761d3dabe8c..8fdb71de2dfed4 100644 --- a/x-pack/plugins/maps/public/connected_components/layer_panel/join_editor/resources/where_expression.js +++ b/x-pack/plugins/maps/public/connected_components/layer_panel/join_editor/resources/where_expression.js @@ -8,6 +8,7 @@ import React, { Component } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButton, EuiPopover, EuiExpression, EuiFormHelpText } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; +import { UI_SETTINGS } from '../../../../../../../../src/plugins/data/public'; import { getUiSettings, getData } from '../../../../kibana_services'; export class WhereExpression extends Component { @@ -79,7 +80,7 @@ export class WhereExpression extends Component { query={ whereQuery ? whereQuery - : { language: getUiSettings().get('search:queryLanguage'), query: '' } + : { language: getUiSettings().get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE), query: '' } } onQuerySubmit={this._onQueryChange} indexPatterns={[indexPattern]} diff --git a/x-pack/plugins/ml/public/application/datavisualizer/index_based/page.tsx b/x-pack/plugins/ml/public/application/datavisualizer/index_based/page.tsx index d68c0342ac857d..97b4043c9fd644 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/index_based/page.tsx +++ b/x-pack/plugins/ml/public/application/datavisualizer/index_based/page.tsx @@ -27,6 +27,7 @@ import { Query, esQuery, esKuery, + UI_SETTINGS, } from '../../../../../../../src/plugins/data/public'; import { SavedSearchSavedObject } from '../../../../common/types/kibana'; import { NavigationMenu } from '../../components/navigation_menu'; @@ -254,7 +255,7 @@ export const Page: FC = () => { qry = esKuery.toElasticsearchQuery(ast, currentIndexPattern); } else { qry = esQuery.luceneStringToDsl(qryString); - esQuery.decorateQuery(qry, kibanaConfig.get('query:queryString:options')); + esQuery.decorateQuery(qry, kibanaConfig.get(UI_SETTINGS.QUERY_STRING_OPTIONS)); } return { diff --git a/x-pack/plugins/ml/public/application/services/explorer_service.ts b/x-pack/plugins/ml/public/application/services/explorer_service.ts index efcec8cf2b9549..717ed3ba64c378 100644 --- a/x-pack/plugins/ml/public/application/services/explorer_service.ts +++ b/x-pack/plugins/ml/public/application/services/explorer_service.ts @@ -6,7 +6,11 @@ import { IUiSettingsClient } from 'kibana/public'; import { i18n } from '@kbn/i18n'; -import { TimefilterContract, TimeRange } from '../../../../../../src/plugins/data/public'; +import { + TimefilterContract, + TimeRange, + UI_SETTINGS, +} from '../../../../../../src/plugins/data/public'; import { getBoundsRoundedToInterval, TimeBuckets, TimeRangeBounds } from '../util/time_buckets'; import { ExplorerJob, OverallSwimlaneData, SwimlaneData } from '../explorer/explorer_utils'; import { VIEW_BY_JOB_LABEL } from '../explorer/explorer_constants'; @@ -25,8 +29,8 @@ export class ExplorerService { private mlResultsService: MlResultsService ) { this.timeBuckets = new TimeBuckets({ - 'histogram:maxBars': uiSettings.get('histogram:maxBars'), - 'histogram:barTarget': uiSettings.get('histogram:barTarget'), + 'histogram:maxBars': uiSettings.get(UI_SETTINGS.HISTOGRAM_MAX_BARS), + 'histogram:barTarget': uiSettings.get(UI_SETTINGS.HISTOGRAM_BAR_TARGET), dateFormat: uiSettings.get('dateFormat'), 'dateFormat:scaled': uiSettings.get('dateFormat:scaled'), }); diff --git a/x-pack/plugins/ml/public/application/util/time_buckets.d.ts b/x-pack/plugins/ml/public/application/util/time_buckets.d.ts index 9c5d663a6e4ab1..91661ea3fd3fab 100644 --- a/x-pack/plugins/ml/public/application/util/time_buckets.d.ts +++ b/x-pack/plugins/ml/public/application/util/time_buckets.d.ts @@ -5,6 +5,7 @@ */ import { Moment } from 'moment'; +import { UI_SETTINGS } from '../../../../../../src/plugins/data/public'; export interface TimeRangeBounds { min?: Moment; diff --git a/x-pack/plugins/ml/public/application/util/time_buckets.js b/x-pack/plugins/ml/public/application/util/time_buckets.js index 2b23eca1ab5c0f..1915a4ce6516bc 100644 --- a/x-pack/plugins/ml/public/application/util/time_buckets.js +++ b/x-pack/plugins/ml/public/application/util/time_buckets.js @@ -11,7 +11,7 @@ import dateMath from '@elastic/datemath'; import { timeBucketsCalcAutoIntervalProvider } from './calc_auto_interval'; import { parseInterval } from '../../../common/util/parse_interval'; import { getFieldFormats, getUiSettings } from './dependency_cache'; -import { FIELD_FORMAT_IDS } from '../../../../../../src/plugins/data/public'; +import { FIELD_FORMAT_IDS, UI_SETTINGS } from '../../../../../../src/plugins/data/public'; const unitsDesc = dateMath.unitsDesc; const largeMax = unitsDesc.indexOf('w'); // Multiple units of week or longer converted to days for ES intervals. @@ -21,8 +21,8 @@ const calcAuto = timeBucketsCalcAutoIntervalProvider(); export function getTimeBucketsFromCache() { const uiSettings = getUiSettings(); return new TimeBuckets({ - 'histogram:maxBars': uiSettings.get('histogram:maxBars'), - 'histogram:barTarget': uiSettings.get('histogram:barTarget'), + [UI_SETTINGS.HISTOGRAM_MAX_BARS]: uiSettings.get(UI_SETTINGS.HISTOGRAM_MAX_BARS), + [UI_SETTINGS.HISTOGRAM_BAR_TARGET]: uiSettings.get(UI_SETTINGS.HISTOGRAM_BAR_TARGET), dateFormat: uiSettings.get('dateFormat'), 'dateFormat:scaled': uiSettings.get('dateFormat:scaled'), }); @@ -35,8 +35,8 @@ export function getTimeBucketsFromCache() { */ export function TimeBuckets(timeBucketsConfig) { this._timeBucketsConfig = timeBucketsConfig; - this.barTarget = this._timeBucketsConfig['histogram:barTarget']; - this.maxBars = this._timeBucketsConfig['histogram:maxBars']; + this.barTarget = this._timeBucketsConfig[UI_SETTINGS.HISTOGRAM_BAR_TARGET]; + this.maxBars = this._timeBucketsConfig[UI_SETTINGS.HISTOGRAM_MAX_BARS]; } /** diff --git a/x-pack/plugins/ml/public/application/util/time_buckets.test.js b/x-pack/plugins/ml/public/application/util/time_buckets.test.js index baecf7df906412..250c7255f5b99f 100644 --- a/x-pack/plugins/ml/public/application/util/time_buckets.test.js +++ b/x-pack/plugins/ml/public/application/util/time_buckets.test.js @@ -5,6 +5,7 @@ */ import moment from 'moment'; +import { UI_SETTINGS } from '../../../../../../src/plugins/data/public'; import { TimeBuckets, getBoundsRoundedToInterval, calcEsInterval } from './time_buckets'; describe('ML - time buckets', () => { @@ -13,8 +14,8 @@ describe('ML - time buckets', () => { beforeEach(() => { const timeBucketsConfig = { - 'histogram:maxBars': 100, - 'histogram:barTarget': 50, + [UI_SETTINGS.HISTOGRAM_MAX_BARS]: 100, + [UI_SETTINGS.HISTOGRAM_BAR_TARGET]: 50, }; autoBuckets = new TimeBuckets(timeBucketsConfig); diff --git a/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/swimlane_input_resolver.ts b/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/swimlane_input_resolver.ts index e48ce9f9a1d92d..74a7b432de2673 100644 --- a/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/swimlane_input_resolver.ts +++ b/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/swimlane_input_resolver.ts @@ -27,7 +27,7 @@ import { MlStartDependencies } from '../../plugin'; import { SWIMLANE_TYPE } from '../../application/explorer/explorer_constants'; import { Filter } from '../../../../../../src/plugins/data/common/es_query/filters'; import { Query } from '../../../../../../src/plugins/data/common/query'; -import { esKuery } from '../../../../../../src/plugins/data/public'; +import { esKuery, UI_SETTINGS } from '../../../../../../src/plugins/data/public'; import { ExplorerJob, OverallSwimlaneData } from '../../application/explorer/explorer_utils'; import { parseInterval } from '../../../common/util/parse_interval'; import { AnomalyDetectorService } from '../../application/services/anomaly_detector_service'; @@ -62,8 +62,8 @@ export function useSwimlaneInputResolver( const timeBuckets = useMemo(() => { return new TimeBuckets({ - 'histogram:maxBars': uiSettings.get('histogram:maxBars'), - 'histogram:barTarget': uiSettings.get('histogram:barTarget'), + 'histogram:maxBars': uiSettings.get(UI_SETTINGS.HISTOGRAM_MAX_BARS), + 'histogram:barTarget': uiSettings.get(UI_SETTINGS.HISTOGRAM_BAR_TARGET), dateFormat: uiSettings.get('dateFormat'), 'dateFormat:scaled': uiSettings.get('dateFormat:scaled'), }); diff --git a/x-pack/plugins/monitoring/public/plugin.ts b/x-pack/plugins/monitoring/public/plugin.ts index 73133da5a006ce..24383028e558c9 100644 --- a/x-pack/plugins/monitoring/public/plugin.ts +++ b/x-pack/plugins/monitoring/public/plugin.ts @@ -17,6 +17,7 @@ import { FeatureCatalogueCategory, HomePublicPluginSetup, } from '../../../../src/plugins/home/public'; +import { UI_SETTINGS } from '../../../../src/plugins/data/public'; import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public'; import { MonitoringPluginDependencies, MonitoringConfig } from './types'; import { @@ -110,7 +111,7 @@ export class MonitoringPlugin timefilter.setRefreshInterval(refreshInterval); timefilter.setTime(time); uiSettings.overrideLocalDefault( - 'timepicker:refreshIntervalDefaults', + UI_SETTINGS.TIMEPICKER_REFRESH_INTERVAL_DEFAULTS, JSON.stringify(refreshInterval) ); uiSettings.overrideLocalDefault('timepicker:timeDefaults', JSON.stringify(time)); diff --git a/x-pack/plugins/reporting/server/export_types/csv/server/execute_job.test.ts b/x-pack/plugins/reporting/server/export_types/csv/server/execute_job.test.ts index 6f227d00974ca1..ddcf94079ade42 100644 --- a/x-pack/plugins/reporting/server/export_types/csv/server/execute_job.test.ts +++ b/x-pack/plugins/reporting/server/export_types/csv/server/execute_job.test.ts @@ -8,7 +8,7 @@ import nodeCrypto from '@elastic/node-crypto'; // @ts-ignore import Puid from 'puid'; import sinon from 'sinon'; -import { fieldFormats } from '../../../../../../../src/plugins/data/server'; +import { fieldFormats, UI_SETTINGS } from '../../../../../../../src/plugins/data/server'; import { CancellationToken } from '../../../../common'; import { CSV_BOM_CHARS } from '../../../../common/constants'; import { LevelLogger } from '../../../lib'; @@ -16,6 +16,10 @@ import { setFieldFormats } from '../../../services'; import { createMockReportingCore } from '../../../test_helpers'; import { JobDocPayloadDiscoverCsv } from '../types'; import { executeJobFactory } from './execute_job'; +import { + CSV_SEPARATOR_SETTING, + CSV_QUOTE_VALUES_SETTING, +} from '../../../../../../../src/plugins/share/server'; const delay = (ms: number) => new Promise((resolve) => setTimeout(() => resolve(), ms)); @@ -94,13 +98,13 @@ describe('CSV Execute Job', function () { .stub(clusterStub, 'callAsCurrentUser') .resolves(defaultElasticsearchResponse); - mockUiSettingsClient.get.withArgs('csv:separator').returns(','); - mockUiSettingsClient.get.withArgs('csv:quoteValues').returns(true); + mockUiSettingsClient.get.withArgs(CSV_SEPARATOR_SETTING).returns(','); + mockUiSettingsClient.get.withArgs(CSV_QUOTE_VALUES_SETTING).returns(true); setFieldFormats({ fieldFormatServiceFactory() { const uiConfigMock = {}; - (uiConfigMock as any)['format:defaultTypeMap'] = { + (uiConfigMock as any)[UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP] = { _default_: { id: 'string', params: {} }, }; @@ -748,7 +752,7 @@ describe('CSV Execute Job', function () { }); it('should use custom uiSettings csv:separator for header', async function () { - mockUiSettingsClient.get.withArgs('csv:separator').returns(';'); + mockUiSettingsClient.get.withArgs(CSV_SEPARATOR_SETTING).returns(';'); const executeJob = await executeJobFactory(mockReportingCore, mockLogger); const jobParams = getJobDocPayload({ headers: encryptedHeaders, @@ -760,7 +764,7 @@ describe('CSV Execute Job', function () { }); it('should escape column headers if uiSettings csv:quoteValues is true', async function () { - mockUiSettingsClient.get.withArgs('csv:quoteValues').returns(true); + mockUiSettingsClient.get.withArgs(CSV_QUOTE_VALUES_SETTING).returns(true); const executeJob = await executeJobFactory(mockReportingCore, mockLogger); const jobParams = getJobDocPayload({ headers: encryptedHeaders, @@ -772,7 +776,7 @@ describe('CSV Execute Job', function () { }); it(`shouldn't escape column headers if uiSettings csv:quoteValues is false`, async function () { - mockUiSettingsClient.get.withArgs('csv:quoteValues').returns(false); + mockUiSettingsClient.get.withArgs(CSV_QUOTE_VALUES_SETTING).returns(false); const executeJob = await executeJobFactory(mockReportingCore, mockLogger); const jobParams = getJobDocPayload({ headers: encryptedHeaders, diff --git a/x-pack/plugins/reporting/server/export_types/csv/server/execute_job.ts b/x-pack/plugins/reporting/server/export_types/csv/server/execute_job.ts index de5ddb2503b2f8..4b17cc669efe1b 100644 --- a/x-pack/plugins/reporting/server/export_types/csv/server/execute_job.ts +++ b/x-pack/plugins/reporting/server/export_types/csv/server/execute_job.ts @@ -7,6 +7,10 @@ import { i18n } from '@kbn/i18n'; import Hapi from 'hapi'; import { IUiSettingsClient, KibanaRequest } from '../../../../../../../src/core/server'; +import { + CSV_SEPARATOR_SETTING, + CSV_QUOTE_VALUES_SETTING, +} from '../../../../../../../src/plugins/share/server'; import { ReportingCore } from '../../..'; import { CSV_BOM_CHARS, CSV_JOB_TYPE } from '../../../../common/constants'; import { getFieldFormats } from '../../../../server/services'; @@ -94,8 +98,8 @@ export const executeJobFactory: ExecuteJobFactory { const [separator, quoteValues, timezone] = await Promise.all([ - client.get('csv:separator'), - client.get('csv:quoteValues'), + client.get(CSV_SEPARATOR_SETTING), + client.get(CSV_QUOTE_VALUES_SETTING), client.get('dateFormat:tz'), ]); diff --git a/x-pack/plugins/reporting/server/export_types/csv/server/lib/field_format_map.test.ts b/x-pack/plugins/reporting/server/export_types/csv/server/lib/field_format_map.test.ts index 0434da3d11fe1e..83aa23de676639 100644 --- a/x-pack/plugins/reporting/server/export_types/csv/server/lib/field_format_map.test.ts +++ b/x-pack/plugins/reporting/server/export_types/csv/server/lib/field_format_map.test.ts @@ -9,6 +9,7 @@ import expect from '@kbn/expect'; import { fieldFormats, FieldFormatsGetConfigFn, + UI_SETTINGS, } from '../../../../../../../../src/plugins/data/server'; import { fieldFormatMapFactory } from './field_format_map'; @@ -28,10 +29,10 @@ describe('field format map', function () { }, }; const configMock: Record = {}; - configMock['format:defaultTypeMap'] = { + configMock[UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP] = { number: { id: 'number', params: {} }, }; - configMock['format:number:defaultPattern'] = '0,0.[000]'; + configMock[UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN] = '0,0.[000]'; const getConfig = ((key: string) => configMock[key]) as FieldFormatsGetConfigFn; const testValue = '4000'; diff --git a/x-pack/plugins/reporting/server/export_types/csv_from_savedobject/server/lib/generate_csv_search.ts b/x-pack/plugins/reporting/server/export_types/csv_from_savedobject/server/lib/generate_csv_search.ts index a9e4366f4eda6b..3f997a703bef12 100644 --- a/x-pack/plugins/reporting/server/export_types/csv_from_savedobject/server/lib/generate_csv_search.ts +++ b/x-pack/plugins/reporting/server/export_types/csv_from_savedobject/server/lib/generate_csv_search.ts @@ -16,7 +16,12 @@ import { Filter, IIndexPattern, Query, + UI_SETTINGS, } from '../../../../../../../../src/plugins/data/server'; +import { + CSV_SEPARATOR_SETTING, + CSV_QUOTE_VALUES_SETTING, +} from '../../../../../../../../src/plugins/share/server'; import { CancellationToken } from '../../../../../common'; import { LevelLogger } from '../../../../lib'; import { createGenerateCsv } from '../../../csv/server/lib/generate_csv'; @@ -32,9 +37,9 @@ import { getFilters } from './get_filters'; const getEsQueryConfig = async (config: IUiSettingsClient) => { const configs = await Promise.all([ - config.get('query:allowLeadingWildcards'), - config.get('query:queryString:options'), - config.get('courier:ignoreFilterIfFieldNotInIndex'), + config.get(UI_SETTINGS.QUERY_ALLOW_LEADING_WILDCARDS), + config.get(UI_SETTINGS.QUERY_STRING_OPTIONS), + config.get(UI_SETTINGS.COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX), ]); const [allowLeadingWildcards, queryStringOptions, ignoreFilterIfFieldNotInIndex] = configs; return { @@ -45,7 +50,10 @@ const getEsQueryConfig = async (config: IUiSettingsClient) => { }; const getUiSettings = async (config: IUiSettingsClient) => { - const configs = await Promise.all([config.get('csv:separator'), config.get('csv:quoteValues')]); + const configs = await Promise.all([ + config.get(CSV_SEPARATOR_SETTING), + config.get(CSV_QUOTE_VALUES_SETTING), + ]); const [separator, quoteValues] = configs; return { separator, quoteValues }; }; diff --git a/x-pack/plugins/security_solution/public/alerts/components/rules/description_step/helpers.test.tsx b/x-pack/plugins/security_solution/public/alerts/components/rules/description_step/helpers.test.tsx index e39ee38d71da7a..b82d1c0a36ab28 100644 --- a/x-pack/plugins/security_solution/public/alerts/components/rules/description_step/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/alerts/components/rules/description_step/helpers.test.tsx @@ -9,7 +9,11 @@ import { shallow } from 'enzyme'; import { EuiLoadingSpinner } from '@elastic/eui'; import { coreMock } from '../../../../../../../../src/core/public/mocks'; -import { esFilters, FilterManager } from '../../../../../../../../src/plugins/data/public'; +import { + esFilters, + FilterManager, + UI_SETTINGS, +} from '../../../../../../../../src/plugins/data/public'; import { SeverityBadge } from '../severity_badge'; import * as i18n from './translations'; @@ -29,7 +33,7 @@ import { ListItems } from './types'; const setupMock = coreMock.createSetup(); const uiSettingsMock = (pinnedByDefault: boolean) => (key: string) => { switch (key) { - case 'filters:pinnedByDefault': + case UI_SETTINGS.FILTERS_PINNED_BY_DEFAULT: return pinnedByDefault; default: throw new Error(`Unexpected uiSettings key in FilterManager mock: ${key}`); diff --git a/x-pack/plugins/security_solution/public/alerts/components/rules/description_step/index.test.tsx b/x-pack/plugins/security_solution/public/alerts/components/rules/description_step/index.test.tsx index 1f474630fd6e3a..b8f81f6d7e5f7a 100644 --- a/x-pack/plugins/security_solution/public/alerts/components/rules/description_step/index.test.tsx +++ b/x-pack/plugins/security_solution/public/alerts/components/rules/description_step/index.test.tsx @@ -13,7 +13,12 @@ import { getDescriptionItem, } from '.'; -import { esFilters, Filter, FilterManager } from '../../../../../../../../src/plugins/data/public'; +import { + esFilters, + Filter, + FilterManager, + UI_SETTINGS, +} from '../../../../../../../../src/plugins/data/public'; import { mockAboutStepRule, mockDefineStepRule, @@ -33,7 +38,7 @@ describe('description_step', () => { const setupMock = coreMock.createSetup(); const uiSettingsMock = (pinnedByDefault: boolean) => (key: string) => { switch (key) { - case 'filters:pinnedByDefault': + case UI_SETTINGS.FILTERS_PINNED_BY_DEFAULT: return pinnedByDefault; default: throw new Error(`Unexpected uiSettings key in FilterManager mock: ${key}`); diff --git a/x-pack/plugins/security_solution/server/lib/framework/kibana_framework_adapter.ts b/x-pack/plugins/security_solution/server/lib/framework/kibana_framework_adapter.ts index 9a7b56eed366de..6d9e9b13bc356a 100644 --- a/x-pack/plugins/security_solution/server/lib/framework/kibana_framework_adapter.ts +++ b/x-pack/plugins/security_solution/server/lib/framework/kibana_framework_adapter.ts @@ -15,7 +15,7 @@ import { RequestHandlerContext, KibanaRequest, } from '../../../../../../src/core/server'; -import { IndexPatternsFetcher } from '../../../../../../src/plugins/data/server'; +import { IndexPatternsFetcher, UI_SETTINGS } from '../../../../../../src/plugins/data/server'; import { AuthenticatedUser } from '../../../../security/common/model'; import { SetupPlugins } from '../../plugin'; @@ -43,10 +43,10 @@ export class KibanaBackendFrameworkAdapter implements FrameworkAdapter { params: Record ) { const { elasticsearch, uiSettings } = req.context.core; - const includeFrozen = await uiSettings.client.get('search:includeFrozen'); + const includeFrozen = await uiSettings.client.get(UI_SETTINGS.SEARCH_INCLUDE_FROZEN); const maxConcurrentShardRequests = endpoint === 'msearch' - ? await uiSettings.client.get('courier:maxConcurrentShardRequests') + ? await uiSettings.client.get(UI_SETTINGS.COURIER_MAX_CONCURRENT_SHARD_REQUESTS) : 0; return elasticsearch.legacy.client.callAsCurrentUser(endpoint, { diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 5b017c6565c040..1a2e5db9e7190f 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -496,6 +496,81 @@ "dashboard.topNave.viewConfigDescription": "編集をキャンセルして表示限定モードに切り替えます", "dashboard.urlWasRemovedInSixZeroWarningMessage": "URL「dashboard/create」は6.0で廃止されました。ブックマークを更新してください。", "dashboard.visitVisualizeAppLinkText": "可視化アプリにアクセス", + "data.advancedSettings.courier.batchSearchesText": "無効の場合、ダッシュボードパネルは個々に読み込まれ、検索リクエストはユーザーが移動するか\n クエリを更新すると停止します。有効の場合、ダッシュボードパネルはすべてのデータが読み込まれると同時に読み込まれ、\n 検索は停止しません。", + "data.advancedSettings.courier.batchSearchesTextDeprecation": "この設定はサポートが終了し、Kibana 8.0 では削除されます。", + "data.advancedSettings.courier.batchSearchesTitle": "同時検索のバッチ処理", + "data.advancedSettings.courier.customRequestPreference.requestPreferenceLinkText": "リクエスト設定", + "data.advancedSettings.courier.customRequestPreferenceText": "{setRequestReferenceSetting} が {customSettingValue} に設定されている時に使用される {requestPreferenceLink} です。", + "data.advancedSettings.courier.customRequestPreferenceTitle": "カスタムリクエスト設定", + "data.advancedSettings.courier.ignoreFilterText": "この構成は、似ていないインデックスにアクセスするビジュアライゼーションを含むダッシュボードのサポートを強化します。無効にすると、すべてのフィルターがすべてのビジュアライゼーションに適用されます。有効にすると、ビジュアライゼーションのインデックスにフィルター対象のフィールドが含まれていない場合、ビジュアライゼーションの際にフィルターが無視されます。", + "data.advancedSettings.courier.ignoreFilterTitle": "フィルターの無視", + "data.advancedSettings.courier.maxRequestsText": "Kibana から送信された _msearch requests リクエストに使用される {maxRequestsLink} 設定を管理します。この構成を無効にして Elasticsearch のデフォルトを使用するには、0 に設定します。", + "data.advancedSettings.courier.maxRequestsTitle": "最大同時シャードリクエスト", + "data.advancedSettings.courier.requestPreferenceCustom": "カスタム", + "data.advancedSettings.courier.requestPreferenceNone": "なし", + "data.advancedSettings.courier.requestPreferenceSessionId": "セッション ID", + "data.advancedSettings.courier.requestPreferenceText": "どのシャードが検索リクエストを扱うかを設定できます。
    \n
  • {sessionId}: 同じシャードのすべての検索リクエストを実行するため、オペレーションを制限します。\n これにはリクエスト間でシャードのキャッシュを共有できるというメリットがあります。
  • \n
  • {custom}: 独自の設定が可能になります。\n couriercustomRequestPreference で設定値をカスタマイズします。
  • \n
  • {none}: 設定されていないことを意味します。\n これにより、リクエストが全シャードコピー間に分散されるため、パフォーマンスが改善される可能性があります。\n ただし、シャードによって更新ステータスが異なる場合があるため、結果に矛盾が生じる可能性があります。
  • \n
", + "data.advancedSettings.courier.requestPreferenceTitle": "リクエスト設定", + "data.advancedSettings.defaultIndexText": "インデックスが設定されていない時にアクセスするインデックスです", + "data.advancedSettings.defaultIndexTitle": "デフォルトのインデックス", + "data.advancedSettings.pinFiltersText": "フィルターがデフォルトでグローバル (ピン付けされた状態) になるかの設定です", + "data.advancedSettings.pinFiltersTitle": "フィルターをデフォルトでピン付けする", + "data.advancedSettings.query.allowWildcardsText": "設定すると、クエリ句の頭に * が使えるようになります。現在クエリバーで実験的クエリ機能が有効になっている場合にのみ適用されます。基本的な Lucene クエリでリーディングワイルドカードを無効にするには、{queryStringOptionsPattern} を使用します。", + "data.advancedSettings.query.allowWildcardsTitle": "クエリでリーディングワイルドカードを許可する", + "data.advancedSettings.query.queryStringOptions.optionsLinkText": "オプション", + "data.advancedSettings.query.queryStringOptionsText": "Lucene クエリ文字列パーサーの {optionsLink}「{queryLanguage}」が {luceneLanguage} に設定されている時にのみ使用されます。", + "data.advancedSettings.query.queryStringOptionsTitle": "クエリ文字列のオプション", + "data.advancedSettings.searchQueryLanguageKql": "KQL", + "data.advancedSettings.searchQueryLanguageLucene": "Lucene", + "data.advancedSettings.searchQueryLanguageText": "クエリバーで使用されるクエリ言語です。KQL は Kibana 用に特別に開発された新しい言語です。", + "data.advancedSettings.searchQueryLanguageTitle": "クエリ言語", + "data.advancedSettings.shortenFieldsText": "長いフィールドを短くします。例: foo.bar.baz の代わりに f.b.baz と表示", + "data.advancedSettings.shortenFieldsTitle": "フィールドの短縮", + "data.advancedSettings.sortOptions.optionsLinkText": "オプション", + "data.advancedSettings.sortOptionsText": "Elasticsearch の並べ替えパラメーターの {optionsLink}", + "data.advancedSettings.sortOptionsTitle": "並べ替えオプション", + "data.advancedSettings.format.bytesFormat.numeralFormatLinkText": "数字フォーマット", + "data.advancedSettings.format.bytesFormatText": "「バイト」フォーマットのデフォルト {numeralFormatLink} です", + "data.advancedSettings.format.bytesFormatTitle": "バイトフォーマット", + "data.advancedSettings.format.currencyFormat.numeralFormatLinkText": "数字フォーマット", + "data.advancedSettings.format.currencyFormatText": "「通貨」フォーマットのデフォルト {numeralFormatLink} です", + "data.advancedSettings.format.currencyFormatTitle": "通貨フォーマット", + "data.advancedSettings.format.defaultTypeMapText": "各フィールドタイプにデフォルトで使用するフォーマット名のマップです。フィールドタイプが特に指定されていない場合は {defaultFormat} が使用されます", + "data.advancedSettings.format.defaultTypeMapTitle": "フィールドタイプフォーマット名", + "data.advancedSettings.format.formattingLocale.numeralLanguageLinkText": "数字言語", + "data.advancedSettings.format.formattingLocaleText": "{numeralLanguageLink} ロケール", + "data.advancedSettings.format.formattingLocaleTitle": "フォーマットロケール", + "data.advancedSettings.format.numberFormat.numeralFormatLinkText": "数字フォーマット", + "data.advancedSettings.format.numberFormatText": "「数字」フォーマットのデフォルト {numeralFormatLink} です", + "data.advancedSettings.format.numberFormatTitle": "数字フォーマット", + "data.advancedSettings.format.percentFormat.numeralFormatLinkText": "数字フォーマット", + "data.advancedSettings.format.percentFormatText": "「パーセント」フォーマットのデフォルト {numeralFormatLink} です", + "data.advancedSettings.format.percentFormatTitle": "パーセントフォーマット", + "data.advancedSettings.histogram.barTargetText": "日付ヒストグラムで「自動」間隔を使用する際、この数に近いバーの作成を試みます", + "data.advancedSettings.histogram.barTargetTitle": "目標バー数", + "data.advancedSettings.histogram.maxBarsText": "日付ヒストグラムに表示されるバーの数の上限です。必要に応じて値をスケーリングしてください", + "data.advancedSettings.histogram.maxBarsTitle": "最高バー数", + "data.advancedSettings.historyLimitText": "履歴があるフィールド (例: クエリインプット) に個の数の最近の値が表示されます", + "data.advancedSettings.historyLimitTitle": "履歴制限数", + "data.advancedSettings.indexPatternPlaceholderText": "「管理 > インデックスパターン > インデックスパターンを作成」で使用される「インデックスパターン名」フィールドのプレースホルダーです。", + "data.advancedSettings.indexPatternPlaceholderTitle": "インデックスパターンのプレースホルダー", + "data.advancedSettings.suggestFilterValuesText": "フィルターエディターがフィールドの値の候補を表示しないようにするには、このプロパティを false にしてください。", + "data.advancedSettings.suggestFilterValuesTitle": "フィルターエディターの候補値", + "data.advancedSettings.timepicker.last15Minutes": "過去 15 分間", + "data.advancedSettings.timepicker.last1Hour": "過去 1 時間", + "data.advancedSettings.timepicker.last1Year": "過去 1 年間", + "data.advancedSettings.timepicker.last24Hours": "過去 24 時間", + "data.advancedSettings.timepicker.last30Days": "過去 30 日間", + "data.advancedSettings.timepicker.last30Minutes": "過去 30 分間", + "data.advancedSettings.timepicker.last7Days": "過去 7 日間", + "data.advancedSettings.timepicker.last90Days": "過去 90 日間", + "data.advancedSettings.timepicker.quickRanges.acceptedFormatsLinkText": "対応フォーマット", + "data.advancedSettings.timepicker.quickRangesText": "タイムピッカーのクイックセクションに表示される範囲のリストです。それぞれのオブジェクトに「開始」、「終了」({acceptedFormatsLink} を参照)、「表示」(表示するタイトル) が含まれるオブジェクトの配列です。", + "data.advancedSettings.timepicker.quickRangesTitle": "タイムピッカーのクイック範囲", + "data.advancedSettings.timepicker.refreshIntervalDefaultsText": "時間フィルターのデフォルト更新間隔", + "data.advancedSettings.timepicker.refreshIntervalDefaultsTitle": "タイムピッカーの更新間隔", + "data.advancedSettings.timepicker.thisWeek": "今週", + "data.advancedSettings.timepicker.today": "今日", "data.aggTypes.buckets.ranges.rangesFormatMessage": "{gte} {from} と {lt} {to}", "data.common.kql.errors.endOfInputText": "インプットの終わり", "data.common.kql.errors.fieldNameText": "フィールド名", @@ -2047,25 +2122,10 @@ "inspector.requests.statisticsTabLabel": "統計", "inspector.title": "インスペクター", "inspector.view": "{viewName} を表示", - "kbn.advancedSettings.courier.batchSearchesText": "無効の場合、ダッシュボードパネルは個々に読み込まれ、検索リクエストはユーザーが移動するか\n クエリを更新すると停止します。有効の場合、ダッシュボードパネルはすべてのデータが読み込まれると同時に読み込まれ、\n 検索は停止しません。", - "kbn.advancedSettings.courier.batchSearchesTextDeprecation": "この設定はサポートが終了し、Kibana 8.0 では削除されます。", - "kbn.advancedSettings.courier.batchSearchesTitle": "同時検索のバッチ処理", - "kbn.advancedSettings.courier.customRequestPreference.requestPreferenceLinkText": "リクエスト設定", - "kbn.advancedSettings.courier.customRequestPreferenceText": "{setRequestReferenceSetting} が {customSettingValue} に設定されている時に使用される {requestPreferenceLink} です。", - "kbn.advancedSettings.courier.customRequestPreferenceTitle": "カスタムリクエスト設定", - "kbn.advancedSettings.courier.ignoreFilterText": "この構成は、似ていないインデックスにアクセスするビジュアライゼーションを含むダッシュボードのサポートを強化します。無効にすると、すべてのフィルターがすべてのビジュアライゼーションに適用されます。有効にすると、ビジュアライゼーションのインデックスにフィルター対象のフィールドが含まれていない場合、ビジュアライゼーションの際にフィルターが無視されます。", - "kbn.advancedSettings.courier.ignoreFilterTitle": "フィルターの無視", - "kbn.advancedSettings.courier.maxRequestsText": "Kibana から送信された _msearch requests リクエストに使用される {maxRequestsLink} 設定を管理します。この構成を無効にして Elasticsearch のデフォルトを使用するには、0 に設定します。", - "kbn.advancedSettings.courier.maxRequestsTitle": "最大同時シャードリクエスト", - "kbn.advancedSettings.courier.requestPreferenceCustom": "カスタム", - "kbn.advancedSettings.courier.requestPreferenceNone": "なし", - "kbn.advancedSettings.courier.requestPreferenceSessionId": "セッション ID", - "kbn.advancedSettings.courier.requestPreferenceText": "どのシャードが検索リクエストを扱うかを設定できます。
    \n
  • {sessionId}: 同じシャードのすべての検索リクエストを実行するため、オペレーションを制限します。\n これにはリクエスト間でシャードのキャッシュを共有できるというメリットがあります。
  • \n
  • {custom}: 独自の設定が可能になります。\n couriercustomRequestPreference で設定値をカスタマイズします。
  • \n
  • {none}: 設定されていないことを意味します。\n これにより、リクエストが全シャードコピー間に分散されるため、パフォーマンスが改善される可能性があります。\n ただし、シャードによって更新ステータスが異なる場合があるため、結果に矛盾が生じる可能性があります。
  • \n
", - "kbn.advancedSettings.courier.requestPreferenceTitle": "リクエスト設定", - "kbn.advancedSettings.csv.quoteValuesText": "csv エクスポートに値を引用するかどうかです", - "kbn.advancedSettings.csv.quoteValuesTitle": "CSV の値を引用", - "kbn.advancedSettings.csv.separatorText": "エクスポートされた値をこの文字列で区切ります", - "kbn.advancedSettings.csv.separatorTitle": "CSV セパレーター", + "share.advancedSettings.csv.quoteValuesText": "csv エクスポートに値を引用するかどうかです", + "share.advancedSettings.csv.quoteValuesTitle": "CSV の値を引用", + "share.advancedSettings.csv.separatorText": "エクスポートされた値をこの文字列で区切ります", + "share.advancedSettings.csv.separatorTitle": "CSV セパレーター", "kbn.advancedSettings.darkModeText": "Kibana UI のダークモードを有効にします。この設定を適用するにはページの更新が必要です。", "kbn.advancedSettings.darkModeTitle": "ダークモード", "kbn.advancedSettings.dateFormat.dayOfWeekText": "週の初めの曜日を設定します", @@ -2081,38 +2141,11 @@ "kbn.advancedSettings.dateNanosFormatText": "Elasticsearch の {dateNanosLink} データタイプに使用されます", "kbn.advancedSettings.dateNanosFormatTitle": "ナノ秒フォーマットでの日付", "kbn.advancedSettings.dateNanosLinkTitle": "date_nanos", - "kbn.advancedSettings.defaultIndexText": "インデックスが設定されていない時にアクセスするインデックスです", - "kbn.advancedSettings.defaultIndexTitle": "デフォルトのインデックス", "kbn.advancedSettings.defaultRoute.defaultRouteIsRelativeValidationMessage": "相対 URL でなければなりません。", "kbn.advancedSettings.defaultRoute.defaultRouteText": "この設定は、Kibana 起動時のデフォルトのルートを設定します。この設定で、Kibana 起動時のランディングページを変更できます。経路は相対 URL でなければなりません。", "kbn.advancedSettings.defaultRoute.defaultRouteTitle": "デフォルトのルート", "kbn.advancedSettings.disableAnimationsText": "Kibana UI の不要なアニメーションをオフにします。変更を適用するにはページを更新してください。", "kbn.advancedSettings.disableAnimationsTitle": "アニメーションを無効にする", - "kbn.advancedSettings.format.bytesFormat.numeralFormatLinkText": "数字フォーマット", - "kbn.advancedSettings.format.bytesFormatText": "「バイト」フォーマットのデフォルト {numeralFormatLink} です", - "kbn.advancedSettings.format.bytesFormatTitle": "バイトフォーマット", - "kbn.advancedSettings.format.currencyFormat.numeralFormatLinkText": "数字フォーマット", - "kbn.advancedSettings.format.currencyFormatText": "「通貨」フォーマットのデフォルト {numeralFormatLink} です", - "kbn.advancedSettings.format.currencyFormatTitle": "通貨フォーマット", - "kbn.advancedSettings.format.defaultTypeMapText": "各フィールドタイプにデフォルトで使用するフォーマット名のマップです。フィールドタイプが特に指定されていない場合は {defaultFormat} が使用されます", - "kbn.advancedSettings.format.defaultTypeMapTitle": "フィールドタイプフォーマット名", - "kbn.advancedSettings.format.formattingLocale.numeralLanguageLinkText": "数字言語", - "kbn.advancedSettings.format.formattingLocaleText": "{numeralLanguageLink} ロケール", - "kbn.advancedSettings.format.formattingLocaleTitle": "フォーマットロケール", - "kbn.advancedSettings.format.numberFormat.numeralFormatLinkText": "数字フォーマット", - "kbn.advancedSettings.format.numberFormatText": "「数字」フォーマットのデフォルト {numeralFormatLink} です", - "kbn.advancedSettings.format.numberFormatTitle": "数字フォーマット", - "kbn.advancedSettings.format.percentFormat.numeralFormatLinkText": "数字フォーマット", - "kbn.advancedSettings.format.percentFormatText": "「パーセント」フォーマットのデフォルト {numeralFormatLink} です", - "kbn.advancedSettings.format.percentFormatTitle": "パーセントフォーマット", - "kbn.advancedSettings.histogram.barTargetText": "日付ヒストグラムで「自動」間隔を使用する際、この数に近いバーの作成を試みます", - "kbn.advancedSettings.histogram.barTargetTitle": "目標バー数", - "kbn.advancedSettings.histogram.maxBarsText": "日付ヒストグラムに表示されるバーの数の上限です。必要に応じて値をスケーリングしてください", - "kbn.advancedSettings.histogram.maxBarsTitle": "最高バー数", - "kbn.advancedSettings.historyLimitText": "履歴があるフィールド (例: クエリインプット) に個の数の最近の値が表示されます", - "kbn.advancedSettings.historyLimitTitle": "履歴制限数", - "kbn.advancedSettings.indexPatternPlaceholderText": "「管理 > インデックスパターン > インデックスパターンを作成」で使用される「インデックスパターン名」フィールドのプレースホルダーです。", - "kbn.advancedSettings.indexPatternPlaceholderTitle": "インデックスパターンのプレースホルダー", "kbn.advancedSettings.maxCellHeightText": "表のセルが使用する高さの上限です。この切り捨てを無効にするには 0 に設定します", "kbn.advancedSettings.maxCellHeightTitle": "表のセルの高さの上限", "kbn.advancedSettings.notifications.banner.markdownLinkText": "マークダウン対応", @@ -2130,43 +2163,10 @@ "kbn.advancedSettings.pageNavigationLegacy": "レガシー", "kbn.advancedSettings.pageNavigationModern": "モダン", "kbn.advancedSettings.pageNavigationName": "サイドナビゲーションスタイル", - "kbn.advancedSettings.pinFiltersText": "フィルターがデフォルトでグローバル (ピン付けされた状態) になるかの設定です", - "kbn.advancedSettings.pinFiltersTitle": "フィルターをデフォルトでピン付けする", - "kbn.advancedSettings.query.allowWildcardsText": "設定すると、クエリ句の頭に * が使えるようになります。現在クエリバーで実験的クエリ機能が有効になっている場合にのみ適用されます。基本的な Lucene クエリでリーディングワイルドカードを無効にするには、{queryStringOptionsPattern} を使用します。", - "kbn.advancedSettings.query.allowWildcardsTitle": "クエリでリーディングワイルドカードを許可する", - "kbn.advancedSettings.query.queryStringOptions.optionsLinkText": "オプション", - "kbn.advancedSettings.query.queryStringOptionsText": "Lucene クエリ文字列パーサーの {optionsLink}「{queryLanguage}」が {luceneLanguage} に設定されている時にのみ使用されます。", - "kbn.advancedSettings.query.queryStringOptionsTitle": "クエリ文字列のオプション", - "kbn.advancedSettings.searchQueryLanguageKql": "KQL", - "kbn.advancedSettings.searchQueryLanguageLucene": "Lucene", - "kbn.advancedSettings.searchQueryLanguageText": "クエリバーで使用されるクエリ言語です。KQL は Kibana 用に特別に開発された新しい言語です。", - "kbn.advancedSettings.searchQueryLanguageTitle": "クエリ言語", - "kbn.advancedSettings.shortenFieldsText": "長いフィールドを短くします。例: foo.bar.baz の代わりに f.b.baz と表示", - "kbn.advancedSettings.shortenFieldsTitle": "フィールドの短縮", - "kbn.advancedSettings.sortOptions.optionsLinkText": "オプション", - "kbn.advancedSettings.sortOptionsText": "Elasticsearch の並べ替えパラメーターの {optionsLink}", - "kbn.advancedSettings.sortOptionsTitle": "並べ替えオプション", "kbn.advancedSettings.storeUrlText": "URL は長くなりすぎてブラウザが対応できない場合があります。セッションストレージに URL の一部を保存することがで この問題に対処できるかテストしています。結果を教えてください!", "kbn.advancedSettings.storeUrlTitle": "セッションストレージに URL を格納", - "kbn.advancedSettings.suggestFilterValuesText": "フィルターエディターがフィールドの値の候補を表示しないようにするには、このプロパティを false にしてください。", - "kbn.advancedSettings.suggestFilterValuesTitle": "フィルターエディターの候補値", - "kbn.advancedSettings.timepicker.last15Minutes": "過去 15 分間", - "kbn.advancedSettings.timepicker.last1Hour": "過去 1 時間", - "kbn.advancedSettings.timepicker.last1Year": "過去 1 年間", - "kbn.advancedSettings.timepicker.last24Hours": "過去 24 時間", - "kbn.advancedSettings.timepicker.last30Days": "過去 30 日間", - "kbn.advancedSettings.timepicker.last30Minutes": "過去 30 分間", - "kbn.advancedSettings.timepicker.last7Days": "過去 7 日間", - "kbn.advancedSettings.timepicker.last90Days": "過去 90 日間", - "kbn.advancedSettings.timepicker.quickRanges.acceptedFormatsLinkText": "対応フォーマット", - "kbn.advancedSettings.timepicker.quickRangesText": "タイムピッカーのクイックセクションに表示される範囲のリストです。それぞれのオブジェクトに「開始」、「終了」({acceptedFormatsLink} を参照)、「表示」(表示するタイトル) が含まれるオブジェクトの配列です。", - "kbn.advancedSettings.timepicker.quickRangesTitle": "タイムピッカーのクイック範囲", - "kbn.advancedSettings.timepicker.refreshIntervalDefaultsText": "時間フィルターのデフォルト更新間隔", - "kbn.advancedSettings.timepicker.refreshIntervalDefaultsTitle": "タイムピッカーの更新間隔", - "kbn.advancedSettings.timepicker.thisWeek": "今週", "kbn.advancedSettings.timepicker.timeDefaultsText": "時間フィルターが選択されずに Kibana が起動した際に使用される時間フィルターです", "kbn.advancedSettings.timepicker.timeDefaultsTitle": "デフォルトのタイムピッカー", - "kbn.advancedSettings.timepicker.today": "今日", "kbn.advancedSettings.visualization.showRegionMapWarningsText": "用語がマップの形に合わない場合に地域マップに警告を表示するかどうかです。", "kbn.advancedSettings.visualization.showRegionMapWarningsTitle": "地域マップに警告を表示", "kbn.advancedSettings.visualization.tileMap.maxPrecision.cellDimensionsLinkText": "ディメンションの説明", @@ -2175,8 +2175,8 @@ "kbn.advancedSettings.visualization.tileMap.wmsDefaults.propertiesLinkText": "プロパティ", "kbn.advancedSettings.visualization.tileMap.wmsDefaultsText": "座標マップの WMS マップサーバーサポートのデフォルトの {propertiesLink} です。", "kbn.advancedSettings.visualization.tileMap.wmsDefaultsTitle": "デフォルトの WMS プロパティ", - "kbn.advancedSettings.visualizeEnableLabsText": "ユーザーが実験的なビジュアライゼーションを作成、表示、編集できるようになります。無効の場合、\n ユーザーは本番準備が整ったビジュアライゼーションのみを利用できます。", - "kbn.advancedSettings.visualizeEnableLabsTitle": "実験的なビジュアライゼーションを有効にする", + "visualizations.advancedSettings.visualizeEnableLabsText": "ユーザーが実験的なビジュアライゼーションを作成、表示、編集できるようになります。無効の場合、\n ユーザーは本番準備が整ったビジュアライゼーションのみを利用できます。", + "visualizations.advancedSettings.visualizeEnableLabsTitle": "実験的なビジュアライゼーションを有効にする", "kibana_legacy.bigUrlWarningNotificationMessage": "{advancedSettingsLink}で{storeInSessionStorageParam}オプションを有効にするか、オンスクリーンビジュアルを簡素化してください。", "kibana_legacy.bigUrlWarningNotificationMessage.advancedSettingsLinkText": "高度な設定", "kibana_legacy.bigUrlWarningNotificationTitle": "URLが大きく、Kibanaの動作が停止する可能性があります", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index cee6860a58b5a4..deb50de785bbe3 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -496,6 +496,81 @@ "dashboard.topNave.viewConfigDescription": "取消编辑并切换到仅查看模式", "dashboard.urlWasRemovedInSixZeroWarningMessage": "6.0 中已移除 url“dashboard/create”。请更新您的书签。", "dashboard.visitVisualizeAppLinkText": "访问 Visualize 应用", + "data.advancedSettings.courier.batchSearchesText": "禁用时,仪表板面板将分别加载,用户离开时或更新查询时,\n 搜索请求将终止。启用时,仪表板面板将一起加载并加载所有数据,\n 搜索将不会终止。", + "data.advancedSettings.courier.batchSearchesTextDeprecation": "此设置已过时,将在 Kibana 8.0 中移除。", + "data.advancedSettings.courier.batchSearchesTitle": "批处理并发搜索", + "data.advancedSettings.courier.customRequestPreference.requestPreferenceLinkText": "请求首选项", + "data.advancedSettings.courier.customRequestPreferenceText": "将 “{setRequestReferenceSetting} 设置为 {customSettingValue} 时,将使用 “{requestPreferenceLink}”。", + "data.advancedSettings.courier.customRequestPreferenceTitle": "定制请求首选项", + "data.advancedSettings.courier.ignoreFilterText": "此配置增强对包含可视化的仪表板访问不同索引的支持。禁用时,将向所有可视化应用所有筛选。启用时,如果可视化的索引不包含筛选字段,则会为该可视化忽略筛选。", + "data.advancedSettings.courier.ignoreFilterTitle": "忽略筛选", + "data.advancedSettings.courier.maxRequestsText": "控制用于 Kibana 发送的 _msearch 请求的 “{maxRequestsLink}” 设置。设置为 0 可禁用此配置并使用 Elasticsearch 默认值。", + "data.advancedSettings.courier.maxRequestsTitle": "最大并发分片请求数", + "data.advancedSettings.courier.requestPreferenceCustom": "定制", + "data.advancedSettings.courier.requestPreferenceNone": "无", + "data.advancedSettings.courier.requestPreferenceSessionId": "会话 ID", + "data.advancedSettings.courier.requestPreferenceText": "允许您设置用于处理搜索请求的分片。
    \n
  • {sessionId}:仅限在相同分片上执行操作中的所有搜索请求。\n 这有利于在各个请求之间复用分片缓存。
  • \n
  • {custom}:允许您定义自己的首选项。\n 使用 courier:customRequestPreference 定制首选项值。
  • \n
  • {none}:表示不设置首选项。\n 这可能会提供更佳的性能,因此请求可以在所有分片副本上进行分配。\n 不过,结果可能会不一致,因为不同的分片可能处于不同的刷新状态。
  • \n
", + "data.advancedSettings.courier.requestPreferenceTitle": "请求首选项", + "data.advancedSettings.defaultIndexText": "未设置索引时要访问的索引", + "data.advancedSettings.defaultIndexTitle": "默认索引", + "data.advancedSettings.format.bytesFormat.numeralFormatLinkText": "数值格式", + "data.advancedSettings.format.bytesFormatText": "“字节”格式的默认{numeralFormatLink}", + "data.advancedSettings.format.bytesFormatTitle": "字节格式", + "data.advancedSettings.format.currencyFormat.numeralFormatLinkText": "数值格式", + "data.advancedSettings.format.currencyFormatText": "“货币”格式的默认{numeralFormatLink}", + "data.advancedSettings.format.currencyFormatTitle": "货币格式", + "data.advancedSettings.format.defaultTypeMapText": "要默认用于每个字段类型的格式名称的映射。如果未显式提及字段类型,则将使用{defaultFormat}", + "data.advancedSettings.format.defaultTypeMapTitle": "字段类型格式名称", + "data.advancedSettings.format.formattingLocale.numeralLanguageLinkText": "数值语言", + "data.advancedSettings.format.formattingLocaleText": "{numeralLanguageLink}区域设置", + "data.advancedSettings.format.formattingLocaleTitle": "格式区域设置", + "data.advancedSettings.format.numberFormat.numeralFormatLinkText": "数值格式", + "data.advancedSettings.format.numberFormatText": "“数字”格式的默认{numeralFormatLink}", + "data.advancedSettings.format.numberFormatTitle": "数字格式", + "data.advancedSettings.format.percentFormat.numeralFormatLinkText": "数值格式", + "data.advancedSettings.format.percentFormatText": "“百分比”格式的默认{numeralFormatLink}", + "data.advancedSettings.format.percentFormatTitle": "百分比格式", + "data.advancedSettings.histogram.barTargetText": "在日期直方图中使用“auto”时尝试生成大约此数目的条形", + "data.advancedSettings.histogram.barTargetTitle": "目标条形数", + "data.advancedSettings.histogram.maxBarsText": "在日期直方图中不要显示超过该数目的条形", + "data.advancedSettings.histogram.maxBarsTitle": "最大条形数", + "data.advancedSettings.historyLimitText": "在具有历史记录(例如查询输入)的字段中,显示此数目的最近值", + "data.advancedSettings.historyLimitTitle": "历史记录限制", + "data.advancedSettings.indexPatternPlaceholderText": "在“管理 > 索引模式 > 创建索引模式”中“索引模式名称”的占位符。", + "data.advancedSettings.indexPatternPlaceholderTitle": "索引模式占位符", + "data.advancedSettings.pinFiltersText": "筛选是否默认有全局状态(被固定)", + "data.advancedSettings.pinFiltersTitle": "默认固定筛选", + "data.advancedSettings.query.allowWildcardsText": "设置后,将允许 * 用作查询语句的第一个字符。当前仅在查询栏中启用实验性查询功能时才会应用。要在基本 lucene 查询中禁用前导通配符,请使用“{queryStringOptionsPattern}”。", + "data.advancedSettings.query.allowWildcardsTitle": "在查询中允许前导通配符", + "data.advancedSettings.query.queryStringOptions.optionsLinkText": "选项", + "data.advancedSettings.query.queryStringOptionsText": "lucene 查询字符串解析器的{optionsLink}。只有将“{queryLanguage}”设置为 {luceneLanguage} 时才会使用。", + "data.advancedSettings.query.queryStringOptionsTitle": "查询字符串选项", + "data.advancedSettings.searchQueryLanguageKql": "KQL", + "data.advancedSettings.searchQueryLanguageLucene": "Lucene", + "data.advancedSettings.searchQueryLanguageText": "查询栏使用的查询语言。KQL 是专门为 Kibana 打造的新型语言。", + "data.advancedSettings.searchQueryLanguageTitle": "查询语言", + "data.advancedSettings.shortenFieldsText": "缩短长字段,例如,不显示 foo.bar.baz,而显示 f.b.baz", + "data.advancedSettings.shortenFieldsTitle": "缩短字段", + "data.advancedSettings.sortOptions.optionsLinkText": "选项", + "data.advancedSettings.sortOptionsText": "Elasticsearch 排序参数的{optionsLink}", + "data.advancedSettings.sortOptionsTitle": "排序选项", + "data.advancedSettings.suggestFilterValuesText": "将此属性设置 false 以阻止筛选编辑器建议字段的值。", + "data.advancedSettings.suggestFilterValuesTitle": "筛选编辑器建议值", + "data.advancedSettings.timepicker.last15Minutes": "过去 15 分钟", + "data.advancedSettings.timepicker.last1Hour": "过去 1 小时", + "data.advancedSettings.timepicker.last1Year": "过去 1 年", + "data.advancedSettings.timepicker.last24Hours": "过去 24 小时", + "data.advancedSettings.timepicker.last30Days": "过去 30 天", + "data.advancedSettings.timepicker.last30Minutes": "过去 30 分钟", + "data.advancedSettings.timepicker.last7Days": "过去 7 天", + "data.advancedSettings.timepicker.last90Days": "过去 90 天", + "data.advancedSettings.timepicker.quickRanges.acceptedFormatsLinkText": "接受的格式", + "data.advancedSettings.timepicker.quickRangesText": "要在时间选取器的“速选”部分中显示的范围列表。这应该是对象数组,每个对象包含“from”、“to”(请参阅“{acceptedFormatsLink}”)和“display”(要显示的标题)。", + "data.advancedSettings.timepicker.quickRangesTitle": "时间筛选速选范围", + "data.advancedSettings.timepicker.refreshIntervalDefaultsText": "时间筛选的默认刷新时间间隔", + "data.advancedSettings.timepicker.refreshIntervalDefaultsTitle": "时间筛选刷新时间间隔", + "data.advancedSettings.timepicker.thisWeek": "本周", + "data.advancedSettings.timepicker.today": "今日", "data.aggTypes.buckets.ranges.rangesFormatMessage": "{gte} {from} 和 {lt} {to}", "data.common.kql.errors.endOfInputText": "输入结束", "data.common.kql.errors.fieldNameText": "字段名称", @@ -2050,25 +2125,10 @@ "inspector.requests.statisticsTabLabel": "统计信息", "inspector.title": "检查器", "inspector.view": "视图:{viewName}", - "kbn.advancedSettings.courier.batchSearchesText": "禁用时,仪表板面板将分别加载,用户离开时或更新查询时,\n 搜索请求将终止。启用时,仪表板面板将一起加载并加载所有数据,\n 搜索将不会终止。", - "kbn.advancedSettings.courier.batchSearchesTextDeprecation": "此设置已过时,将在 Kibana 8.0 中移除。", - "kbn.advancedSettings.courier.batchSearchesTitle": "批处理并发搜索", - "kbn.advancedSettings.courier.customRequestPreference.requestPreferenceLinkText": "请求首选项", - "kbn.advancedSettings.courier.customRequestPreferenceText": "将 “{setRequestReferenceSetting} 设置为 {customSettingValue} 时,将使用 “{requestPreferenceLink}”。", - "kbn.advancedSettings.courier.customRequestPreferenceTitle": "定制请求首选项", - "kbn.advancedSettings.courier.ignoreFilterText": "此配置增强对包含可视化的仪表板访问不同索引的支持。禁用时,将向所有可视化应用所有筛选。启用时,如果可视化的索引不包含筛选字段,则会为该可视化忽略筛选。", - "kbn.advancedSettings.courier.ignoreFilterTitle": "忽略筛选", - "kbn.advancedSettings.courier.maxRequestsText": "控制用于 Kibana 发送的 _msearch 请求的 “{maxRequestsLink}” 设置。设置为 0 可禁用此配置并使用 Elasticsearch 默认值。", - "kbn.advancedSettings.courier.maxRequestsTitle": "最大并发分片请求数", - "kbn.advancedSettings.courier.requestPreferenceCustom": "定制", - "kbn.advancedSettings.courier.requestPreferenceNone": "无", - "kbn.advancedSettings.courier.requestPreferenceSessionId": "会话 ID", - "kbn.advancedSettings.courier.requestPreferenceText": "允许您设置用于处理搜索请求的分片。
    \n
  • {sessionId}:仅限在相同分片上执行操作中的所有搜索请求。\n 这有利于在各个请求之间复用分片缓存。
  • \n
  • {custom}:允许您定义自己的首选项。\n 使用 courier:customRequestPreference 定制首选项值。
  • \n
  • {none}:表示不设置首选项。\n 这可能会提供更佳的性能,因此请求可以在所有分片副本上进行分配。\n 不过,结果可能会不一致,因为不同的分片可能处于不同的刷新状态。
  • \n
", - "kbn.advancedSettings.courier.requestPreferenceTitle": "请求首选项", - "kbn.advancedSettings.csv.quoteValuesText": "在 csv 导出中是否应使用引号引起值?", - "kbn.advancedSettings.csv.quoteValuesTitle": "使用引号引起 CSV 值", - "kbn.advancedSettings.csv.separatorText": "使用此字符串分隔导出的值", - "kbn.advancedSettings.csv.separatorTitle": "CSV 分隔符", + "share.advancedSettings.csv.quoteValuesText": "在 csv 导出中是否应使用引号引起值?", + "share.advancedSettings.csv.quoteValuesTitle": "使用引号引起 CSV 值", + "share.advancedSettings.csv.separatorText": "使用此字符串分隔导出的值", + "share.advancedSettings.csv.separatorTitle": "CSV 分隔符", "kbn.advancedSettings.darkModeText": "为 Kibana UI 启用深色模式需要刷新页面,才能应用设置。", "kbn.advancedSettings.darkModeTitle": "深色模式", "kbn.advancedSettings.dateFormat.dayOfWeekText": "一周从哪一日开始?", @@ -2084,38 +2144,11 @@ "kbn.advancedSettings.dateNanosFormatText": "用于 Elasticsearch 的 {dateNanosLink} 数据类型", "kbn.advancedSettings.dateNanosFormatTitle": "纳秒格式的日期", "kbn.advancedSettings.dateNanosLinkTitle": "date_nanos", - "kbn.advancedSettings.defaultIndexText": "未设置索引时要访问的索引", - "kbn.advancedSettings.defaultIndexTitle": "默认索引", "kbn.advancedSettings.defaultRoute.defaultRouteIsRelativeValidationMessage": "必须是相对 URL。", "kbn.advancedSettings.defaultRoute.defaultRouteText": "此设置指定打开 Kibana 时的默认路由。您可以使用此设置修改打开 Kibana 时的登陆页面。路由必须是相对 URL。", "kbn.advancedSettings.defaultRoute.defaultRouteTitle": "默认路由", "kbn.advancedSettings.disableAnimationsText": "在 Kibana UI 中关闭所有没有必要的动画。刷新页面以应用更改。", "kbn.advancedSettings.disableAnimationsTitle": "禁用动画", - "kbn.advancedSettings.format.bytesFormat.numeralFormatLinkText": "数值格式", - "kbn.advancedSettings.format.bytesFormatText": "“字节”格式的默认{numeralFormatLink}", - "kbn.advancedSettings.format.bytesFormatTitle": "字节格式", - "kbn.advancedSettings.format.currencyFormat.numeralFormatLinkText": "数值格式", - "kbn.advancedSettings.format.currencyFormatText": "“货币”格式的默认{numeralFormatLink}", - "kbn.advancedSettings.format.currencyFormatTitle": "货币格式", - "kbn.advancedSettings.format.defaultTypeMapText": "要默认用于每个字段类型的格式名称的映射。如果未显式提及字段类型,则将使用{defaultFormat}", - "kbn.advancedSettings.format.defaultTypeMapTitle": "字段类型格式名称", - "kbn.advancedSettings.format.formattingLocale.numeralLanguageLinkText": "数值语言", - "kbn.advancedSettings.format.formattingLocaleText": "{numeralLanguageLink}区域设置", - "kbn.advancedSettings.format.formattingLocaleTitle": "格式区域设置", - "kbn.advancedSettings.format.numberFormat.numeralFormatLinkText": "数值格式", - "kbn.advancedSettings.format.numberFormatText": "“数字”格式的默认{numeralFormatLink}", - "kbn.advancedSettings.format.numberFormatTitle": "数字格式", - "kbn.advancedSettings.format.percentFormat.numeralFormatLinkText": "数值格式", - "kbn.advancedSettings.format.percentFormatText": "“百分比”格式的默认{numeralFormatLink}", - "kbn.advancedSettings.format.percentFormatTitle": "百分比格式", - "kbn.advancedSettings.histogram.barTargetText": "在日期直方图中使用“auto”时尝试生成大约此数目的条形", - "kbn.advancedSettings.histogram.barTargetTitle": "目标条形数", - "kbn.advancedSettings.histogram.maxBarsText": "在日期直方图中不要显示超过该数目的条形", - "kbn.advancedSettings.histogram.maxBarsTitle": "最大条形数", - "kbn.advancedSettings.historyLimitText": "在具有历史记录(例如查询输入)的字段中,显示此数目的最近值", - "kbn.advancedSettings.historyLimitTitle": "历史记录限制", - "kbn.advancedSettings.indexPatternPlaceholderText": "在“管理 > 索引模式 > 创建索引模式”中“索引模式名称”的占位符。", - "kbn.advancedSettings.indexPatternPlaceholderTitle": "索引模式占位符", "kbn.advancedSettings.maxCellHeightText": "表中单元格应占用的最大高度。设置为 0 可禁用截短", "kbn.advancedSettings.maxCellHeightTitle": "最大表单元格高度", "kbn.advancedSettings.notifications.banner.markdownLinkText": "Markdown 受支持", @@ -2133,43 +2166,10 @@ "kbn.advancedSettings.pageNavigationLegacy": "旧版", "kbn.advancedSettings.pageNavigationModern": "现代", "kbn.advancedSettings.pageNavigationName": "侧边导航样式", - "kbn.advancedSettings.pinFiltersText": "筛选是否默认有全局状态(被固定)", - "kbn.advancedSettings.pinFiltersTitle": "默认固定筛选", - "kbn.advancedSettings.query.allowWildcardsText": "设置后,将允许 * 用作查询语句的第一个字符。当前仅在查询栏中启用实验性查询功能时才会应用。要在基本 lucene 查询中禁用前导通配符,请使用“{queryStringOptionsPattern}”。", - "kbn.advancedSettings.query.allowWildcardsTitle": "在查询中允许前导通配符", - "kbn.advancedSettings.query.queryStringOptions.optionsLinkText": "选项", - "kbn.advancedSettings.query.queryStringOptionsText": "lucene 查询字符串解析器的{optionsLink}。只有将“{queryLanguage}”设置为 {luceneLanguage} 时才会使用。", - "kbn.advancedSettings.query.queryStringOptionsTitle": "查询字符串选项", - "kbn.advancedSettings.searchQueryLanguageKql": "KQL", - "kbn.advancedSettings.searchQueryLanguageLucene": "Lucene", - "kbn.advancedSettings.searchQueryLanguageText": "查询栏使用的查询语言。KQL 是专门为 Kibana 打造的新型语言。", - "kbn.advancedSettings.searchQueryLanguageTitle": "查询语言", - "kbn.advancedSettings.shortenFieldsText": "缩短长字段,例如,不显示 foo.bar.baz,而显示 f.b.baz", - "kbn.advancedSettings.shortenFieldsTitle": "缩短字段", - "kbn.advancedSettings.sortOptions.optionsLinkText": "选项", - "kbn.advancedSettings.sortOptionsText": "Elasticsearch 排序参数的{optionsLink}", - "kbn.advancedSettings.sortOptionsTitle": "排序选项", "kbn.advancedSettings.storeUrlText": "URL 有时会变得过长,以使得某些浏览器无法处理。为此,我们正在测试将 URL 的各个组成部分存储在会话存储中是否会有帮助。请告知我们这样做的效果!", "kbn.advancedSettings.storeUrlTitle": "将 URL 存储在会话存储中", - "kbn.advancedSettings.suggestFilterValuesText": "将此属性设置 false 以阻止筛选编辑器建议字段的值。", - "kbn.advancedSettings.suggestFilterValuesTitle": "筛选编辑器建议值", - "kbn.advancedSettings.timepicker.last15Minutes": "过去 15 分钟", - "kbn.advancedSettings.timepicker.last1Hour": "过去 1 小时", - "kbn.advancedSettings.timepicker.last1Year": "过去 1 年", - "kbn.advancedSettings.timepicker.last24Hours": "过去 24 小时", - "kbn.advancedSettings.timepicker.last30Days": "过去 30 天", - "kbn.advancedSettings.timepicker.last30Minutes": "过去 30 分钟", - "kbn.advancedSettings.timepicker.last7Days": "过去 7 天", - "kbn.advancedSettings.timepicker.last90Days": "过去 90 天", - "kbn.advancedSettings.timepicker.quickRanges.acceptedFormatsLinkText": "接受的格式", - "kbn.advancedSettings.timepicker.quickRangesText": "要在时间选取器的“速选”部分中显示的范围列表。这应该是对象数组,每个对象包含“from”、“to”(请参阅“{acceptedFormatsLink}”)和“display”(要显示的标题)。", - "kbn.advancedSettings.timepicker.quickRangesTitle": "时间筛选速选范围", - "kbn.advancedSettings.timepicker.refreshIntervalDefaultsText": "时间筛选的默认刷新时间间隔", - "kbn.advancedSettings.timepicker.refreshIntervalDefaultsTitle": "时间筛选刷新时间间隔", - "kbn.advancedSettings.timepicker.thisWeek": "本周", "kbn.advancedSettings.timepicker.timeDefaultsText": "未使用时间筛选启动 Kibana 时要使用的时间筛选选择", "kbn.advancedSettings.timepicker.timeDefaultsTitle": "时间筛选默认值", - "kbn.advancedSettings.timepicker.today": "今日", "kbn.advancedSettings.visualization.showRegionMapWarningsText": "词无法联接到地图上的形状时,区域地图是否显示警告。", "kbn.advancedSettings.visualization.showRegionMapWarningsTitle": "显示区域地图警告", "kbn.advancedSettings.visualization.tileMap.maxPrecision.cellDimensionsLinkText": "单元格维度的解释", @@ -2178,8 +2178,8 @@ "kbn.advancedSettings.visualization.tileMap.wmsDefaults.propertiesLinkText": "属性", "kbn.advancedSettings.visualization.tileMap.wmsDefaultsText": "坐标地图中 WMS 地图服务器支持的默认{propertiesLink}", "kbn.advancedSettings.visualization.tileMap.wmsDefaultsTitle": "默认 WMS 属性", - "kbn.advancedSettings.visualizeEnableLabsText": "允许用户创建、查看和编辑实验性可视化。如果禁用,\n 仅被视为生产就绪的可视化可供用户使用。", - "kbn.advancedSettings.visualizeEnableLabsTitle": "启用实验性可视化", + "visualizations.advancedSettings.visualizeEnableLabsText": "允许用户创建、查看和编辑实验性可视化。如果禁用,\n 仅被视为生产就绪的可视化可供用户使用。", + "visualizations.advancedSettings.visualizeEnableLabsTitle": "启用实验性可视化", "kibana_legacy.bigUrlWarningNotificationMessage": "在{advancedSettingsLink}中启用“{storeInSessionStorageParam}”选项或简化屏幕视觉效果。", "kibana_legacy.bigUrlWarningNotificationMessage.advancedSettingsLinkText": "高级设置", "kibana_legacy.bigUrlWarningNotificationTitle": "URL 过长,Kibana 可能无法工作", diff --git a/x-pack/plugins/watcher/public/legacy/time_buckets.js b/x-pack/plugins/watcher/public/legacy/time_buckets.js index c1674bc68ab42c..9df254d2bb1e60 100644 --- a/x-pack/plugins/watcher/public/legacy/time_buckets.js +++ b/x-pack/plugins/watcher/public/legacy/time_buckets.js @@ -6,7 +6,7 @@ import _ from 'lodash'; import moment from 'moment'; -import { search, FIELD_FORMAT_IDS } from '../../../../../src/plugins/data/public'; +import { search, FIELD_FORMAT_IDS, UI_SETTINGS } from '../../../../../src/plugins/data/public'; import { calcAutoIntervalLessThan, calcAutoIntervalNear } from './calc_auto_interval'; import { convertDurationToNormalizedEsInterval, @@ -219,14 +219,14 @@ TimeBuckets.prototype.getInterval = function (useNormalizedEsInterval = true) { function readInterval() { const interval = self._i; if (moment.isDuration(interval)) return interval; - return calcAutoIntervalNear(self.getConfig('histogram:barTarget'), Number(duration)); + return calcAutoIntervalNear(self.getConfig(UI_SETTINGS.HISTOGRAM_BAR_TARGET), Number(duration)); } // check to see if the interval should be scaled, and scale it if so function maybeScaleInterval(interval) { if (!self.hasBounds()) return interval; - const maxLength = self.getConfig('histogram:maxBars'); + const maxLength = self.getConfig(UI_SETTINGS.HISTOGRAM_MAX_BARS); const approxLen = duration / interval; let scaled; diff --git a/x-pack/test/api_integration/apis/management/advanced_settings/feature_controls.ts b/x-pack/test/api_integration/apis/management/advanced_settings/feature_controls.ts index 80ffc8fd36e497..77e23bd74cc220 100644 --- a/x-pack/test/api_integration/apis/management/advanced_settings/feature_controls.ts +++ b/x-pack/test/api_integration/apis/management/advanced_settings/feature_controls.ts @@ -7,6 +7,7 @@ import expect from '@kbn/expect'; import { SuperTest } from 'supertest'; import { FtrProviderContext } from '../../../ftr_provider_context'; +import { CSV_QUOTE_VALUES_SETTING } from '../../../../../../src/plugins/share/common/constants'; export default function featureControlsTests({ getService }: FtrProviderContext) { const supertest: SuperTest = getService('supertestWithoutAuth'); @@ -32,7 +33,7 @@ export default function featureControlsTests({ getService }: FtrProviderContext) .post(`${basePath}/api/kibana/settings`) .auth(username, password) .set('kbn-xsrf', 'foo') - .send({ changes: { 'csv:quoteValues': null } }) + .send({ changes: { [CSV_QUOTE_VALUES_SETTING]: null } }) .then((response: any) => ({ error: undefined, response })) .catch((error: any) => ({ error, response: undefined })); } diff --git a/x-pack/test/functional/apps/dashboard/_async_dashboard.ts b/x-pack/test/functional/apps/dashboard/_async_dashboard.ts index 626ca6add6a3ca..b4dfffcdeff574 100644 --- a/x-pack/test/functional/apps/dashboard/_async_dashboard.ts +++ b/x-pack/test/functional/apps/dashboard/_async_dashboard.ts @@ -6,6 +6,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; +import { UI_SETTINGS } from '../../../../../src/plugins/data/common'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const retry = getService('retry'); @@ -95,7 +96,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { } ]`; - await kibanaServer.uiSettings.update({ 'timepicker:quickRanges': SAMPLE_DATA_RANGE }); + await kibanaServer.uiSettings.update({ + [UI_SETTINGS.TIMEPICKER_QUICK_RANGES]: SAMPLE_DATA_RANGE, + }); // refresh page to make sure ui settings update is picked up await browser.refresh(); await PageObjects.header.waitUntilLoadingHasFinished(); diff --git a/x-pack/test/functional/apps/maps/embeddable/dashboard.js b/x-pack/test/functional/apps/maps/embeddable/dashboard.js index 25770ea55a5d55..3c935b385cb39f 100644 --- a/x-pack/test/functional/apps/maps/embeddable/dashboard.js +++ b/x-pack/test/functional/apps/maps/embeddable/dashboard.js @@ -5,6 +5,7 @@ */ import expect from '@kbn/expect'; +import { UI_SETTINGS } from '../../../../../../src/plugins/data/common'; export default function ({ getPageObjects, getService }) { const PageObjects = getPageObjects(['common', 'dashboard', 'maps']); @@ -19,7 +20,7 @@ export default function ({ getPageObjects, getService }) { before(async () => { await kibanaServer.uiSettings.replace({ defaultIndex: 'c698b940-e149-11e8-a35a-370a8516603a', - 'courier:ignoreFilterIfFieldNotInIndex': true, + [UI_SETTINGS.COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX]: true, }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.loadSavedDashboard('map embeddable example'); @@ -27,7 +28,7 @@ export default function ({ getPageObjects, getService }) { after(async () => { await kibanaServer.uiSettings.replace({ - 'courier:ignoreFilterIfFieldNotInIndex': false, + [UI_SETTINGS.COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX]: false, }); });