Skip to content

Commit

Permalink
fix(ui) Fix broken dataPlatformInstance references in browseV2 (#8485)
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscollins3456 authored Jul 26, 2023
1 parent 2495b50 commit 4f961da
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 1 deletion.
2 changes: 2 additions & 0 deletions datahub-web-react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { ContainerEntity } from './app/entity/container/ContainerEntity';
import GlossaryNodeEntity from './app/entity/glossaryNode/GlossaryNodeEntity';
import { DataPlatformEntity } from './app/entity/dataPlatform/DataPlatformEntity';
import { DataProductEntity } from './app/entity/dataProduct/DataProductEntity';
import { DataPlatformInstanceEntity } from './app/entity/dataPlatformInstance/DataPlatformInstanceEntity';

/*
Construct Apollo Client
Expand Down Expand Up @@ -116,6 +117,7 @@ const App: React.VFC = () => {
register.register(new GlossaryNodeEntity());
register.register(new DataPlatformEntity());
register.register(new DataProductEntity());
register.register(new DataPlatformInstanceEntity());
return register;
}, []);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import * as React from 'react';
import { DataPlatformInstance, EntityType } from '../../../types.generated';
import { Entity } from '../Entity';
import { GenericEntityProperties } from '../shared/types';
import { getDataForEntityType } from '../shared/containers/profile/utils';

/**
* Definition of the DataHub DataPlatformInstance entity.
* Most of this still needs to be filled out.
*/
export class DataPlatformInstanceEntity implements Entity<DataPlatformInstance> {
type: EntityType = EntityType.DataPlatformInstance;

icon = () => {
return <></>;
};

isSearchEnabled = () => false;

isBrowseEnabled = () => false;

isLineageEnabled = () => false;

getAutoCompleteFieldName = () => 'name';

getPathName = () => 'dataPlatformInstance';

getEntityName = () => 'Data Platform Instance';

getCollectionName = () => 'Data Platform Instances';

renderProfile = () => <></>;

getOverridePropertiesFromEntity = (): GenericEntityProperties => {
return {};
};

renderPreview = () => {
return <></>;
};

renderSearch = () => {
return <></>;
};

displayName = (data: DataPlatformInstance) => {
return data?.instanceId || data.urn;
};

getGenericEntityProperties = (data: DataPlatformInstance) => {
return getDataForEntityType({
data,
entityType: this.type,
getOverrideProperties: this.getOverridePropertiesFromEntity,
});
};

supportedCapabilities = () => {
return new Set([]);
};
}
3 changes: 2 additions & 1 deletion datahub-web-react/src/app/search/sidebar/BrowseNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from './BrowseContext';
import useSidebarAnalytics from './useSidebarAnalytics';
import EntityLink from './EntityLink';
import { EntityType } from '../../../types.generated';

const FolderStyled = styled(FolderOutlined)`
font-size: 16px;
Expand All @@ -42,7 +43,7 @@ const BrowseNode = () => {
const platformAggregation = usePlatformAggregation();
const browseResultGroup = useBrowseResultGroup();
const { count, entity } = browseResultGroup;
const hasEntityLink = !!entity;
const hasEntityLink = !!entity && entity.type !== EntityType.DataPlatformInstance;
const displayName = useBrowseDisplayName();
const { trackSelectNodeEvent, trackToggleNodeEvent } = useSidebarAnalytics();

Expand Down
3 changes: 3 additions & 0 deletions datahub-web-react/src/graphql/fragments.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1112,4 +1112,7 @@ fragment entityDisplayNameFields on Entity {
name
}
}
... on DataPlatformInstance {
instanceId
}
}

0 comments on commit 4f961da

Please sign in to comment.