Skip to content

Commit 9a25cad

Browse files
Merge branch 'master' into feature/accessRequest
2 parents 0a0f010 + f3cc4e0 commit 9a25cad

File tree

36 files changed

+561
-196
lines changed

36 files changed

+561
-196
lines changed

.github/workflows/airflow-plugin.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ jobs:
8787
token: ${{ secrets.CODECOV_TOKEN }}
8888
directory: .
8989
fail_ci_if_error: false
90-
flags: airflow-${{ matrix.python-version }}-${{ matrix.extraPythonRequirement }}
91-
name: pytest-airflow
90+
flags: airflow,airflow-${{ matrix.extra_pip_extras }}
91+
name: pytest-airflow-${{ matrix.python-version }}-${{ matrix.extra_pip_requirements }}
9292
verbose: true
9393

9494
event-file:

datahub-graphql-core/build.gradle

+4-18
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,16 @@ dependencies {
3131

3232
graphqlCodegen {
3333
// For options: https://github.com/kobylynskyi/graphql-java-codegen/blob/master/docs/codegen-options.md
34-
graphqlSchemaPaths = [
35-
"$projectDir/src/main/resources/entity.graphql".toString(),
36-
"$projectDir/src/main/resources/app.graphql".toString(),
37-
"$projectDir/src/main/resources/search.graphql".toString(),
38-
"$projectDir/src/main/resources/analytics.graphql".toString(),
39-
"$projectDir/src/main/resources/recommendation.graphql".toString(),
40-
"$projectDir/src/main/resources/ingestion.graphql".toString(),
41-
"$projectDir/src/main/resources/auth.graphql".toString(),
42-
"$projectDir/src/main/resources/timeline.graphql".toString(),
43-
"$projectDir/src/main/resources/tests.graphql".toString(),
44-
"$projectDir/src/main/resources/properties.graphql".toString(),
45-
"$projectDir/src/main/resources/step.graphql".toString(),
46-
"$projectDir/src/main/resources/lineage.graphql".toString(),
47-
"$projectDir/src/main/resources/forms.graphql".toString()
48-
]
49-
outputDir = new File("$projectDir/src/mainGeneratedGraphQL/java")
34+
graphqlSchemaPaths = fileTree(dir: "${projectDir}/src/main/resources", include: '**/*.graphql').collect { it.absolutePath }
35+
outputDir = new File("${projectDir}/src/mainGeneratedGraphQL/java")
5036
packageName = "com.linkedin.datahub.graphql.generated"
5137
generateToString = true
5238
generateApis = true
5339
generateParameterizedFieldsResolvers = false
5440
modelValidationAnnotation = "@javax.annotation.Nonnull"
5541
customTypesMapping = [
56-
Long: "Long",
57-
Float: "Float"
42+
Long: "Long",
43+
Float: "Float"
5844
]
5945
}
6046

datahub-web-react/src/app/entity/glossaryTerm/profile/AddRelatedTermsModal.tsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@ import { BrowserWrapper } from '../../../shared/tags/AddTagsTermsModal';
1010
import TermLabel from '../../../shared/TermLabel';
1111
import { useEntityRegistry } from '../../../useEntityRegistry';
1212
import { useEntityData, useRefetch } from '../../shared/EntityContext';
13+
import ParentEntities from '../../../search/filters/ParentEntities';
14+
import { getParentEntities } from '../../../search/filters/utils';
1315

1416
const StyledSelect = styled(Select)`
1517
width: 480px;
1618
`;
1719

20+
const SearchResultContainer = styled.div`
21+
display: flex;
22+
flex-direction: column;
23+
justify-content: center;
24+
`;
25+
1826
interface Props {
1927
onClose: () => void;
2028
relationshipType: TermRelationshipType;
@@ -68,7 +76,10 @@ function AddRelatedTermsModal(props: Props) {
6876

6977
return (
7078
<Select.Option value={result.entity.urn} key={result.entity.urn} name={displayName}>
71-
<TermLabel name={displayName} />
79+
<SearchResultContainer>
80+
<ParentEntities parentEntities={getParentEntities(result.entity) || []} />
81+
<TermLabel name={displayName} />
82+
</SearchResultContainer>
7283
</Select.Option>
7384
);
7485
});

datahub-web-react/src/app/entity/shared/EntityDropdown/NodeParentSelect.tsx

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
import React from 'react';
22
import { Select } from 'antd';
3+
import styled from 'styled-components';
34
import { EntityType, GlossaryNode, SearchResult } from '../../../../types.generated';
45
import { useEntityRegistry } from '../../../useEntityRegistry';
56
import { useEntityData } from '../EntityContext';
67
import ClickOutside from '../../../shared/ClickOutside';
78
import GlossaryBrowser from '../../../glossary/GlossaryBrowser/GlossaryBrowser';
89
import { BrowserWrapper } from '../../../shared/tags/AddTagsTermsModal';
910
import useParentSelector from './useParentSelector';
11+
import ParentEntities from '../../../search/filters/ParentEntities';
12+
import { getParentGlossary } from '../../../glossary/utils';
13+
14+
const SearchResultContainer = styled.div`
15+
display: flex;
16+
flex-direction: column;
17+
justify-content: center;
18+
`;
1019

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

49-
let nodeSearchResults: SearchResult[] = [];
50-
if (isMoving) {
51-
nodeSearchResults = searchResults.filter((r) => filterResultsForMove(r.entity as GlossaryNode, entityDataUrn));
52-
}
58+
const nodeSearchResults: SearchResult[] = searchResults.filter((r) =>
59+
filterResultsForMove(r.entity as GlossaryNode, entityDataUrn),
60+
);
5361

5462
const isShowingGlossaryBrowser = !searchQuery && isFocusedOnInput;
5563
const shouldHideSelf = isMoving && entityType === EntityType.GlossaryNode;
@@ -70,7 +78,10 @@ function NodeParentSelect(props: Props) {
7078
>
7179
{nodeSearchResults?.map((result) => (
7280
<Select.Option key={result?.entity?.urn} value={result.entity.urn}>
73-
{entityRegistry.getDisplayName(result.entity.type, result.entity)}
81+
<SearchResultContainer>
82+
<ParentEntities parentEntities={getParentGlossary(result.entity, entityRegistry)} />
83+
{entityRegistry.getDisplayName(result.entity.type, result.entity)}
84+
</SearchResultContainer>
7485
</Select.Option>
7586
))}
7687
</Select>

datahub-web-react/src/app/entity/shared/containers/profile/sidebar/Domain/SetDomainModal.tsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import DomainNavigator from '../../../../../../domain/nestedDomains/domainNaviga
1616
import ClickOutside from '../../../../../../shared/ClickOutside';
1717
import { ANTD_GRAY } from '../../../../constants';
1818
import { getModalDomContainer } from '../../../../../../../utils/focus';
19+
import ParentEntities from '../../../../../../search/filters/ParentEntities';
20+
import { getParentDomains } from '../../../../../../domain/utils';
1921

2022
type Props = {
2123
urns: string[];
@@ -44,6 +46,12 @@ const LoadingWrapper = styled.div`
4446
}
4547
`;
4648

49+
const SearchResultContainer = styled.div`
50+
display: flex;
51+
flex-direction: column;
52+
justify-content: center;
53+
`;
54+
4755
export const SetDomainModal = ({ urns, onCloseModal, refetch, defaultValue, onOkOverride, titleOverride }: Props) => {
4856
const entityRegistry = useEntityRegistry();
4957
const [isFocusedOnInput, setIsFocusedOnInput] = useState(false);
@@ -88,7 +96,10 @@ export const SetDomainModal = ({ urns, onCloseModal, refetch, defaultValue, onOk
8896
const displayName = entityRegistry.getDisplayName(entity.type, entity);
8997
return (
9098
<Select.Option value={entity.urn} key={entity.urn}>
91-
<DomainLabel name={displayName} />
99+
<SearchResultContainer>
100+
<ParentEntities parentEntities={getParentDomains(entity, entityRegistry)} />
101+
<DomainLabel name={displayName} />
102+
</SearchResultContainer>
92103
</Select.Option>
93104
);
94105
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Create a new component called SearchResultItem.js
2+
import React from 'react';
3+
import { Link } from 'react-router-dom';
4+
import Highlight from 'react-highlighter';
5+
import styled from 'styled-components/macro';
6+
import { Entity } from '../../types.generated';
7+
import { IconStyleType } from '../entity/Entity';
8+
import { ANTD_GRAY } from '../entity/shared/constants';
9+
import ParentEntities from '../search/filters/ParentEntities';
10+
import { getParentGlossary } from './utils';
11+
import EntityRegistry from '../entity/EntityRegistry';
12+
13+
type Props = {
14+
entity: Entity;
15+
entityRegistry: EntityRegistry;
16+
query: string;
17+
onResultClick: () => void;
18+
};
19+
20+
const SearchResult = styled(Link)`
21+
color: #262626;
22+
display: flex;
23+
align-items: center;
24+
gap: 8px;
25+
height: 100%;
26+
padding: 6px 8px;
27+
width: 100%;
28+
&:hover {
29+
background-color: ${ANTD_GRAY[3]};
30+
color: #262626;
31+
}
32+
`;
33+
34+
const IconWrapper = styled.span``;
35+
36+
const highlightMatchStyle = {
37+
fontWeight: 'bold',
38+
background: 'none',
39+
padding: 0,
40+
};
41+
42+
function GlossarySearchResultItem({ entity, entityRegistry, query, onResultClick }: Props) {
43+
return (
44+
<SearchResult to={entityRegistry.getEntityUrl(entity.type, entity.urn)} onClick={onResultClick}>
45+
<IconWrapper>{entityRegistry.getIcon(entity.type, 12, IconStyleType.TAB_VIEW)}</IconWrapper>
46+
<div>
47+
<ParentEntities parentEntities={getParentGlossary(entity, entityRegistry)} />
48+
<Highlight matchStyle={highlightMatchStyle} search={query}>
49+
{entityRegistry.getDisplayName(entity.type, entity)}
50+
</Highlight>
51+
</div>
52+
</SearchResult>
53+
);
54+
}
55+
56+
export default GlossarySearchResultItem;

datahub-web-react/src/app/glossary/GlossarySearch.tsx

+22-33
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import React, { useState } from 'react';
2-
import { Link } from 'react-router-dom';
32
import styled from 'styled-components/macro';
43
import { useGetSearchResultsForMultipleQuery } from '../../graphql/search.generated';
54
import { EntityType } from '../../types.generated';
6-
import { IconStyleType } from '../entity/Entity';
75
import { ANTD_GRAY } from '../entity/shared/constants';
86
import { SearchBar } from '../search/SearchBar';
97
import ClickOutside from '../shared/ClickOutside';
108
import { useEntityRegistry } from '../useEntityRegistry';
9+
import GloassarySearchResultItem from './GloassarySearchResultItem';
1110

1211
const GlossarySearchWrapper = styled.div`
1312
position: relative;
@@ -28,20 +27,10 @@ const ResultsWrapper = styled.div`
2827
top: 45px;
2928
`;
3029

31-
const SearchResult = styled(Link)`
32-
color: #262626;
33-
display: inline-block;
34-
height: 100%;
35-
padding: 6px 8px;
36-
width: 100%;
37-
&:hover {
38-
background-color: ${ANTD_GRAY[3]};
39-
color: #262626;
40-
}
41-
`;
42-
43-
const IconWrapper = styled.span`
44-
margin-right: 8px;
30+
const TermNodeName = styled.span`
31+
margin-top: 12px;
32+
color: ${ANTD_GRAY[8]};
33+
font-weight: bold;
4534
`;
4635

4736
function GlossarySearch() {
@@ -63,6 +52,21 @@ function GlossarySearch() {
6352

6453
const searchResults = data?.searchAcrossEntities?.searchResults;
6554

55+
const renderSearchResults = () => (
56+
<ResultsWrapper>
57+
<TermNodeName>Glossary Terms</TermNodeName>
58+
{searchResults?.map((result) => (
59+
<GloassarySearchResultItem
60+
key={result.entity.urn}
61+
entity={result.entity}
62+
entityRegistry={entityRegistry}
63+
query={query}
64+
onResultClick={() => setIsSearchBarFocused(false)}
65+
/>
66+
))}
67+
</ResultsWrapper>
68+
);
69+
6670
return (
6771
<GlossarySearchWrapper>
6872
<ClickOutside onClickOutside={() => setIsSearchBarFocused(false)}>
@@ -84,23 +88,8 @@ function GlossarySearch() {
8488
entityRegistry={entityRegistry}
8589
onFocus={() => setIsSearchBarFocused(true)}
8690
/>
87-
{isSearchBarFocused && searchResults && !!searchResults.length && (
88-
<ResultsWrapper>
89-
{searchResults.map((result) => {
90-
return (
91-
<SearchResult
92-
to={`${entityRegistry.getEntityUrl(result.entity.type, result.entity.urn)}`}
93-
onClick={() => setIsSearchBarFocused(false)}
94-
>
95-
<IconWrapper>
96-
{entityRegistry.getIcon(result.entity.type, 12, IconStyleType.ACCENT)}
97-
</IconWrapper>
98-
{entityRegistry.getDisplayName(result.entity.type, result.entity)}
99-
</SearchResult>
100-
);
101-
})}
102-
</ResultsWrapper>
103-
)}
91+
{isSearchBarFocused && searchResults && !!searchResults.length && renderSearchResults()}
92+
10493
</ClickOutside>
10594
</GlossarySearchWrapper>
10695
);

datahub-web-react/src/app/glossary/utils.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { EntityType } from '../../types.generated';
1+
import { Entity, EntityType } from '../../types.generated';
2+
import EntityRegistry from '../entity/EntityRegistry';
23
import { GenericEntityProperties } from '../entity/shared/types';
34

45
export const ROOT_NODES = 'rootNodes';
@@ -25,3 +26,8 @@ export function updateGlossarySidebar(
2526
) {
2627
setUrnsToUpdate([...urnsToUpdate, ...parentNodesToUpdate]);
2728
}
29+
30+
export function getParentGlossary<T extends Entity>(node: T, entityRegistry: EntityRegistry) {
31+
const props = entityRegistry.getGenericEntityProperties(EntityType.GlossaryNode, node);
32+
return props?.parentNodes?.nodes ?? [];
33+
}

0 commit comments

Comments
 (0)