Skip to content

Commit

Permalink
[Discover] Refresh fields when data view is edited (#149861)
Browse files Browse the repository at this point in the history
Closes #149838
  • Loading branch information
jughosta authored Feb 3, 2023
1 parent 136171a commit 62d3484
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ const DataViewFlyoutContentContainer = ({
}

if (saveResponse && !(saveResponse instanceof Error)) {
await dataViews.refreshFields(saveResponse);

if (persist) {
const message = i18n.translate('indexPatternEditor.saved', {
defaultMessage: "Saved '{indexPatternName}'",
Expand Down
7 changes: 6 additions & 1 deletion test/functional/apps/discover/group2/_data_view_edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

await PageObjects.discover.createAdHocDataView(initialPattern, true);
expect(await PageObjects.discover.getCurrentlySelectedDataView()).to.be(`${initialPattern}*`);

await retry.waitFor('current data view to get updated', async () => {
return (await PageObjects.discover.getCurrentlySelectedDataView()) === `${initialPattern}*`;
});
await PageObjects.discover.waitUntilSidebarHasLoaded();

expect(await PageObjects.discover.getHitCountInt()).to.be(2);
Expand All @@ -83,6 +86,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await retry.try(async () => {
expect(await PageObjects.discover.getHitCountInt()).to.be(1);
});

await PageObjects.discover.waitUntilSidebarHasLoaded();
expect((await PageObjects.discover.getAllFieldNames()).length).to.be(2);
});
});
Expand Down
3 changes: 3 additions & 0 deletions test/functional/page_objects/discover_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ export class DiscoverPageObject extends FtrService {
async createAdHocDataView(name: string, hasTimeField = false) {
await this.testSubjects.click('discover-dataView-switch-link');
await this.unifiedSearch.createNewDataView(name, true, hasTimeField);
await this.retry.waitFor('flyout to get closed', async () => {
return !(await this.testSubjects.exists('indexPatternEditor__form'));
});
}

async clickAddField() {
Expand Down

0 comments on commit 62d3484

Please sign in to comment.