[8.12] [Advanced Settings] Fix defaultIndex setting's default value (#170865) (#173027)

# Backport

This will backport the following commits from `main` to `8.12`:
- [[Advanced Settings] Fix defaultIndex setting's default value
(#170865)](https://github.com/elastic/kibana/pull/170865)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Elena
Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-12-11T10:01:01Z","message":"[Advanced
Settings] Fix defaultIndex setting's default value (#170865)\n\nFixes
https://github.com/elastic/kibana/issues/168732\r\n\r\n##
Summary\r\n\r\nThis PR changes the default value of the `defaultIndex`
setting to an\r\nempty string. Previously, the default value was set to
`null` and this\r\nwas causing a wrong behaviour in the Advanced
Settings UI as it expects\r\na string value for the settings of type
`string`.\r\n\r\n**Before - the \"Reset to default\" link did not clear
the user
value:**\r\n\r\n\r\n2c47306b-feac-4e08-bbae-3db7b0a3e5fd\r\n\r\n\r\n**With
these
changes:**\r\n\r\n\r\ndc46caa8-9860-4b66-87ca-9c184c5a8391","sha":"946b38ed577ddfccf1fb022d7fa1ff6e9cdd1606","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Kibana
Management","Team:Deployment
Management","release_note:skip","backport:prev-minor","v8.12.0","v8.13.0"],"number":170865,"url":"https://github.com/elastic/kibana/pull/170865","mergeCommit":{"message":"[Advanced
Settings] Fix defaultIndex setting's default value (#170865)\n\nFixes
https://github.com/elastic/kibana/issues/168732\r\n\r\n##
Summary\r\n\r\nThis PR changes the default value of the `defaultIndex`
setting to an\r\nempty string. Previously, the default value was set to
`null` and this\r\nwas causing a wrong behaviour in the Advanced
Settings UI as it expects\r\na string value for the settings of type
`string`.\r\n\r\n**Before - the \"Reset to default\" link did not clear
the user
value:**\r\n\r\n\r\n2c47306b-feac-4e08-bbae-3db7b0a3e5fd\r\n\r\n\r\n**With
these
changes:**\r\n\r\n\r\ndc46caa8-9860-4b66-87ca-9c184c5a8391","sha":"946b38ed577ddfccf1fb022d7fa1ff6e9cdd1606"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/170865","number":170865,"mergeCommit":{"message":"[Advanced
Settings] Fix defaultIndex setting's default value (#170865)\n\nFixes
https://github.com/elastic/kibana/issues/168732\r\n\r\n##
Summary\r\n\r\nThis PR changes the default value of the `defaultIndex`
setting to an\r\nempty string. Previously, the default value was set to
`null` and this\r\nwas causing a wrong behaviour in the Advanced
Settings UI as it expects\r\na string value for the settings of type
`string`.\r\n\r\n**Before - the \"Reset to default\" link did not clear
the user
value:**\r\n\r\n\r\n2c47306b-feac-4e08-bbae-3db7b0a3e5fd\r\n\r\n\r\n**With
these
changes:**\r\n\r\n\r\ndc46caa8-9860-4b66-87ca-9c184c5a8391","sha":"946b38ed577ddfccf1fb022d7fa1ff6e9cdd1606"}}]}]
BACKPORT-->

Co-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2023-12-11 06:16:26 -05:00 committed by GitHub
parent 59564402ab
commit 93cff0aacd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -168,12 +168,12 @@ export function getUiSettings(
name: i18n.translate('data.advancedSettings.defaultIndexTitle', {
defaultMessage: 'Default data view',
}),
value: null,
value: '',
type: 'string',
description: i18n.translate('data.advancedSettings.defaultIndexText', {
defaultMessage: 'Used by discover and visualizations when a data view is not set.',
}),
schema: schema.nullable(schema.string()),
schema: schema.string(),
},
[UI_SETTINGS.COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX]: {
name: i18n.translate('data.advancedSettings.courier.ignoreFilterTitle', {

View file

@ -48,7 +48,7 @@ export default function ({ getService }: FtrProviderContext) {
expect(response5.status).to.be(200);
const response6 = await supertest.get(defaultPath);
expect(response6.body[serviceKeyId]).to.be(null);
expect(response6.body[serviceKeyId]).to.be('');
});
});
});

View file

@ -72,7 +72,7 @@ export default function ({ getService }: FtrProviderContext) {
// TODO: The response comes back undefined in Serverless
const body = response6.body[serviceKeyId];
const expected = body === undefined ? null : body;
expect(expected).to.be(null);
expect(expected).to.be('');
});
});
});