Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ describe('Test legacy route helpers', () => {
},
] as Location[];
const expected = [
'/app/observability-dashboards#/notebooks/GQ5icXwBJCegTOBKO4Um',
'/app/observability-dashboards#/notebooks/clPiPXwBEM7l9gC0xTpA?view=view_both',
`/testBasePath/app/observability-dashboards#/notebooks/GQ5icXwBJCegTOBKO4Um?_g=(time:(from:'2021-10-15T20:25:09.556Z',to:'2021-10-15T20:55:09.556Z'))&view=output_only&security_tenant=global`,
] as RedirectProps['to'][];
'/app/observability-notebooks#/GQ5icXwBJCegTOBKO4Um',
'/app/observability-notebooks#/clPiPXwBEM7l9gC0xTpA?view=view_both',
`/testBasePath/app/observability-notebooks#/GQ5icXwBJCegTOBKO4Um?_g=(time:(from:'2021-10-15T20:25:09.556Z',to:'2021-10-15T20:55:09.556Z'))&view=output_only&security_tenant=global`,
] as Array<RedirectProps['to']>;
expect(locations.map((location) => convertLegacyNotebooksUrl(location))).toEqual(expected);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { observabilityID } from "../../../../../common/constants/shared";
import { observabilityNotebookID } from '../../../../../common/constants/shared';

export const convertLegacyNotebooksUrl = (location: Location)=> {
const pathname = location.pathname.replace('notebooks-dashboards', observabilityID);
const hash = `#/notebooks${location.hash.replace(/^#/, '')}${
export const convertLegacyNotebooksUrl = (location: Location) => {
const pathname = location.pathname.replace('notebooks-dashboards', observabilityNotebookID);
const hash = `${location.hash}${
location.hash.includes('?') ? location.search.replace(/^\?/, '&') : location.search
}`;
return pathname + hash;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ export const generateInContextReport = async (
toggleReportingLoadingModal(true);
let baseUrl =
location.pathname +
location.hash.replace(/\?view=(view_both|input_only|output_only)/, '') +
'?view=output_only';
location.hash.replace(/view=(view_both|input_only|output_only)/, 'view=output_only');
// Add selected tenant info to url
try {
const tenant = await getTenantInfoIfExists();
Expand Down