diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx index 8a07c55c06e..da6dcff4a82 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx @@ -143,7 +143,7 @@ describe('Table', () => { const table = component.find('EuiBasicTable'); const columns = table.prop('columns') as any[]; const content = columns[1].render('My-Dashboard-test', item); - expect(content.props.href).toEqual('/w/ws-1/app/dashboards#/view/dashboard-1'); + expect(content.props.href).toEqual('http://localhost/w/ws-1/app/dashboards#/view/dashboard-1'); }); it('should handle query parse error', () => { diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.tsx index a80c0a0fd15..b7ffc285c03 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.tsx @@ -56,7 +56,7 @@ import { SavedObjectsManagementAction, SavedObjectsManagementColumnServiceStart, } from '../../../services'; -import { WORKSPACE_PATH_PREFIX } from '../../../../../../core/public/utils'; +import { formatUrlWithWorkspaceId } from '../../../../../../core/public/utils'; export interface TableProps { basePath: IBasePath; @@ -231,21 +231,20 @@ export class Table extends PureComponent { sortable: false, 'data-test-subj': 'savedObjectsTableRowTitle', render: (title: string, object: SavedObjectWithMetadata) => { - let { path = '' } = object.meta.inAppUrl || {}; + const { path = '' } = object.meta.inAppUrl || {}; const canGoInApp = this.props.canGoInApp(object); if (!canGoInApp) { return {title || getDefaultTitle(object)}; } + let inAppUrl = basePath.prepend(path); if (object.workspaces?.length) { // first workspace login user have permission const [workspaceId] = object.workspaces.filter((wsId) => visibleWsIds.includes(wsId)); - path = workspaceId ? `${WORKSPACE_PATH_PREFIX}/${workspaceId}${path}` : path; + if (workspaceId) { + inAppUrl = formatUrlWithWorkspaceId(path, workspaceId, basePath); + } } - return ( - - {title || getDefaultTitle(object)} - - ); + return {title || getDefaultTitle(object)}; }, } as EuiTableFieldDataColumnType>, {