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:
Thomas Trompette
2025-08-26 15:31:15 +02:00
committed by GitHub
parent 1640aea44a
commit f4312422ce
23 changed files with 335 additions and 256 deletions
@@ -37,10 +37,8 @@ export type FieldOutputSchema =
export type RecordOutputSchema = {
object: {
nameSingular: string;
fieldIdName: string;
objectMetadataId: string;
isRelationField?: boolean;
} & Leaf;
fields: Record<string, FieldOutputSchema>;
_outputSchemaType: 'RECORD';
@@ -116,7 +116,6 @@ describe('generateFakeFormResponse', () => {
icon: 'test-company-icon',
isLeaf: true,
label: 'Company',
nameSingular: 'company',
objectMetadataId: '20202020-c03c-45d6-a4b0-04afe1357c5c',
value: 'A company',
},
@@ -61,7 +61,6 @@ describe('generateFakeObjectRecordEvent', () => {
icon: 'test-company-icon',
label: 'Company',
value: 'A company',
nameSingular: 'company',
fieldIdName: 'properties.after.id',
objectMetadataId: '20202020-c03c-45d6-a4b0-04afe1357c5c',
},
@@ -93,7 +92,6 @@ describe('generateFakeObjectRecordEvent', () => {
icon: 'test-company-icon',
label: 'Company',
value: 'A company',
nameSingular: 'company',
fieldIdName: 'properties.after.id',
objectMetadataId: '20202020-c03c-45d6-a4b0-04afe1357c5c',
},
@@ -125,7 +123,6 @@ describe('generateFakeObjectRecordEvent', () => {
icon: 'test-company-icon',
label: 'Company',
value: 'A company',
nameSingular: 'company',
fieldIdName: 'properties.before.id',
objectMetadataId: '20202020-c03c-45d6-a4b0-04afe1357c5c',
},
@@ -157,7 +154,6 @@ describe('generateFakeObjectRecordEvent', () => {
icon: 'test-company-icon',
label: 'Company',
value: 'A company',
nameSingular: 'company',
fieldIdName: 'properties.before.id',
objectMetadataId: '20202020-c03c-45d6-a4b0-04afe1357c5c',
},
@@ -41,7 +41,6 @@ describe('generateFakeObjectRecord', () => {
icon: 'test-company-icon',
label: 'Company',
value: 'A company',
nameSingular: 'company',
fieldIdName: 'id',
objectMetadataId: '20202020-c03c-45d6-a4b0-04afe1357c5c',
},
@@ -30,8 +30,6 @@ const generateFakeObjectRecordEventWithPrefix = ({
objectMetadataInfo.objectMetadataItemWithFieldsMaps.icon ?? undefined,
label: objectMetadataInfo.objectMetadataItemWithFieldsMaps.labelSingular,
value: objectMetadataInfo.objectMetadataItemWithFieldsMaps.description,
nameSingular:
objectMetadataInfo.objectMetadataItemWithFieldsMaps.nameSingular,
fieldIdName: `${prefix}.id`,
objectMetadataId: objectMetadataInfo.objectMetadataItemWithFieldsMaps.id,
},
@@ -5,11 +5,9 @@ import { generateObjectRecordFields } from 'src/modules/workflow/workflow-builde
export const generateFakeObjectRecord = ({
objectMetadataInfo,
depth = 0,
isRelationField,
}: {
objectMetadataInfo: ObjectMetadataInfo;
depth?: number;
isRelationField?: boolean;
}): RecordOutputSchema => {
return {
object: {
@@ -18,11 +16,8 @@ export const generateFakeObjectRecord = ({
objectMetadataInfo.objectMetadataItemWithFieldsMaps.icon ?? undefined,
label: objectMetadataInfo.objectMetadataItemWithFieldsMaps.labelSingular,
value: objectMetadataInfo.objectMetadataItemWithFieldsMaps.description,
nameSingular:
objectMetadataInfo.objectMetadataItemWithFieldsMaps.nameSingular,
fieldIdName: 'id',
objectMetadataId: objectMetadataInfo.objectMetadataItemWithFieldsMaps.id,
isRelationField,
},
fields: generateObjectRecordFields({
objectMetadataInfo,
@@ -60,7 +60,6 @@ export const generateObjectRecordFields = ({
objectMetadataMaps: objectMetadataInfo.objectMetadataMaps,
},
depth: depth + 1,
isRelationField: true,
}),
};
}