Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data view mgmt] fix field refresh when index pattern is changed. #150403

Merged
merged 4 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ export const EditIndexPattern = withRouter(
const isRollup = new URLSearchParams(useLocation().search).get('type') === 'rollup';
const displayIndexPatternEditor = showEditDialog ? (
<IndexPatternEditor
onSave={() => setShowEditDialog(false)}
onSave={() => {
setFields(indexPattern.getNonScriptedFields());
setShowEditDialog(false);
}}
onCancel={() => setShowEditDialog(false)}
defaultTypeIsRollup={isRollup}
editData={indexPattern}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ const getItems = (conflictDescriptions: IndexedFieldItem['conflictDescriptions']
};

export const renderFieldName = (field: IndexedFieldItem, timeFieldName?: string) => (
<span>
<span data-test-subj={`field-name-${field.name}`}>
{field.name}
{field.info && field.info.length ? (
<span>
Expand Down
25 changes: 25 additions & 0 deletions test/functional/apps/management/_index_pattern_create_delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('creating and deleting default index', function describeIndexTests() {
before(async function () {
await esArchiver.emptyKibanaIndex();
await esArchiver.loadIfNeeded(
'test/functional/fixtures/es_archiver/kibana_sample_data_flights_index_pattern'
);
await kibanaServer.uiSettings.replace({});
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaIndexPatterns();
Expand Down Expand Up @@ -157,6 +160,28 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});

describe('index pattern edit', function () {
it('should update field list', async function () {
await PageObjects.settings.editIndexPattern(
'kibana_sample_data_flights',
'timestamp',
undefined,
true
);

await retry.try(async () => {
// verify initial field list
expect(await testSubjects.exists('field-name-AvgTicketPrice')).to.be(true);
});

await PageObjects.settings.editIndexPattern('logstash-*', '@timestamp', undefined, true);
await retry.try(async () => {
// verify updated field list
expect(await testSubjects.exists('field-name-agent')).to.be(true);
});
});
});

describe('index pattern deletion', function indexDelete() {
before(function () {
const expectedAlertText = 'Delete data view';
Expand Down