Skip to content

Commit 870a529

Browse files
authored
[Time to Visualize] Disable Visualize URL Tracker When Linked to OriginatingApp (#92917) (#93251)
* changed url tracker for visualize to not save when linked to originating app
1 parent dfb217b commit 870a529

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

src/plugins/visualize/public/plugin.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ export class VisualizePlugin
116116
],
117117
getHistory: () => this.currentHistory!,
118118
onBeforeNavLinkSaved: (urlToSave: string) => {
119-
if (
120-
!urlToSave.includes(`${VisualizeConstants.EDIT_PATH}/`) &&
121-
this.isLinkedToOriginatingApp?.()
122-
) {
119+
if (this.isLinkedToOriginatingApp?.()) {
123120
return core.http.basePath.prepend(VisualizeConstants.VISUALIZE_BASE_PATH);
124121
}
125122
return urlToSave;

test/functional/apps/dashboard/create_and_add_embeddables.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
6969
await PageObjects.dashboard.waitForRenderComplete();
7070
});
7171

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

7878
after(async () => {

test/functional/apps/dashboard/edit_visualizations.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,24 @@ export default function ({ getService, getPageObjects }) {
109109
expect(await testSubjects.exists('visualizationLandingPage')).to.be(true);
110110
});
111111

112+
it('visualize app menu navigates to the visualize listing page if the last opened visualization was linked to dashboard', async () => {
113+
await PageObjects.common.navigateToApp('dashboard');
114+
await PageObjects.dashboard.gotoDashboardLandingPage();
115+
await PageObjects.dashboard.clickNewDashboard();
116+
117+
// Create markdown by reference.
118+
await createMarkdownVis('by reference');
119+
120+
// Edit then save and return
121+
await editMarkdownVis();
122+
await PageObjects.visualize.saveVisualizationAndReturn();
123+
124+
await PageObjects.header.waitUntilLoadingHasFinished();
125+
await appsMenu.clickLink('Visualize Library');
126+
await PageObjects.common.clickConfirmOnModal();
127+
expect(await testSubjects.exists('visualizationLandingPage')).to.be(true);
128+
});
129+
112130
describe('by value', () => {
113131
it('save and return button returns to dashboard after editing visualization with changes saved', async () => {
114132
await PageObjects.common.navigateToApp('dashboard');

0 commit comments

Comments
 (0)