import * as React from 'react'; import { CodeSandboxOutlined } from '@ant-design/icons'; import { MlModel, EntityType, SearchResult } from '../../../types.generated'; import { Preview } from './preview/Preview'; import { MLModelProfile } from './profile/MLModelProfile'; import { Entity, IconStyleType, PreviewType } from '../Entity'; import getChildren from '../../lineage/utils/getChildren'; import { Direction } from '../../lineage/types'; /** * Definition of the DataHub MlModel entity. */ export class MLModelEntity implements Entity { type: EntityType = EntityType.Mlmodel; icon = (fontSize: number, styleType: IconStyleType) => { if (styleType === IconStyleType.TAB_VIEW) { return ; } if (styleType === IconStyleType.HIGHLIGHT) { return ; } return ( ); }; isSearchEnabled = () => true; isBrowseEnabled = () => true; isLineageEnabled = () => true; getAutoCompleteFieldName = () => 'name'; getPathName = () => 'mlModels'; getCollectionName = () => 'ML Models'; renderProfile = (urn: string) => ; renderPreview = (_: PreviewType, data: MlModel) => { return ; }; renderSearch = (result: SearchResult) => { const data = result.entity as MlModel; return ; }; getLineageVizConfig = (entity: MlModel) => { return { urn: entity.urn, name: entity.name, type: EntityType.Mlmodel, upstreamChildren: getChildren({ entity, type: EntityType.Mlmodel }, Direction.Upstream).map( (child) => child.entity.urn, ), downstreamChildren: getChildren({ entity, type: EntityType.Mlmodel }, Direction.Downstream).map( (child) => child.entity.urn, ), icon: entity.platform.info?.logoUrl || undefined, platform: entity.platform.name, }; }; }