2021-03-23 15:18:32 -07:00
|
|
|
import { EntityType, SearchResult } from '../../types.generated';
|
2021-04-09 11:55:25 -07:00
|
|
|
import { FetchedEntity } from '../lineage/types';
|
2021-02-03 11:49:51 -08:00
|
|
|
|
|
|
|
export enum PreviewType {
|
|
|
|
/**
|
|
|
|
* A preview shown within the search experience
|
|
|
|
*/
|
|
|
|
SEARCH,
|
|
|
|
/**
|
|
|
|
* A preview shown within the browse experience
|
|
|
|
*/
|
|
|
|
BROWSE,
|
|
|
|
/**
|
|
|
|
* A generic preview shown within other entity pages, etc.
|
|
|
|
*/
|
|
|
|
PREVIEW,
|
|
|
|
}
|
|
|
|
|
2021-02-23 12:45:42 -08:00
|
|
|
export enum IconStyleType {
|
|
|
|
/**
|
|
|
|
* Colored Icon
|
|
|
|
*/
|
|
|
|
HIGHLIGHT,
|
|
|
|
/**
|
|
|
|
* Grayed out icon
|
|
|
|
*/
|
|
|
|
ACCENT,
|
|
|
|
/**
|
|
|
|
* Rendered in a Tab pane header
|
|
|
|
*/
|
|
|
|
TAB_VIEW,
|
2021-04-17 00:46:02 +08:00
|
|
|
/**
|
|
|
|
* Rendered in Lineage as default
|
|
|
|
*/
|
|
|
|
SVG,
|
2021-02-23 12:45:42 -08:00
|
|
|
}
|
|
|
|
|
2021-02-03 11:49:51 -08:00
|
|
|
/**
|
|
|
|
* Base interface used for authoring DataHub Entities on the client side.
|
|
|
|
*
|
|
|
|
* <T> the generated GraphQL data type associated with the entity.
|
|
|
|
*/
|
|
|
|
export interface Entity<T> {
|
|
|
|
/**
|
|
|
|
* Corresponding GQL EntityType.
|
|
|
|
*/
|
|
|
|
type: EntityType;
|
|
|
|
|
2021-02-23 12:45:42 -08:00
|
|
|
/**
|
|
|
|
* Ant-design icon associated with the Entity. For a list of all candidate icons, see
|
|
|
|
* https://ant.design/components/icon/
|
|
|
|
*/
|
|
|
|
icon: (fontSize: number, styleType: IconStyleType) => JSX.Element;
|
|
|
|
|
2021-02-03 11:49:51 -08:00
|
|
|
/**
|
|
|
|
* Returns whether the entity search is enabled
|
|
|
|
*/
|
|
|
|
isSearchEnabled: () => boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether the entity browse is enabled
|
|
|
|
*/
|
|
|
|
isBrowseEnabled: () => boolean;
|
|
|
|
|
2021-04-09 11:55:25 -07:00
|
|
|
/**
|
|
|
|
* Returns whether the entity browse is enabled
|
|
|
|
*/
|
|
|
|
isLineageEnabled: () => boolean;
|
|
|
|
|
2021-02-03 11:49:51 -08:00
|
|
|
/**
|
|
|
|
* Returns the name of the entity as it appears in a URL, e.g. '/dataset/:urn'.
|
|
|
|
*/
|
|
|
|
getPathName: () => string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the plural name of the entity used when displaying collections (search, browse results), e.g. 'Datasets'.
|
|
|
|
*/
|
|
|
|
getCollectionName: () => string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders the 'profile' of the entity on an entity details page.
|
|
|
|
*/
|
|
|
|
renderProfile: (urn: string) => JSX.Element;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders a preview of the entity across different use cases like search, browse, etc.
|
|
|
|
*/
|
|
|
|
renderPreview: (type: PreviewType, data: T) => JSX.Element;
|
2021-03-23 15:18:32 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders a search result
|
|
|
|
*/
|
|
|
|
renderSearch: (result: SearchResult) => JSX.Element;
|
2021-04-09 11:55:25 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructs config to add entity to lineage viz
|
|
|
|
*/
|
|
|
|
getLineageVizConfig?: (entity: T) => FetchedEntity;
|
2021-02-03 11:49:51 -08:00
|
|
|
}
|