mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-10 00:11:15 +00:00
fix(ui): pass createdBy to highlight query column (#14042)
This commit is contained in:
parent
fe56b0f41e
commit
14b9bed58d
@ -55,6 +55,14 @@ public class QueryPropertiesMapper
|
|||||||
created.setActor(input.getCreated().getActor(GetMode.NULL).toString());
|
created.setActor(input.getCreated().getActor(GetMode.NULL).toString());
|
||||||
result.setCreated(created);
|
result.setCreated(created);
|
||||||
|
|
||||||
|
// Map created resolved audit stamp
|
||||||
|
ResolvedAuditStamp createdOn = new ResolvedAuditStamp();
|
||||||
|
createdOn.setTime(input.getCreated().getTime());
|
||||||
|
final CorpUser createdUser = new CorpUser();
|
||||||
|
createdUser.setUrn(input.getCreated().getActor().toString());
|
||||||
|
createdOn.setActor(createdUser);
|
||||||
|
result.setCreatedOn(createdOn);
|
||||||
|
|
||||||
// Map last modified audit stamp
|
// Map last modified audit stamp
|
||||||
AuditStamp lastModified = new AuditStamp();
|
AuditStamp lastModified = new AuditStamp();
|
||||||
lastModified.setTime(input.getLastModified().getTime());
|
lastModified.setTime(input.getLastModified().getTime());
|
||||||
|
|||||||
@ -12565,6 +12565,11 @@ type QueryProperties {
|
|||||||
"""
|
"""
|
||||||
created: AuditStamp!
|
created: AuditStamp!
|
||||||
|
|
||||||
|
"""
|
||||||
|
A Resolved Audit Stamp corresponding to the creation of this resource
|
||||||
|
"""
|
||||||
|
createdOn: ResolvedAuditStamp!
|
||||||
|
|
||||||
"""
|
"""
|
||||||
An Audit Stamp corresponding to the update of this resource
|
An Audit Stamp corresponding to the update of this resource
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -121,6 +121,10 @@ public class QueryPropertiesMapperTest {
|
|||||||
assertEquals(result.getLastModified().getTime().longValue(), 2000L);
|
assertEquals(result.getLastModified().getTime().longValue(), 2000L);
|
||||||
assertEquals(result.getLastModified().getActor(), userUrn.toString());
|
assertEquals(result.getLastModified().getActor(), userUrn.toString());
|
||||||
|
|
||||||
|
// Verify createdOn resolved stamp
|
||||||
|
assertEquals(result.getCreatedOn().getTime().longValue(), 1000L);
|
||||||
|
assertEquals(result.getCreatedOn().getActor().getUrn(), userUrn.toString());
|
||||||
|
|
||||||
// Verify optional fields
|
// Verify optional fields
|
||||||
assertEquals(result.getName(), "Test Query");
|
assertEquals(result.getName(), "Test Query");
|
||||||
assertEquals(result.getDescription(), "Test Description");
|
assertEquals(result.getDescription(), "Test Description");
|
||||||
|
|||||||
@ -11,8 +11,7 @@ import { Query } from '@app/entityV2/shared/tabs/Dataset/Queries/types';
|
|||||||
import { useEntityRegistryV2 } from '@app/useEntityRegistry';
|
import { useEntityRegistryV2 } from '@app/useEntityRegistry';
|
||||||
import MarkdownViewer from '@src/app/entity/shared/components/legacy/MarkdownViewer';
|
import MarkdownViewer from '@src/app/entity/shared/components/legacy/MarkdownViewer';
|
||||||
|
|
||||||
import { useDeleteQueryMutation } from '@graphql/query.generated';
|
import { ActorWithDisplayNameFragment, useDeleteQueryMutation } from '@graphql/query.generated';
|
||||||
import { CorpUser, EntityType } from '@types';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Description Column
|
* Description Column
|
||||||
@ -68,7 +67,7 @@ export const QueryDescription = ({ description }: DescriptionProps) => {
|
|||||||
const INGESTION_URN = 'urn:li:corpuser:_ingestion';
|
const INGESTION_URN = 'urn:li:corpuser:_ingestion';
|
||||||
|
|
||||||
interface CreatedByProps {
|
interface CreatedByProps {
|
||||||
createdBy?: CorpUser;
|
createdBy?: ActorWithDisplayNameFragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const QueryCreatedBy = ({ createdBy }: CreatedByProps) => {
|
export const QueryCreatedBy = ({ createdBy }: CreatedByProps) => {
|
||||||
@ -76,17 +75,16 @@ export const QueryCreatedBy = ({ createdBy }: CreatedByProps) => {
|
|||||||
|
|
||||||
if (!createdBy || createdBy.urn === INGESTION_URN) return null;
|
if (!createdBy || createdBy.urn === INGESTION_URN) return null;
|
||||||
|
|
||||||
const userName = entityRegistry.getDisplayName(EntityType.CorpUser, createdBy);
|
const userName = entityRegistry.getDisplayName(createdBy.type, createdBy);
|
||||||
|
const photoUrl = createdBy?.editableProperties?.pictureLink || createdBy?.editableInfo?.pictureLink || undefined;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<ActorAvatar
|
<ActorAvatar
|
||||||
size={26}
|
size={26}
|
||||||
name={userName}
|
name={userName}
|
||||||
url={`/${entityRegistry.getPathName(EntityType.CorpUser)}/${createdBy.urn}`}
|
url={`/${entityRegistry.getPathName(createdBy.type)}/${createdBy.urn}`}
|
||||||
photoUrl={
|
photoUrl={photoUrl}
|
||||||
createdBy?.editableProperties?.pictureLink || createdBy?.editableInfo?.pictureLink || undefined
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { ActorWithDisplayNameFragment } from '@graphql/query.generated';
|
||||||
import { CorpUser, Entity, SchemaFieldEntity } from '@types';
|
import { CorpUser, Entity, SchemaFieldEntity } from '@types';
|
||||||
|
|
||||||
export type QueryBuilderState = {
|
export type QueryBuilderState = {
|
||||||
@ -14,7 +15,7 @@ export type Query = {
|
|||||||
description?: string;
|
description?: string;
|
||||||
lastRun?: number;
|
lastRun?: number;
|
||||||
createdTime?: number;
|
createdTime?: number;
|
||||||
createdBy?: CorpUser | null;
|
createdBy?: ActorWithDisplayNameFragment | null;
|
||||||
poweredEntity?: Entity;
|
poweredEntity?: Entity;
|
||||||
usedBy?: CorpUser[];
|
usedBy?: CorpUser[];
|
||||||
columns?: SchemaFieldEntity[];
|
columns?: SchemaFieldEntity[];
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import { EntityLink } from '@app/homeV2/reference/sections/EntityLink';
|
|||||||
import { Sorting } from '@app/sharedV2/sorting/useSorting';
|
import { Sorting } from '@app/sharedV2/sorting/useSorting';
|
||||||
import { useEntityRegistryV2 } from '@app/useEntityRegistry';
|
import { useEntityRegistryV2 } from '@app/useEntityRegistry';
|
||||||
|
|
||||||
|
import { ActorWithDisplayNameFragment } from '@graphql/query.generated';
|
||||||
import { CorpUser, Entity } from '@types';
|
import { CorpUser, Entity } from '@types';
|
||||||
|
|
||||||
const UsersWrapper = styled.div`
|
const UsersWrapper = styled.div`
|
||||||
@ -108,7 +109,7 @@ export default function useQueryTableColumns({
|
|||||||
const createdByB = entityRegistry.getDisplayName(queryB.createdBy.type, queryB.createdBy);
|
const createdByB = entityRegistry.getDisplayName(queryB.createdBy.type, queryB.createdBy);
|
||||||
return createdByA.localeCompare(createdByB);
|
return createdByA.localeCompare(createdByB);
|
||||||
},
|
},
|
||||||
render: (createdBy: CorpUser) => {
|
render: (createdBy: ActorWithDisplayNameFragment) => {
|
||||||
return <QueryCreatedBy createdBy={createdBy} />;
|
return <QueryCreatedBy createdBy={createdBy} />;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -17,6 +17,7 @@ export function mapQuery({ queryEntity, entityUrn, siblingUrn, poweredEntity }:
|
|||||||
description: queryEntity.properties?.description || undefined,
|
description: queryEntity.properties?.description || undefined,
|
||||||
query: queryEntity.properties?.statement?.value || '',
|
query: queryEntity.properties?.statement?.value || '',
|
||||||
createdTime: queryEntity?.properties?.created?.time,
|
createdTime: queryEntity?.properties?.created?.time,
|
||||||
|
createdBy: queryEntity?.properties?.createdOn?.actor,
|
||||||
columns: queryEntity.subjects
|
columns: queryEntity.subjects
|
||||||
?.filter((s) => !!s.schemaField)
|
?.filter((s) => !!s.schemaField)
|
||||||
?.filter((s) => {
|
?.filter((s) => {
|
||||||
|
|||||||
@ -8,6 +8,18 @@ query getQuery($urn: String!) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fragment ActorWithDisplayName on CorpUser {
|
||||||
|
urn
|
||||||
|
type
|
||||||
|
...entityDisplayNameFields
|
||||||
|
editableProperties {
|
||||||
|
pictureLink
|
||||||
|
}
|
||||||
|
editableInfo {
|
||||||
|
pictureLink
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fragment query on QueryEntity {
|
fragment query on QueryEntity {
|
||||||
urn
|
urn
|
||||||
properties {
|
properties {
|
||||||
@ -22,6 +34,12 @@ fragment query on QueryEntity {
|
|||||||
time
|
time
|
||||||
actor
|
actor
|
||||||
}
|
}
|
||||||
|
createdOn {
|
||||||
|
time
|
||||||
|
actor {
|
||||||
|
...ActorWithDisplayName
|
||||||
|
}
|
||||||
|
}
|
||||||
lastModified {
|
lastModified {
|
||||||
time
|
time
|
||||||
actor
|
actor
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user