2021-01-17 12:54:49 -08:00
|
|
|
import * as React from 'react';
|
|
|
|
import { Affix } from 'antd';
|
2021-08-31 22:00:56 -07:00
|
|
|
import { LegacyBrowsePath } from './LegacyBrowsePath';
|
2021-01-17 12:54:49 -08:00
|
|
|
import { useGetBrowsePathsQuery } from '../../graphql/browse.generated';
|
|
|
|
import { EntityType } from '../../types.generated';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
urn: string;
|
|
|
|
type: EntityType;
|
|
|
|
children: React.ReactNode;
|
2021-04-03 11:13:25 -07:00
|
|
|
lineageSupported?: boolean;
|
2021-04-23 00:18:39 -07:00
|
|
|
isBrowsable?: boolean;
|
2021-01-17 12:54:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-01-25 13:29:23 -08:00
|
|
|
* A entity-details page that includes a search header & entity browse path view
|
2021-01-17 12:54:49 -08:00
|
|
|
*/
|
2021-04-23 00:18:39 -07:00
|
|
|
export const BrowsableEntityPage = ({
|
|
|
|
urn: _urn,
|
|
|
|
type: _type,
|
|
|
|
children: _children,
|
|
|
|
lineageSupported,
|
|
|
|
isBrowsable,
|
|
|
|
}: Props) => {
|
2022-12-19 09:55:56 -08:00
|
|
|
const { data } = useGetBrowsePathsQuery({
|
|
|
|
variables: { input: { urn: _urn, type: _type } },
|
|
|
|
fetchPolicy: 'cache-first',
|
|
|
|
});
|
2021-01-17 12:54:49 -08:00
|
|
|
|
|
|
|
return (
|
2022-07-01 18:08:08 -04:00
|
|
|
<>
|
2021-01-17 12:54:49 -08:00
|
|
|
{data && data.browsePaths && data.browsePaths.length > 0 && (
|
2021-08-31 22:00:56 -07:00
|
|
|
<Affix offsetTop={60}>
|
|
|
|
<LegacyBrowsePath
|
2021-04-14 05:22:43 +08:00
|
|
|
type={_type}
|
|
|
|
path={data.browsePaths[0].path}
|
|
|
|
lineageSupported={lineageSupported}
|
|
|
|
isProfilePage
|
2021-04-23 00:18:39 -07:00
|
|
|
isBrowsable={isBrowsable}
|
2021-04-14 05:22:43 +08:00
|
|
|
/>
|
2021-01-17 12:54:49 -08:00
|
|
|
</Affix>
|
|
|
|
)}
|
|
|
|
{_children}
|
2022-07-01 18:08:08 -04:00
|
|
|
</>
|
2021-01-17 12:54:49 -08:00
|
|
|
);
|
|
|
|
};
|