2025-04-16 16:55:38 -07:00
|
|
|
import { Infinity, ChartScatter, FileText, ListBullets, TreeStructure, WarningCircle } from '@phosphor-icons/react';
|
|
|
|
import * as React from 'react';
|
|
|
|
|
2025-02-19 10:50:13 -08:00
|
|
|
import { IncidentTab } from '@app/entity/shared/tabs/Incident/IncidentTab';
|
2025-04-16 16:55:38 -07:00
|
|
|
import { GenericEntityProperties } from '@app/entity/shared/types';
|
|
|
|
import { Entity, EntityCapabilityType, IconStyleType, PreviewType } from '@app/entityV2/Entity';
|
|
|
|
import { Preview } from '@app/entityV2/mlFeature/preview/Preview';
|
|
|
|
import { EntityMenuItems } from '@app/entityV2/shared/EntityDropdown/EntityMenuActions';
|
|
|
|
import { TYPE_ICON_CLASS_NAME } from '@app/entityV2/shared/components/subtypes';
|
|
|
|
import { EntityProfile } from '@app/entityV2/shared/containers/profile/EntityProfile';
|
|
|
|
import { SidebarAboutSection } from '@app/entityV2/shared/containers/profile/sidebar/AboutSection/SidebarAboutSection';
|
2025-06-11 09:26:40 -04:00
|
|
|
import { SidebarApplicationSection } from '@app/entityV2/shared/containers/profile/sidebar/Applications/SidebarApplicationSection';
|
2025-04-16 16:55:38 -07:00
|
|
|
import DataProductSection from '@app/entityV2/shared/containers/profile/sidebar/DataProduct/DataProductSection';
|
|
|
|
import { SidebarDomainSection } from '@app/entityV2/shared/containers/profile/sidebar/Domain/SidebarDomainSection';
|
|
|
|
import { SidebarOwnerSection } from '@app/entityV2/shared/containers/profile/sidebar/Ownership/sidebar/SidebarOwnerSection';
|
|
|
|
import SidebarEntityHeader from '@app/entityV2/shared/containers/profile/sidebar/SidebarEntityHeader';
|
|
|
|
import { SidebarGlossaryTermsSection } from '@app/entityV2/shared/containers/profile/sidebar/SidebarGlossaryTermsSection';
|
|
|
|
import { SidebarTagsSection } from '@app/entityV2/shared/containers/profile/sidebar/SidebarTagsSection';
|
|
|
|
import StatusSection from '@app/entityV2/shared/containers/profile/sidebar/shared/StatusSection';
|
|
|
|
import { getDataForEntityType } from '@app/entityV2/shared/containers/profile/utils';
|
|
|
|
import SidebarNotesSection from '@app/entityV2/shared/sidebarSection/SidebarNotesSection';
|
|
|
|
import SidebarStructuredProperties from '@app/entityV2/shared/sidebarSection/SidebarStructuredProperties';
|
|
|
|
import { DocumentationTab } from '@app/entityV2/shared/tabs/Documentation/DocumentationTab';
|
|
|
|
import { LineageTab } from '@app/entityV2/shared/tabs/Lineage/LineageTab';
|
|
|
|
import { FeatureTableTab } from '@app/entityV2/shared/tabs/ML/MlFeatureFeatureTableTab';
|
|
|
|
import { PropertiesTab } from '@app/entityV2/shared/tabs/Properties/PropertiesTab';
|
|
|
|
import { SidebarTitleActionType, getDataProduct, isOutputPort } from '@app/entityV2/shared/utils';
|
|
|
|
|
|
|
|
import { useGetMlFeatureQuery } from '@graphql/mlFeature.generated';
|
|
|
|
import { EntityType, MlFeature, SearchResult } from '@types';
|
2025-01-29 20:42:01 -05:00
|
|
|
|
|
|
|
const headerDropdownItems = new Set([
|
|
|
|
EntityMenuItems.UPDATE_DEPRECATION,
|
|
|
|
EntityMenuItems.RAISE_INCIDENT,
|
|
|
|
EntityMenuItems.ANNOUNCE,
|
|
|
|
]);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Definition of the DataHub MLFeature entity.
|
|
|
|
*/
|
|
|
|
export class MLFeatureEntity implements Entity<MlFeature> {
|
|
|
|
type: EntityType = EntityType.Mlfeature;
|
|
|
|
|
|
|
|
icon = (fontSize?: number, styleType?: IconStyleType, color?: string) => {
|
|
|
|
if (styleType === IconStyleType.TAB_VIEW) {
|
2025-03-31 08:58:01 -07:00
|
|
|
return <ChartScatter className={TYPE_ICON_CLASS_NAME} style={{ fontSize, color }} weight="regular" />;
|
2025-01-29 20:42:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (styleType === IconStyleType.HIGHLIGHT) {
|
|
|
|
return (
|
2025-03-31 08:58:01 -07:00
|
|
|
<ChartScatter
|
|
|
|
className={TYPE_ICON_CLASS_NAME}
|
|
|
|
style={{ fontSize, color: color || '#9633b9' }}
|
|
|
|
weight="regular"
|
|
|
|
/>
|
2025-01-29 20:42:01 -05:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2025-03-31 08:58:01 -07:00
|
|
|
<ChartScatter
|
2025-01-29 20:42:01 -05:00
|
|
|
className={TYPE_ICON_CLASS_NAME}
|
2025-08-04 10:18:26 -07:00
|
|
|
style={{ fontSize: fontSize || 'inherit', color: color || 'inherit' }}
|
2025-03-31 08:58:01 -07:00
|
|
|
weight="regular"
|
2025-01-29 20:42:01 -05:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
isSearchEnabled = () => true;
|
|
|
|
|
|
|
|
isBrowseEnabled = () => false;
|
|
|
|
|
|
|
|
isLineageEnabled = () => true;
|
|
|
|
|
|
|
|
getAutoCompleteFieldName = () => 'name';
|
|
|
|
|
|
|
|
getGraphName = () => 'mlFeature';
|
|
|
|
|
|
|
|
getPathName = () => 'features';
|
|
|
|
|
|
|
|
getEntityName = () => 'Feature';
|
|
|
|
|
|
|
|
getCollectionName = () => 'Features';
|
|
|
|
|
|
|
|
getOverridePropertiesFromEntity = (feature?: MlFeature | null): GenericEntityProperties => {
|
|
|
|
return {
|
|
|
|
// eslint-disable-next-line
|
|
|
|
platform: feature?.['featureTables']?.relationships?.[0]?.entity?.platform,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
useEntityQuery = useGetMlFeatureQuery;
|
|
|
|
|
|
|
|
renderProfile = (urn: string) => (
|
|
|
|
<EntityProfile
|
|
|
|
urn={urn}
|
|
|
|
key={urn}
|
|
|
|
entityType={EntityType.Mlfeature}
|
|
|
|
useEntityQuery={useGetMlFeatureQuery}
|
|
|
|
getOverrideProperties={this.getOverridePropertiesFromEntity}
|
|
|
|
headerDropdownItems={headerDropdownItems}
|
|
|
|
tabs={[
|
|
|
|
{
|
|
|
|
name: 'Feature Tables',
|
|
|
|
component: FeatureTableTab,
|
2025-03-31 08:58:01 -07:00
|
|
|
icon: Infinity,
|
2025-01-29 20:42:01 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Documentation',
|
|
|
|
component: DocumentationTab,
|
2025-03-31 08:58:01 -07:00
|
|
|
icon: FileText,
|
2025-01-29 20:42:01 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Lineage',
|
|
|
|
component: LineageTab,
|
2025-03-31 08:58:01 -07:00
|
|
|
icon: TreeStructure,
|
2025-06-04 15:04:27 -07:00
|
|
|
supportsFullsize: true,
|
2025-01-29 20:42:01 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Properties',
|
|
|
|
component: PropertiesTab,
|
2025-03-31 08:58:01 -07:00
|
|
|
icon: ListBullets,
|
2025-01-29 20:42:01 -05:00
|
|
|
},
|
2025-02-19 10:50:13 -08:00
|
|
|
{
|
|
|
|
name: 'Incidents',
|
2025-03-31 08:58:01 -07:00
|
|
|
icon: WarningCircle,
|
2025-02-19 10:50:13 -08:00
|
|
|
component: IncidentTab,
|
2025-07-08 17:58:08 -04:00
|
|
|
getCount: (_, mlFeature) => {
|
|
|
|
return mlFeature?.mlFeature?.activeIncidents?.total;
|
2025-02-19 10:50:13 -08:00
|
|
|
},
|
|
|
|
},
|
2025-01-29 20:42:01 -05:00
|
|
|
]}
|
|
|
|
sidebarSections={this.getSidebarSections()}
|
|
|
|
sidebarTabs={this.getSidebarTabs()}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
|
|
|
|
getSidebarSections = () => [
|
|
|
|
{
|
|
|
|
component: SidebarEntityHeader,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: SidebarAboutSection,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: SidebarNotesSection,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: SidebarOwnerSection,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: SidebarDomainSection,
|
|
|
|
},
|
2025-06-11 09:26:40 -04:00
|
|
|
{
|
|
|
|
component: SidebarApplicationSection,
|
|
|
|
},
|
2025-01-29 20:42:01 -05:00
|
|
|
{
|
|
|
|
component: DataProductSection,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: SidebarTagsSection,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: SidebarGlossaryTermsSection,
|
|
|
|
},
|
|
|
|
{
|
2025-02-19 10:50:13 -08:00
|
|
|
component: SidebarStructuredProperties,
|
2025-01-29 20:42:01 -05:00
|
|
|
},
|
|
|
|
{
|
2025-02-19 10:50:13 -08:00
|
|
|
component: StatusSection,
|
2025-01-29 20:42:01 -05:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
getSidebarTabs = () => [
|
|
|
|
{
|
|
|
|
name: 'Lineage',
|
|
|
|
component: LineageTab,
|
|
|
|
description: "View this data asset's upstream and downstream dependencies",
|
2025-03-31 08:58:01 -07:00
|
|
|
icon: TreeStructure,
|
2025-01-29 20:42:01 -05:00
|
|
|
properties: {
|
|
|
|
actionType: SidebarTitleActionType.LineageExplore,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Properties',
|
|
|
|
component: PropertiesTab,
|
|
|
|
description: 'View additional properties about this asset',
|
2025-03-31 08:58:01 -07:00
|
|
|
icon: ListBullets,
|
2025-01-29 20:42:01 -05:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
renderPreview = (previewType: PreviewType, data: MlFeature) => {
|
|
|
|
const genericProperties = this.getGenericEntityProperties(data);
|
|
|
|
// eslint-disable-next-line
|
|
|
|
const platform = data?.['featureTables']?.relationships?.[0]?.entity?.platform;
|
|
|
|
return (
|
|
|
|
<Preview
|
|
|
|
urn={data.urn}
|
|
|
|
data={genericProperties}
|
|
|
|
name={data.name || ''}
|
|
|
|
featureNamespace={data.featureNamespace || ''}
|
|
|
|
description={data.description}
|
|
|
|
owners={data.ownership?.owners}
|
|
|
|
platform={platform}
|
|
|
|
dataProduct={getDataProduct(genericProperties?.dataProduct)}
|
|
|
|
headerDropdownItems={headerDropdownItems}
|
|
|
|
previewType={previewType}
|
|
|
|
browsePaths={data.browsePathV2 || undefined}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
renderSearch = (result: SearchResult) => {
|
|
|
|
const data = result.entity as MlFeature;
|
|
|
|
const genericProperties = this.getGenericEntityProperties(data);
|
|
|
|
// eslint-disable-next-line
|
|
|
|
const platform = data?.['featureTables']?.relationships?.[0]?.entity?.platform;
|
|
|
|
return (
|
|
|
|
<Preview
|
|
|
|
urn={data.urn}
|
|
|
|
data={genericProperties}
|
|
|
|
name={data.name || ''}
|
|
|
|
featureNamespace={data.featureNamespace || ''}
|
|
|
|
description={data.description || ''}
|
|
|
|
owners={data.ownership?.owners}
|
|
|
|
dataProduct={getDataProduct(genericProperties?.dataProduct)}
|
|
|
|
platform={platform}
|
|
|
|
platformInstanceId={data.dataPlatformInstance?.instanceId}
|
|
|
|
degree={(result as any).degree}
|
|
|
|
paths={(result as any).paths}
|
|
|
|
isOutputPort={isOutputPort(result)}
|
|
|
|
headerDropdownItems={headerDropdownItems}
|
|
|
|
browsePaths={data.browsePathV2 || undefined}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
displayName = (data: MlFeature) => {
|
|
|
|
return data.name || data.urn;
|
|
|
|
};
|
|
|
|
|
|
|
|
getGenericEntityProperties = (mlFeature: MlFeature) => {
|
|
|
|
return getDataForEntityType({
|
|
|
|
data: mlFeature,
|
|
|
|
entityType: this.type,
|
|
|
|
getOverrideProperties: this.getOverridePropertiesFromEntity,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
getLineageVizConfig = (entity: MlFeature) => {
|
|
|
|
return {
|
|
|
|
urn: entity.urn,
|
|
|
|
name: entity.name,
|
|
|
|
type: EntityType.Mlfeature,
|
|
|
|
// eslint-disable-next-line
|
|
|
|
icon: entity?.['featureTables']?.relationships?.[0]?.entity?.platform?.properties?.logoUrl || undefined,
|
|
|
|
// eslint-disable-next-line
|
|
|
|
platform: entity?.['featureTables']?.relationships?.[0]?.entity?.platform,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
supportedCapabilities = () => {
|
|
|
|
return new Set([
|
|
|
|
EntityCapabilityType.OWNERS,
|
|
|
|
EntityCapabilityType.GLOSSARY_TERMS,
|
|
|
|
EntityCapabilityType.TAGS,
|
|
|
|
EntityCapabilityType.DOMAINS,
|
|
|
|
EntityCapabilityType.DEPRECATION,
|
|
|
|
EntityCapabilityType.SOFT_DELETE,
|
|
|
|
EntityCapabilityType.DATA_PRODUCTS,
|
|
|
|
EntityCapabilityType.LINEAGE,
|
2025-06-11 09:26:40 -04:00
|
|
|
EntityCapabilityType.APPLICATIONS,
|
2025-01-29 20:42:01 -05:00
|
|
|
]);
|
|
|
|
};
|
|
|
|
}
|