diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_panel/customize_panel_action.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_panel/customize_panel_action.tsx index 4f73baa981587..172c05d330a7d 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_panel/customize_panel_action.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_panel/customize_panel_action.tsx @@ -71,9 +71,6 @@ export class CustomizePanelAction implements Action closed$.next(true); handle.close(); }; - const closeFlyout = () => { - close(); - }; const handle = this.overlays.openFlyout( toMountPoint( @@ -101,6 +98,6 @@ export class CustomizePanelAction implements Action filter((mode) => mode !== ViewMode.EDIT), take(1) ) - .subscribe({ next: closeFlyout, complete: closeFlyout }); + .subscribe({ next: close, complete: close }); } } diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_panel/customize_panel_editor.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_panel/customize_panel_editor.tsx index c982304b61c68..12575eb23279d 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_panel/customize_panel_editor.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_panel/customize_panel_editor.tsx @@ -96,7 +96,7 @@ export const CustomizePanelEditor = (props: CustomizePanelProps) => { ); const commonlyUsedRangesForDatePicker = props.commonlyUsedRanges - ? props.commonlyUsedRanges!.map( + ? props.commonlyUsedRanges.map( ({ from, to, display }: { from: string; to: string; display: string }) => { return { start: from, @@ -246,7 +246,7 @@ export const CustomizePanelEditor = (props: CustomizePanelProps) => { { expect(descriptionFieldAfter.props().value).toBe(''); expect(updateInput).toBeCalledWith({ description: '', title: '' }); }); - -// TODO -test.skip('Can set a custom time range for the panel', async () => {}); diff --git a/test/functional/apps/dashboard/group5/data_shared_attributes.ts b/test/functional/apps/dashboard/group5/data_shared_attributes.ts index f27bc900ea806..71d8a16b2f7d8 100644 --- a/test/functional/apps/dashboard/group5/data_shared_attributes.ts +++ b/test/functional/apps/dashboard/group5/data_shared_attributes.ts @@ -78,7 +78,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.expectCustomizePanelSettingsFlyoutOpen(); await dashboardCustomizePanel.setCustomPanelTitle(CUSTOM_VIS_TITLE); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await dashboardCustomizePanel.expectCustomizePanelSettingsFlyoutClosed(); await retry.try(async () => { @@ -95,7 +95,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.expectCustomizePanelSettingsFlyoutOpen(); await dashboardCustomizePanel.clickToggleHidePanelTitle(); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await dashboardCustomizePanel.expectCustomizePanelSettingsFlyoutClosed(); }; await toggleHideTitle(); @@ -114,7 +114,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.dashboard.switchToEditMode(); await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.resetCustomPanelTitle(); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await dashboardCustomizePanel.expectCustomizePanelSettingsFlyoutClosed(); await retry.try(async () => { @@ -133,7 +133,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboardPanelActions.customizePanel(el); await dashboardCustomizePanel.expectCustomizePanelSettingsFlyoutOpen(); await dashboardCustomizePanel.setCustomPanelTitle(CUSTOM_SEARCH_TITLE); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await dashboardCustomizePanel.expectCustomizePanelSettingsFlyoutClosed(); await retry.try(async () => { diff --git a/test/functional/apps/dashboard/group5/share.ts b/test/functional/apps/dashboard/group5/share.ts index 08c494611b9c8..b6a2e9811e51f 100644 --- a/test/functional/apps/dashboard/group5/share.ts +++ b/test/functional/apps/dashboard/group5/share.ts @@ -131,7 +131,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should have "panels" in app state when a panel has been modified', async () => { await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.setCustomPanelTitle('Test New Title'); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await PageObjects.dashboard.waitForRenderComplete(); await testSubjects.existOrFail('dashboardUnsavedChangesBadge'); diff --git a/test/functional/services/dashboard/panel_settings.ts b/test/functional/services/dashboard/panel_settings.ts index 13dc8a24f20d1..e21410f34a739 100644 --- a/test/functional/services/dashboard/panel_settings.ts +++ b/test/functional/services/dashboard/panel_settings.ts @@ -93,8 +93,8 @@ export function DashboardCustomizePanelProvider({ getService }: FtrProviderConte await testSubjects.click('resetCustomEmbeddablePanelDescriptionButton'); } - public async clickFlyoutPrimaryButton() { - log.debug('clickFlyoutPrimaryButton'); + public async clickSaveButton() { + log.debug('clickSaveButton'); await testSubjects.click('saveCustomizePanelButton'); } diff --git a/x-pack/test/functional/apps/dashboard/group2/panel_time_range.ts b/x-pack/test/functional/apps/dashboard/group2/panel_time_range.ts index 9a7be027350cb..ee07446783603 100644 --- a/x-pack/test/functional/apps/dashboard/group2/panel_time_range.ts +++ b/x-pack/test/functional/apps/dashboard/group2/panel_time_range.ts @@ -47,7 +47,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboardCustomizePanel.clickToggleShowCustomTimeRange(); await dashboardCustomizePanel.clickToggleQuickMenuButton(); await dashboardCustomizePanel.clickCommonlyUsedTimeRange('Last_30 days'); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await PageObjects.dashboard.waitForRenderComplete(); await dashboardBadgeActions.expectExistsTimeRangeBadgeAction(); expect(await testSubjects.exists('emptyPlaceholder')); @@ -57,7 +57,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('can remove a custom time range from a panel', async () => { await dashboardBadgeActions.clickTimeRangeBadgeAction(); await dashboardCustomizePanel.clickToggleShowCustomTimeRange(); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await PageObjects.dashboard.waitForRenderComplete(); await dashboardBadgeActions.expectMissingTimeRangeBadgeAction(); expect(await testSubjects.exists('xyVisChart')); @@ -71,7 +71,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboardCustomizePanel.clickToggleShowCustomTimeRange(); await dashboardCustomizePanel.clickToggleQuickMenuButton(); await dashboardCustomizePanel.clickCommonlyUsedTimeRange('Last_30 days'); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await PageObjects.dashboard.waitForRenderComplete(); await dashboardBadgeActions.expectExistsTimeRangeBadgeAction(); expect(await testSubjects.exists('emptyPlaceholder')); @@ -81,7 +81,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('can remove a custom time range from a panel', async () => { await dashboardBadgeActions.clickTimeRangeBadgeAction(); await dashboardCustomizePanel.clickToggleShowCustomTimeRange(); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await PageObjects.dashboard.waitForRenderComplete(); await dashboardBadgeActions.expectMissingTimeRangeBadgeAction(); expect(await testSubjects.exists('xyVisChart')); diff --git a/x-pack/test/functional/apps/dashboard/group2/panel_titles.ts b/x-pack/test/functional/apps/dashboard/group2/panel_titles.ts index ab06a3a509ebe..14970ba7764ab 100644 --- a/x-pack/test/functional/apps/dashboard/group2/panel_titles.ts +++ b/x-pack/test/functional/apps/dashboard/group2/panel_titles.ts @@ -52,14 +52,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('saving new panel with blank title clears "unsaved changes" badge', async () => { await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.setCustomPanelTitle(''); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await PageObjects.dashboard.clearUnsavedChanges(); }); it('custom title causes unsaved changes and saving clears it', async () => { await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.setCustomPanelTitle(CUSTOM_TITLE); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); const panelTitle = (await PageObjects.dashboard.getPanelTitles())[0]; expect(panelTitle).to.equal(CUSTOM_TITLE); await PageObjects.dashboard.clearUnsavedChanges(); @@ -69,11 +69,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const BY_VALUE_TITLE = 'Reset Title - By Value'; await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.setCustomPanelTitle(BY_VALUE_TITLE); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.resetCustomPanelTitle(); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); const panelTitle = (await PageObjects.dashboard.getPanelTitles())[0]; expect(panelTitle).to.equal(EMPTY_TITLE); await PageObjects.dashboard.clearUnsavedChanges(); @@ -90,7 +90,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.dashboard.switchToEditMode(); await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.setCustomPanelTitle(CUSTOM_TITLE); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await PageObjects.dashboard.clickQuickSave(); await PageObjects.dashboard.clickCancelOutOfEditMode(); @@ -102,7 +102,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.dashboard.switchToEditMode(); await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.clickToggleHidePanelTitle(); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await PageObjects.dashboard.clickQuickSave(); await PageObjects.dashboard.clickCancelOutOfEditMode(); @@ -113,7 +113,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.dashboard.switchToEditMode(); await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.clickToggleHidePanelTitle(); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await PageObjects.dashboard.clickQuickSave(); }); }); @@ -122,7 +122,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('linking a by value panel with a custom title to the library will overwrite the custom title with the library title', async () => { await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.setCustomPanelTitle(CUSTOM_TITLE); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await dashboardPanelActions.saveToLibrary(LIBRARY_TITLE_FOR_CUSTOM_TESTS); await retry.try(async () => { // need to surround in 'retry' due to delays in HTML updates causing the title read to be behind @@ -134,11 +134,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('resetting title on a by reference panel sets it to the library title', async () => { await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.setCustomPanelTitle('This should go away'); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.resetCustomPanelTitle(); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); const resetPanelTitle = (await PageObjects.dashboard.getPanelTitles())[0]; expect(resetPanelTitle).to.equal(LIBRARY_TITLE_FOR_CUSTOM_TESTS); }); @@ -146,7 +146,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('unlinking a by reference panel with a custom title will keep the current title', async () => { await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.setCustomPanelTitle(CUSTOM_TITLE); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await dashboardPanelActions.unlinkFromLibary(); const newPanelTitle = (await PageObjects.dashboard.getPanelTitles())[0]; expect(newPanelTitle).to.equal(CUSTOM_TITLE); @@ -155,7 +155,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it("linking a by value panel with a blank title to the library will set the panel's title to the library title", async () => { await dashboardPanelActions.customizePanel(); await dashboardCustomizePanel.setCustomPanelTitle(''); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await dashboardPanelActions.saveToLibrary(LIBRARY_TITLE_FOR_EMPTY_TESTS); await retry.try(async () => { // need to surround in 'retry' due to delays in HTML updates causing the title read to be behind diff --git a/x-pack/test/functional/apps/dashboard/group3/drilldowns/explore_data_panel_action.ts b/x-pack/test/functional/apps/dashboard/group3/drilldowns/explore_data_panel_action.ts index f3c512ce91273..8e943c2b3104d 100644 --- a/x-pack/test/functional/apps/dashboard/group3/drilldowns/explore_data_panel_action.ts +++ b/x-pack/test/functional/apps/dashboard/group3/drilldowns/explore_data_panel_action.ts @@ -47,7 +47,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await panelActions.customizePanel(); await dashboardCustomizePanel.clickToggleShowCustomTimeRange(); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await dashboard.saveDashboard('Dashboard with Pie Chart'); }); @@ -83,7 +83,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboardCustomizePanel.clickToggleShowCustomTimeRange(); await dashboardCustomizePanel.clickToggleQuickMenuButton(); await dashboardCustomizePanel.clickCommonlyUsedTimeRange('Last_90 days'); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await dashboard.saveDashboard('Dashboard with Pie Chart'); diff --git a/x-pack/test/functional/apps/discover/saved_searches.ts b/x-pack/test/functional/apps/discover/saved_searches.ts index 4adef6d4d3f4e..f043c1985e702 100644 --- a/x-pack/test/functional/apps/discover/saved_searches.ts +++ b/x-pack/test/functional/apps/discover/saved_searches.ts @@ -56,7 +56,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dashboardCustomizePanel.clickToggleShowCustomTimeRange(); await dashboardCustomizePanel.clickToggleQuickMenuButton(); await dashboardCustomizePanel.clickCommonlyUsedTimeRange('Last_90 days'); - await dashboardCustomizePanel.clickFlyoutPrimaryButton(); + await dashboardCustomizePanel.clickSaveButton(); await PageObjects.header.waitUntilLoadingHasFinished(); expect(await dataGrid.hasNoResults()).to.be(true);