Skip to content

Commit

Permalink
Merge branch 'datahub-project:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 authored Jan 29, 2024
2 parents 65cc070 + f378fb6 commit 9093432
Show file tree
Hide file tree
Showing 43 changed files with 1,197 additions and 964 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/metadata-ingestion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
# DATAHUB_LOOKML_GIT_TEST_SSH_KEY: ${{ secrets.DATAHUB_LOOKML_GIT_TEST_SSH_KEY }}
strategy:
matrix:
python-version: ["3.7", "3.10"]
python-version: ["3.8", "3.10"]
command:
[
"testQuick",
Expand All @@ -40,7 +40,7 @@ jobs:
"testIntegrationBatch2",
]
include:
- python-version: "3.7"
- python-version: "3.8"
- python-version: "3.10"
fail-fast: false
steps:
Expand Down
22 changes: 4 additions & 18 deletions datahub-graphql-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,16 @@ dependencies {

graphqlCodegen {
// For options: https://github.com/kobylynskyi/graphql-java-codegen/blob/master/docs/codegen-options.md
graphqlSchemaPaths = [
"$projectDir/src/main/resources/entity.graphql".toString(),
"$projectDir/src/main/resources/app.graphql".toString(),
"$projectDir/src/main/resources/search.graphql".toString(),
"$projectDir/src/main/resources/analytics.graphql".toString(),
"$projectDir/src/main/resources/recommendation.graphql".toString(),
"$projectDir/src/main/resources/ingestion.graphql".toString(),
"$projectDir/src/main/resources/auth.graphql".toString(),
"$projectDir/src/main/resources/timeline.graphql".toString(),
"$projectDir/src/main/resources/tests.graphql".toString(),
"$projectDir/src/main/resources/properties.graphql".toString(),
"$projectDir/src/main/resources/step.graphql".toString(),
"$projectDir/src/main/resources/lineage.graphql".toString(),
"$projectDir/src/main/resources/forms.graphql".toString()
]
outputDir = new File("$projectDir/src/mainGeneratedGraphQL/java")
graphqlSchemaPaths = fileTree(dir: "${projectDir}/src/main/resources", include: '**/*.graphql').collect { it.absolutePath }
outputDir = new File("${projectDir}/src/mainGeneratedGraphQL/java")
packageName = "com.linkedin.datahub.graphql.generated"
generateToString = true
generateApis = true
generateParameterizedFieldsResolvers = false
modelValidationAnnotation = "@javax.annotation.Nonnull"
customTypesMapping = [
Long: "Long",
Float: "Float"
Long: "Long",
Float: "Float"
]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,19 @@ import { BrowserWrapper } from '../../../shared/tags/AddTagsTermsModal';
import TermLabel from '../../../shared/TermLabel';
import { useEntityRegistry } from '../../../useEntityRegistry';
import { useEntityData, useRefetch } from '../../shared/EntityContext';
import ParentEntities from '../../../search/filters/ParentEntities';
import { getParentEntities } from '../../../search/filters/utils';

const StyledSelect = styled(Select)`
width: 480px;
`;

const SearchResultContainer = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
`;

interface Props {
onClose: () => void;
relationshipType: TermRelationshipType;
Expand Down Expand Up @@ -68,7 +76,10 @@ function AddRelatedTermsModal(props: Props) {

return (
<Select.Option value={result.entity.urn} key={result.entity.urn} name={displayName}>
<TermLabel name={displayName} />
<SearchResultContainer>
<ParentEntities parentEntities={getParentEntities(result.entity) || []} />
<TermLabel name={displayName} />
</SearchResultContainer>
</Select.Option>
);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import React from 'react';
import { Select } from 'antd';
import styled from 'styled-components';
import { EntityType, GlossaryNode, SearchResult } from '../../../../types.generated';
import { useEntityRegistry } from '../../../useEntityRegistry';
import { useEntityData } from '../EntityContext';
import ClickOutside from '../../../shared/ClickOutside';
import GlossaryBrowser from '../../../glossary/GlossaryBrowser/GlossaryBrowser';
import { BrowserWrapper } from '../../../shared/tags/AddTagsTermsModal';
import useParentSelector from './useParentSelector';
import ParentEntities from '../../../search/filters/ParentEntities';
import { getParentGlossary } from '../../../glossary/utils';

const SearchResultContainer = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
`;

// filter out entity itself and its children
export function filterResultsForMove(entity: GlossaryNode, entityUrn: string) {
Expand Down Expand Up @@ -46,10 +55,9 @@ function NodeParentSelect(props: Props) {
setSelectedParentUrn,
});

let nodeSearchResults: SearchResult[] = [];
if (isMoving) {
nodeSearchResults = searchResults.filter((r) => filterResultsForMove(r.entity as GlossaryNode, entityDataUrn));
}
const nodeSearchResults: SearchResult[] = searchResults.filter((r) =>
filterResultsForMove(r.entity as GlossaryNode, entityDataUrn),
);

const isShowingGlossaryBrowser = !searchQuery && isFocusedOnInput;
const shouldHideSelf = isMoving && entityType === EntityType.GlossaryNode;
Expand All @@ -70,7 +78,10 @@ function NodeParentSelect(props: Props) {
>
{nodeSearchResults?.map((result) => (
<Select.Option key={result?.entity?.urn} value={result.entity.urn}>
{entityRegistry.getDisplayName(result.entity.type, result.entity)}
<SearchResultContainer>
<ParentEntities parentEntities={getParentGlossary(result.entity, entityRegistry)} />
{entityRegistry.getDisplayName(result.entity.type, result.entity)}
</SearchResultContainer>
</Select.Option>
))}
</Select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import DomainNavigator from '../../../../../../domain/nestedDomains/domainNaviga
import ClickOutside from '../../../../../../shared/ClickOutside';
import { ANTD_GRAY } from '../../../../constants';
import { getModalDomContainer } from '../../../../../../../utils/focus';
import ParentEntities from '../../../../../../search/filters/ParentEntities';
import { getParentDomains } from '../../../../../../domain/utils';

type Props = {
urns: string[];
Expand Down Expand Up @@ -44,6 +46,12 @@ const LoadingWrapper = styled.div`
}
`;

const SearchResultContainer = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
`;

export const SetDomainModal = ({ urns, onCloseModal, refetch, defaultValue, onOkOverride, titleOverride }: Props) => {
const entityRegistry = useEntityRegistry();
const [isFocusedOnInput, setIsFocusedOnInput] = useState(false);
Expand Down Expand Up @@ -88,7 +96,10 @@ export const SetDomainModal = ({ urns, onCloseModal, refetch, defaultValue, onOk
const displayName = entityRegistry.getDisplayName(entity.type, entity);
return (
<Select.Option value={entity.urn} key={entity.urn}>
<DomainLabel name={displayName} />
<SearchResultContainer>
<ParentEntities parentEntities={getParentDomains(entity, entityRegistry)} />
<DomainLabel name={displayName} />
</SearchResultContainer>
</Select.Option>
);
};
Expand Down
56 changes: 56 additions & 0 deletions datahub-web-react/src/app/glossary/GloassarySearchResultItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Create a new component called SearchResultItem.js
import React from 'react';
import { Link } from 'react-router-dom';
import Highlight from 'react-highlighter';
import styled from 'styled-components/macro';
import { Entity } from '../../types.generated';
import { IconStyleType } from '../entity/Entity';
import { ANTD_GRAY } from '../entity/shared/constants';
import ParentEntities from '../search/filters/ParentEntities';
import { getParentGlossary } from './utils';
import EntityRegistry from '../entity/EntityRegistry';

type Props = {
entity: Entity;
entityRegistry: EntityRegistry;
query: string;
onResultClick: () => void;
};

const SearchResult = styled(Link)`
color: #262626;
display: flex;
align-items: center;
gap: 8px;
height: 100%;
padding: 6px 8px;
width: 100%;
&:hover {
background-color: ${ANTD_GRAY[3]};
color: #262626;
}
`;

const IconWrapper = styled.span``;

const highlightMatchStyle = {
fontWeight: 'bold',
background: 'none',
padding: 0,
};

function GlossarySearchResultItem({ entity, entityRegistry, query, onResultClick }: Props) {
return (
<SearchResult to={entityRegistry.getEntityUrl(entity.type, entity.urn)} onClick={onResultClick}>
<IconWrapper>{entityRegistry.getIcon(entity.type, 12, IconStyleType.TAB_VIEW)}</IconWrapper>
<div>
<ParentEntities parentEntities={getParentGlossary(entity, entityRegistry)} />
<Highlight matchStyle={highlightMatchStyle} search={query}>
{entityRegistry.getDisplayName(entity.type, entity)}
</Highlight>
</div>
</SearchResult>
);
}

export default GlossarySearchResultItem;
55 changes: 22 additions & 33 deletions datahub-web-react/src/app/glossary/GlossarySearch.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React, { useState } from 'react';
import { Link } from 'react-router-dom';
import styled from 'styled-components/macro';
import { useGetSearchResultsForMultipleQuery } from '../../graphql/search.generated';
import { EntityType } from '../../types.generated';
import { IconStyleType } from '../entity/Entity';
import { ANTD_GRAY } from '../entity/shared/constants';
import { SearchBar } from '../search/SearchBar';
import ClickOutside from '../shared/ClickOutside';
import { useEntityRegistry } from '../useEntityRegistry';
import GloassarySearchResultItem from './GloassarySearchResultItem';

const GlossarySearchWrapper = styled.div`
position: relative;
Expand All @@ -28,20 +27,10 @@ const ResultsWrapper = styled.div`
top: 45px;
`;

const SearchResult = styled(Link)`
color: #262626;
display: inline-block;
height: 100%;
padding: 6px 8px;
width: 100%;
&:hover {
background-color: ${ANTD_GRAY[3]};
color: #262626;
}
`;

const IconWrapper = styled.span`
margin-right: 8px;
const TermNodeName = styled.span`
margin-top: 12px;
color: ${ANTD_GRAY[8]};
font-weight: bold;
`;

function GlossarySearch() {
Expand All @@ -63,6 +52,21 @@ function GlossarySearch() {

const searchResults = data?.searchAcrossEntities?.searchResults;

const renderSearchResults = () => (
<ResultsWrapper>
<TermNodeName>Glossary Terms</TermNodeName>
{searchResults?.map((result) => (
<GloassarySearchResultItem
key={result.entity.urn}
entity={result.entity}
entityRegistry={entityRegistry}
query={query}
onResultClick={() => setIsSearchBarFocused(false)}
/>
))}
</ResultsWrapper>
);

return (
<GlossarySearchWrapper>
<ClickOutside onClickOutside={() => setIsSearchBarFocused(false)}>
Expand All @@ -84,23 +88,8 @@ function GlossarySearch() {
entityRegistry={entityRegistry}
onFocus={() => setIsSearchBarFocused(true)}
/>
{isSearchBarFocused && searchResults && !!searchResults.length && (
<ResultsWrapper>
{searchResults.map((result) => {
return (
<SearchResult
to={`${entityRegistry.getEntityUrl(result.entity.type, result.entity.urn)}`}
onClick={() => setIsSearchBarFocused(false)}
>
<IconWrapper>
{entityRegistry.getIcon(result.entity.type, 12, IconStyleType.ACCENT)}
</IconWrapper>
{entityRegistry.getDisplayName(result.entity.type, result.entity)}
</SearchResult>
);
})}
</ResultsWrapper>
)}
{isSearchBarFocused && searchResults && !!searchResults.length && renderSearchResults()}

</ClickOutside>
</GlossarySearchWrapper>
);
Expand Down
8 changes: 7 additions & 1 deletion datahub-web-react/src/app/glossary/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { EntityType } from '../../types.generated';
import { Entity, EntityType } from '../../types.generated';
import EntityRegistry from '../entity/EntityRegistry';
import { GenericEntityProperties } from '../entity/shared/types';

export const ROOT_NODES = 'rootNodes';
Expand All @@ -25,3 +26,8 @@ export function updateGlossarySidebar(
) {
setUrnsToUpdate([...urnsToUpdate, ...parentNodesToUpdate]);
}

export function getParentGlossary<T extends Entity>(node: T, entityRegistry: EntityRegistry) {
const props = entityRegistry.getGenericEntityProperties(EntityType.GlossaryNode, node);
return props?.parentNodes?.nodes ?? [];
}
Loading

0 comments on commit 9093432

Please sign in to comment.