Display relation field id reaching max depth (#14101)
Search record action do not fetch relations. We could add it to but the logic used, based on gql filtering will be refactored soon. Issue it that the output schema of the step is displaying relation content as if there were available. This PR: - remove the relation content from search record output schema - replace it by the relation field id so the user can still use it - makes UUID selectable in object record picker field Before https://github.com/user-attachments/assets/1bdb4c24-ef32-4a15-9da9-149f270abb01 After https://github.com/user-attachments/assets/d6e97160-c5a3-4989-a603-0c7ce8128b31
This commit is contained in:
+3
-1
@@ -68,7 +68,7 @@ describe('filterOutputSchema', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('shouldDisplayRecordObjects only (false, true)', () => {
|
||||
describe('shouldDisplayRecordObjects and related fields only (false, true)', () => {
|
||||
describe('record schema', () => {
|
||||
it('should keep record schema with object and filter compatible fields', () => {
|
||||
const inputSchema = createRecordSchema('person', {
|
||||
@@ -78,9 +78,11 @@ describe('filterOutputSchema', () => {
|
||||
isLeaf: false,
|
||||
value: createRecordSchema('employee'),
|
||||
},
|
||||
domain: { isLeaf: true, type: FieldMetadataType.TEXT },
|
||||
});
|
||||
|
||||
const expectedSchema = createRecordSchema('person', {
|
||||
id: { isLeaf: true, type: FieldMetadataType.UUID },
|
||||
name: { isLeaf: true, value: 'string' },
|
||||
employee: {
|
||||
isLeaf: false,
|
||||
|
||||
+7
-1
@@ -1,7 +1,13 @@
|
||||
import { type InputSchemaPropertyType } from '@/workflow/types/InputSchema';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
export const isFieldTypeCompatibleWithRecordId = (
|
||||
type?: InputSchemaPropertyType,
|
||||
): boolean => {
|
||||
return !type || type === 'string' || type === 'unknown';
|
||||
return (
|
||||
!type ||
|
||||
type === 'string' ||
|
||||
type === 'unknown' ||
|
||||
type === FieldMetadataType.UUID
|
||||
);
|
||||
};
|
||||
|
||||
+11
-1
@@ -34,6 +34,14 @@ const getCompositeSubFieldName = (
|
||||
: undefined;
|
||||
};
|
||||
|
||||
const isIdFieldName = (fieldName: string) => {
|
||||
return (
|
||||
fieldName === 'id' ||
|
||||
// For database events, id field will have a prefix such as properties.after.id
|
||||
fieldName.endsWith('.id')
|
||||
);
|
||||
};
|
||||
|
||||
const navigateToTargetField = (
|
||||
startingSchema: RecordOutputSchemaV2,
|
||||
pathSegments: string[],
|
||||
@@ -73,7 +81,9 @@ const buildVariableResult = (
|
||||
const targetField = getFieldFromSchema(targetFieldName, targetSchema);
|
||||
// Determine the variable label based on whether we want the full record or a specific field
|
||||
const variableLabel =
|
||||
isFullRecord && isRecordOutputSchemaV2(targetSchema)
|
||||
isFullRecord &&
|
||||
isRecordOutputSchemaV2(targetSchema) &&
|
||||
isIdFieldName(targetFieldName)
|
||||
? getRecordObjectLabel(targetSchema)
|
||||
: targetField?.label;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user