diff --git a/catalog-rest-service/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.component.tsx b/catalog-rest-service/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.component.tsx index 67cc1dc1831..95ce701821c 100644 --- a/catalog-rest-service/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.component.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/components/DatasetDetails/DatasetDetails.component.tsx @@ -18,7 +18,6 @@ import { getUserTeams, } from '../../utils/CommonUtils'; import { getTagsWithoutTier, getUsagePercentile } from '../../utils/TableUtils'; -import { getRelativeDay } from '../../utils/TimeUtils'; import Description from '../common/description/Description'; import EntityPageInfo from '../common/entityPageInfo/EntityPageInfo'; import TabsPane from '../common/TabsPane/TabsPane'; @@ -28,6 +27,7 @@ import FrequentlyJoinedTables from '../FrequentlyJoinedTables/FrequentlyJoinedTa import ManageTab from '../ManageTab/ManageTab.component'; import SchemaTab from '../SchemaTab/SchemaTab.component'; import TableProfiler from '../TableProfiler/TableProfiler.component'; +import TableProfilerGraph from '../TableProfiler/TableProfilerGraph.component'; import { DatasetDetailsProps } from './DatasetDetails.interface'; const DatasetDetails: React.FC = ({ @@ -168,29 +168,10 @@ const DatasetDetails: React.FC = ({ return freqJoin; }; - const getProfilerRowDiff = (tableProfile: Table['tableProfile']) => { - let retDiff; - if (tableProfile && tableProfile.length > 0) { - let rowDiff: string | number = tableProfile[0].rowCount || 0; - const dayDiff = getRelativeDay( - tableProfile[0].profileDate - ? new Date(tableProfile[0].profileDate).getTime() - : Date.now() - ); - if (tableProfile.length > 1) { - rowDiff = rowDiff - (tableProfile[1].rowCount || 0); - } - retDiff = `${(rowDiff >= 0 ? '+' : '') + rowDiff} rows ${dayDiff}`; - } - - return retDiff; - }; - - const profilerRowDiff = getProfilerRowDiff(tableProfile); const extraInfo: Array<{ key?: string; - value: string | number; + value: string | number | React.ReactNode; isLink?: boolean; placeholderText?: string; openInNewTab?: boolean; @@ -208,13 +189,6 @@ const DatasetDetails: React.FC = ({ { key: 'Tier', value: tier ? tier.split('.')[1] : '' }, { key: 'Usage', value: usage }, { key: 'Queries', value: `${weeklyUsageCount} past week` }, - { - key: 'Rows', - value: - tableProfile && tableProfile[0]?.rowCount - ? tableProfile[0].rowCount - : '--', - }, { key: 'Columns', value: @@ -222,12 +196,31 @@ const DatasetDetails: React.FC = ({ ? tableProfile[0].columnCount : '--', }, + { + key: 'Rows', + value: tableProfile ? ( + ({ + date: d.profileDate, + value: d.rowCount ?? 0, + })) + .reverse() as Array<{ + date: Date; + value: number; + }> + } + height={38} + toolTipPos={{ x: 20, y: -30 }} + /> + ) : ( + '--' + ), + }, ]; - if (!isNil(profilerRowDiff)) { - extraInfo.push({ value: profilerRowDiff }); - } - const onDescriptionEdit = (): void => { setIsEdit(true); }; diff --git a/catalog-rest-service/src/main/resources/ui/src/components/EntityInfoDrawer/EntityInfoDrawer.component.tsx b/catalog-rest-service/src/main/resources/ui/src/components/EntityInfoDrawer/EntityInfoDrawer.component.tsx index fe6ed6eee3c..af170284c17 100644 --- a/catalog-rest-service/src/main/resources/ui/src/components/EntityInfoDrawer/EntityInfoDrawer.component.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/components/EntityInfoDrawer/EntityInfoDrawer.component.tsx @@ -180,7 +180,6 @@ const EntityInfoDrawer = ({ ) : ( <>
- Overview
{getEntityOverview( selectedNode.type, @@ -188,7 +187,7 @@ const EntityInfoDrawer = ({ serviceType ).map((d) => { return ( -

+

{d.name && {d.name}:} { Column Name - Rows Distinct Ratio (%) Null Ratio (%) Min @@ -97,20 +96,6 @@ const TableProfiler = ({ tableProfiles, columns }: Props) => { {col.name}

- - ({ - date: d.profilDate, - value: d.rows ?? 0, - })) - .reverse() as ProfilerGraphData - } - /> - ; + margin?: { top: number; left: number; right: number; bottom: number }; + toolTipPos?: { x: number; y: number }; + height?: number; + className?: string; }; -const TableProfilerGraph = ({ data }: Props) => { +const TableProfilerGraph = ({ + data, + margin, + toolTipPos, + height, + className = '', +}: Props) => { const CustomTooltip = ({ active, payload, @@ -26,30 +36,34 @@ const TableProfilerGraph = ({ data }: Props) => { }; return ( - - - - +
+ + + + +
); }; diff --git a/catalog-rest-service/src/main/resources/ui/src/components/common/entityPageInfo/EntityPageInfo.tsx b/catalog-rest-service/src/main/resources/ui/src/components/common/entityPageInfo/EntityPageInfo.tsx index 1ee965fbc11..89ed85c7257 100644 --- a/catalog-rest-service/src/main/resources/ui/src/components/common/entityPageInfo/EntityPageInfo.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/components/common/entityPageInfo/EntityPageInfo.tsx @@ -18,7 +18,7 @@ import FollowersModal from './FollowersModal'; type ExtraInfo = { key?: string; - value: string | number; + value: string | number | React.ReactNode; isLink?: boolean; placeholderText?: string; openInNewTab?: boolean; @@ -175,7 +175,7 @@ const EntityPageInfo = ({
{extraInfo.map((info, index) => ( - + {!isNil(info.key) ? ( <> diff --git a/catalog-rest-service/src/main/resources/ui/src/utils/EntityUtils.ts b/catalog-rest-service/src/main/resources/ui/src/utils/EntityUtils.tsx similarity index 82% rename from catalog-rest-service/src/main/resources/ui/src/utils/EntityUtils.ts rename to catalog-rest-service/src/main/resources/ui/src/utils/EntityUtils.tsx index c14cb1f860c..4f463e2f1bb 100644 --- a/catalog-rest-service/src/main/resources/ui/src/utils/EntityUtils.ts +++ b/catalog-rest-service/src/main/resources/ui/src/utils/EntityUtils.tsx @@ -1,4 +1,6 @@ import { isNil } from 'lodash'; +import React from 'react'; +import TableProfilerGraph from '../components/TableProfiler/TableProfilerGraph.component'; import { getDatabaseDetailsPath, getServiceDetailsPath, @@ -17,7 +19,6 @@ import { getUsagePercentile, } from './TableUtils'; import { getTableTags } from './TagsUtils'; -import { getRelativeDay } from './TimeUtils'; export const getEntityTags = ( type: string, @@ -53,7 +54,7 @@ export const getEntityOverview = ( serviceType: string ): Array<{ name: string; - value: string; + value: string | number | React.ReactNode; isLink: boolean; isExternal?: boolean; url?: string; @@ -73,25 +74,7 @@ export const getEntityOverview = ( ? getUsagePercentile(usageSummary?.weeklyStats?.percentileRank || 0) : '--'; const queries = usageSummary?.weeklyStats?.count.toLocaleString() || '--'; - const getProfilerRowDiff = (tableProfile: Table['tableProfile']) => { - let retDiff; - if (tableProfile && tableProfile.length > 0) { - let rowDiff: string | number = tableProfile[0].rowCount || 0; - const dayDiff = getRelativeDay( - tableProfile[0].profileDate - ? new Date(tableProfile[0].profileDate).getTime() - : Date.now() - ); - if (tableProfile.length > 1) { - rowDiff = rowDiff - (tableProfile[1].rowCount || 0); - } - retDiff = `${(rowDiff >= 0 ? '+' : '') + rowDiff} rows ${dayDiff}`; - } - return retDiff; - }; - - const profilerRowDiff = getProfilerRowDiff(tableProfile); const overview = [ { name: 'Service', @@ -136,14 +119,6 @@ export const getEntityOverview = ( value: `${queries} past week`, isLink: false, }, - { - name: 'Rows', - value: - tableProfile && tableProfile[0]?.rowCount - ? tableProfile[0].rowCount - : '--', - isLink: false, - }, { name: 'Columns', value: @@ -152,10 +127,31 @@ export const getEntityOverview = ( : '--', isLink: false, }, + { + name: 'Rows', + value: tableProfile ? ( + ({ + date: d.profileDate, + value: d.rowCount ?? 0, + })) + .reverse() as Array<{ + date: Date; + value: number; + }> + } + height={38} + toolTipPos={{ x: 20, y: -30 }} + /> + ) : ( + '--' + ), + isLink: false, + }, ]; - if (!isNil(profilerRowDiff)) { - overview.push({ value: profilerRowDiff, name: '', isLink: false }); - } return overview; }