Skip to content

Commit

Permalink
[Advanced Settings] Fix defaultIndex setting's default value (#170865)
Browse files Browse the repository at this point in the history
Fixes #168732

## Summary

This PR changes the default value of the `defaultIndex` setting to an
empty string. Previously, the default value was set to `null` and this
was causing a wrong behaviour in the Advanced Settings UI as it expects
a string value for the settings of type `string`.

**Before - the "Reset to default" link did not clear the user value:**


https://github.com/elastic/kibana/assets/59341489/2c47306b-feac-4e08-bbae-3db7b0a3e5fd


**With these changes:**


https://github.com/elastic/kibana/assets/59341489/dc46caa8-9860-4b66-87ca-9c184c5a8391
  • Loading branch information
ElenaStoeva authored Dec 11, 2023
1 parent d065840 commit 946b38e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/plugins/data/server/ui_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
});
});
});
Expand Down

0 comments on commit 946b38e

Please sign in to comment.