Skip to content

Commit afa5888

Browse files
improving chart & dashboard entity page rendering (#5864)
Co-authored-by: John Joyce <[email protected]>
1 parent eb16caa commit afa5888

File tree

4 files changed

+24
-43
lines changed

4 files changed

+24
-43
lines changed

datahub-web-react/src/app/entity/chart/ChartEntity.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { LineChartOutlined } from '@ant-design/icons';
22
import * as React from 'react';
33

4-
import { Chart, EntityType, SearchResult } from '../../../types.generated';
4+
import { Chart, EntityType, LineageDirection, SearchResult } from '../../../types.generated';
55
import { Entity, EntityCapabilityType, IconStyleType, PreviewType } from '../Entity';
66
import { ChartPreview } from './preview/ChartPreview';
77
import { GetChartQuery, useGetChartQuery, useUpdateChartMutation } from '../../../graphql/chart.generated';
@@ -12,7 +12,6 @@ import { SidebarOwnerSection } from '../shared/containers/profile/sidebar/Owners
1212
import { GenericEntityProperties } from '../shared/types';
1313
import { EntityProfile } from '../shared/containers/profile/EntityProfile';
1414
import { PropertiesTab } from '../shared/tabs/Properties/PropertiesTab';
15-
import { ChartInputsTab } from '../shared/tabs/Entity/ChartInputsTab';
1615
import { ChartDashboardsTab } from '../shared/tabs/Entity/ChartDashboardsTab';
1716
import { getDataForEntityType } from '../shared/containers/profile/utils';
1817
import { SidebarDomainSection } from '../shared/containers/profile/sidebar/Domain/SidebarDomainSection';
@@ -98,6 +97,9 @@ export class ChartEntity implements Entity<Chart> {
9897
{
9998
name: 'Lineage',
10099
component: LineageTab,
100+
properties: {
101+
defaultDirection: LineageDirection.Upstream,
102+
},
101103
display: {
102104
visible: (_, _1) => true,
103105
enabled: (_, chart: GetChartQuery) => {
@@ -107,15 +109,6 @@ export class ChartEntity implements Entity<Chart> {
107109
},
108110
},
109111
},
110-
111-
{
112-
name: 'Inputs',
113-
component: ChartInputsTab,
114-
display: {
115-
visible: (_, _1) => true,
116-
enabled: (_, chart: GetChartQuery) => (chart?.chart?.inputs?.total || 0) > 0,
117-
},
118-
},
119112
{
120113
name: 'Dashboards',
121114
component: ChartDashboardsTab,

datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
useGetDashboardQuery,
77
useUpdateDashboardMutation,
88
} from '../../../graphql/dashboard.generated';
9-
import { Dashboard, EntityType, OwnershipType, SearchResult } from '../../../types.generated';
9+
import { Dashboard, EntityType, LineageDirection, OwnershipType, SearchResult } from '../../../types.generated';
1010
import { Entity, EntityCapabilityType, IconStyleType, PreviewType } from '../Entity';
1111
import { EntityProfile } from '../shared/containers/profile/EntityProfile';
1212
import { SidebarOwnerSection } from '../shared/containers/profile/sidebar/Ownership/SidebarOwnerSection';
@@ -82,6 +82,16 @@ export class DashboardEntity implements Entity<Dashboard> {
8282
component: DashboardStatsSummarySubHeader,
8383
}}
8484
tabs={[
85+
{
86+
name: 'Charts',
87+
component: DashboardChartsTab,
88+
display: {
89+
visible: (_, dashboard: GetDashboardQuery) =>
90+
(dashboard?.dashboard?.charts?.total || 0) > 0 ||
91+
(dashboard?.dashboard?.datasets?.total || 0) === 0,
92+
enabled: (_, dashboard: GetDashboardQuery) => (dashboard?.dashboard?.charts?.total || 0) > 0,
93+
},
94+
},
8595
{
8696
name: 'Documentation',
8797
component: DocumentationTab,
@@ -93,6 +103,9 @@ export class DashboardEntity implements Entity<Dashboard> {
93103
{
94104
name: 'Lineage',
95105
component: LineageTab,
106+
properties: {
107+
defaultDirection: LineageDirection.Upstream,
108+
},
96109
display: {
97110
visible: (_, _1) => true,
98111
enabled: (_, dashboard: GetDashboardQuery) => {
@@ -103,16 +116,6 @@ export class DashboardEntity implements Entity<Dashboard> {
103116
},
104117
},
105118
},
106-
{
107-
name: 'Charts',
108-
component: DashboardChartsTab,
109-
display: {
110-
visible: (_, dashboard: GetDashboardQuery) =>
111-
(dashboard?.dashboard?.charts?.total || 0) > 0 ||
112-
(dashboard?.dashboard?.datasets?.total || 0) === 0,
113-
enabled: (_, dashboard: GetDashboardQuery) => (dashboard?.dashboard?.charts?.total || 0) > 0,
114-
},
115-
},
116119
{
117120
name: 'Datasets',
118121
component: DashboardDatasetsTab,

datahub-web-react/src/app/entity/shared/tabs/Entity/ChartInputsTab.tsx

Lines changed: 0 additions & 19 deletions
This file was deleted.

datahub-web-react/src/app/entity/shared/tabs/Lineage/LineageTab.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@ const StyledButton = styled(Button)<{ isSelected: boolean }>`
2626
`}
2727
`;
2828

29-
export const LineageTab = () => {
29+
export const LineageTab = ({
30+
properties = { defaultDirection: LineageDirection.Downstream },
31+
}: {
32+
properties?: { defaultDirection: LineageDirection };
33+
}) => {
3034
const { urn, entityType } = useEntityData();
3135
const history = useHistory();
3236
const entityRegistry = useEntityRegistry();
33-
const [lineageDirection, setLineageDirection] = useState<string>(LineageDirection.Downstream);
37+
const [lineageDirection, setLineageDirection] = useState<string>(properties.defaultDirection);
3438

3539
const routeToLineage = useCallback(() => {
3640
history.push(getEntityPath(entityType, urn, entityRegistry, true, false));

0 commit comments

Comments
 (0)