Skip to content

Commit

Permalink
refactor(ui): Remove unnecessary fields in GraphQL (datahub-project#5358
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jjoyce0510 authored and shirshanka committed Jul 9, 2022
1 parent 72e78fd commit c7a2df3
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 78 deletions.
1 change: 0 additions & 1 deletion datahub-web-react/src/Mocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ export const dataset3 = {
primaryKeys: [],
foreignKeys: [],
},
previousSchemaMetadata: null,
editableSchemaMetadata: null,
deprecation: null,
usageStats: null,
Expand Down
4 changes: 2 additions & 2 deletions datahub-web-react/src/app/entity/dataJob/DataJobEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export class DataJobEntity implements Entity<DataJob> {
display: {
visible: (_, _1) => true,
enabled: (_, dataJob: GetDataJobQuery) =>
(dataJob?.dataJob?.incoming?.count || 0) !== 0 ||
(dataJob?.dataJob?.outgoing?.count || 0) !== 0,
(dataJob?.dataJob?.upstream?.count || 0) !== 0 ||
(dataJob?.dataJob?.downstream?.count || 0) !== 0,
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { useEntityRegistry } from '../../../../useEntityRegistry';
export const DataJobFlowTab = () => {
const entity = useBaseEntity() as any;
const dataJob = entity && entity.dataJob;
const dataFlows = dataJob?.parentFlow?.relationships.map((relationship) => relationship.entity);
const dataFlow = dataJob?.dataFlow;
const entityRegistry = useEntityRegistry();
const title = `Part of ${entityRegistry.getEntityName(EntityType.DataFlow)}`;
return <EntityList title={title} type={EntityType.DataFlow} entities={dataFlows || []} />;
return <EntityList title={title} type={EntityType.DataFlow} entities={[dataFlow] || []} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ export type DatasetEntityArg = {
path: string;
};

export const datasetEntity = ({
platform,
origin,
path,
}: DatasetEntityArg): Dataset & { previousSchemaMetadata: any } => {
export const datasetEntity = ({ platform, origin, path }: DatasetEntityArg): Dataset => {
const name = `${path}.${faker.company.bsNoun()}_${faker.company.bsNoun()}`;
const description = `${faker.commerce.productDescription()}`;
const datahubUser = findUserByUsername('datahub');
Expand Down Expand Up @@ -80,7 +76,6 @@ export const datasetEntity = ({
usageStats: null,
glossaryTerms: null,
schemaMetadata: null,
previousSchemaMetadata: null,
__typename: 'Dataset',
subTypes: null,
health: [],
Expand Down
3 changes: 0 additions & 3 deletions datahub-web-react/src/graphql/chart.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ query getChart($urn: String!) {
dashboards: relationships(input: { types: ["Contains"], direction: INCOMING, start: 0, count: 100 }) {
...fullRelationshipResults
}
container {
...entityContainer
}
parentContainers {
...parentContainersFields
}
Expand Down
3 changes: 0 additions & 3 deletions datahub-web-react/src/graphql/dashboard.graphql
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
query getDashboard($urn: String!) {
dashboard(urn: $urn) {
...dashboardFields
editableProperties {
description
}
charts: relationships(input: { types: ["Contains"], direction: OUTGOING, start: 0, count: 100 }) {
...fullRelationshipResults
}
Expand Down
24 changes: 0 additions & 24 deletions datahub-web-react/src/graphql/dataJob.graphql
Original file line number Diff line number Diff line change
@@ -1,41 +1,17 @@
query getDataJob($urn: String!) {
dataJob(urn: $urn) {
...dataJobFields
parentFlow: relationships(input: { types: ["IsPartOf"], direction: OUTGOING, start: 0, count: 1 }) {
...fullRelationshipResults
}
incoming: relationships(
input: {
types: ["DownstreamOf", "Consumes", "Produces", "TrainedBy"]
direction: INCOMING
start: 0
count: 100
}
) {
...fullRelationshipResults
}
outgoing: relationships(
input: { types: ["DownstreamOf", "Consumes", "Produces"], direction: OUTGOING, start: 0, count: 100 }
) {
...fullRelationshipResults
}
upstream: lineage(input: { direction: UPSTREAM, start: 0, count: 100 }) {
...partialLineageResults
}
downstream: lineage(input: { direction: DOWNSTREAM, start: 0, count: 100 }) {
...partialLineageResults
}
status {
removed
}
runs(start: 0, count: 20) {
count
start
total
}
deprecation {
...deprecationFields
}
}
}

Expand Down
6 changes: 0 additions & 6 deletions datahub-web-react/src/graphql/dataset.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ fragment nonSiblingDatasetFields on Dataset {
schemaMetadata(version: 0) {
...schemaMetadataFields
}
previousSchemaMetadata: schemaMetadata(version: -1) {
...schemaMetadataFields
}
editableSchemaMetadata {
editableSchemaFieldInfo {
fieldPath
Expand Down Expand Up @@ -74,9 +71,6 @@ fragment nonSiblingDatasetFields on Dataset {
domain {
...entityDomain
}
container {
...entityContainer
}
parentContainers {
...parentContainersFields
}
Expand Down
38 changes: 10 additions & 28 deletions datahub-web-react/src/graphql/fragments.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,9 @@ fragment glossaryNode on GlossaryNode {
properties {
name
}
children: relationships(
input: {
types: ["IsPartOf"]
direction: INCOMING
start: 0
count: 1000
}
) {
count
}
children: relationships(input: { types: ["IsPartOf"], direction: INCOMING, start: 0, count: 1000 }) {
count
}
}

fragment glossaryTerm on GlossaryTerm {
Expand Down Expand Up @@ -209,9 +202,6 @@ fragment nonRecursiveDatasetFields on Dataset {
schemaMetadata(version: 0) {
...schemaMetadataFields
}
previousSchemaMetadata: schemaMetadata(version: -1) {
...schemaMetadataFields
}
editableSchemaMetadata {
editableSchemaFieldInfo {
fieldPath
Expand Down Expand Up @@ -306,17 +296,6 @@ fragment dataJobFields on DataJob {
ownership {
...ownershipFields
}
inputOutput {
inputDatasets {
...nonRecursiveDatasetFields
}
outputDatasets {
...nonRecursiveDatasetFields
}
inputDatajobs {
...nonRecursiveDataJobFields
}
}
properties {
name
description
Expand Down Expand Up @@ -344,6 +323,9 @@ fragment dataJobFields on DataJob {
deprecation {
...deprecationFields
}
status {
removed
}
dataPlatformInstance {
...dataPlatformInstanceFields
}
Expand Down Expand Up @@ -371,6 +353,9 @@ fragment dashboardFields on Dashboard {
time
}
}
editableProperties {
description
}
ownership {
...ownershipFields
}
Expand All @@ -389,9 +374,6 @@ fragment dashboardFields on Dashboard {
domain {
...entityDomain
}
container {
...entityContainer
}
parentContainers {
...parentContainersFields
}
Expand Down Expand Up @@ -798,7 +780,7 @@ fragment nonConflictingPlatformFields on DataPlatform {
}
}

fragment dataPlatformInstanceFields on DataPlatformInstance {
fragment dataPlatformInstanceFields on DataPlatformInstance {
urn
type
platform {
Expand Down
77 changes: 74 additions & 3 deletions datahub-web-react/src/graphql/lineage.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,39 @@ fragment lineageNodeProperties on EntityWithRelationships {
urn
type
... on DataJob {
...dataJobFields
urn
type
dataFlow {
...nonRecursiveDataFlowFields
}
jobId
ownership {
...ownershipFields
}
properties {
name
description
externalUrl
customProperties {
key
value
}
}
globalTags {
...globalTagsFields
}
glossaryTerms {
...glossaryTerms
}
domain {
...entityDomain
}
deprecation {
...deprecationFields
}
dataPlatformInstance {
...dataPlatformInstanceFields
}
editableProperties {
description
}
Expand Down Expand Up @@ -42,13 +74,52 @@ fragment lineageNodeProperties on EntityWithRelationships {
}
}
... on Dashboard {
...dashboardFields
editableProperties {
urn
type
tool
dashboardId
properties {
name
description
externalUrl
lastRefreshed
created {
time
}
lastModified {
time
}
}
ownership {
...ownershipFields
}
globalTags {
...globalTagsFields
}
glossaryTerms {
...glossaryTerms
}
platform {
...platformFields
}
domain {
...entityDomain
}
parentContainers {
...parentContainersFields
}
status {
removed
}
deprecation {
...deprecationFields
}
dataPlatformInstance {
...dataPlatformInstanceFields
}
editableProperties {
description
}
status {
removed
}
Expand Down

0 comments on commit c7a2df3

Please sign in to comment.