fix(embed): hide chart & dashboard previews if not for looker (#8307)

This commit is contained in:
Gabe Lyons 2023-06-27 08:26:46 -07:00 committed by GitHub
parent d075bb4824
commit c9e4be5dab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -25,6 +25,7 @@ import { capitalizeFirstLetterOnly } from '../../shared/textUtil';
import DataProductSection from '../shared/containers/profile/sidebar/DataProduct/DataProductSection'; import DataProductSection from '../shared/containers/profile/sidebar/DataProduct/DataProductSection';
import { getDataProduct } from '../shared/utils'; import { getDataProduct } from '../shared/utils';
import EmbeddedProfile from '../shared/embed/EmbeddedProfile'; import EmbeddedProfile from '../shared/embed/EmbeddedProfile';
import { LOOKER_URN } from '../../ingest/source/builder/constants';
/** /**
* Definition of the DataHub Chart entity. * Definition of the DataHub Chart entity.
@ -99,8 +100,10 @@ export class ChartEntity implements Entity<Chart> {
name: 'Preview', name: 'Preview',
component: EmbedTab, component: EmbedTab,
display: { display: {
visible: (_, chart: GetChartQuery) => !!chart?.chart?.embed?.renderUrl, visible: (_, chart: GetChartQuery) =>
enabled: (_, chart: GetChartQuery) => !!chart?.chart?.embed?.renderUrl, !!chart?.chart?.embed?.renderUrl && chart?.chart?.platform.urn === LOOKER_URN,
enabled: (_, chart: GetChartQuery) =>
!!chart?.chart?.embed?.renderUrl && chart?.chart?.platform.urn === LOOKER_URN,
}, },
}, },
{ {

View File

@ -29,6 +29,7 @@ import { EmbedTab } from '../shared/tabs/Embed/EmbedTab';
import EmbeddedProfile from '../shared/embed/EmbeddedProfile'; import EmbeddedProfile from '../shared/embed/EmbeddedProfile';
import DataProductSection from '../shared/containers/profile/sidebar/DataProduct/DataProductSection'; import DataProductSection from '../shared/containers/profile/sidebar/DataProduct/DataProductSection';
import { getDataProduct } from '../shared/utils'; import { getDataProduct } from '../shared/utils';
import { LOOKER_URN } from '../../ingest/source/builder/constants';
/** /**
* Definition of the DataHub Dashboard entity. * Definition of the DataHub Dashboard entity.
@ -113,8 +114,12 @@ export class DashboardEntity implements Entity<Dashboard> {
name: 'Preview', name: 'Preview',
component: EmbedTab, component: EmbedTab,
display: { display: {
visible: (_, dashboard: GetDashboardQuery) => !!dashboard?.dashboard?.embed?.renderUrl, visible: (_, dashboard: GetDashboardQuery) =>
enabled: (_, dashboard: GetDashboardQuery) => !!dashboard?.dashboard?.embed?.renderUrl, !!dashboard?.dashboard?.embed?.renderUrl &&
dashboard?.dashboard?.platform.urn === LOOKER_URN,
enabled: (_, dashboard: GetDashboardQuery) =>
!!dashboard?.dashboard?.embed?.renderUrl &&
dashboard?.dashboard?.platform.urn === LOOKER_URN,
}, },
}, },
{ {