-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(previews): add previews for glossary terms, tags, and domains (#…
…5784) * add graphql for chart glossary terms * add placeholder tab component * continued progress * finished rendering of other tooltips * fix tests * add null check * force more clicks * fix analytics test
- Loading branch information
1 parent
ca29f8b
commit 5bf5fc2
Showing
32 changed files
with
591 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...ore/src/main/java/com/linkedin/datahub/graphql/types/chart/mappers/InputFieldsMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.linkedin.datahub.graphql.types.chart.mappers; | ||
|
||
import com.linkedin.common.InputFields; | ||
import com.linkedin.common.urn.Urn; | ||
import com.linkedin.datahub.graphql.generated.InputField; | ||
import com.linkedin.datahub.graphql.types.dataset.mappers.SchemaFieldMapper; | ||
import java.util.stream.Collectors; | ||
import javax.annotation.Nonnull; | ||
|
||
|
||
public class InputFieldsMapper { | ||
|
||
public static final InputFieldsMapper INSTANCE = new InputFieldsMapper(); | ||
|
||
public static com.linkedin.datahub.graphql.generated.InputFields map(@Nonnull final InputFields metadata, @Nonnull final Urn entityUrn) { | ||
return INSTANCE.apply(metadata, entityUrn); | ||
} | ||
|
||
public com.linkedin.datahub.graphql.generated.InputFields apply(@Nonnull final InputFields input, @Nonnull final Urn entityUrn) { | ||
final com.linkedin.datahub.graphql.generated.InputFields result = new com.linkedin.datahub.graphql.generated.InputFields(); | ||
result.setFields(input.getFields().stream().map(field -> { | ||
InputField fieldResult = new InputField(); | ||
|
||
if (field.hasSchemaField()) { | ||
fieldResult.setSchemaField(SchemaFieldMapper.map(field.getSchemaField(), entityUrn)); | ||
} | ||
return fieldResult; | ||
}).collect(Collectors.toList())); | ||
|
||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from 'react'; | ||
|
||
import { Typography } from 'antd'; | ||
import { InputFields, MatchedField, Maybe } from '../../../types.generated'; | ||
import TagTermGroup from '../../shared/tags/TagTermGroup'; | ||
import { FIELDS_TO_HIGHLIGHT } from '../dataset/search/highlights'; | ||
import { getMatchPrioritizingPrimary } from '../shared/utils'; | ||
|
||
type Props = { | ||
matchedFields: MatchedField[]; | ||
inputFields: Maybe<InputFields> | undefined; | ||
}; | ||
|
||
const LABEL_INDEX_NAME = 'fieldLabels'; | ||
const TYPE_PROPERTY_KEY_NAME = 'type'; | ||
|
||
export const ChartSnippet = ({ matchedFields, inputFields }: Props) => { | ||
const matchedField = getMatchPrioritizingPrimary(matchedFields, 'fieldLabels'); | ||
|
||
if (matchedField?.name === LABEL_INDEX_NAME) { | ||
const matchedSchemaField = inputFields?.fields?.find( | ||
(field) => field?.schemaField?.label === matchedField.value, | ||
); | ||
const matchedGlossaryTerm = matchedSchemaField?.schemaField?.glossaryTerms?.terms?.find( | ||
(term) => term?.term?.name === matchedField.value, | ||
); | ||
|
||
if (matchedGlossaryTerm) { | ||
let termType = 'term'; | ||
const typeProperty = matchedGlossaryTerm.term.properties?.customProperties?.find( | ||
(property) => property.key === TYPE_PROPERTY_KEY_NAME, | ||
); | ||
if (typeProperty) { | ||
termType = typeProperty.value || termType; | ||
} | ||
|
||
return ( | ||
<Typography.Text> | ||
Matches {termType} <TagTermGroup uneditableGlossaryTerms={{ terms: [matchedGlossaryTerm] }} /> | ||
</Typography.Text> | ||
); | ||
} | ||
} | ||
|
||
return matchedField ? ( | ||
<Typography.Text> | ||
Matches {FIELDS_TO_HIGHLIGHT.get(matchedField.name)} <b>{matchedField.value}</b> | ||
</Typography.Text> | ||
) : null; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.