Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui) Display combined sibling results in search + 2 minor updates #8602

Conversation

chriscollins3456
Copy link
Collaborator

The bulk of the diff in this PR combines sibling results when showing search result cards - this clears some confusion when a sibling search result sometimes shows all info like dataset stats and other times it doesn't (same idea for tags, glossary terms, etc.).

The other two minor edits are:

  1. de-deuplicate owners on search result card (can happen when the same owner is applied more than once as a different owner type
  2. add an entity urn to search results for debugging purposes (request by customer success)

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

@github-actions github-actions bot added the product PR or Issue related to the DataHub UI/UX label Aug 9, 2023
Comment on lines 263 to 266
const uniqueOwnerUrns = new Set();
const uniqueOwners = owners?.filter(
(owner) => !uniqueOwnerUrns.has(owner.owner.urn) && uniqueOwnerUrns.add(owner.owner.urn),
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good use of a Set 👍

Optional: Maybe a useUniqueOwners(owners) custom hook? Lots of logic already in this file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm why hook as opposed to a utility function? since it's not using any hooks itself - I could just do getUniqueOwners in a utility file


return (
<PreviewContainer data-testid={dataTestID} onMouseDown={onPreventMouseDown}>
<PreviewContainer data-testid={dataTestID} onMouseDown={onPreventMouseDown} id={`entityUrn-${urn}`}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure it's a good practice to keep id's unique on the page. I this with setup, it'll render this DefaultPreviewCard along with a SearchResult at the same time?

Looking at containers search result rendering here: https://github.com/joshuaeilers/datahub/blob/779d692cdc7a74ff85f33960ff7572521736329b/datahub-web-react/src/app/entity/container/ContainerEntity.tsx#L140

and then again down below in the SearchResultList.

I could be wrong here about the multiple times, but it might be a good idea to put this into a class or other data-* attribute so we don't collide.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yeah good call they would definitely both be rendered with the same ID. will make that change to a class or something else. I really only think we need one of them anyways...

const baseEntityKey = Object.keys(baseEntity)[0];
const extractedBaseEntity = baseEntity[baseEntityKey];

const combineEntityWithSiblings = (entity: any) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we need it as any here and can't be a T or an EntityType or something more strongly typed perhaps?

Copy link
Contributor

@joshuaeilers joshuaeilers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just marking this as changes needed for the id part

@@ -2,7 +2,7 @@ import { useAppConfig } from '../useAppConfig';

const useSearchAndBrowseVersion = () => {
const appConfig = useAppConfig();
const searchVersion = appConfig.config.featureFlags.showSearchFiltersV2 ? 'v2' : 'v1';
const searchVersion = appConfig.config.featureFlags.showSearchFiltersV2 ? 'v1' : 'v2';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a revert on this change

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh goodness

@chriscollins3456 chriscollins3456 merged commit d9b8191 into datahub-project:master Aug 15, 2023
34 checks passed
if (!baseEntity) {
return baseEntity;
}
const baseEntityKey = Object.keys(baseEntity)[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chriscollins3456 just seeing this now. What is the idea behind converting the object to keys and taking whatever the first entry might be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR or Issue related to the DataHub UI/UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants