Skip to content

Commit

Permalink
cleanup in getFormattedEntityData method (#14454)
Browse files Browse the repository at this point in the history
* cleanup in getFormattedEntityData method

* fix failed test after cleanup in entity-summary-panel-utils

* added unit test for getMapOfListHighlights method

* separate test of different functions in different describe block

* in children table constraints will not pass

* fix a type issue

* children will only return for Column and Field type

* cleanup and remove redundancy in mock

* added unit test for getHighlightOfListItem method

* some cleanup + improve type defination

* minor change

* some cleanup
  • Loading branch information
Abhishek332 authored Jan 4, 2024
1 parent e0f16cf commit d406bf3
Show file tree
Hide file tree
Showing 19 changed files with 618 additions and 551 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,10 @@ function ContainerSummary({

<SummaryTagsDescription
entityDetail={entityDetails}
tags={
getSortedTagsWithHighlight({
tags: entityDetails.tags,
sortTagsBasedOnGivenTagFQNs: get(
highlights,
'tag.name',
[] as string[]
),
}) ?? []
}
tags={getSortedTagsWithHighlight(
entityDetails.tags,
get(highlights, 'tag.name')
)}
/>

<Divider className="m-y-xs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,10 @@ function DashboardSummary({
entityDetail={entityDetails}
tags={
tags ??
getSortedTagsWithHighlight({
tags: entityDetails.tags,
sortTagsBasedOnGivenTagFQNs: get(
highlights,
'tag.name',
[] as string[]
),
}) ??
[]
getSortedTagsWithHighlight(
entityDetails.tags,
get(highlights, 'tag.name')
)
}
/>
<Divider className="m-y-xs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,10 @@ const DataModelSummary = ({
entityDetail={entityDetails}
tags={
tags ??
getSortedTagsWithHighlight({
tags: entityDetails.tags,
sortTagsBasedOnGivenTagFQNs: get(
highlights,
'tag.name',
[] as string[]
),
}) ??
[]
getSortedTagsWithHighlight(
entityDetails.tags,
get(highlights, 'tag.name')
)
}
/>
<Divider className="m-y-xs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,10 @@ const DatabaseSchemaSummary = ({
entityDetail={entityDetails}
tags={
tags ??
getSortedTagsWithHighlight({
tags: entityDetails.tags,
sortTagsBasedOnGivenTagFQNs: get(
highlights,
'tag.name',
[] as string[]
),
}) ??
[]
getSortedTagsWithHighlight(
entityDetails.tags,
get(highlights, 'tag.name')
)
}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,10 @@ const DatabaseSummary = ({
entityDetail={entityDetails}
tags={
tags ??
getSortedTagsWithHighlight({
tags: entityDetails.tags,
sortTagsBasedOnGivenTagFQNs: get(
highlights,
'tag.name',
[] as string[]
),
}) ??
[]
getSortedTagsWithHighlight(
entityDetails.tags,
get(highlights, 'tag.name')
)
}
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,10 @@ function MlModelSummary({
entityDetail={entityDetails}
tags={
tags ??
getSortedTagsWithHighlight({
tags: entityDetails.tags,
sortTagsBasedOnGivenTagFQNs: get(
highlights,
'tag.name',
[] as string[]
),
}) ??
[]
getSortedTagsWithHighlight(
entityDetails.tags,
get(highlights, 'tag.name')
)
}
/>
<Divider className="m-y-xs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,10 @@ function PipelineSummary({
entityDetail={entityDetails}
tags={
tags ??
getSortedTagsWithHighlight({
tags: entityDetails.tags,
sortTagsBasedOnGivenTagFQNs: get(
highlights,
'tag.name',
[] as string[]
),
}) ??
[]
getSortedTagsWithHighlight(
entityDetails.tags,
get(highlights, 'tag.name')
)
}
/>
<Divider className="m-y-xs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,10 @@ function SearchIndexSummary({
entityDetail={entityDetails}
tags={
tags ??
getSortedTagsWithHighlight({
tags: entityDetails.tags,
sortTagsBasedOnGivenTagFQNs: get(
highlights,
'tag.name',
[] as string[]
),
}) ??
[]
getSortedTagsWithHighlight(
entityDetails.tags,
get(highlights, 'tag.name')
)
}
/>
<Divider className="m-y-xs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,10 @@ const ServiceSummary = ({
entityDetail={entityDetails}
tags={
tags ??
getSortedTagsWithHighlight({
tags: entityDetails.tags,
sortTagsBasedOnGivenTagFQNs: get(
highlights,
'tag.name',
[] as string[]
),
}) ??
[]
getSortedTagsWithHighlight(
entityDetails.tags,
get(highlights, 'tag.name')
)
}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,10 @@ const StoredProcedureSummary = ({
entityDetail={entityDetails}
tags={
tags ??
getSortedTagsWithHighlight({
tags: entityDetails.tags,
sortTagsBasedOnGivenTagFQNs: get(
highlights,
'tag.name',
[] as string[]
),
}) ??
[]
getSortedTagsWithHighlight(
entityDetails.tags,
get(highlights, 'tag.name')
)
}
/>
<Divider className="m-y-xs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ import {
} from '../../../../generated/entity/data/table';
import { TagLabel } from '../../../../generated/type/tagLabel';

export interface HighlightedTagLabel extends TagLabel {
isHighlighted: boolean;
}

export interface BasicEntityInfo {
algorithm?: string;
name: string;
title: ReactNode;
type?: DataType | ChartType | FeatureType | string;
tags?: TagLabel[];
tags?: Array<TagLabel | HighlightedTagLabel>;
description?: string;
columnConstraint?: Constraint;
tableConstraints?: TableConstraint[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,10 @@ function TableSummary({
entityDetail={tableDetails}
tags={
tags ??
getSortedTagsWithHighlight({
tags: tableDetails.tags,
sortTagsBasedOnGivenTagFQNs: get(
highlights,
'tag.name',
[] as string[]
),
}) ??
[]
getSortedTagsWithHighlight(
tableDetails.tags,
get(highlights, 'tag.name')
)
}
/>
<Divider className="m-y-xs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,10 @@ function TopicSummary({
entityDetail={entityDetails}
tags={
tags ??
getSortedTagsWithHighlight({
tags: entityDetails.tags,
sortTagsBasedOnGivenTagFQNs: get(
highlights,
'tag.name',
[] as string[]
),
}) ??
[]
getSortedTagsWithHighlight(
entityDetails.tags,
get(highlights, 'tag.name')
)
}
/>
<Divider className="m-y-xs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import { ROUTES } from '../../../constants/constants';
import { TAG_START_WITH } from '../../../constants/Tag.constants';
import { TagSource } from '../../../generated/type/tagLabel';
import { reduceColorOpacity } from '../../../utils/CommonUtils';
import { HighlightedTagLabel } from '../../../utils/EntitySummaryPanelUtils';
import { getEntityName } from '../../../utils/EntityUtils';
import Fqn from '../../../utils/Fqn';
import { getEncodedFqn } from '../../../utils/StringsUtils';
import { getTagDisplay, getTagTooltip } from '../../../utils/TagsUtils';
import { HighlightedTagLabel } from '../../Explore/EntitySummaryPanel/SummaryList/SummaryList.interface';
import { TagsV1Props } from './TagsV1.interface';
import './tagsV1.less';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import { TagProps } from 'antd';
import { TAG_START_WITH } from '../../../constants/Tag.constants';
import { TagLabel, TagSource } from '../../../generated/type/tagLabel';
import { HighlightedTagLabel } from '../../../utils/EntitySummaryPanelUtils';
import { HighlightedTagLabel } from '../../Explore/EntitySummaryPanel/SummaryList/SummaryList.interface';

export type TagsV1Props = {
tag: TagLabel | HighlightedTagLabel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import { Col, Divider, Row, Typography } from 'antd';
import React from 'react';
import { useTranslation } from 'react-i18next';
import TagsViewer from '../../../components/Tag/TagsViewer/TagsViewer';
import { TagLabel } from '../../../generated/type/tagLabel';
import { BasicEntityInfo } from '../../Explore/EntitySummaryPanel/SummaryList/SummaryList.interface';
import { EntityUnion } from '../../Explore/ExplorePage.interface';
import RichTextEditorPreviewer from '../RichTextEditor/RichTextEditorPreviewer';

const SummaryTagsDescription = ({
tags,
tags = [],
entityDetail,
}: {
tags: TagLabel[];
tags: BasicEntityInfo['tags'];
entityDetail: EntityUnion;
}) => {
const { t } = useTranslation();
Expand Down
Loading

0 comments on commit d406bf3

Please sign in to comment.