From dd43e6b258d1115a58298d88ea3150a0d6f608f8 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 23 Jul 2021 04:20:40 +0800 Subject: [PATCH] feat(react): surface edited descriptions on search preview for dataset, datajob, dataflow, chart, dashboard (#2932) --- .../src/app/entity/chart/ChartEntity.tsx | 2 +- .../src/app/entity/dashboard/DashboardEntity.tsx | 2 +- .../src/app/entity/dataFlow/DataFlowEntity.tsx | 4 ++-- .../src/app/entity/dataJob/DataJobEntity.tsx | 4 ++-- .../src/app/entity/dataset/DatasetEntity.tsx | 4 ++-- .../src/app/preview/DefaultPreviewCard.tsx | 10 +++++++++- datahub-web-react/src/graphql/search.graphql | 15 +++++++++++++++ 7 files changed, 32 insertions(+), 9 deletions(-) diff --git a/datahub-web-react/src/app/entity/chart/ChartEntity.tsx b/datahub-web-react/src/app/entity/chart/ChartEntity.tsx index dfd5110913..b16f580aad 100644 --- a/datahub-web-react/src/app/entity/chart/ChartEntity.tsx +++ b/datahub-web-react/src/app/entity/chart/ChartEntity.tsx @@ -59,7 +59,7 @@ export class ChartEntity implements Entity { urn={data.urn} platform={data.tool} name={data.info?.name} - description={data.info?.description} + description={data.editableProperties?.description || data.info?.description} access={data.info?.access} owners={data.ownership?.owners} tags={data?.globalTags || undefined} diff --git a/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx b/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx index 9f0e2e9482..6c587ab002 100644 --- a/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx +++ b/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx @@ -70,7 +70,7 @@ export class DashboardEntity implements Entity { urn={data.urn} platform={data.tool} name={data.info?.name} - description={data.info?.description} + description={data.editableProperties?.description || data.info?.description} access={data.info?.access} tags={data.globalTags || undefined} owners={data.ownership?.owners} diff --git a/datahub-web-react/src/app/entity/dataFlow/DataFlowEntity.tsx b/datahub-web-react/src/app/entity/dataFlow/DataFlowEntity.tsx index 45ce77f149..e36d96cdfc 100644 --- a/datahub-web-react/src/app/entity/dataFlow/DataFlowEntity.tsx +++ b/datahub-web-react/src/app/entity/dataFlow/DataFlowEntity.tsx @@ -51,7 +51,7 @@ export class DataFlowEntity implements Entity { { { { { urn={data.urn} name={data.name} origin={data.origin} - description={data.description} + description={data.editableProperties?.description || data.description} platformName={data.platform.name} platformLogo={data.platform.info?.logoUrl} owners={data.ownership?.owners} @@ -85,7 +85,7 @@ export class DatasetEntity implements Entity { urn={data.urn} name={data.name} origin={data.origin} - description={data.description} + description={data.editableProperties?.description || data.description} platformName={data.platform.name} platformLogo={data.platform.info?.logoUrl} owners={data.ownership?.owners} diff --git a/datahub-web-react/src/app/preview/DefaultPreviewCard.tsx b/datahub-web-react/src/app/preview/DefaultPreviewCard.tsx index 81c36d2a2d..a6a35413ee 100644 --- a/datahub-web-react/src/app/preview/DefaultPreviewCard.tsx +++ b/datahub-web-react/src/app/preview/DefaultPreviewCard.tsx @@ -6,6 +6,7 @@ import { GlobalTags, Owner, GlossaryTerms } from '../../types.generated'; import { useEntityRegistry } from '../useEntityRegistry'; import AvatarsGroup from '../shared/avatar/AvatarsGroup'; import TagTermGroup from '../shared/tags/TagTermGroup'; +import MarkdownViewer from '../entity/shared/MarkdownViewer'; interface Props { name: string; @@ -30,6 +31,13 @@ const DescriptionParagraph = styled(Typography.Paragraph)` } `; +const DescriptionMarkdownViewer = styled(MarkdownViewer)` + &&& { + margin-bottom: 0px; + padding-left: 8px; + } +`; + const PreviewImage = styled(Image)` max-height: 48px; width: auto; @@ -88,7 +96,7 @@ export default function DefaultPreviewCard({ {description.length === 0 ? ( No description ) : ( - {description} + )} {snippet} diff --git a/datahub-web-react/src/graphql/search.graphql b/datahub-web-react/src/graphql/search.graphql index b9d3fec70b..3c7e9e1e4b 100644 --- a/datahub-web-react/src/graphql/search.graphql +++ b/datahub-web-react/src/graphql/search.graphql @@ -35,6 +35,9 @@ query getSearchResults($input: SearchInput!) { logoUrl } } + editableProperties { + description + } platformNativeType tags properties { @@ -85,6 +88,9 @@ query getSearchResults($input: SearchInput!) { globalTags { ...globalTagsFields } + editableProperties { + description + } } ... on Chart { urn @@ -107,6 +113,9 @@ query getSearchResults($input: SearchInput!) { globalTags { ...globalTagsFields } + editableProperties { + description + } } ... on DataFlow { urn @@ -125,6 +134,9 @@ query getSearchResults($input: SearchInput!) { globalTags { ...globalTagsFields } + editableProperties { + description + } } ... on DataJob { urn @@ -151,6 +163,9 @@ query getSearchResults($input: SearchInput!) { globalTags { ...globalTagsFields } + editableProperties { + description + } } ... on GlossaryTerm { name