Skip to content

Commit

Permalink
Merge branch 'master' into profiler-allow-specific-override
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 authored Nov 15, 2022
2 parents ff3b1ab + 6e415ca commit 6dea3b6
Show file tree
Hide file tree
Showing 111 changed files with 6,067 additions and 9,040 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/metadata-ingestion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ jobs:
"testIntegrationBatch1",
"testSlowIntegration",
]
include:
- python-version: "3.7"
extraPythonRequirement: "sqlalchemy==1.3.24 apache-airflow~=2.2.0"
- python-version: "3.10"
extraPythonRequirement: "sqlalchemy~=1.4.0 apache-airflow>=2.4.0"
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand All @@ -50,8 +55,8 @@ jobs:
hadoop-version: "3.2"
- name: Install dependencies
run: ./metadata-ingestion/scripts/install_deps.sh
- name: Run metadata-ingestion tests
run: ./gradlew :metadata-ingestion:build :metadata-ingestion:${{ matrix.command }}
- name: Run metadata-ingestion tests (extras ${{ matrix.extraPythonRequirement }})
run: ./gradlew -Pextra_pip_requirements='${{ matrix.extraPythonRequirement }}' :metadata-ingestion:${{ matrix.command }}
- name: pip freeze show list installed
if: always()
run: source metadata-ingestion/venv/bin/activate && pip freeze
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public MLModelProperties apply(@NonNull final com.linkedin.ml.metadata.MLModelPr

result.setDate(mlModelProperties.getDate());
result.setDescription(mlModelProperties.getDescription());
if (mlModelProperties.getExternalUrl() != null) {
result.setExternalUrl(mlModelProperties.getExternalUrl().toString());
}
if (mlModelProperties.getVersion() != null) {
result.setVersion(mlModelProperties.getVersion().getVersionTag());
}
Expand Down
2 changes: 2 additions & 0 deletions datahub-graphql-core/src/main/resources/entity.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -8333,6 +8333,8 @@ type MLModelProperties {
groups: [MLModelGroup]

customProperties: [CustomPropertiesEntry!]

externalUrl: String
}

type MLFeatureProperties {
Expand Down
3 changes: 2 additions & 1 deletion datahub-web-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"js-cookie": "^2.2.1",
"lodash.debounce": "^4.0.8",
"miragejs": "^0.1.41",
"moment-timezone": "^0.5.34",
"moment-timezone": "^0.5.35",
"monaco-editor": "^0.28.1",
"monaco-yaml": "^3.2.1",
"query-string": "^6.13.8",
Expand All @@ -89,6 +89,7 @@
"styled-components": "^5.2.1",
"typescript": "^4.1.3",
"uuid": "^8.3.2",
"virtualizedtableforantd4": "^1.2.1",
"vx": "^0.0.1",
"web-vitals": "^0.2.4",
"yamljs": "^0.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ import { SchemaTab } from '../../../shared/tabs/Dataset/Schema/SchemaTab';
import EntityContext from '../../../shared/EntityContext';
import { EntityType, SchemaMetadata } from '../../../../../types.generated';

jest.mock('virtualizedtableforantd4', () => {
/* eslint-disable-next-line */
const { SchemaRow } = require('../../../shared/tabs/Dataset/Schema/components/SchemaRow');
return {
...jest.requireActual('virtualizedtableforantd4'),
useVT: () => [{ body: { row: SchemaRow } }, jest.fn()],
};
});

describe('Schema', () => {
it('renders', () => {
const { getByText } = render(
Expand Down
6 changes: 4 additions & 2 deletions datahub-web-react/src/app/entity/mlModel/MLModelEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ export class MLModelEntity implements Entity<MlModel> {

getCollectionName = () => 'ML Models';

getOverridePropertiesFromEntity = (_?: MlModel | null): GenericEntityProperties => {
return {};
getOverridePropertiesFromEntity = (mlModel?: MlModel | null): GenericEntityProperties => {
return {
externalUrl: mlModel?.properties?.externalUrl,
};
};

renderProfile = (urn: string) => (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import styled from 'styled-components';
import { Table } from 'antd';
import styled from 'styled-components';
import { ANTD_GRAY } from '../../constants';

export const StyledTable = styled(Table)`
overflow: inherit;
height: inherit;
&&& .ant-table-cell {
background-color: #fff;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import React from 'react';
import styled from 'styled-components';
import { Typography, Tooltip } from 'antd';
import { FolderOutlined, RightOutlined } from '@ant-design/icons';
import { ANTD_GRAY } from '../../../../constants';
import { EntityType, GlossaryNode } from '../../../../../../../types.generated';
import useContentTruncation from '../../../../../../shared/useContentTruncation';
import { useEntityRegistry } from '../../../../../../useEntityRegistry';

export const StyledRightOutlined = styled(RightOutlined)`
color: ${ANTD_GRAY[7]};
font-size: 8px;
margin: 0 10px;
`;

// must display content in reverse to have ellipses at the beginning of content
export const ParentNodesWrapper = styled.div`
align-items: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
flex-direction: row-reverse;
display: flex;
`;

export const Ellipsis = styled.span`
color: ${ANTD_GRAY[7]};
margin-right: 2px;
`;

export const StyledTooltip = styled(Tooltip)`
display: flex;
white-space: nowrap;
overflow: hidden;
`;

const GlossaryNodeText = styled(Typography.Text)<{ color: string }>`
font-size: 12px;
line-height: 20px;
color: ${(props) => props.color};
`;

const GlossaryNodeIcon = styled(FolderOutlined)<{ color: string }>`
color: ${(props) => props.color};
&&& {
font-size: 12px;
margin-right: 4px;
}
`;

interface Props {
parentNodes?: GlossaryNode[] | null;
}

export default function ParentNodesView({ parentNodes }: Props) {
const entityRegistry = useEntityRegistry();
const { contentRef, isContentTruncated } = useContentTruncation(parentNodes);

return (
<StyledTooltip
title={
<>
{[...(parentNodes || [])]?.reverse()?.map((parentNode, idx) => (
<>
<GlossaryNodeIcon color="white" />
<GlossaryNodeText color="white">
{entityRegistry.getDisplayName(EntityType.GlossaryNode, parentNode)}
</GlossaryNodeText>
{idx + 1 !== parentNodes?.length && <StyledRightOutlined data-testid="right-arrow" />}
</>
))}
</>
}
overlayStyle={isContentTruncated ? {} : { display: 'none' }}
>
{isContentTruncated && <Ellipsis>...</Ellipsis>}
<ParentNodesWrapper ref={contentRef}>
{[...(parentNodes || [])]?.map((parentNode, idx) => (
<>
<GlossaryNodeText color={ANTD_GRAY[7]}>
{entityRegistry.getDisplayName(EntityType.GlossaryNode, parentNode)}
</GlossaryNodeText>
<GlossaryNodeIcon color={ANTD_GRAY[7]} />
{idx + 1 !== parentNodes?.length && <StyledRightOutlined data-testid="right-arrow" />}
</>
))}
</ParentNodesWrapper>
</StyledTooltip>
);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from 'react';
import React from 'react';
import { useEntityRegistry } from '../../../../../../useEntityRegistry';
import { IconStyleType } from '../../../../../Entity';
import { useEntityData } from '../../../../EntityContext';
Expand All @@ -8,6 +8,7 @@ import PlatformContentView from './PlatformContentView';
import { GenericEntityProperties } from '../../../../types';
import EntityRegistry from '../../../../../EntityRegistry';
import { EntityType } from '../../../../../../../types.generated';
import useContentTruncation from '../../../../../../shared/useContentTruncation';

export function getDisplayedEntityType(
entityData: GenericEntityProperties | null,
Expand All @@ -20,23 +21,6 @@ export function getDisplayedEntityType(
return entityData?.entityTypeOverride || entityTypeCased || '';
}

export function useParentContainersTruncation(dataDependency: any) {
const parentContainersRef = useRef<HTMLDivElement>(null);
const [areContainersTruncated, setAreContainersTruncated] = useState(false);

useEffect(() => {
if (
parentContainersRef &&
parentContainersRef.current &&
parentContainersRef.current.scrollWidth > parentContainersRef.current.clientWidth
) {
setAreContainersTruncated(true);
}
}, [dataDependency]);

return { parentContainersRef, areContainersTruncated };
}

function PlatformContentContainer() {
const { entityType, entityData } = useEntityData();
const entityRegistry = useEntityRegistry();
Expand All @@ -50,7 +34,7 @@ function PlatformContentContainer() {
const displayedEntityType = getDisplayedEntityType(entityData, entityRegistry, entityType);
const instanceId = entityData?.dataPlatformInstance?.instanceId;

const { parentContainersRef, areContainersTruncated } = useParentContainersTruncation(entityData);
const { contentRef, isContentTruncated } = useContentTruncation(entityData);

return (
<PlatformContentView
Expand All @@ -65,8 +49,8 @@ function PlatformContentContainer() {
typeIcon={typeIcon}
entityType={displayedEntityType}
parentContainers={entityData?.parentContainers?.containers}
parentContainersRef={parentContainersRef}
areContainersTruncated={areContainersTruncated}
parentContainersRef={contentRef}
areContainersTruncated={isContentTruncated}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import React from 'react';
import styled from 'styled-components';
import { Typography, Image, Tooltip } from 'antd';
import { FolderOutlined, RightOutlined } from '@ant-design/icons';
import { Typography, Image } from 'antd';
import { Maybe } from 'graphql/jsutils/Maybe';
import { Container, GlossaryNode } from '../../../../../../../types.generated';
import { ANTD_GRAY } from '../../../../constants';
import ContainerLink from './ContainerLink';
import { capitalizeFirstLetterOnly } from '../../../../../../shared/textUtil';
import ParentNodesView, {
StyledRightOutlined,
ParentNodesWrapper as ParentContainersWrapper,
Ellipsis,
StyledTooltip,
} from './ParentNodesView';

const LogoIcon = styled.span`
display: flex;
Expand Down Expand Up @@ -45,46 +50,6 @@ const PlatformDivider = styled.div`
vertical-align: text-top;
`;

const StyledRightOutlined = styled(RightOutlined)`
color: ${ANTD_GRAY[7]};
font-size: 8px;
margin: 0 10px;
`;

const ParentContainersWrapper = styled.div`
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
flex-direction: row-reverse;
display: flex;
`;

const Ellipsis = styled.span`
color: ${ANTD_GRAY[7]};
margin-right: 2px;
`;

const StyledTooltip = styled(Tooltip)`
display: flex;
white-space: nowrap;
overflow: hidden;
`;

const GlossaryNodeText = styled(Typography.Text)`
font-size: 12px;
line-height: 20px;
color: ${ANTD_GRAY[7]};
`;

const GlossaryNodeIcon = styled(FolderOutlined)`
color: ${ANTD_GRAY[7]};
&&& {
font-size: 12px;
margin-right: 4px;
}
`;

export function getParentContainerNames(containers?: Maybe<Container>[] | null) {
let parentNames = '';
if (containers) {
Expand Down Expand Up @@ -181,13 +146,7 @@ function PlatformContentView(props: Props) {
</ParentContainersWrapper>
{directParentContainer && <ContainerLink container={directParentContainer} />}
</StyledTooltip>
{[...(parentNodes || [])]?.reverse()?.map((parentNode, idx) => (
<>
<GlossaryNodeIcon />
<GlossaryNodeText>{parentNode?.properties?.name}</GlossaryNodeText>
{idx + 1 !== parentNodes?.length && <StyledRightOutlined data-testid="right-arrow" />}
</>
))}
<ParentNodesView parentNodes={parentNodes} />
</PlatformContentWrapper>
);
}
Expand Down
Loading

0 comments on commit 6dea3b6

Please sign in to comment.