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
david-leifker authored Dec 11, 2023
2 parents 28585a6 + 5ac854d commit 10746c0
Show file tree
Hide file tree
Showing 89 changed files with 1,516 additions and 1,138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.linkedin.common.TimeStamp;
import com.linkedin.common.urn.Urn;
import com.linkedin.data.DataMap;
import com.linkedin.datahub.graphql.generated.AuditStamp;
import com.linkedin.datahub.graphql.generated.Container;
import com.linkedin.datahub.graphql.generated.DataPlatform;
import com.linkedin.datahub.graphql.generated.Dataset;
Expand Down Expand Up @@ -200,10 +201,12 @@ private void mapDatasetProperties(
}
TimeStamp lastModified = gmsProperties.getLastModified();
if (lastModified != null) {
properties.setLastModified(lastModified.getTime());
if (lastModified.hasActor()) {
properties.setLastModifiedActor(lastModified.getActor().toString());
}
Urn actor = lastModified.getActor();
properties.setLastModified(
new AuditStamp(lastModified.getTime(), actor == null ? null : actor.toString()));
properties.setLastModifiedActor(actor == null ? null : actor.toString());
} else {
properties.setLastModified(new AuditStamp(0L, null));
}
}

Expand Down
9 changes: 5 additions & 4 deletions datahub-graphql-core/src/main/resources/entity.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1789,12 +1789,13 @@ type DatasetProperties {
"""
Last Modified timestamp millis associated with the Dataset
"""
lastModified: Long
lastModified: AuditStamp!

"""
Actor associated with the Dataset's lastModified timestamp
Actor associated with the Dataset's lastModified timestamp.
Deprecated - Use lastModified.actor instead.
"""
lastModifiedActor: String
lastModifiedActor: String @deprecated
}


Expand Down Expand Up @@ -11234,4 +11235,4 @@ input UpdateOwnershipTypeInput {
The description of the Custom Ownership Type
"""
description: String
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.linkedin.common.TimeStamp;
import com.linkedin.common.urn.Urn;
import com.linkedin.datahub.graphql.generated.AuditStamp;
import com.linkedin.datahub.graphql.generated.Dataset;
import com.linkedin.datahub.graphql.generated.DatasetProperties;
import com.linkedin.entity.Aspect;
Expand Down Expand Up @@ -58,7 +59,8 @@ public void testDatasetPropertiesMapperWithCreatedAndLastModified() {
expectedDatasetProperties.setQualifiedName("Test QualifiedName");
expectedDatasetProperties.setLastModifiedActor(TEST_LAST_MODIFIED_ACTOR_URN.toString());
expectedDatasetProperties.setCreatedActor(TEST_CREATED_ACTOR_URN.toString());
expectedDatasetProperties.setLastModified(20L);
expectedDatasetProperties.setLastModified(
new AuditStamp(20L, TEST_LAST_MODIFIED_ACTOR_URN.toString()));
expectedDatasetProperties.setCreated(10L);
expected.setProperties(expectedDatasetProperties);

Expand All @@ -68,7 +70,11 @@ public void testDatasetPropertiesMapperWithCreatedAndLastModified() {
actual.getProperties().getQualifiedName(), expected.getProperties().getQualifiedName());

Assert.assertEquals(
actual.getProperties().getLastModified(), expected.getProperties().getLastModified());
actual.getProperties().getLastModified().getTime(),
expected.getProperties().getLastModified().getTime());
Assert.assertEquals(
actual.getProperties().getLastModified().getActor(),
expected.getProperties().getLastModified().getActor());
Assert.assertEquals(actual.getProperties().getCreated(), expected.getProperties().getCreated());

Assert.assertEquals(
Expand Down Expand Up @@ -102,15 +108,19 @@ public void testDatasetPropertiesMapperWithoutCreatedAndLastModified() {
expectedDatasetProperties.setName("Test");
expectedDatasetProperties.setLastModifiedActor(null);
expectedDatasetProperties.setCreatedActor(null);
expectedDatasetProperties.setLastModified(null);
expectedDatasetProperties.setLastModified(new AuditStamp(0L, null));
expectedDatasetProperties.setCreated(null);
expected.setProperties(expectedDatasetProperties);

Assert.assertEquals(actual.getUrn(), expected.getUrn());
Assert.assertEquals(actual.getProperties().getName(), expected.getProperties().getName());

Assert.assertEquals(
actual.getProperties().getLastModified(), expected.getProperties().getLastModified());
actual.getProperties().getLastModified().getTime(),
expected.getProperties().getLastModified().getTime());
Assert.assertEquals(
actual.getProperties().getLastModified().getActor(),
expected.getProperties().getLastModified().getActor());
Assert.assertEquals(actual.getProperties().getCreated(), expected.getProperties().getCreated());

Assert.assertEquals(
Expand Down Expand Up @@ -152,15 +162,19 @@ public void testDatasetPropertiesMapperWithoutTimestampActors() {
expectedDatasetProperties.setName("Test");
expectedDatasetProperties.setLastModifiedActor(null);
expectedDatasetProperties.setCreatedActor(null);
expectedDatasetProperties.setLastModified(20L);
expectedDatasetProperties.setLastModified(new AuditStamp(20L, null));
expectedDatasetProperties.setCreated(10L);
expected.setProperties(expectedDatasetProperties);

Assert.assertEquals(actual.getUrn(), expected.getUrn());
Assert.assertEquals(actual.getProperties().getName(), expected.getProperties().getName());

Assert.assertEquals(
actual.getProperties().getLastModified(), expected.getProperties().getLastModified());
actual.getProperties().getLastModified().getTime(),
expected.getProperties().getLastModified().getTime());
Assert.assertEquals(
actual.getProperties().getLastModified().getActor(),
expected.getProperties().getLastModified().getActor());
Assert.assertEquals(actual.getProperties().getCreated(), expected.getProperties().getCreated());

Assert.assertEquals(
Expand Down
12 changes: 1 addition & 11 deletions datahub-web-react/codegen.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
overwrite: true
schema:
- '../datahub-graphql-core/src/main/resources/app.graphql'
- '../datahub-graphql-core/src/main/resources/entity.graphql'
- '../datahub-graphql-core/src/main/resources/search.graphql'
- '../datahub-graphql-core/src/main/resources/analytics.graphql'
- '../datahub-graphql-core/src/main/resources/recommendation.graphql'
- '../datahub-graphql-core/src/main/resources/auth.graphql'
- '../datahub-graphql-core/src/main/resources/ingestion.graphql'
- '../datahub-graphql-core/src/main/resources/timeline.graphql'
- '../datahub-graphql-core/src/main/resources/tests.graphql'
- '../datahub-graphql-core/src/main/resources/step.graphql'
- '../datahub-graphql-core/src/main/resources/lineage.graphql'
- '../datahub-graphql-core/src/main/resources/*.graphql'
config:
scalars:
Long: number
Expand Down
1 change: 1 addition & 0 deletions datahub-web-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"scripts": {
"analyze": "source-map-explorer 'dist/static/js/*.js'",
"start": "yarn run generate && BROWSER=none REACT_APP_MOCK=false craco start",
"start:dev": "yarn run generate && DISABLE_ESLINT_PLUGIN=true BROWSER=none REACT_APP_MOCK=false craco start",
"start:mock": "yarn run generate && BROWSER=none REACT_APP_MOCK=true craco start",
"start:e2e": "REACT_APP_MOCK=cy BROWSER=none PORT=3010 craco start",
"ec2-dev": "yarn run generate && CI=true;export CI;BROWSER=none craco start",
Expand Down
2 changes: 1 addition & 1 deletion datahub-web-react/src/App.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
@font-face {
font-family: 'Manrope';
font-style: normal;
src: local('Mnarope'), url('./fonts/manrope.woff2') format('woff2'),
src: local('Manrope'), url('./fonts/manrope.woff2') format('woff2'),
}
59 changes: 4 additions & 55 deletions datahub-web-react/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useMemo, useState } from 'react';
import React, { useEffect, useState } from 'react';
import Cookies from 'js-cookie';
import { message } from 'antd';
import { BrowserRouter as Router } from 'react-router-dom';
Expand All @@ -8,34 +8,11 @@ import { ThemeProvider } from 'styled-components';
import { Helmet, HelmetProvider } from 'react-helmet-async';
import './App.less';
import { Routes } from './app/Routes';
import EntityRegistry from './app/entity/EntityRegistry';
import { DashboardEntity } from './app/entity/dashboard/DashboardEntity';
import { ChartEntity } from './app/entity/chart/ChartEntity';
import { UserEntity } from './app/entity/user/User';
import { GroupEntity } from './app/entity/group/Group';
import { DatasetEntity } from './app/entity/dataset/DatasetEntity';
import { DataFlowEntity } from './app/entity/dataFlow/DataFlowEntity';
import { DataJobEntity } from './app/entity/dataJob/DataJobEntity';
import { TagEntity } from './app/entity/tag/Tag';
import { EntityRegistryContext } from './entityRegistryContext';
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 { GlossaryTermEntity } from './app/entity/glossaryTerm/GlossaryTermEntity';
import { MLFeatureEntity } from './app/entity/mlFeature/MLFeatureEntity';
import { MLPrimaryKeyEntity } from './app/entity/mlPrimaryKey/MLPrimaryKeyEntity';
import { MLFeatureTableEntity } from './app/entity/mlFeatureTable/MLFeatureTableEntity';
import { MLModelEntity } from './app/entity/mlModel/MLModelEntity';
import { MLModelGroupEntity } from './app/entity/mlModelGroup/MLModelGroupEntity';
import { DomainEntity } from './app/entity/domain/DomainEntity';
import { ContainerEntity } from './app/entity/container/ContainerEntity';
import GlossaryNodeEntity from './app/entity/glossaryNode/GlossaryNodeEntity';
import { DataPlatformEntity } from './app/entity/dataPlatform/DataPlatformEntity';
import { DataProductEntity } from './app/entity/dataProduct/DataProductEntity';
import { DataPlatformInstanceEntity } from './app/entity/dataPlatformInstance/DataPlatformInstanceEntity';
import { RoleEntity } from './app/entity/Access/RoleEntity';
import possibleTypesResult from './possibleTypes.generated';

/*
Expand Down Expand Up @@ -101,44 +78,16 @@ const App: React.VFC = () => {
});
}, []);

const entityRegistry = useMemo(() => {
const register = new EntityRegistry();
register.register(new DatasetEntity());
register.register(new DashboardEntity());
register.register(new ChartEntity());
register.register(new UserEntity());
register.register(new GroupEntity());
register.register(new TagEntity());
register.register(new DataFlowEntity());
register.register(new DataJobEntity());
register.register(new GlossaryTermEntity());
register.register(new MLFeatureEntity());
register.register(new MLPrimaryKeyEntity());
register.register(new MLFeatureTableEntity());
register.register(new MLModelEntity());
register.register(new MLModelGroupEntity());
register.register(new DomainEntity());
register.register(new ContainerEntity());
register.register(new GlossaryNodeEntity());
register.register(new RoleEntity());
register.register(new DataPlatformEntity());
register.register(new DataProductEntity());
register.register(new DataPlatformInstanceEntity());
return register;
}, []);

return (
<HelmetProvider>
<ThemeProvider theme={dynamicThemeConfig}>
<Router>
<Helmet>
<title>{dynamicThemeConfig.content.title}</title>
</Helmet>
<EntityRegistryContext.Provider value={entityRegistry}>
<ApolloProvider client={client}>
<Routes />
</ApolloProvider>
</EntityRegistryContext.Provider>
<ApolloProvider client={client}>
<Routes />
</ApolloProvider>
</Router>
</ThemeProvider>
</HelmetProvider>
Expand Down
7 changes: 7 additions & 0 deletions datahub-web-react/src/Mocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,11 @@ export const dataset3 = {
},
],
externalUrl: 'https://data.hub',
lastModified: {
__typename: 'AuditStamp',
time: 0,
actor: null,
},
},
parentContainers: {
__typename: 'ParentContainersResult',
Expand Down Expand Up @@ -702,6 +707,7 @@ export const dataset5 = {
origin: 'PROD',
customProperties: [{ key: 'propertyAKey', value: 'propertyAValue', associatedUrn: 'urn:li:dataset:5' }],
externalUrl: 'https://data.hub',
lastModified: dataset3.properties?.lastModified,
},
};

Expand All @@ -716,6 +722,7 @@ export const dataset6 = {
origin: 'PROD',
customProperties: [{ key: 'propertyAKey', value: 'propertyAValue', associatedUrn: 'urn:li:dataset:6' }],
externalUrl: 'https://data.hub',
lastModified: dataset3.properties?.lastModified,
},
};

Expand Down
13 changes: 8 additions & 5 deletions datahub-web-react/src/app/AppProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { EducationStepsProvider } from '../providers/EducationStepsProvider';
import UserContextProvider from './context/UserContextProvider';
import QuickFiltersProvider from '../providers/QuickFiltersProvider';
import SearchContextProvider from './search/context/SearchContextProvider';
import EntityRegistryProvider from './EntityRegistryProvider';

interface Props {
children: React.ReactNode;
Expand All @@ -13,11 +14,13 @@ export default function AppProviders({ children }: Props) {
return (
<AppConfigProvider>
<UserContextProvider>
<EducationStepsProvider>
<QuickFiltersProvider>
<SearchContextProvider>{children}</SearchContextProvider>
</QuickFiltersProvider>
</EducationStepsProvider>
<EntityRegistryProvider>
<EducationStepsProvider>
<QuickFiltersProvider>
<SearchContextProvider>{children}</SearchContextProvider>
</QuickFiltersProvider>
</EducationStepsProvider>
</EntityRegistryProvider>
</UserContextProvider>
</AppConfigProvider>
);
Expand Down
10 changes: 10 additions & 0 deletions datahub-web-react/src/app/EntityRegistryProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import { EntityRegistryContext } from '../entityRegistryContext';
import useBuildEntityRegistry from './useBuildEntityRegistry';

const EntityRegistryProvider = ({ children }: { children: React.ReactNode }) => {
const entityRegistry = useBuildEntityRegistry();
return <EntityRegistryContext.Provider value={entityRegistry}>{children}</EntityRegistryContext.Provider>;
};

export default EntityRegistryProvider;
20 changes: 9 additions & 11 deletions datahub-web-react/src/app/ProtectedRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,23 @@ import EmbedLookup from './embed/lookup';
* Container for all views behind an authentication wall.
*/
export const ProtectedRoutes = (): JSX.Element => {
const entityRegistry = useEntityRegistry();

return (
<AppProviders>
<Layout style={{ height: '100%', width: '100%' }}>
<Layout>
<Switch>
<Route exact path="/" render={() => <HomePage />} />
<Route exact path={PageRoutes.EMBED_LOOKUP} render={() => <EmbedLookup />} />
{entityRegistry.getEntities().map((entity) => (
<Layout>
<Switch>
<Route exact path="/" render={() => <HomePage />} />
<Route exact path={PageRoutes.EMBED_LOOKUP} render={() => <EmbedLookup />} />
{useEntityRegistry()
.getEntities()
.map((entity) => (
<Route
key={`${entity.getPathName()}/${PageRoutes.EMBED}`}
path={`${PageRoutes.EMBED}/${entity.getPathName()}/:urn`}
render={() => <EmbeddedPage entityType={entity.type} />}
/>
))}
<Route path="/*" render={() => <SearchRoutes />} />
</Switch>
</Layout>
<Route path="/*" render={() => <SearchRoutes />} />
</Switch>
</Layout>
</AppProviders>
);
Expand Down
48 changes: 48 additions & 0 deletions datahub-web-react/src/app/buildEntityRegistry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import EntityRegistry from './entity/EntityRegistry';
import { DashboardEntity } from './entity/dashboard/DashboardEntity';
import { ChartEntity } from './entity/chart/ChartEntity';
import { UserEntity } from './entity/user/User';
import { GroupEntity } from './entity/group/Group';
import { DatasetEntity } from './entity/dataset/DatasetEntity';
import { DataFlowEntity } from './entity/dataFlow/DataFlowEntity';
import { DataJobEntity } from './entity/dataJob/DataJobEntity';
import { TagEntity } from './entity/tag/Tag';
import { GlossaryTermEntity } from './entity/glossaryTerm/GlossaryTermEntity';
import { MLFeatureEntity } from './entity/mlFeature/MLFeatureEntity';
import { MLPrimaryKeyEntity } from './entity/mlPrimaryKey/MLPrimaryKeyEntity';
import { MLFeatureTableEntity } from './entity/mlFeatureTable/MLFeatureTableEntity';
import { MLModelEntity } from './entity/mlModel/MLModelEntity';
import { MLModelGroupEntity } from './entity/mlModelGroup/MLModelGroupEntity';
import { DomainEntity } from './entity/domain/DomainEntity';
import { ContainerEntity } from './entity/container/ContainerEntity';
import GlossaryNodeEntity from './entity/glossaryNode/GlossaryNodeEntity';
import { DataPlatformEntity } from './entity/dataPlatform/DataPlatformEntity';
import { DataProductEntity } from './entity/dataProduct/DataProductEntity';
import { DataPlatformInstanceEntity } from './entity/dataPlatformInstance/DataPlatformInstanceEntity';
import { RoleEntity } from './entity/Access/RoleEntity';

export default function buildEntityRegistry() {
const registry = new EntityRegistry();
registry.register(new DatasetEntity());
registry.register(new DashboardEntity());
registry.register(new ChartEntity());
registry.register(new UserEntity());
registry.register(new GroupEntity());
registry.register(new TagEntity());
registry.register(new DataFlowEntity());
registry.register(new DataJobEntity());
registry.register(new GlossaryTermEntity());
registry.register(new MLFeatureEntity());
registry.register(new MLPrimaryKeyEntity());
registry.register(new MLFeatureTableEntity());
registry.register(new MLModelEntity());
registry.register(new MLModelGroupEntity());
registry.register(new DomainEntity());
registry.register(new ContainerEntity());
registry.register(new GlossaryNodeEntity());
registry.register(new RoleEntity());
registry.register(new DataPlatformEntity());
registry.register(new DataProductEntity());
registry.register(new DataPlatformInstanceEntity());
return registry;
}
Loading

0 comments on commit 10746c0

Please sign in to comment.