Skip to content

Commit

Permalink
[Time to Visualize] Disable Visualize URL Tracker When Linked to Orig…
Browse files Browse the repository at this point in the history
…inatingApp (#92917)

* changed url tracker for visualize to not save when linked to originating app
  • Loading branch information
ThomThomson authored Mar 2, 2021
1 parent cce6861 commit 41b81a1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/plugins/visualize/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ export class VisualizePlugin
],
getHistory: () => this.currentHistory!,
onBeforeNavLinkSaved: (urlToSave: string) => {
if (
!urlToSave.includes(`${VisualizeConstants.EDIT_PATH}/`) &&
this.isLinkedToOriginatingApp?.()
) {
if (this.isLinkedToOriginatingApp?.()) {
return core.http.basePath.prepend(VisualizeConstants.VISUALIZE_BASE_PATH);
}
return urlToSave;
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/dashboard/create_and_add_embeddables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.dashboard.waitForRenderComplete();
});

it('saves the saved visualization url to the app link', async () => {
it('saves the listing page instead of the visualization to the app link', async () => {
await PageObjects.header.clickVisualize(true);
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(VisualizeConstants.EDIT_PATH);
expect(currentUrl).not.to.contain(VisualizeConstants.EDIT_PATH);
});

after(async () => {
Expand Down
18 changes: 18 additions & 0 deletions test/functional/apps/dashboard/edit_visualizations.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,24 @@ export default function ({ getService, getPageObjects }) {
expect(await testSubjects.exists('visualizationLandingPage')).to.be(true);
});

it('visualize app menu navigates to the visualize listing page if the last opened visualization was linked to dashboard', async () => {
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.gotoDashboardLandingPage();
await PageObjects.dashboard.clickNewDashboard();

// Create markdown by reference.
await createMarkdownVis('by reference');

// Edit then save and return
await editMarkdownVis();
await PageObjects.visualize.saveVisualizationAndReturn();

await PageObjects.header.waitUntilLoadingHasFinished();
await appsMenu.clickLink('Visualize Library');
await PageObjects.common.clickConfirmOnModal();
expect(await testSubjects.exists('visualizationLandingPage')).to.be(true);
});

describe('by value', () => {
it('save and return button returns to dashboard after editing visualization with changes saved', async () => {
await PageObjects.common.navigateToApp('dashboard');
Expand Down

0 comments on commit 41b81a1

Please sign in to comment.