Allow to select full object and object id in filters (#14083)
Today WorkflowVariablesDropdownAllItems is used for variable picker in all workflow steps, and for step field picker in filters. Using that component in filters prevent us from knowing if a full record or only the id has been selected. This PR: - creates a new component WorkflowDropdownStepOutputItems, mostly copying the logic of WorkflowVariablesDropdownAllItems - call it WorkflowStepFilterFieldSelect, removing the display logic from that parent component - store isFullRecord in filter. So we now know if we should display a record picker or a uuid picker Before - selecting id makes picker behaves like when we select an object https://github.com/user-attachments/assets/bde34dc5-8011-4983-8d0f-d8cb0cb3c045 After - selecting object and id are two different things https://github.com/user-attachments/assets/49289990-3e6d-4ad7-abc1-e3ade2a821bb
This commit is contained in:
-3
@@ -39,7 +39,6 @@ export const WorkflowVariablesDropdown = ({
|
||||
shouldDisplayRecordFields,
|
||||
shouldDisplayRecordObjects,
|
||||
fieldTypesToExclude,
|
||||
shouldEnableSelectRelationObject,
|
||||
multiline,
|
||||
clickableComponent,
|
||||
}: {
|
||||
@@ -48,7 +47,6 @@ export const WorkflowVariablesDropdown = ({
|
||||
shouldDisplayRecordFields: boolean;
|
||||
shouldDisplayRecordObjects: boolean;
|
||||
fieldTypesToExclude?: InputSchemaPropertyType[];
|
||||
shouldEnableSelectRelationObject?: boolean;
|
||||
disabled?: boolean;
|
||||
multiline?: boolean;
|
||||
clickableComponent?: React.ReactNode;
|
||||
@@ -134,7 +132,6 @@ export const WorkflowVariablesDropdown = ({
|
||||
step={selectedStep}
|
||||
onSelect={handleSubItemSelect}
|
||||
onBack={handleBack}
|
||||
shouldEnableSelectRelationObject={shouldEnableSelectRelationObject}
|
||||
/>
|
||||
) : (
|
||||
<WorkflowVariablesDropdownFieldItems
|
||||
|
||||
+6
-21
@@ -24,14 +24,12 @@ type WorkflowVariablesDropdownAllItemsProps = {
|
||||
step: StepOutputSchema;
|
||||
onSelect: (value: string) => void;
|
||||
onBack: () => void;
|
||||
shouldEnableSelectRelationObject?: boolean;
|
||||
};
|
||||
|
||||
export const WorkflowVariablesDropdownAllItems = ({
|
||||
step,
|
||||
onSelect,
|
||||
onBack,
|
||||
shouldEnableSelectRelationObject,
|
||||
}: WorkflowVariablesDropdownAllItemsProps) => {
|
||||
const { t } = useLingui();
|
||||
const { getIcon } = useIcons();
|
||||
@@ -65,25 +63,12 @@ export const WorkflowVariablesDropdownAllItems = ({
|
||||
return;
|
||||
}
|
||||
|
||||
const isRelationField = currentSubStep.object.isRelationField ?? false;
|
||||
const isRelationObjectSelectable =
|
||||
shouldEnableSelectRelationObject ?? false;
|
||||
|
||||
if (isRelationField && isRelationObjectSelectable) {
|
||||
onSelect(
|
||||
getVariableTemplateFromPath({
|
||||
stepId: step.id,
|
||||
path: currentPath,
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
onSelect(
|
||||
getVariableTemplateFromPath({
|
||||
stepId: step.id,
|
||||
path: [...currentPath, currentSubStep.object.fieldIdName],
|
||||
}),
|
||||
);
|
||||
}
|
||||
onSelect(
|
||||
getVariableTemplateFromPath({
|
||||
stepId: step.id,
|
||||
path: [...currentPath, currentSubStep.object.fieldIdName],
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
const displayedSubStepObject = getDisplayedSubStepObject();
|
||||
|
||||
Reference in New Issue
Block a user