2021-02-03 11:49:51 -08:00
|
|
|
import React from 'react';
|
|
|
|
import { useParams } from 'react-router-dom';
|
|
|
|
import { EntityType } from '../../types.generated';
|
|
|
|
import { BrowsableEntityPage } from '../browse/BrowsableEntityPage';
|
2021-04-03 11:13:25 -07:00
|
|
|
import LineageExplorer from '../lineage/LineageExplorer';
|
|
|
|
import useIsLineageMode from '../lineage/utils/useIsLineageMode';
|
2021-03-13 07:55:29 -08:00
|
|
|
import { SearchablePage } from '../search/SearchablePage';
|
2021-02-03 11:49:51 -08:00
|
|
|
import { useEntityRegistry } from '../useEntityRegistry';
|
|
|
|
|
|
|
|
interface RouteParams {
|
|
|
|
urn: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
entityType: EntityType;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Responsible for rendering an Entity Profile
|
|
|
|
*/
|
|
|
|
export const EntityPage = ({ entityType }: Props) => {
|
|
|
|
const { urn } = useParams<RouteParams>();
|
|
|
|
const entityRegistry = useEntityRegistry();
|
2021-03-13 07:55:29 -08:00
|
|
|
const isBrowsable = entityRegistry.getEntity(entityType).isBrowseEnabled();
|
2021-04-23 00:18:39 -07:00
|
|
|
const isLineageSupported = entityRegistry.getEntity(entityType).isLineageEnabled();
|
|
|
|
const ContainerPage = isBrowsable || isLineageSupported ? BrowsableEntityPage : SearchablePage;
|
2021-04-03 11:13:25 -07:00
|
|
|
const isLineageMode = useIsLineageMode();
|
|
|
|
|
2021-02-03 11:49:51 -08:00
|
|
|
return (
|
2021-04-23 00:18:39 -07:00
|
|
|
<ContainerPage isBrowsable={isBrowsable} urn={urn} type={entityType} lineageSupported={isLineageSupported}>
|
2021-04-09 11:55:25 -07:00
|
|
|
{isLineageMode && isLineageSupported ? (
|
|
|
|
<LineageExplorer type={entityType} urn={urn} />
|
|
|
|
) : (
|
|
|
|
entityRegistry.renderProfile(entityType, urn)
|
|
|
|
)}
|
2021-03-13 07:55:29 -08:00
|
|
|
</ContainerPage>
|
2021-02-03 11:49:51 -08:00
|
|
|
);
|
|
|
|
};
|