From c9e4be5dabb1f7827d41f40fefd79ad71544950b Mon Sep 17 00:00:00 2001 From: Gabe Lyons Date: Tue, 27 Jun 2023 08:26:46 -0700 Subject: [PATCH] fix(embed): hide chart & dashboard previews if not for looker (#8307) --- datahub-web-react/src/app/entity/chart/ChartEntity.tsx | 7 +++++-- .../src/app/entity/dashboard/DashboardEntity.tsx | 9 +++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/datahub-web-react/src/app/entity/chart/ChartEntity.tsx b/datahub-web-react/src/app/entity/chart/ChartEntity.tsx index ae6c2b1a72..aaf4d4a968 100644 --- a/datahub-web-react/src/app/entity/chart/ChartEntity.tsx +++ b/datahub-web-react/src/app/entity/chart/ChartEntity.tsx @@ -25,6 +25,7 @@ import { capitalizeFirstLetterOnly } from '../../shared/textUtil'; import DataProductSection from '../shared/containers/profile/sidebar/DataProduct/DataProductSection'; import { getDataProduct } from '../shared/utils'; import EmbeddedProfile from '../shared/embed/EmbeddedProfile'; +import { LOOKER_URN } from '../../ingest/source/builder/constants'; /** * Definition of the DataHub Chart entity. @@ -99,8 +100,10 @@ export class ChartEntity implements Entity { name: 'Preview', component: EmbedTab, display: { - visible: (_, chart: GetChartQuery) => !!chart?.chart?.embed?.renderUrl, - enabled: (_, chart: GetChartQuery) => !!chart?.chart?.embed?.renderUrl, + visible: (_, chart: GetChartQuery) => + !!chart?.chart?.embed?.renderUrl && chart?.chart?.platform.urn === LOOKER_URN, + enabled: (_, chart: GetChartQuery) => + !!chart?.chart?.embed?.renderUrl && chart?.chart?.platform.urn === LOOKER_URN, }, }, { diff --git a/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx b/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx index b7c390dad9..b8dc686171 100644 --- a/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx +++ b/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx @@ -29,6 +29,7 @@ import { EmbedTab } from '../shared/tabs/Embed/EmbedTab'; import EmbeddedProfile from '../shared/embed/EmbeddedProfile'; import DataProductSection from '../shared/containers/profile/sidebar/DataProduct/DataProductSection'; import { getDataProduct } from '../shared/utils'; +import { LOOKER_URN } from '../../ingest/source/builder/constants'; /** * Definition of the DataHub Dashboard entity. @@ -113,8 +114,12 @@ export class DashboardEntity implements Entity { name: 'Preview', component: EmbedTab, display: { - visible: (_, dashboard: GetDashboardQuery) => !!dashboard?.dashboard?.embed?.renderUrl, - enabled: (_, dashboard: GetDashboardQuery) => !!dashboard?.dashboard?.embed?.renderUrl, + visible: (_, dashboard: GetDashboardQuery) => + !!dashboard?.dashboard?.embed?.renderUrl && + dashboard?.dashboard?.platform.urn === LOOKER_URN, + enabled: (_, dashboard: GetDashboardQuery) => + !!dashboard?.dashboard?.embed?.renderUrl && + dashboard?.dashboard?.platform.urn === LOOKER_URN, }, }, {