mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-17 21:56:56 +00:00
feat(container): Add domains aspect to container. (#4059)
This commit is contained in:
parent
aab622793d
commit
c8922b39d6
@ -32,7 +32,8 @@ public class ContainerType implements com.linkedin.datahub.graphql.types.EntityT
|
||||
Constants.SUB_TYPES_ASPECT_NAME,
|
||||
Constants.GLOBAL_TAGS_ASPECT_NAME,
|
||||
Constants.GLOSSARY_TERMS_ASPECT_NAME,
|
||||
Constants.CONTAINER_ASPECT_NAME
|
||||
Constants.CONTAINER_ASPECT_NAME,
|
||||
Constants.DOMAINS_ASPECT_NAME
|
||||
);
|
||||
private final EntityClient _entityClient;
|
||||
|
||||
|
@ -11,12 +11,14 @@ import com.linkedin.container.ContainerProperties;
|
||||
import com.linkedin.container.EditableContainerProperties;
|
||||
import com.linkedin.datahub.graphql.generated.Container;
|
||||
import com.linkedin.datahub.graphql.generated.DataPlatform;
|
||||
import com.linkedin.datahub.graphql.generated.Domain;
|
||||
import com.linkedin.datahub.graphql.generated.EntityType;
|
||||
import com.linkedin.datahub.graphql.types.common.mappers.InstitutionalMemoryMapper;
|
||||
import com.linkedin.datahub.graphql.types.common.mappers.OwnershipMapper;
|
||||
import com.linkedin.datahub.graphql.types.common.mappers.StringMapMapper;
|
||||
import com.linkedin.datahub.graphql.types.glossary.mappers.GlossaryTermsMapper;
|
||||
import com.linkedin.datahub.graphql.types.tag.mappers.GlobalTagsMapper;
|
||||
import com.linkedin.domain.Domains;
|
||||
import com.linkedin.entity.EntityResponse;
|
||||
import com.linkedin.entity.EnvelopedAspect;
|
||||
import com.linkedin.entity.EnvelopedAspectMap;
|
||||
@ -89,6 +91,17 @@ public class ContainerMapper {
|
||||
.build());
|
||||
}
|
||||
|
||||
final EnvelopedAspect envelopedDomains = aspects.get(Constants.DOMAINS_ASPECT_NAME);
|
||||
if (envelopedDomains != null) {
|
||||
final Domains domains = new Domains(envelopedDomains.getValue().data());
|
||||
// Currently we only take the first domain if it exists.
|
||||
if (domains.getDomains().size() > 0) {
|
||||
result.setDomain(Domain.builder()
|
||||
.setType(EntityType.DOMAIN)
|
||||
.setUrn(domains.getDomains().get(0).toString()).build());
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1183,6 +1183,11 @@ type Container implements Entity {
|
||||
"""
|
||||
subTypes: SubTypes
|
||||
|
||||
"""
|
||||
The Domain associated with the Dataset
|
||||
"""
|
||||
domain: Domain
|
||||
|
||||
"""
|
||||
Children entities inside of the Container
|
||||
"""
|
||||
|
@ -117,6 +117,7 @@ export class ContainerEntity implements Entity<Container> {
|
||||
subTypes={data.subTypes}
|
||||
container={data.container}
|
||||
entityCount={data.entities?.total}
|
||||
domain={data.domain}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@ -134,6 +135,7 @@ export class ContainerEntity implements Entity<Container> {
|
||||
subTypes={data.subTypes}
|
||||
container={data.container}
|
||||
entityCount={data.entities?.total}
|
||||
domain={data.domain}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { Container, EntityType, Owner, SearchInsight, SubTypes } from '../../../../types.generated';
|
||||
import { Container, EntityType, Owner, SearchInsight, SubTypes, Domain } from '../../../../types.generated';
|
||||
import DefaultPreviewCard from '../../../preview/DefaultPreviewCard';
|
||||
import { useEntityRegistry } from '../../../useEntityRegistry';
|
||||
import { IconStyleType } from '../../Entity';
|
||||
@ -16,6 +16,7 @@ export const Preview = ({
|
||||
logoComponent,
|
||||
container,
|
||||
entityCount,
|
||||
domain,
|
||||
}: {
|
||||
urn: string;
|
||||
name: string;
|
||||
@ -28,6 +29,7 @@ export const Preview = ({
|
||||
logoComponent?: JSX.Element;
|
||||
container?: Container | null;
|
||||
entityCount?: number;
|
||||
domain?: Domain | null;
|
||||
}): JSX.Element => {
|
||||
const entityRegistry = useEntityRegistry();
|
||||
const typeName = (subTypes?.typeNames?.length && subTypes?.typeNames[0]) || 'Container';
|
||||
@ -45,6 +47,7 @@ export const Preview = ({
|
||||
container={container || undefined}
|
||||
typeIcon={entityRegistry.getIcon(EntityType.Container, 12, IconStyleType.ACCENT)}
|
||||
entityCount={entityCount}
|
||||
domain={domain || undefined}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -60,6 +60,7 @@ entities:
|
||||
- institutionalMemory
|
||||
- browsePaths # unclear if this will be used
|
||||
- status
|
||||
- domains
|
||||
- name: glossaryTerm
|
||||
keyAspect: glossaryTermKey
|
||||
aspects:
|
||||
|
Loading…
x
Reference in New Issue
Block a user