mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Links] Don't close the flyout if the user cancels save to library (#188995)
Fixes #188931 ## Summary Fixes Links panel flyout closing if the user cancels the Save modal
This commit is contained in:
parent
e1e5d2893d
commit
47c7137a95
3 changed files with 17 additions and 2 deletions
|
@ -76,7 +76,7 @@ export const runSaveToLibrary = async (
|
|||
});
|
||||
return { id };
|
||||
} catch (error) {
|
||||
reject();
|
||||
reject(error);
|
||||
return { error };
|
||||
}
|
||||
};
|
||||
|
|
|
@ -96,11 +96,13 @@ export async function openEditorFlyout({
|
|||
options: { references },
|
||||
});
|
||||
resolve(newState);
|
||||
closeEditorFlyout(editorFlyout);
|
||||
} else {
|
||||
const saveResult = await runSaveToLibrary(newState);
|
||||
resolve(saveResult);
|
||||
// If saveResult is undefined, the user cancelled the save as modal and we should not close the flyout
|
||||
if (saveResult) closeEditorFlyout(editorFlyout);
|
||||
}
|
||||
closeEditorFlyout(editorFlyout);
|
||||
};
|
||||
|
||||
const onAddToDashboard = (newLinks: ResolvedLink[], newLayout: LinksLayoutType) => {
|
||||
|
|
|
@ -82,6 +82,19 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
await dashboard.clickDiscardChanges();
|
||||
});
|
||||
|
||||
it('does not close the flyout when the user cancels the save as modal', async () => {
|
||||
await dashboardAddPanel.clickEditorMenuButton();
|
||||
await dashboardAddPanel.clickAddNewPanelFromUIActionLink('Links');
|
||||
await createSomeLinks();
|
||||
await dashboardLinks.toggleSaveByReference(true);
|
||||
await dashboardLinks.clickPanelEditorSaveButton();
|
||||
|
||||
await testSubjects.exists('savedObjectSaveModal');
|
||||
await testSubjects.click('saveCancelButton');
|
||||
await testSubjects.existOrFail('links--panelEditor--flyout');
|
||||
await dashboardLinks.clickPanelEditorCloseButton();
|
||||
});
|
||||
|
||||
describe('by-value links panel', async () => {
|
||||
it('can create a new by-value links panel', async () => {
|
||||
await dashboardAddPanel.clickEditorMenuButton();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue