Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(autorender): Auto render aspects that don't have frontend components in the UI #3597

Merged
merged 43 commits into from
Nov 30, 2021

Conversation

gabe-lyons
Copy link
Contributor

Introduced a few templates for auto rendering aspects. This allows users of Datahub to see extensions of their metadata model in the UI without updating Java or React code.

Coming soon: extend the metadata model without forking datahub!

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable)

@github-actions
Copy link

github-actions bot commented Nov 19, 2021

Unit Test Results

     44 files  ±0       44 suites  ±0   27m 35s ⏱️ -8s
   619 tests ±0     567 ✔️ ±0  52 💤 ±0  0 ±0 
1 358 runs  ±0  1 290 ✔️ ±0  68 💤 ±0  0 ±0 

Results for commit 1d69e3c. ± Comparison against base commit ca6f69f.

♻️ This comment has been updated with latest results.

@@ -238,6 +242,7 @@ public GmsGraphQLEngine(
this.mlPrimaryKeyType = new MLPrimaryKeyType(entityClient);
this.dataFlowType = new DataFlowType(entityClient);
this.dataJobType = new DataJobType(entityClient);
this.entityRegistry = entityRegistry;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: seems odd to place this here. Can we put it below all of the types? Or above?

@@ -213,6 +216,7 @@ public GmsGraphQLEngine(
final AnalyticsService analyticsService,
final EntityService entityService,
final RecommendationsService recommendationsService,
final EntityRegistry entityRegistry,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put this at the end, instead of between 2 services?

@AllArgsConstructor
public class WeaklyTypedAspectsResolver implements DataFetcher<CompletableFuture<List<RawAspect>>> {

EntityClient _aspectClient;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: shouldn't these be private finals?

private static final JacksonDataCodec CODEC = new JacksonDataCodec();

private boolean shouldReturnAspect(AspectSpec aspectSpec, AspectParams params) {
return !params.getAutoRender() || aspectSpec.isAutoRender();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is confusing on first read --

I only return an aspect if there is no "auto render" params OR if the aspect is auto-render enabled? (Not clear what the difference is, yet)

Params to configure what list of aspects should be fetched by the aspects property
"""
input AspectParams {
autoRender: Boolean
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be for fetching ONLY those aspects which are defined as autorender?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no comment on autoRender field

entityData?.autoRenderAspects?.map((aspect) => ({
name: aspect.renderSpec?.displayName || aspect.aspectName,
component: () => (
<DynamicTab
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty cool!

}

export default function TableValueElement({ value }: { value: any }) {
if (typeof value === 'boolean') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very interesting!

@@ -60,6 +62,10 @@
@Qualifier("dataHubTokenService")
private TokenService _tokenService;

@Autowired
@Qualifier("entityRegistry")
private EntityRegistry _entityRegistry;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit sad to see another storage layer dependency ending up in GraphQL land!

return null;
}

if (entity.hasAspect()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff! Is there ever a reason we'll want an "Enveloped Aspect" hre? That is the raw aspect PLUS information about when / by who it was created, the version, the system metadata, etc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah- i agree that endpoint would be useful! i left space in the graphql response to add that in later 👍

Copy link
Collaborator

@jjoyce0510 jjoyce0510 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few minor things. Otherwise looks good. Interested to see how we can continue to push ourselves in a more dynamic direction.

Copy link
Contributor

@shirshanka shirshanka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs needed

Copy link
Contributor

@shirshanka shirshanka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@shirshanka shirshanka merged commit 6436f06 into datahub-project:master Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants