Tt filter step input per variable type (#13371)

- add fieldMetadataId to step output schema
- use it to display FormFieldInput in Filter input
- few fixes for a few fields

Next step:
- Handle composite fields
- Design review
This commit is contained in:
Thomas Trompette
2025-07-23 13:54:06 +02:00
committed by GitHub
parent a0a575fa0b
commit 015c4477a7
28 changed files with 347 additions and 79 deletions
@@ -12,6 +12,7 @@ describe('filterOutputSchema', () => {
fieldIdName: 'id',
isLeaf: true,
value: 'Fake value',
objectMetadataId: '123',
},
fields: {},
};
@@ -35,6 +36,7 @@ describe('filterOutputSchema', () => {
fieldIdName: 'id',
isLeaf: true,
value: 'Fake value',
objectMetadataId: '123',
},
fields,
});
@@ -16,6 +16,7 @@ const mockStep = {
label: 'Company',
value: 'John',
isLeaf: true,
objectMetadataId: '123',
},
fields: {
name: { label: 'Name', value: 'Twenty', isLeaf: true },
@@ -16,6 +16,7 @@ const mockStep = {
label: 'Company',
value: 'John',
isLeaf: true,
objectMetadataId: '123',
},
fields: {
name: { label: 'Name', value: 'Twenty', isLeaf: true },
@@ -19,6 +19,7 @@ describe('searchVariableThroughOutputSchema', () => {
label: 'Company',
value: 'John',
isLeaf: true,
objectMetadataId: '123',
},
fields: {
name: { label: 'Name', value: 'Twenty', isLeaf: true },
@@ -38,6 +39,7 @@ describe('searchVariableThroughOutputSchema', () => {
label: 'Person',
value: 'Jane',
isLeaf: true,
objectMetadataId: '123',
},
fields: {
firstName: { label: 'First Name', value: 'Jane', isLeaf: true },
@@ -270,6 +272,7 @@ describe('searchVariableThroughOutputSchema', () => {
isLeaf: true,
fieldIdName: 'properties.after.id',
nameSingular: 'company',
objectMetadataId: '123',
},
_outputSchemaType: 'RECORD',
},
@@ -43,6 +43,17 @@ const getVariableType = (key: string, outputSchema: OutputSchema): string => {
return outputSchema[key]?.type ?? 'unknown';
};
const getFieldMetadataId = (
key: string,
outputSchema: OutputSchema,
): string | undefined => {
if (isRecordOutputSchema(outputSchema)) {
return outputSchema.fields[key]?.fieldMetadataId;
}
return undefined;
};
const searchCurrentStepOutputSchema = ({
stepOutputSchema,
path,
@@ -120,6 +131,10 @@ const searchCurrentStepOutputSchema = ({
isSelectedFieldInNextKey ? nextKey : selectedField,
currentSubStep,
),
fieldMetadataId: getFieldMetadataId(
isSelectedFieldInNextKey ? nextKey : selectedField,
currentSubStep,
),
};
};
@@ -160,7 +175,7 @@ export const searchVariableThroughOutputSchema = ({
};
}
const { variableLabel, variablePathLabel, variableType } =
const { variableLabel, variablePathLabel, variableType, fieldMetadataId } =
searchCurrentStepOutputSchema({
stepOutputSchema,
path,
@@ -172,5 +187,6 @@ export const searchVariableThroughOutputSchema = ({
variableLabel,
variablePathLabel: `${variablePathLabel} > ${variableLabel}`,
variableType,
fieldMetadataId,
};
};