Skip to content

Commit

Permalink
feat(ui) Add sorting to the Usage column & fix entity type name in Li…
Browse files Browse the repository at this point in the history
…neage Drawer (#6290)
  • Loading branch information
Ankit-Keshari-Vituity authored Nov 1, 2022
1 parent 873b100 commit 96848d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,23 @@ export default function SchemaTable({
},
};

// Function to get the count of each usageStats fieldPath
function getCount(fieldPath: any) {
const data: any =
usageStats?.aggregations?.fields &&
usageStats?.aggregations?.fields.find((field) => {
return field?.fieldName === fieldPath;
});
return data && data.count;
}

const usageColumn = {
width: '10%',
title: 'Usage',
dataIndex: 'fieldPath',
key: 'usage',
render: usageStatsRenderer,
sorter: (sourceA, sourceB) => getCount(sourceA.fieldPath) - getCount(sourceB.fieldPath),
};

const menuColumn = {
Expand Down
3 changes: 1 addition & 2 deletions datahub-web-react/src/app/lineage/LineageExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { EntityAndType, EntitySelectParams, FetchedEntities } from './types';
import LineageViz from './LineageViz';
import extendAsyncEntities from './utils/extendAsyncEntities';
import { EntityType } from '../../types.generated';
import { capitalizeFirstLetter } from '../shared/textUtil';
import { ANTD_GRAY } from '../entity/shared/constants';
import { GetEntityLineageQuery, useGetEntityLineageQuery } from '../../graphql/lineage.generated';
import { useIsSeparateSiblingsMode } from '../entity/shared/siblingUtils';
Expand Down Expand Up @@ -184,7 +183,7 @@ export default function LineageExplorer({ urn, type }: Props) {
Close
</Button>
<Button href={entityRegistry.getEntityUrl(selectedEntity.type, selectedEntity.urn)}>
<InfoCircleOutlined /> {capitalizeFirstLetter(selectedEntity.type)} Details
<InfoCircleOutlined /> {entityRegistry.getEntityName(selectedEntity.type)} Details
</Button>
</FooterButtonGroup>
)
Expand Down

0 comments on commit 96848d5

Please sign in to comment.