diff --git a/x-pack/legacy/plugins/epm/public/hooks/use_links.tsx b/x-pack/legacy/plugins/epm/public/hooks/use_links.tsx index d2436afb3395a..5ab57691ba88c 100644 --- a/x-pack/legacy/plugins/epm/public/hooks/use_links.tsx +++ b/x-pack/legacy/plugins/epm/public/hooks/use_links.tsx @@ -17,6 +17,7 @@ interface DetailParams { name: string; version: string; panel?: DetailViewPanelName; + withAppRoot?: boolean; } const removeRelativePath = (relativePath: string): string => @@ -47,17 +48,12 @@ export function useLinks() { return http.basePath.prepend(filePath); }, toListView: () => appRoot(patterns.LIST_VIEW), - toDetailView: ({ name, version, panel }: DetailParams) => { + toDetailView: ({ name, version, panel, withAppRoot = true }: DetailParams) => { // panel is optional, but `generatePath` won't accept `path: undefined` // so use this to pass `{ pkgkey }` or `{ pkgkey, panel }` const params = Object.assign({ pkgkey: `${name}-${version}` }, panel ? { panel } : {}); - return appRoot(generatePath(patterns.DETAIL_VIEW, params)); - }, - toDetailViewRelative: ({ name, version, panel }: DetailParams) => { - // panel is optional, but `generatePath` won't accept `path: undefined` - // so use this to pass `{ pkgkey }` or `{ pkgkey, panel }` - const params = Object.assign({ pkgkey: `${name}-${version}` }, panel ? { panel } : {}); - return generatePath(patterns.DETAIL_VIEW, params); + const path = generatePath(patterns.DETAIL_VIEW, params); + return withAppRoot ? appRoot(path) : path; }, toAddDataSourceView: ({ name, version }: { name: string; version: string }) => appRoot(generatePath(patterns.ADD_DATA_SOURCE_VIEW, { pkgkey: `${name}-${version}` })), diff --git a/x-pack/legacy/plugins/epm/public/screens/add_data_source/add_data_source_steps.tsx b/x-pack/legacy/plugins/epm/public/screens/add_data_source/add_data_source_steps.tsx index e48be23d636b4..50c41946c65e1 100644 --- a/x-pack/legacy/plugins/epm/public/screens/add_data_source/add_data_source_steps.tsx +++ b/x-pack/legacy/plugins/epm/public/screens/add_data_source/add_data_source_steps.tsx @@ -31,7 +31,7 @@ const FormNav = styled.div` export const AddDataSourceSteps = (props: AddDataSourceStepsProps) => { const [addDataSourceSuccess, setAddDataSourceSuccess] = useState(false); const { notifications } = useCore(); - const { toDetailViewRelative } = useLinks(); + const { toDetailView } = useLinks(); const { pkgName, pkgTitle, pkgVersion } = props; const handleRequestInstallDatasource = useCallback(async () => { try { @@ -59,7 +59,12 @@ export const AddDataSourceSteps = (props: AddDataSourceStepsProps) => { {addDataSourceSuccess ? ( ) : (