Skip to content

Commit

Permalink
Backend performance improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jjoyce0510 committed Jul 1, 2022
1 parent fbd0d86 commit b31eca4
Show file tree
Hide file tree
Showing 27 changed files with 136 additions and 223 deletions.
21 changes: 17 additions & 4 deletions datahub-web-react/src/app/entity/chart/ChartEntity.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LineChartOutlined } from '@ant-design/icons';
import * as React from 'react';
import { Chart, EntityType, SearchResult } from '../../../types.generated';
import { Chart, EntityType, PlatformType, SearchResult } from '../../../types.generated';
import { Entity, IconStyleType, PreviewType } from '../Entity';
import { ChartPreview } from './preview/ChartPreview';
import { GetChartQuery, useGetChartQuery, useUpdateChartMutation } from '../../../graphql/chart.generated';
Expand All @@ -14,6 +14,7 @@ import { PropertiesTab } from '../shared/tabs/Properties/PropertiesTab';
import { ChartInputsTab } from '../shared/tabs/Entity/ChartInputsTab';
import { ChartDashboardsTab } from '../shared/tabs/Entity/ChartDashboardsTab';
import { getDataForEntityType } from '../shared/containers/profile/utils';
import { capitalizeFirstLetter } from '../../shared/textUtil';
import { SidebarDomainSection } from '../shared/containers/profile/sidebar/Domain/SidebarDomainSection';
import { EntityMenuItems } from '../shared/EntityDropdown/EntityDropdown';

Expand Down Expand Up @@ -119,19 +120,31 @@ export class ChartEntity implements Entity<Chart> {

getOverridePropertiesFromEntity = (chart?: Chart | null): GenericEntityProperties => {
// TODO: Get rid of this once we have correctly formed platform coming back.
const tool = chart?.tool || '';
const name = chart?.properties?.name;
const externalUrl = chart?.properties?.externalUrl;
return {
name,
externalUrl,
platform: {
urn: `urn:li:dataPlatform:(${tool})`,
type: EntityType.DataPlatform,
name: tool,
properties: {
logoUrl: chart?.platform?.properties?.logoUrl,
displayName: capitalizeFirstLetter(tool),
type: PlatformType.Others,
datasetNameDelimiter: '.',
},
},
};
};

renderPreview = (_: PreviewType, data: Chart) => {
return (
<ChartPreview
urn={data.urn}
platform={data.platform.properties?.displayName || data.platform.name}
platform={data.tool}
name={data.properties?.name}
description={data.editableProperties?.description || data.properties?.description}
access={data.properties?.access}
Expand All @@ -150,7 +163,7 @@ export class ChartEntity implements Entity<Chart> {
return (
<ChartPreview
urn={data.urn}
platform={data.platform.properties?.displayName || data.platform.name}
platform={data.tool}
platformInstanceId={data.dataPlatformInstance?.instanceId}
name={data.properties?.name}
description={data.editableProperties?.description || data.properties?.description}
Expand All @@ -171,7 +184,7 @@ export class ChartEntity implements Entity<Chart> {
name: entity.properties?.name || '',
type: EntityType.Chart,
icon: entity?.platform?.properties?.logoUrl || '',
platform: entity?.platform.properties?.displayName || entity?.platform.name,
platform: entity.tool,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
import DefaultPreviewCard from '../../../preview/DefaultPreviewCard';
import { useEntityRegistry } from '../../../useEntityRegistry';
import { capitalizeFirstLetter } from '../../../shared/textUtil';
import { IconStyleType } from '../../Entity';

export const ChartPreview = ({
urn,
Expand Down Expand Up @@ -55,7 +54,6 @@ export const ChartPreview = ({
name={name || ''}
description={description || ''}
type="Chart"
typeIcon={entityRegistry.getIcon(EntityType.Chart, 14, IconStyleType.ACCENT)}
logoUrl={logoUrl || ''}
platform={capitalizedPlatform}
platformInstanceId={platformInstanceId}
Expand Down
21 changes: 17 additions & 4 deletions datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
useGetDashboardQuery,
useUpdateDashboardMutation,
} from '../../../graphql/dashboard.generated';
import { Dashboard, EntityType, OwnershipType, SearchResult } from '../../../types.generated';
import { Dashboard, EntityType, OwnershipType, PlatformType, SearchResult } from '../../../types.generated';
import { Entity, IconStyleType, PreviewType } from '../Entity';
import { EntityProfile } from '../shared/containers/profile/EntityProfile';
import { SidebarOwnerSection } from '../shared/containers/profile/sidebar/Ownership/SidebarOwnerSection';
Expand All @@ -17,6 +17,7 @@ import { PropertiesTab } from '../shared/tabs/Properties/PropertiesTab';
import { GenericEntityProperties } from '../shared/types';
import { DashboardPreview } from './preview/DashboardPreview';
import { getDataForEntityType } from '../shared/containers/profile/utils';
import { capitalizeFirstLetter } from '../../shared/textUtil';
import { SidebarDomainSection } from '../shared/containers/profile/sidebar/Domain/SidebarDomainSection';
import { EntityMenuItems } from '../shared/EntityDropdown/EntityDropdown';

Expand Down Expand Up @@ -117,19 +118,31 @@ export class DashboardEntity implements Entity<Dashboard> {

getOverridePropertiesFromEntity = (dashboard?: Dashboard | null): GenericEntityProperties => {
// TODO: Get rid of this once we have correctly formed platform coming back.
const tool = dashboard?.tool || '';
const name = dashboard?.properties?.name;
const externalUrl = dashboard?.properties?.externalUrl;
return {
name,
externalUrl,
platform: {
urn: `urn:li:dataPlatform:(${tool})`,
type: EntityType.DataPlatform,
name: tool,
properties: {
logoUrl: dashboard?.platform?.properties?.logoUrl || '',
displayName: capitalizeFirstLetter(tool),
type: PlatformType.Others,
datasetNameDelimiter: '.',
},
},
};
};

renderPreview = (_: PreviewType, data: Dashboard) => {
return (
<DashboardPreview
urn={data.urn}
platform={data.platform.properties?.displayName || data.platform.name}
platform={data.tool}
name={data.properties?.name}
description={data.editableProperties?.description || data.properties?.description}
access={data.properties?.access}
Expand All @@ -148,7 +161,7 @@ export class DashboardEntity implements Entity<Dashboard> {
return (
<DashboardPreview
urn={data.urn}
platform={data.platform.properties?.displayName || data.platform.name}
platform={data.tool}
name={data.properties?.name}
platformInstanceId={data.dataPlatformInstance?.instanceId}
description={data.editableProperties?.description || data.properties?.description}
Expand All @@ -171,7 +184,7 @@ export class DashboardEntity implements Entity<Dashboard> {
name: entity.properties?.name || '',
type: EntityType.Dashboard,
icon: entity?.platform?.properties?.logoUrl || '',
platform: entity?.platform.properties?.displayName || entity?.platform.name,
platform: entity.tool,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
import DefaultPreviewCard from '../../../preview/DefaultPreviewCard';
import { useEntityRegistry } from '../../../useEntityRegistry';
import { capitalizeFirstLetter } from '../../../shared/textUtil';
import { IconStyleType } from '../../Entity';

export const DashboardPreview = ({
urn,
Expand Down Expand Up @@ -55,7 +54,6 @@ export const DashboardPreview = ({
name={name || ''}
description={description || ''}
type="Dashboard"
typeIcon={entityRegistry.getIcon(EntityType.Dashboard, 14, IconStyleType.ACCENT)}
logoUrl={logoUrl || ''}
platformInstanceId={platformInstanceId}
platform={capitalizedPlatform}
Expand Down
21 changes: 18 additions & 3 deletions datahub-web-react/src/app/entity/dataFlow/DataFlowEntity.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { ShareAltOutlined } from '@ant-design/icons';
import { DataFlow, EntityType, OwnershipType, SearchResult } from '../../../types.generated';
import { DataFlow, EntityType, OwnershipType, PlatformType, SearchResult } from '../../../types.generated';
import { Preview } from './preview/Preview';
import { Entity, IconStyleType, PreviewType } from '../Entity';
import { EntityProfile } from '../shared/containers/profile/EntityProfile';
Expand All @@ -13,6 +13,7 @@ import { SidebarOwnerSection } from '../shared/containers/profile/sidebar/Owners
import { GenericEntityProperties } from '../shared/types';
import { DataFlowJobsTab } from '../shared/tabs/Entity/DataFlowJobsTab';
import { getDataForEntityType } from '../shared/containers/profile/utils';
import { capitalizeFirstLetter } from '../../shared/textUtil';
import { SidebarDomainSection } from '../shared/containers/profile/sidebar/Domain/SidebarDomainSection';
import { EntityMenuItems } from '../shared/EntityDropdown/EntityDropdown';

Expand Down Expand Up @@ -103,21 +104,34 @@ export class DataFlowEntity implements Entity<DataFlow> {

getOverridePropertiesFromEntity = (dataFlow?: DataFlow | null): GenericEntityProperties => {
// TODO: Get rid of this once we have correctly formed platform coming back.
const tool = dataFlow?.orchestrator || '';
const name = dataFlow?.properties?.name;
const externalUrl = dataFlow?.properties?.externalUrl;
return {
name,
externalUrl,
platform: {
urn: `urn:li:dataPlatform:(${tool})`,
type: EntityType.DataPlatform,
name: tool,
properties: {
logoUrl: dataFlow?.platform?.properties?.logoUrl || '',
displayName: capitalizeFirstLetter(tool),
type: PlatformType.Others,
datasetNameDelimiter: '.',
},
},
};
};

renderPreview = (_: PreviewType, data: DataFlow) => {
const platformName = data.orchestrator.charAt(0).toUpperCase() + data.orchestrator.slice(1);
return (
<Preview
urn={data.urn}
name={data.properties?.name || ''}
description={data.editableProperties?.description || data.properties?.description}
platformName={data.platform.properties?.displayName || data.platform.name}
platformName={platformName}
platformLogo={data?.platform?.properties?.logoUrl || ''}
owners={data.ownership?.owners}
globalTags={data.globalTags}
Expand All @@ -128,13 +142,14 @@ export class DataFlowEntity implements Entity<DataFlow> {

renderSearch = (result: SearchResult) => {
const data = result.entity as DataFlow;
const platformName = data.orchestrator.charAt(0).toUpperCase() + data.orchestrator.slice(1);
return (
<Preview
urn={data.urn}
name={data.properties?.name || ''}
platformInstanceId={data.dataPlatformInstance?.instanceId}
description={data.editableProperties?.description || data.properties?.description || ''}
platformName={data.platform.properties?.displayName || data.platform.name}
platformName={platformName}
platformLogo={data?.platform?.properties?.logoUrl || ''}
owners={data.ownership?.owners}
globalTags={data.globalTags}
Expand Down
2 changes: 0 additions & 2 deletions datahub-web-react/src/app/entity/dataFlow/preview/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Domain, EntityType, GlobalTags, Owner, SearchInsight } from '../../../.
import DefaultPreviewCard from '../../../preview/DefaultPreviewCard';
import { useEntityRegistry } from '../../../useEntityRegistry';
import { capitalizeFirstLetter } from '../../../shared/textUtil';
import { IconStyleType } from '../../Entity';

export const Preview = ({
urn,
Expand Down Expand Up @@ -39,7 +38,6 @@ export const Preview = ({
description={description || ''}
platformInstanceId={platformInstanceId}
type="Data Pipeline"
typeIcon={entityRegistry.getIcon(EntityType.DataFlow, 14, IconStyleType.ACCENT)}
platform={capitalizedPlatform}
logoUrl={platformLogo || ''}
owners={owners}
Expand Down
30 changes: 23 additions & 7 deletions datahub-web-react/src/app/entity/dataJob/DataJobEntity.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { ConsoleSqlOutlined } from '@ant-design/icons';
import { DataJob, EntityType, OwnershipType, SearchResult } from '../../../types.generated';
import { DataJob, EntityType, OwnershipType, PlatformType, SearchResult } from '../../../types.generated';
import { Preview } from './preview/Preview';
import { Entity, IconStyleType, PreviewType } from '../Entity';
import { EntityProfile } from '../shared/containers/profile/EntityProfile';
Expand All @@ -14,6 +14,7 @@ import { SidebarOwnerSection } from '../shared/containers/profile/sidebar/Owners
import { GenericEntityProperties } from '../shared/types';
import { DataJobFlowTab } from '../shared/tabs/Entity/DataJobFlowTab';
import { getDataForEntityType } from '../shared/containers/profile/utils';
import { capitalizeFirstLetter } from '../../shared/textUtil';
import { SidebarDomainSection } from '../shared/containers/profile/sidebar/Domain/SidebarDomainSection';
import { RunsTab } from './tabs/RunsTab';
import { EntityMenuItems } from '../shared/EntityDropdown/EntityDropdown';
Expand Down Expand Up @@ -123,23 +124,36 @@ export class DataJobEntity implements Entity<DataJob> {

getOverridePropertiesFromEntity = (dataJob?: DataJob | null): GenericEntityProperties => {
// TODO: Get rid of this once we have correctly formed platform coming back.
const tool = dataJob?.dataFlow?.orchestrator || '';
const name = dataJob?.properties?.name;
const externalUrl = dataJob?.properties?.externalUrl;
return {
name,
externalUrl,
platform: dataJob?.dataFlow?.platform,
platform: {
urn: `urn:li:dataPlatform:(${tool})`,
type: EntityType.DataPlatform,
name: tool,
properties: {
logoUrl: dataJob?.dataFlow?.platform?.properties?.logoUrl || '',
displayName: capitalizeFirstLetter(tool),
type: PlatformType.Others,
datasetNameDelimiter: '.',
},
},
};
};

renderPreview = (_: PreviewType, data: DataJob) => {
const platformName = data.dataFlow?.platform.properties?.displayName || data.dataFlow?.platform.name;
const platformName = data.dataFlow
? data.dataFlow?.orchestrator.charAt(0).toUpperCase() + data.dataFlow?.orchestrator.slice(1)
: '';
return (
<Preview
urn={data.urn}
name={data.properties?.name || ''}
description={data.editableProperties?.description || data.properties?.description}
platformName={platformName || ''}
platformName={platformName}
platformLogo={data?.dataFlow?.platform?.properties?.logoUrl || ''}
owners={data.ownership?.owners}
globalTags={data.globalTags || null}
Expand All @@ -150,13 +164,15 @@ export class DataJobEntity implements Entity<DataJob> {

renderSearch = (result: SearchResult) => {
const data = result.entity as DataJob;
const platformName = data.dataFlow?.platform.properties?.displayName || data.dataFlow?.platform.name;
const platformName = data.dataFlow
? data.dataFlow?.orchestrator.charAt(0).toUpperCase() + data.dataFlow?.orchestrator.slice(1)
: '';
return (
<Preview
urn={data.urn}
name={data.properties?.name || ''}
description={data.editableProperties?.description || data.properties?.description}
platformName={platformName || ''}
platformName={platformName}
platformLogo={data?.dataFlow?.platform?.properties?.logoUrl || ''}
platformInstanceId={data.dataPlatformInstance?.instanceId}
owners={data.ownership?.owners}
Expand All @@ -173,7 +189,7 @@ export class DataJobEntity implements Entity<DataJob> {
name: entity?.properties?.name || '',
type: EntityType.DataJob,
icon: entity?.dataFlow?.platform?.properties?.logoUrl || '',
platform: entity.dataFlow?.platform.properties?.displayName || entity.dataFlow?.platform.name || '',
platform: entity?.dataFlow?.orchestrator || '',
};
};

Expand Down
2 changes: 0 additions & 2 deletions datahub-web-react/src/app/entity/dataJob/preview/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Domain, EntityType, GlobalTags, Owner, SearchInsight } from '../../../.
import DefaultPreviewCard from '../../../preview/DefaultPreviewCard';
import { useEntityRegistry } from '../../../useEntityRegistry';
import { capitalizeFirstLetter } from '../../../shared/textUtil';
import { IconStyleType } from '../../Entity';

export const Preview = ({
urn,
Expand Down Expand Up @@ -38,7 +37,6 @@ export const Preview = ({
name={name}
description={description || ''}
type="Data Task"
typeIcon={entityRegistry.getIcon(EntityType.DataJob, 14, IconStyleType.ACCENT)}
platform={capitalizedPlatform}
logoUrl={platformLogo || ''}
platformInstanceId={platformInstanceId}
Expand Down
2 changes: 1 addition & 1 deletion datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export class DatasetEntity implements Entity<Dataset> {
};

displayName = (data: Dataset) => {
return data?.properties?.name || data.name || data.urn;
return data?.properties?.name || data.name;
};

platformLogoUrl = (data: Dataset) => {
Expand Down
2 changes: 1 addition & 1 deletion datahub-web-react/src/app/entity/domain/DomainEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class DomainEntity implements Entity<Domain> {
};

displayName = (data: Domain) => {
return data?.properties?.name || data?.id || data.urn;
return data?.properties?.name || data?.id;
};

getOverridePropertiesFromEntity = (data: Domain) => {
Expand Down
2 changes: 0 additions & 2 deletions datahub-web-react/src/app/entity/domain/preview/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import { EntityType, Owner, SearchInsight } from '../../../../types.generated';
import DefaultPreviewCard from '../../../preview/DefaultPreviewCard';
import { useEntityRegistry } from '../../../useEntityRegistry';
import { IconStyleType } from '../../Entity';

export const Preview = ({
urn,
Expand All @@ -28,7 +27,6 @@ export const Preview = ({
name={name || ''}
description={description || ''}
type="Domain"
typeIcon={entityRegistry.getIcon(EntityType.Domain, 14, IconStyleType.ACCENT)}
owners={owners}
insights={insights}
logoComponent={logoComponent}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { BookOutlined } from '@ant-design/icons';
import { EntityType, Owner } from '../../../../types.generated';
import DefaultPreviewCard from '../../../preview/DefaultPreviewCard';
import { useEntityRegistry } from '../../../useEntityRegistry';
import { IconStyleType } from '../../Entity';

export const Preview = ({
urn,
Expand All @@ -25,7 +24,6 @@ export const Preview = ({
owners={owners}
logoComponent={<BookOutlined style={{ fontSize: '20px' }} />}
type="Glossary Term"
typeIcon={entityRegistry.getIcon(EntityType.GlossaryTerm, 14, IconStyleType.ACCENT)}
/>
);
};
Loading

0 comments on commit b31eca4

Please sign in to comment.