import { AppstoreOutlined, FileDoneOutlined, FileOutlined, UnorderedListOutlined } from '@ant-design/icons'; import { ListBullets } from '@phosphor-icons/react'; import * as React from 'react'; import DomainIcon from '@app/domain/DomainIcon'; import { Entity, EntityCapabilityType, IconStyleType, PreviewType } from '@app/entityV2/Entity'; import DataProductsTab from '@app/entityV2/domain/DataProductsTab/DataProductsTab'; import { DomainEntitiesTab } from '@app/entityV2/domain/DomainEntitiesTab'; import { Preview } from '@app/entityV2/domain/preview/Preview'; import { DomainSummaryTab } from '@app/entityV2/domain/summary/DomainSummaryTab'; import { EntityMenuItems } from '@app/entityV2/shared/EntityDropdown/EntityMenuActions'; import { EntityProfileTab } from '@app/entityV2/shared/constants'; import { EntityProfile } from '@app/entityV2/shared/containers/profile/EntityProfile'; import { SidebarAboutSection } from '@app/entityV2/shared/containers/profile/sidebar/AboutSection/SidebarAboutSection'; import SidebarEntitiesSection from '@app/entityV2/shared/containers/profile/sidebar/Domain/SidebarEntitiesSection'; import { SidebarOwnerSection } from '@app/entityV2/shared/containers/profile/sidebar/Ownership/sidebar/SidebarOwnerSection'; import SidebarEntityHeader from '@app/entityV2/shared/containers/profile/sidebar/SidebarEntityHeader'; import StatusSection from '@app/entityV2/shared/containers/profile/sidebar/shared/StatusSection'; import { getDataForEntityType } from '@app/entityV2/shared/containers/profile/utils'; import { EntityActionItem } from '@app/entityV2/shared/entity/EntityActions'; import SidebarNotesSection from '@app/entityV2/shared/sidebarSection/SidebarNotesSection'; import SidebarStructuredProperties from '@app/entityV2/shared/sidebarSection/SidebarStructuredProperties'; import { SUMMARY_TAB_ICON } from '@app/entityV2/shared/summary/HeaderComponents'; import { DocumentationTab } from '@app/entityV2/shared/tabs/Documentation/DocumentationTab'; import { PropertiesTab } from '@app/entityV2/shared/tabs/Properties/PropertiesTab'; import { useGetDomainQuery } from '@graphql/domain.generated'; import { Domain, EntityType, SearchResult } from '@types'; const headerDropdownItems = new Set([ EntityMenuItems.MOVE, EntityMenuItems.SHARE, EntityMenuItems.DELETE, EntityMenuItems.ANNOUNCE, ]); /** * Definition of the DataHub Domain entity. */ export class DomainEntity implements Entity { type: EntityType = EntityType.Domain; icon = (fontSize?: number, styleType?: IconStyleType, color?: string) => { if (styleType === IconStyleType.TAB_VIEW) { return ; } if (styleType === IconStyleType.HIGHLIGHT) { return ; } if (styleType === IconStyleType.SVG) { return ( ); } return ; }; isSearchEnabled = () => true; isBrowseEnabled = () => false; isLineageEnabled = () => false; getAutoCompleteFieldName = () => 'name'; getGraphName = () => 'domain'; getPathName = () => this.getGraphName(); getEntityName = () => 'Domain'; getCollectionName = () => 'Domains'; useEntityQuery = useGetDomainQuery; renderProfile = (urn: string) => ( { return entityData?.entities?.total; }, component: DomainEntitiesTab, icon: AppstoreOutlined, }, { id: EntityProfileTab.DOCUMENTATION_TAB, name: 'Documentation', component: DocumentationTab, icon: FileOutlined, }, { id: EntityProfileTab.DATA_PRODUCTS_TAB, name: 'Data Products', getCount: (entityData, _) => { return entityData?.dataProducts?.total; }, component: DataProductsTab, icon: FileDoneOutlined, }, { name: 'Properties', component: PropertiesTab, icon: UnorderedListOutlined, }, ]} sidebarSections={this.getSidebarSections()} sidebarTabs={this.getSidebarTabs()} /> ); getSidebarSections = () => [ { component: SidebarEntityHeader, }, { component: SidebarAboutSection, }, { component: SidebarNotesSection, }, { component: SidebarEntitiesSection, }, { component: SidebarOwnerSection, }, { component: SidebarStructuredProperties, }, { component: StatusSection, }, ]; getSidebarTabs = () => [ { name: 'Properties', component: PropertiesTab, description: 'View additional properties about this asset', icon: ListBullets, }, ]; renderPreview = (previewType: PreviewType, data: Domain) => { const genericProperties = this.getGenericEntityProperties(data); return ( ); }; renderSearch = (result: SearchResult) => { const data = result.entity as Domain; const genericProperties = this.getGenericEntityProperties(data); return ( ); }; displayName = (data: Domain) => { return data?.properties?.name || data?.id || data.urn; }; getOverridePropertiesFromEntity = (data: Domain) => { return { name: data.properties?.name, }; }; getGenericEntityProperties = (data: Domain) => { return getDataForEntityType({ data, entityType: this.type, getOverrideProperties: this.getOverridePropertiesFromEntity, }); }; supportedCapabilities = () => { // TODO.. Determine whether SOFT_DELETE should go into here. return new Set([EntityCapabilityType.OWNERS]); }; }