From 5d4957ca317e31d67542b400c0429cbb298cf355 Mon Sep 17 00:00:00 2001 From: Ankit Keshari Date: Fri, 9 Sep 2022 16:32:04 +0530 Subject: [PATCH 1/4] Converted the number with comma --- .../src/app/search/SearchFilterLabel.tsx | 22 ++++++++++--------- .../src/app/shared/numberWithCommas.tsx | 4 ++++ 2 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 datahub-web-react/src/app/shared/numberWithCommas.tsx diff --git a/datahub-web-react/src/app/search/SearchFilterLabel.tsx b/datahub-web-react/src/app/search/SearchFilterLabel.tsx index 2d2f08fd88352e..3949bcea5a5ba9 100644 --- a/datahub-web-react/src/app/search/SearchFilterLabel.tsx +++ b/datahub-web-react/src/app/search/SearchFilterLabel.tsx @@ -21,6 +21,7 @@ import { useEntityRegistry } from '../useEntityRegistry'; import { ENTITY_FILTER_NAME } from './utils/constants'; import CustomAvatar from '../shared/avatar/CustomAvatar'; import { IconStyleType } from '../entity/Entity'; +import { numberWithCommas } from '../shared/numberWithCommas'; type Props = { aggregation: AggregationMetadata; @@ -46,7 +47,8 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { const entityType = aggregation.value.toUpperCase() as EntityType; return ( - {entityType ? entityRegistry.getCollectionName(entityType) : aggregation.value} ({countText}) + {entityType ? entityRegistry.getCollectionName(entityType) : aggregation.value} ( + {numberWithCommas(countText)}) ); } @@ -60,7 +62,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { {truncatedDisplayName} - ({countText}) + ({numberWithCommas(countText)}){' '} ); } @@ -94,7 +96,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { {entityRegistry.getIcon(EntityType.CorpGroup, 16, IconStyleType.ACCENT)} - {truncatedDisplayName} ({countText}) + {truncatedDisplayName} ({numberWithCommas(countText)}) ); } @@ -109,7 +111,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { {truncatedDisplayName} - ({countText}) + ({numberWithCommas(countText)}) ); } @@ -124,7 +126,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { )} - {truncatedDisplayName} ({countText}) + {truncatedDisplayName} ({numberWithCommas(countText)}) ); @@ -136,7 +138,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { const truncatedDisplayName = displayName.length > 25 ? `${displayName.slice(0, 25)}...` : displayName; return ( - {truncatedDisplayName} ({countText}) + {truncatedDisplayName} ({numberWithCommas(countText)}) ); } @@ -151,7 +153,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { )} - {truncatedDisplayName} ({countText}) + {truncatedDisplayName} ({numberWithCommas(countText)}) ); @@ -163,7 +165,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { const truncatedDomainName = displayName.length > 25 ? `${displayName.slice(0, 25)}...` : displayName; return ( - ({countText}) + ({numberWithCommas(countText)}) ); } @@ -175,7 +177,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { return ( - {truncatedDomainName} ({countText}) + {truncatedDomainName} ({numberWithCommas(countText)}) ); @@ -186,7 +188,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { } return ( <> - {aggregation.value} ({countText}) + {aggregation.value} ({numberWithCommas(countText)}) ); }; diff --git a/datahub-web-react/src/app/shared/numberWithCommas.tsx b/datahub-web-react/src/app/shared/numberWithCommas.tsx new file mode 100644 index 00000000000000..78999568c83eb3 --- /dev/null +++ b/datahub-web-react/src/app/shared/numberWithCommas.tsx @@ -0,0 +1,4 @@ +// Function to convert a number with comma +export const numberWithCommas = (number) => { + return number.toString().replace(/\B(? Date: Fri, 9 Sep 2022 16:37:37 +0530 Subject: [PATCH 2/4] Rename the Column header from terms to Glossary Terms --- .../src/app/entity/shared/tabs/Dataset/Schema/SchemaTable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datahub-web-react/src/app/entity/shared/tabs/Dataset/Schema/SchemaTable.tsx b/datahub-web-react/src/app/entity/shared/tabs/Dataset/Schema/SchemaTable.tsx index 504675a64bbf13..25c275e76c16eb 100644 --- a/datahub-web-react/src/app/entity/shared/tabs/Dataset/Schema/SchemaTable.tsx +++ b/datahub-web-react/src/app/entity/shared/tabs/Dataset/Schema/SchemaTable.tsx @@ -107,7 +107,7 @@ export default function SchemaTable({ const termColumn = { width: 125, - title: 'Terms', + title: 'Glossary Terms', dataIndex: 'globalTags', key: 'tag', render: termRenderer, From be49b21eb81eb0db00f4f71a27488d3bb1c55861 Mon Sep 17 00:00:00 2001 From: Ankit Keshari Date: Mon, 19 Sep 2022 18:20:34 +0530 Subject: [PATCH 3/4] Used formatNumber function instead of numberWithCommas to add comma in the number > 1000 --- .../src/app/search/SearchFilterLabel.tsx | 22 +++++++++---------- .../src/app/shared/numberWithCommas.tsx | 4 ---- 2 files changed, 11 insertions(+), 15 deletions(-) delete mode 100644 datahub-web-react/src/app/shared/numberWithCommas.tsx diff --git a/datahub-web-react/src/app/search/SearchFilterLabel.tsx b/datahub-web-react/src/app/search/SearchFilterLabel.tsx index 3949bcea5a5ba9..b0e9a6e7e801d9 100644 --- a/datahub-web-react/src/app/search/SearchFilterLabel.tsx +++ b/datahub-web-react/src/app/search/SearchFilterLabel.tsx @@ -21,7 +21,7 @@ import { useEntityRegistry } from '../useEntityRegistry'; import { ENTITY_FILTER_NAME } from './utils/constants'; import CustomAvatar from '../shared/avatar/CustomAvatar'; import { IconStyleType } from '../entity/Entity'; -import { numberWithCommas } from '../shared/numberWithCommas'; +import { formatNumber } from '../shared/formatNumber'; type Props = { aggregation: AggregationMetadata; @@ -48,7 +48,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { return ( {entityType ? entityRegistry.getCollectionName(entityType) : aggregation.value} ( - {numberWithCommas(countText)}) + {formatNumber(countText)}) ); } @@ -62,7 +62,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { {truncatedDisplayName} - ({numberWithCommas(countText)}){' '} + ({formatNumber(countText)}){' '} ); } @@ -96,7 +96,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { {entityRegistry.getIcon(EntityType.CorpGroup, 16, IconStyleType.ACCENT)} - {truncatedDisplayName} ({numberWithCommas(countText)}) + {truncatedDisplayName} ({formatNumber(countText)}) ); } @@ -111,7 +111,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { {truncatedDisplayName} - ({numberWithCommas(countText)}) + ({formatNumber(countText)}) ); } @@ -126,7 +126,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { )} - {truncatedDisplayName} ({numberWithCommas(countText)}) + {truncatedDisplayName} ({formatNumber(countText)}) ); @@ -138,7 +138,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { const truncatedDisplayName = displayName.length > 25 ? `${displayName.slice(0, 25)}...` : displayName; return ( - {truncatedDisplayName} ({numberWithCommas(countText)}) + {truncatedDisplayName} ({formatNumber(countText)}) ); } @@ -153,7 +153,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { )} - {truncatedDisplayName} ({numberWithCommas(countText)}) + {truncatedDisplayName} ({formatNumber(countText)}) ); @@ -165,7 +165,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { const truncatedDomainName = displayName.length > 25 ? `${displayName.slice(0, 25)}...` : displayName; return ( - ({numberWithCommas(countText)}) + ({formatNumber(countText)}) ); } @@ -177,7 +177,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { return ( - {truncatedDomainName} ({numberWithCommas(countText)}) + {truncatedDomainName} ({formatNumber(countText)}) ); @@ -188,7 +188,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { } return ( <> - {aggregation.value} ({numberWithCommas(countText)}) + {aggregation.value} ({formatNumber(countText)}) ); }; diff --git a/datahub-web-react/src/app/shared/numberWithCommas.tsx b/datahub-web-react/src/app/shared/numberWithCommas.tsx deleted file mode 100644 index 78999568c83eb3..00000000000000 --- a/datahub-web-react/src/app/shared/numberWithCommas.tsx +++ /dev/null @@ -1,4 +0,0 @@ -// Function to convert a number with comma -export const numberWithCommas = (number) => { - return number.toString().replace(/\B(? Date: Mon, 19 Sep 2022 22:06:06 +0530 Subject: [PATCH 4/4] Removed Space --- datahub-web-react/src/app/search/SearchFilterLabel.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datahub-web-react/src/app/search/SearchFilterLabel.tsx b/datahub-web-react/src/app/search/SearchFilterLabel.tsx index b0e9a6e7e801d9..ccf4c6b40338fa 100644 --- a/datahub-web-react/src/app/search/SearchFilterLabel.tsx +++ b/datahub-web-react/src/app/search/SearchFilterLabel.tsx @@ -1,6 +1,6 @@ +import * as React from 'react'; import { BookOutlined } from '@ant-design/icons'; import { Tag, Tooltip } from 'antd'; -import * as React from 'react'; import styled from 'styled-components'; import { AggregationMetadata, @@ -62,7 +62,7 @@ export const SearchFilterLabel = ({ aggregation, field }: Props) => { {truncatedDisplayName} - ({formatNumber(countText)}){' '} + ({formatNumber(countText)}) ); }