From c632ee81e22811213648ea8d6f945ec0c05a2eb0 Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Sat, 17 Dec 2022 14:30:46 +0530 Subject: [PATCH] UI : Added Organization displayName in DataInsight health glance (#9359) * Added Organization displayName in DataInsight health glance * changes as per comments Co-authored-by: Shailesh Parmar --- .../DataInsightDetail/DataInsightSummary.tsx | 20 ++++++++++++++++++- .../ui/src/locale/languages/en-us.json | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/DataInsightSummary.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/DataInsightSummary.tsx index 0a4e0f8d6cd..667d98e12a2 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/DataInsightSummary.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/DataInsightSummary.tsx @@ -17,6 +17,7 @@ import React, { FC, useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Link, useParams } from 'react-router-dom'; import { getAggregateChartData } from '../../axiosAPIs/DataInsightAPI'; +import { getTeamByName } from '../../axiosAPIs/teamsAPI'; import { getUserPath } from '../../constants/constants'; import { ENTITIES_CHARTS, @@ -28,10 +29,12 @@ import { DataInsightChartType, } from '../../generated/dataInsight/dataInsightChartResult'; import { MostActiveUsers } from '../../generated/dataInsight/type/mostActiveUsers'; +import { Team } from '../../generated/entity/teams/team'; import { ChartFilter, DataInsightTabs, } from '../../interface/data-insight.interface'; +import { getEntityName } from '../../utils/CommonUtils'; import { getEntitiesChartSummary, getWebChartSummary, @@ -60,6 +63,8 @@ const DataInsightSummary: FC = ({ chartFilter, onScrollToChart }) => { const [mostActiveUser, setMostActiveUser] = useState(); + const [OrganizationDetails, setOrganizationDetails] = useState(); + const entitiesSummaryList = useMemo( () => getEntitiesChartSummary(entitiesCharts), [entitiesCharts] @@ -72,6 +77,15 @@ const DataInsightSummary: FC = ({ chartFilter, onScrollToChart }) => { const { t } = useTranslation(); + const fetchOrganizationDetails = async () => { + try { + const data = await getTeamByName('Organization'); + setOrganizationDetails(data); + } catch (err) { + // for this API do not show the toast message + } + }; + const fetchEntitiesChartData = async () => { setIsLoading(true); try { @@ -157,6 +171,7 @@ const DataInsightSummary: FC = ({ chartFilter, onScrollToChart }) => { }; useEffect(() => { + fetchOrganizationDetails(); fetchEntitiesChartData(); fetchMostActiveUser(); fetchWebChartData(); @@ -169,7 +184,10 @@ const DataInsightSummary: FC = ({ chartFilter, onScrollToChart }) => { loading={isLoading} title={ - {t('label.data-insight-summary')} + {t('label.data-insight-summary', { + organization: + getEntityName(OrganizationDetails) || t('label.open-metadata'), + })} }> diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json index 58ece70d8d6..b321d4f7031 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json @@ -176,7 +176,7 @@ "pipeline": "Pipeline", "dashboard": "Dashboard", "find-in-table": "Find in table", - "data-insight-summary": "OpenMetadata health at a glance", + "data-insight-summary": "{{organization}} health at a glance", "data-insight-description-summary": "Percentage of Data Assets with Description", "data-insight-owner-summary": "Percentage of Data Assets with Owners", "data-insight-tier-summary": "Total Data Assets by Tier",