fix(ui): dereference issues (#12109)

This commit is contained in:
Aseem Bansal 2024-12-13 11:47:49 +05:30 committed by GitHub
parent bc4c7c633e
commit eee49b3cb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 14 additions and 14 deletions

View File

@ -24,11 +24,11 @@ const StructuredPropValues = ({ schemaFieldEntity, propColumn }: Props) => {
const entityRegistry = useEntityRegistry();
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 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 displayedValues = hasMoreValues ? values.slice(0, 1) : values;

View File

@ -41,8 +41,8 @@ const StructuredPropertyBadge = ({ structuredProperties }: Props) => {
if (!badgeStructuredProperty) return null;
const propertyValue = propRow?.values[0].value;
const relatedDescription = propRow?.structuredProperty.definition.allowedValues?.find(
const propertyValue = propRow?.values[0]?.value;
const relatedDescription = propRow?.structuredProperty?.definition?.allowedValues?.find(
(v) => getStructuredPropertyValue(v.value) === propertyValue,
)?.description;
@ -56,7 +56,7 @@ const StructuredPropertyBadge = ({ structuredProperties }: Props) => {
<Text color="gray" size="sm" weight="bold">
Value
</Text>
<Text color="gray">{propRow?.values[0].value}</Text>
<Text color="gray">{propRow?.values[0]?.value}</Text>
</ValueContainer>
{relatedDescription && (
<ValueContainer>
@ -79,7 +79,7 @@ const StructuredPropertyBadge = ({ structuredProperties }: Props) => {
>
<BadgeContainer>
<Pill
label={propRow?.values[0].value?.toString() || ''}
label={propRow?.values[0]?.value?.toString() || ''}
size="sm"
colorScheme="violet"
clickable={false}

View File

@ -87,7 +87,7 @@ const SidebarStructuredPropsSection = ({ properties }: Props) => {
property,
currentProperties,
);
const isRichText = propertyRow?.dataType?.info.type === StdDataType.RichText;
const isRichText = propertyRow?.dataType?.info?.type === StdDataType.RichText;
const values = propertyRow?.values;
const hasMultipleValues = values && values.length > 1;
const propertyName = getDisplayName(property.entity as StructuredPropertyEntity);

View File

@ -57,7 +57,7 @@ function Form({ formUrn }: Props) {
const title = formAssociation?.form?.info?.name;
const associatedUrn = formAssociation?.associatedUrn;
const description = formAssociation?.form?.info?.description;
const owners = formAssociation?.form.ownership?.owners;
const owners = formAssociation?.form?.ownership?.owners;
return (
<TabWrapper>

View File

@ -99,7 +99,7 @@ export default function EditStructuredPropertyModal({
return (
<Modal
title={`${isAddMode ? 'Add property' : 'Edit property'} ${structuredProperty?.definition.displayName}`}
title={`${isAddMode ? 'Add property' : 'Edit property'} ${structuredProperty?.definition?.displayName}`}
onCancel={closeModal}
open={isOpen}
width={650}

View File

@ -39,7 +39,7 @@ const StructuredProperties = () => {
const searchAcrossEntities = data?.searchAcrossEntities;
const noOfProperties = searchAcrossEntities?.searchResults?.length;
const badgeProperty = searchAcrossEntities?.searchResults.find(
const badgeProperty = searchAcrossEntities?.searchResults?.find(
(prop) => (prop.entity as StructuredPropertyEntity).settings?.showAsAssetBadge,
)?.entity;

View File

@ -32,7 +32,7 @@ const ViewAdvancedOptions = ({ propEntity }: Props) => {
{propEntity && (
<RowContainer>
<StyledLabel>Qualified Name</StyledLabel>
<Text color="gray"> {propEntity?.definition.qualifiedName}</Text>
<Text color="gray"> {propEntity?.definition?.qualifiedName}</Text>
</RowContainer>
)}
</Collapse.Panel>

View File

@ -40,9 +40,9 @@ const ViewStructuredPropsDrawer = ({
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(
selectedPropEntity.definition.valueType.urn,

View File

@ -156,7 +156,7 @@ export const ExecutionDetailsModal = ({ urn, open, onClose }: Props) => {
(status && <Typography.Text type="secondary">{getExecutionRequestSummaryText(status)}</Typography.Text>) ||
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;
try {
recipeYaml = recipeJson && YAML.stringify(JSON.parse(recipeJson), 8, 2).trim();