Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const SelectControl = ({
selectSizeVariant={selectSizeVariant}
textAccent={textAccent}
hasRightElement={hasRightElement}
title={selectedOption.fullLabel}
>
{isDefined(selectedOption?.Icon) ? (
<selectedOption.Icon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const WorkflowStepFilterFieldSelect = ({
part: 'stepId',
});

const { variableLabel } = useSearchVariable({
const { variableLabel, variablePathLabel } = useSearchVariable({
stepId,
rawVariableName: stepFilter.stepOutputKey,
isFullRecord: stepFilter.isFullRecord ?? false,
Expand Down Expand Up @@ -110,6 +110,7 @@ export const WorkflowStepFilterFieldSelect = ({
selectedOption={{
value: stepFilter.stepOutputKey,
label: disabledLabel,
fullLabel: variablePathLabel,
Icon: icon,
}}
isDisabled={true}
Expand All @@ -127,6 +128,7 @@ export const WorkflowStepFilterFieldSelect = ({
<SelectControl
selectedOption={{
label,
fullLabel: variablePathLabel,
value: stepFilter.stepOutputKey,
Icon: icon,
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export const useStepsOutputSchema = () => {
type: step.type,
icon: getActionIcon(step.type),
outputSchema: (outputSchema ?? {}) as OutputSchemaV2,
objectName: (step.settings?.input as { objectName?: string })
?.objectName,
};

set(stepsOutputSchemaFamilyState(stepKey), stepOutputSchema);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ export type StepOutputSchemaV2 = {
type: WorkflowTriggerType | WorkflowActionType;
icon?: string;
outputSchema: OutputSchemaV2;
objectName?: string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ export const searchVariableThroughFindRecordsOutputSchema = ({
searchRecordOutputSchema,
rawVariableName,
isFullRecord = false,
stepNameLabel,
}: {
stepName: string;
searchRecordOutputSchema: FindRecordsOutputSchema;
rawVariableName: string;
isFullRecord?: boolean;
stepNameLabel?: string;
}): VariableSearchResult => {
if (!isDefined(searchRecordOutputSchema)) {
return {
Expand Down Expand Up @@ -84,14 +86,19 @@ export const searchVariableThroughFindRecordsOutputSchema = ({
selectedField: fieldName,
path: pathSegments,
isFullRecord,
stepNameLabel,
});
}

if (searchResultKey === 'totalCount') {
const label =
searchRecordOutputSchema[searchResultKey]?.label ?? 'Total Count';
const basePath = `${stepName} > ${label}`;
return {
variableLabel:
searchRecordOutputSchema[searchResultKey]?.label ?? 'Total Count',
variablePathLabel: `${stepName} > ${searchRecordOutputSchema[searchResultKey]?.label ?? 'Total Count'}`,
variableLabel: label,
variablePathLabel: stepNameLabel
? `${basePath} (${stepNameLabel})`
: basePath,
variableType: FieldMetadataType.NUMBER,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const searchVariableThroughOutputSchemaV2 = ({
searchRecordOutputSchema: stepOutputSchema.outputSchema,
rawVariableName,
isFullRecord,
stepNameLabel: stepOutputSchema.objectName,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const buildVariableResult = (
targetSchema: RecordFieldNodeValue,
targetFieldName: string,
isFullRecord: boolean,
stepNameLabel?: string,
): VariableSearchResult => {
const targetField = getFieldFromSchema(targetFieldName, targetSchema);
// Determine the variable label based on whether we want the full record or a specific field
Expand All @@ -97,7 +98,10 @@ const buildVariableResult = (

// Build the full path: stepName > field1 > field2 > targetField
const fullPathSegments = [stepName, ...pathLabels, variableLabel];
const variablePathLabel = fullPathSegments.join(' > ');
const basePath = fullPathSegments.join(' > ');
const variablePathLabel = stepNameLabel
? `${basePath} (${stepNameLabel})`
: basePath;

return {
variableLabel,
Expand All @@ -117,12 +121,14 @@ export const searchRecordOutputSchema = ({
path,
selectedField,
isFullRecord,
stepNameLabel,
}: {
stepName: string;
recordOutputSchema: RecordOutputSchemaV2;
path: string[];
selectedField: string;
isFullRecord: boolean;
stepNameLabel?: string;
}): VariableSearchResult => {
const navigationResult = navigateToTargetField(recordOutputSchema, path);

Expand All @@ -140,6 +146,7 @@ export const searchRecordOutputSchema = ({
navigationResult.schema,
selectedField,
isFullRecord,
stepNameLabel,
);
};

Expand Down
1 change: 1 addition & 0 deletions packages/twenty-ui/src/input/types/SelectOption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type SelectOption<
> = {
Icon?: IconComponent | null;
label: string;
fullLabel?: string;
value: Value;
disabled?: boolean;
color?: ThemeColor | 'transparent';
Expand Down
Loading