mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-03 15:17:58 +00:00
fix(ui): dereference issues (#12109)
This commit is contained in:
parent
bc4c7c633e
commit
eee49b3cb8
@ -24,11 +24,11 @@ const StructuredPropValues = ({ schemaFieldEntity, propColumn }: Props) => {
|
|||||||
const entityRegistry = useEntityRegistry();
|
const entityRegistry = useEntityRegistry();
|
||||||
|
|
||||||
const property = schemaFieldEntity.structuredProperties?.properties?.find(
|
const property = schemaFieldEntity.structuredProperties?.properties?.find(
|
||||||
(prop) => prop.structuredProperty.urn === propColumn?.entity.urn,
|
(prop) => prop.structuredProperty.urn === propColumn?.entity?.urn,
|
||||||
);
|
);
|
||||||
const propRow = property ? mapStructuredPropertyToPropertyRow(property) : undefined;
|
const propRow = property ? mapStructuredPropertyToPropertyRow(property) : undefined;
|
||||||
const values = propRow?.values;
|
const values = propRow?.values;
|
||||||
const isRichText = propRow?.dataType?.info.type === StdDataType.RichText;
|
const isRichText = propRow?.dataType?.info?.type === StdDataType.RichText;
|
||||||
|
|
||||||
const hasMoreValues = values && values.length > 2;
|
const hasMoreValues = values && values.length > 2;
|
||||||
const displayedValues = hasMoreValues ? values.slice(0, 1) : values;
|
const displayedValues = hasMoreValues ? values.slice(0, 1) : values;
|
||||||
|
@ -41,8 +41,8 @@ const StructuredPropertyBadge = ({ structuredProperties }: Props) => {
|
|||||||
|
|
||||||
if (!badgeStructuredProperty) return null;
|
if (!badgeStructuredProperty) return null;
|
||||||
|
|
||||||
const propertyValue = propRow?.values[0].value;
|
const propertyValue = propRow?.values[0]?.value;
|
||||||
const relatedDescription = propRow?.structuredProperty.definition.allowedValues?.find(
|
const relatedDescription = propRow?.structuredProperty?.definition?.allowedValues?.find(
|
||||||
(v) => getStructuredPropertyValue(v.value) === propertyValue,
|
(v) => getStructuredPropertyValue(v.value) === propertyValue,
|
||||||
)?.description;
|
)?.description;
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ const StructuredPropertyBadge = ({ structuredProperties }: Props) => {
|
|||||||
<Text color="gray" size="sm" weight="bold">
|
<Text color="gray" size="sm" weight="bold">
|
||||||
Value
|
Value
|
||||||
</Text>
|
</Text>
|
||||||
<Text color="gray">{propRow?.values[0].value}</Text>
|
<Text color="gray">{propRow?.values[0]?.value}</Text>
|
||||||
</ValueContainer>
|
</ValueContainer>
|
||||||
{relatedDescription && (
|
{relatedDescription && (
|
||||||
<ValueContainer>
|
<ValueContainer>
|
||||||
@ -79,7 +79,7 @@ const StructuredPropertyBadge = ({ structuredProperties }: Props) => {
|
|||||||
>
|
>
|
||||||
<BadgeContainer>
|
<BadgeContainer>
|
||||||
<Pill
|
<Pill
|
||||||
label={propRow?.values[0].value?.toString() || ''}
|
label={propRow?.values[0]?.value?.toString() || ''}
|
||||||
size="sm"
|
size="sm"
|
||||||
colorScheme="violet"
|
colorScheme="violet"
|
||||||
clickable={false}
|
clickable={false}
|
||||||
|
@ -87,7 +87,7 @@ const SidebarStructuredPropsSection = ({ properties }: Props) => {
|
|||||||
property,
|
property,
|
||||||
currentProperties,
|
currentProperties,
|
||||||
);
|
);
|
||||||
const isRichText = propertyRow?.dataType?.info.type === StdDataType.RichText;
|
const isRichText = propertyRow?.dataType?.info?.type === StdDataType.RichText;
|
||||||
const values = propertyRow?.values;
|
const values = propertyRow?.values;
|
||||||
const hasMultipleValues = values && values.length > 1;
|
const hasMultipleValues = values && values.length > 1;
|
||||||
const propertyName = getDisplayName(property.entity as StructuredPropertyEntity);
|
const propertyName = getDisplayName(property.entity as StructuredPropertyEntity);
|
||||||
|
@ -57,7 +57,7 @@ function Form({ formUrn }: Props) {
|
|||||||
const title = formAssociation?.form?.info?.name;
|
const title = formAssociation?.form?.info?.name;
|
||||||
const associatedUrn = formAssociation?.associatedUrn;
|
const associatedUrn = formAssociation?.associatedUrn;
|
||||||
const description = formAssociation?.form?.info?.description;
|
const description = formAssociation?.form?.info?.description;
|
||||||
const owners = formAssociation?.form.ownership?.owners;
|
const owners = formAssociation?.form?.ownership?.owners;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TabWrapper>
|
<TabWrapper>
|
||||||
|
@ -99,7 +99,7 @@ export default function EditStructuredPropertyModal({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
title={`${isAddMode ? 'Add property' : 'Edit property'} ${structuredProperty?.definition.displayName}`}
|
title={`${isAddMode ? 'Add property' : 'Edit property'} ${structuredProperty?.definition?.displayName}`}
|
||||||
onCancel={closeModal}
|
onCancel={closeModal}
|
||||||
open={isOpen}
|
open={isOpen}
|
||||||
width={650}
|
width={650}
|
||||||
|
@ -39,7 +39,7 @@ const StructuredProperties = () => {
|
|||||||
|
|
||||||
const searchAcrossEntities = data?.searchAcrossEntities;
|
const searchAcrossEntities = data?.searchAcrossEntities;
|
||||||
const noOfProperties = searchAcrossEntities?.searchResults?.length;
|
const noOfProperties = searchAcrossEntities?.searchResults?.length;
|
||||||
const badgeProperty = searchAcrossEntities?.searchResults.find(
|
const badgeProperty = searchAcrossEntities?.searchResults?.find(
|
||||||
(prop) => (prop.entity as StructuredPropertyEntity).settings?.showAsAssetBadge,
|
(prop) => (prop.entity as StructuredPropertyEntity).settings?.showAsAssetBadge,
|
||||||
)?.entity;
|
)?.entity;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ const ViewAdvancedOptions = ({ propEntity }: Props) => {
|
|||||||
{propEntity && (
|
{propEntity && (
|
||||||
<RowContainer>
|
<RowContainer>
|
||||||
<StyledLabel>Qualified Name</StyledLabel>
|
<StyledLabel>Qualified Name</StyledLabel>
|
||||||
<Text color="gray"> {propEntity?.definition.qualifiedName}</Text>
|
<Text color="gray"> {propEntity?.definition?.qualifiedName}</Text>
|
||||||
</RowContainer>
|
</RowContainer>
|
||||||
)}
|
)}
|
||||||
</Collapse.Panel>
|
</Collapse.Panel>
|
||||||
|
@ -40,9 +40,9 @@ const ViewStructuredPropsDrawer = ({
|
|||||||
|
|
||||||
const selectedPropEntity = selectedProperty && (selectedProperty?.entity as StructuredPropertyEntity);
|
const selectedPropEntity = selectedProperty && (selectedProperty?.entity as StructuredPropertyEntity);
|
||||||
|
|
||||||
const allowedValues = selectedPropEntity?.definition.allowedValues;
|
const allowedValues = selectedPropEntity?.definition?.allowedValues;
|
||||||
|
|
||||||
const allowedTypes = selectedPropEntity?.definition.typeQualifier?.allowedTypes;
|
const allowedTypes = selectedPropEntity?.definition?.typeQualifier?.allowedTypes;
|
||||||
|
|
||||||
const propType = getValueTypeLabel(
|
const propType = getValueTypeLabel(
|
||||||
selectedPropEntity.definition.valueType.urn,
|
selectedPropEntity.definition.valueType.urn,
|
||||||
|
@ -156,7 +156,7 @@ export const ExecutionDetailsModal = ({ urn, open, onClose }: Props) => {
|
|||||||
(status && <Typography.Text type="secondary">{getExecutionRequestSummaryText(status)}</Typography.Text>) ||
|
(status && <Typography.Text type="secondary">{getExecutionRequestSummaryText(status)}</Typography.Text>) ||
|
||||||
undefined;
|
undefined;
|
||||||
|
|
||||||
const recipeJson = data?.executionRequest?.input.arguments?.find((arg) => arg.key === 'recipe')?.value;
|
const recipeJson = data?.executionRequest?.input?.arguments?.find((arg) => arg.key === 'recipe')?.value;
|
||||||
let recipeYaml: string;
|
let recipeYaml: string;
|
||||||
try {
|
try {
|
||||||
recipeYaml = recipeJson && YAML.stringify(JSON.parse(recipeJson), 8, 2).trim();
|
recipeYaml = recipeJson && YAML.stringify(JSON.parse(recipeJson), 8, 2).trim();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user