Skip to content

Commit

Permalink
Merge branch 'master' into jj--incidents-oss-v1
Browse files Browse the repository at this point in the history
  • Loading branch information
jjoyce0510 authored Jan 29, 2024
2 parents a4ad261 + f378fb6 commit 3861541
Show file tree
Hide file tree
Showing 71 changed files with 2,366 additions and 1,435 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/airflow-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
directory: .
fail_ci_if_error: false
flags: airflow-${{ matrix.python-version }}-${{ matrix.extraPythonRequirement }}
name: pytest-airflow
flags: airflow,airflow-${{ matrix.extra_pip_extras }}
name: pytest-airflow-${{ matrix.python-version }}-${{ matrix.extra_pip_requirements }}
verbose: true

event-file:
Expand Down
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
23 changes: 4 additions & 19 deletions datahub-graphql-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +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(),
"$projectDir/src/main/resources/incident.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
34 changes: 8 additions & 26 deletions datahub-web-react/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import React, { useEffect, useState } from 'react';
import React from 'react';
import Cookies from 'js-cookie';
import { message } from 'antd';
import { BrowserRouter as Router } from 'react-router-dom';
import { ApolloClient, ApolloProvider, createHttpLink, InMemoryCache, ServerError } from '@apollo/client';
import { onError } from '@apollo/client/link/error';
import { ThemeProvider } from 'styled-components';
import { Helmet, HelmetProvider } from 'react-helmet-async';
import './App.less';
import { Routes } from './app/Routes';
import { Theme } from './conf/theme/types';
import defaultThemeConfig from './conf/theme/theme_light.config.json';
import { PageRoutes } from './conf/Global';
import { isLoggedInVar } from './app/auth/checkAuthStatus';
import { GlobalCfg } from './conf';
import possibleTypesResult from './possibleTypes.generated';
import { ErrorCodes } from './app/shared/constants';
import CustomThemeProvider from './CustomThemeProvider';
import { useCustomTheme } from './customThemeContext';

/*
Construct Apollo Client
Expand Down Expand Up @@ -76,33 +75,16 @@ const client = new ApolloClient({
});

export const InnerApp: React.VFC = () => {
const [dynamicThemeConfig, setDynamicThemeConfig] = useState<Theme>(defaultThemeConfig);

useEffect(() => {
if (import.meta.env.DEV) {
import(/* @vite-ignore */ `./conf/theme/${import.meta.env.REACT_APP_THEME_CONFIG}`).then((theme) => {
setDynamicThemeConfig(theme);
});
} else {
// Send a request to the server to get the theme config.
fetch(`/assets/conf/theme/${import.meta.env.REACT_APP_THEME_CONFIG}`)
.then((response) => response.json())
.then((theme) => {
setDynamicThemeConfig(theme);
});
}
}, []);

return (
<HelmetProvider>
<Helmet>
<title>{dynamicThemeConfig.content.title}</title>
</Helmet>
<ThemeProvider theme={dynamicThemeConfig}>
<CustomThemeProvider>
<Helmet>
<title>{useCustomTheme().theme?.content.title}</title>
</Helmet>
<Router>
<Routes />
</Router>
</ThemeProvider>
</CustomThemeProvider>
</HelmetProvider>
);
};
Expand Down
32 changes: 32 additions & 0 deletions datahub-web-react/src/CustomThemeProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React, { useEffect, useState } from 'react';
import { ThemeProvider } from 'styled-components';
import { Theme } from './conf/theme/types';
import defaultThemeConfig from './conf/theme/theme_light.config.json';
import { CustomThemeContext } from './customThemeContext';

const CustomThemeProvider = ({ children }: { children: React.ReactNode }) => {
const [currentTheme, setTheme] = useState<Theme>(defaultThemeConfig);

useEffect(() => {
if (import.meta.env.DEV) {
import(/* @vite-ignore */ `./conf/theme/${import.meta.env.REACT_APP_THEME_CONFIG}`).then((theme) => {
setTheme(theme);
});
} else {
// Send a request to the server to get the theme config.
fetch(`/assets/conf/theme/${import.meta.env.REACT_APP_THEME_CONFIG}`)
.then((response) => response.json())
.then((theme) => {
setTheme(theme);
});
}
}, []);

return (
<CustomThemeContext.Provider value={{ theme: currentTheme, updateTheme: setTheme }}>
<ThemeProvider theme={currentTheme}>{children}</ThemeProvider>
</CustomThemeContext.Provider>
);
};

export default CustomThemeProvider;
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;
Loading

0 comments on commit 3861541

Please sign in to comment.