Handle relations for filters (#13654)
- Refacto variable dropdown so it can display both objects and fields - we do not filter on object name anymore to simplify the code - add relation handler in filters https://github.com/user-attachments/assets/e4f03f11-45cb-4d3f-b628-e996129dd996
This commit is contained in:
+9
-3
@@ -24,6 +24,8 @@ export const WorkflowStepFilterFieldSelect = ({
|
||||
stepFilter,
|
||||
}: WorkflowStepFilterFieldSelectProps) => {
|
||||
const { readonly } = useContext(WorkflowStepFilterContext);
|
||||
const shouldDisplayRecordFields = true;
|
||||
const shouldDisplayRecordObjects = true;
|
||||
|
||||
const { upsertStepFilterSettings } = useUpsertStepFilterSettings();
|
||||
|
||||
@@ -44,9 +46,10 @@ export const WorkflowStepFilterFieldSelect = ({
|
||||
|
||||
const { getFieldMetadataItemById } = useGetFieldMetadataItemById();
|
||||
|
||||
const availableVariablesInWorkflowStep = useAvailableVariablesInWorkflowStep(
|
||||
{},
|
||||
);
|
||||
const availableVariablesInWorkflowStep = useAvailableVariablesInWorkflowStep({
|
||||
shouldDisplayRecordFields,
|
||||
shouldDisplayRecordObjects,
|
||||
});
|
||||
|
||||
const noAvailableVariables = availableVariablesInWorkflowStep.length === 0;
|
||||
|
||||
@@ -157,6 +160,9 @@ export const WorkflowStepFilterFieldSelect = ({
|
||||
textAccent={isSelectedFieldNotFound ? 'placeholder' : 'default'}
|
||||
/>
|
||||
}
|
||||
shouldDisplayRecordFields={shouldDisplayRecordFields}
|
||||
shouldDisplayRecordObjects={shouldDisplayRecordObjects}
|
||||
shouldEnableSelectRelationObject={true}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
+4
@@ -43,6 +43,7 @@ const isFilterableFieldMetadataType = (
|
||||
FieldMetadataType.RICH_TEXT_V2,
|
||||
FieldMetadataType.ARRAY,
|
||||
FieldMetadataType.UUID,
|
||||
FieldMetadataType.RELATION,
|
||||
...COMPOSITE_FIELD_METADATA_TYPES,
|
||||
].includes(type as FieldMetadataType);
|
||||
};
|
||||
@@ -142,6 +143,9 @@ export const WorkflowStepFilterValueInput = ({
|
||||
metadata: {
|
||||
fieldName: selectedFieldMetadataItem?.name ?? '',
|
||||
options: selectedFieldMetadataItem?.options ?? [],
|
||||
relationObjectMetadataNameSingular:
|
||||
selectedFieldMetadataItem?.relation?.targetObjectMetadata?.nameSingular,
|
||||
relationType: selectedFieldMetadataItem?.relation?.type,
|
||||
} as FieldMetadata,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user