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:
+2
@@ -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,
|
||||
});
|
||||
|
||||
+1
@@ -16,6 +16,7 @@ const mockStep = {
|
||||
label: 'Company',
|
||||
value: 'John',
|
||||
isLeaf: true,
|
||||
objectMetadataId: '123',
|
||||
},
|
||||
fields: {
|
||||
name: { label: 'Name', value: 'Twenty', isLeaf: true },
|
||||
|
||||
+1
@@ -16,6 +16,7 @@ const mockStep = {
|
||||
label: 'Company',
|
||||
value: 'John',
|
||||
isLeaf: true,
|
||||
objectMetadataId: '123',
|
||||
},
|
||||
fields: {
|
||||
name: { label: 'Name', value: 'Twenty', isLeaf: true },
|
||||
|
||||
+3
@@ -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',
|
||||
},
|
||||
|
||||
+17
-1
@@ -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,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user