Skip to content

Commit

Permalink
fix: add information alert when no data model bindings (#14758)
Browse files Browse the repository at this point in the history
Co-authored-by: JamalAlabdullah <[email protected]>
  • Loading branch information
mlqn and JamalAlabdullah authored Feb 21, 2025
1 parent 8657dc2 commit b2b0c50
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,23 @@ export const DataModelBindings = (): React.JSX.Element => {
}

const { dataModelBindings } = schema.properties;

if (!dataModelBindings) {
return (
<Alert size='small' className={classes.alert}>
{t('ux_editor.modal_properties_data_model_binding_not_present')}
</Alert>
);
}

let dataModelBindingsProperties = dataModelBindings?.properties;

if (dataModelBindings.anyOf) {
if (dataModelBindings?.anyOf) {
const { properties } = Object.values(dataModelBindings.anyOf).find((dataModelProp: any) =>
(dataModelProp.required as string[]).includes(multipleAttachments ? 'list' : 'simpleBinding'),
) as any;
dataModelBindingsProperties = properties;
}

if (!Object.keys(dataModelBindingsProperties || {}).length) {
return (
<Alert size='small' className={classes.alert}>
{t('ux_editor.modal_properties_data_model_binding_not_present')}
</Alert>
);
}

const handleMultipleAttachmentsSwitch = () => {
const updatedValue = !multipleAttachments;
setMultipleAttachments(updatedValue);
Expand Down

0 comments on commit b2b0c50

Please sign in to comment.