2021-07-28 20:39:05 -07:00
|
|
|
import * as React from 'react';
|
|
|
|
import { CodeSandboxOutlined } from '@ant-design/icons';
|
2022-04-12 22:42:12 -07:00
|
|
|
import { MlModelGroup, EntityType, SearchResult, OwnershipType } from '../../../types.generated';
|
2021-07-28 20:39:05 -07:00
|
|
|
import { Preview } from './preview/Preview';
|
|
|
|
import { Entity, IconStyleType, PreviewType } from '../Entity';
|
2021-10-26 21:23:08 -07:00
|
|
|
import { getDataForEntityType } from '../shared/containers/profile/utils';
|
2022-04-12 22:42:12 -07:00
|
|
|
import { GenericEntityProperties } from '../shared/types';
|
|
|
|
import { EntityProfile } from '../shared/containers/profile/EntityProfile';
|
|
|
|
import { SidebarDomainSection } from '../shared/containers/profile/sidebar/Domain/SidebarDomainSection';
|
|
|
|
import { SidebarOwnerSection } from '../shared/containers/profile/sidebar/Ownership/SidebarOwnerSection';
|
|
|
|
import { SidebarAboutSection } from '../shared/containers/profile/sidebar/SidebarAboutSection';
|
|
|
|
import { SidebarTagsSection } from '../shared/containers/profile/sidebar/SidebarTagsSection';
|
|
|
|
import { useGetMlModelGroupQuery } from '../../../graphql/mlModelGroup.generated';
|
|
|
|
import ModelGroupModels from './profile/ModelGroupModels';
|
|
|
|
import { DocumentationTab } from '../shared/tabs/Documentation/DocumentationTab';
|
2021-07-28 20:39:05 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Definition of the DataHub MlModelGroup entity.
|
|
|
|
*/
|
|
|
|
export class MLModelGroupEntity implements Entity<MlModelGroup> {
|
|
|
|
type: EntityType = EntityType.MlmodelGroup;
|
|
|
|
|
|
|
|
icon = (fontSize: number, styleType: IconStyleType) => {
|
|
|
|
if (styleType === IconStyleType.TAB_VIEW) {
|
|
|
|
return <CodeSandboxOutlined style={{ fontSize }} />;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (styleType === IconStyleType.HIGHLIGHT) {
|
|
|
|
return <CodeSandboxOutlined style={{ fontSize, color: '#9633b9' }} />;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<CodeSandboxOutlined
|
|
|
|
style={{
|
|
|
|
fontSize,
|
|
|
|
color: '#BFBFBF',
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
isSearchEnabled = () => true;
|
|
|
|
|
|
|
|
isBrowseEnabled = () => true;
|
|
|
|
|
|
|
|
isLineageEnabled = () => true;
|
|
|
|
|
|
|
|
getAutoCompleteFieldName = () => 'name';
|
|
|
|
|
|
|
|
getPathName = () => 'mlModelGroup';
|
|
|
|
|
2021-09-28 10:30:37 -07:00
|
|
|
getEntityName = () => 'ML Group';
|
|
|
|
|
2021-07-28 20:39:05 -07:00
|
|
|
getCollectionName = () => 'ML Groups';
|
|
|
|
|
2022-04-12 22:42:12 -07:00
|
|
|
getOverridePropertiesFromEntity = (_?: MlModelGroup | null): GenericEntityProperties => {
|
|
|
|
return {};
|
|
|
|
};
|
|
|
|
|
|
|
|
renderProfile = (urn: string) => (
|
|
|
|
<EntityProfile
|
|
|
|
urn={urn}
|
|
|
|
key={urn}
|
|
|
|
entityType={EntityType.MlmodelGroup}
|
|
|
|
useEntityQuery={useGetMlModelGroupQuery}
|
|
|
|
getOverrideProperties={this.getOverridePropertiesFromEntity}
|
2022-04-21 09:51:47 -07:00
|
|
|
showDeprecateOption
|
2022-04-12 22:42:12 -07:00
|
|
|
tabs={[
|
|
|
|
{
|
|
|
|
name: 'Models',
|
|
|
|
component: ModelGroupModels,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Documentation',
|
|
|
|
component: DocumentationTab,
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
sidebarSections={[
|
|
|
|
{
|
|
|
|
component: SidebarAboutSection,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: SidebarTagsSection,
|
|
|
|
properties: {
|
|
|
|
hasTags: true,
|
|
|
|
hasTerms: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: SidebarOwnerSection,
|
|
|
|
properties: {
|
|
|
|
defaultOwnerType: OwnershipType.TechnicalOwner,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: SidebarDomainSection,
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
);
|
2021-07-28 20:39:05 -07:00
|
|
|
|
|
|
|
renderPreview = (_: PreviewType, data: MlModelGroup) => {
|
|
|
|
return <Preview group={data} />;
|
|
|
|
};
|
|
|
|
|
|
|
|
renderSearch = (result: SearchResult) => {
|
|
|
|
const data = result.entity as MlModelGroup;
|
|
|
|
return <Preview group={data} />;
|
|
|
|
};
|
|
|
|
|
|
|
|
getLineageVizConfig = (entity: MlModelGroup) => {
|
|
|
|
return {
|
|
|
|
urn: entity.urn,
|
|
|
|
name: entity.name,
|
|
|
|
type: EntityType.MlmodelGroup,
|
2022-01-25 21:03:31 -06:00
|
|
|
icon: entity.platform?.properties?.logoUrl || undefined,
|
2021-10-22 15:46:46 -07:00
|
|
|
platform: entity.platform?.name,
|
2021-07-28 20:39:05 -07:00
|
|
|
};
|
|
|
|
};
|
2021-09-02 19:05:13 -07:00
|
|
|
|
|
|
|
displayName = (data: MlModelGroup) => {
|
|
|
|
return data.name;
|
|
|
|
};
|
2021-10-26 21:23:08 -07:00
|
|
|
|
|
|
|
getGenericEntityProperties = (mlModelGroup: MlModelGroup) => {
|
|
|
|
return getDataForEntityType({
|
|
|
|
data: mlModelGroup,
|
|
|
|
entityType: this.type,
|
|
|
|
getOverrideProperties: (data) => data,
|
|
|
|
});
|
|
|
|
};
|
2021-07-28 20:39:05 -07:00
|
|
|
}
|