Filter batch fixes (#13486)
- handle multiselect and select Before <img width="200" height="200" alt="Capture d’écran 2025-07-29 à 13 47 36" src="https://github.com/user-attachments/assets/02fd2085-f2a5-405e-adb4-a53457b43d95" /> After <img width="200" height="200" alt="Capture d’écran 2025-07-29 à 13 44 09" src="https://github.com/user-attachments/assets/b85dde54-0284-4f4f-b19d-b86516afdf81" /> - Fix node display in run Before <img width="200" height="200" alt="Capture d’écran 2025-07-29 à 13 47 13" src="https://github.com/user-attachments/assets/c32dedaf-0c37-4300-9693-27a790a4d727" /> After <img width="200" height="200" alt="Capture d’écran 2025-07-29 à 13 44 58" src="https://github.com/user-attachments/assets/ab4449d0-933d-49f4-8572-75e484401c2c" /> - Remove assert to fix discard draft - handle label for readonly
This commit is contained in:
-2
@@ -1,7 +1,6 @@
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||
import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState';
|
||||
import { assertWorkflowWithCurrentVersionIsDefined } from '@/workflow/utils/assertWorkflowWithCurrentVersionIsDefined';
|
||||
import { WorkflowDiagramEdgeV2Container } from '@/workflow/workflow-diagram/components/WorkflowDiagramEdgeV2Container';
|
||||
import { WorkflowDiagramEdgeV2VisibilityContainer } from '@/workflow/workflow-diagram/components/WorkflowDiagramEdgeV2VisibilityContainer';
|
||||
import { CREATE_STEP_NODE_WIDTH } from '@/workflow/workflow-diagram/constants/CreateStepNodeWidth';
|
||||
@@ -51,7 +50,6 @@ export const WorkflowDiagramDefaultEdgeEditable = ({
|
||||
workflowVisualizerWorkflowIdComponentState,
|
||||
);
|
||||
const workflow = useWorkflowWithCurrentVersion(workflowVisualizerWorkflowId);
|
||||
assertWorkflowWithCurrentVersionIsDefined(workflow);
|
||||
|
||||
const { createStep } = useCreateStep({ workflow });
|
||||
const { startNodeCreation } = useStartNodeCreation();
|
||||
|
||||
+9
-2
@@ -11,6 +11,7 @@ import { WorkflowEditActionCreateRecord } from '@/workflow/workflow-steps/workfl
|
||||
import { WorkflowEditActionDeleteRecord } from '@/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionDeleteRecord';
|
||||
import { WorkflowEditActionSendEmail } from '@/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionSendEmail';
|
||||
import { WorkflowEditActionUpdateRecord } from '@/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionUpdateRecord';
|
||||
import { WorkflowEditActionFilter } from '@/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowEditActionFilter';
|
||||
import { WorkflowEditActionFindRecords } from '@/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowEditActionFindRecords';
|
||||
import { WorkflowEditActionFormFiller } from '@/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFiller';
|
||||
import { WorkflowEditActionHttpRequest } from '@/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest';
|
||||
@@ -204,8 +205,14 @@ export const WorkflowRunStepNodeDetail = ({
|
||||
);
|
||||
}
|
||||
case 'FILTER': {
|
||||
throw new Error(
|
||||
"The Filter action isn't meant to be displayed as a node.",
|
||||
return (
|
||||
<WorkflowEditActionFilter
|
||||
key={stepId}
|
||||
action={stepDefinition.definition}
|
||||
actionOptions={{
|
||||
readonly: true,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import { isDefined } from 'twenty-shared/utils';
|
||||
export const useCreateStep = ({
|
||||
workflow,
|
||||
}: {
|
||||
workflow: WorkflowWithCurrentVersion;
|
||||
workflow: WorkflowWithCurrentVersion | undefined;
|
||||
}) => {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const { createWorkflowVersionStep } = useCreateWorkflowVersionStep();
|
||||
@@ -26,6 +26,12 @@ export const useCreateStep = ({
|
||||
|
||||
const { getUpdatableWorkflowVersion } = useGetUpdatableWorkflowVersion();
|
||||
|
||||
if (!isDefined(workflow)) {
|
||||
return {
|
||||
createStep: async () => undefined,
|
||||
};
|
||||
}
|
||||
|
||||
const createStep = async ({
|
||||
newStepType,
|
||||
parentStepId,
|
||||
|
||||
+6
-3
@@ -116,7 +116,9 @@ export const WorkflowStepFilterFieldSelect = ({
|
||||
: variableLabel;
|
||||
const dropdownId = `step-filter-field-${stepFilter.id}`;
|
||||
|
||||
if (noAvailableVariables) {
|
||||
const isReadonly = readonly ?? false;
|
||||
|
||||
if (isReadonly || noAvailableVariables) {
|
||||
return (
|
||||
<Dropdown
|
||||
dropdownId={dropdownId}
|
||||
@@ -124,7 +126,9 @@ export const WorkflowStepFilterFieldSelect = ({
|
||||
<SelectControl
|
||||
selectedOption={{
|
||||
value: stepFilter.stepOutputKey,
|
||||
label: t`No available fields to select`,
|
||||
label: isReadonly
|
||||
? (variableLabel ?? '')
|
||||
: t`No available fields to select`,
|
||||
}}
|
||||
isDisabled={true}
|
||||
/>
|
||||
@@ -145,7 +149,6 @@ export const WorkflowStepFilterFieldSelect = ({
|
||||
value: stepFilter.stepOutputKey,
|
||||
label,
|
||||
}}
|
||||
isDisabled={readonly}
|
||||
textAccent={isSelectedFieldNotFound ? 'placeholder' : 'default'}
|
||||
/>
|
||||
}
|
||||
|
||||
+18
@@ -1,6 +1,7 @@
|
||||
import { useGetFieldMetadataItemById } from '@/object-metadata/hooks/useGetFieldMetadataItemById';
|
||||
import { configurableViewFilterOperands } from '@/object-record/object-filter-dropdown/utils/configurableViewFilterOperands';
|
||||
import { FormFieldInput } from '@/object-record/record-field/components/FormFieldInput';
|
||||
import { FormMultiSelectFieldInput } from '@/object-record/record-field/form-types/components/FormMultiSelectFieldInput';
|
||||
import { FormTextFieldInput } from '@/object-record/record-field/form-types/components/FormTextFieldInput';
|
||||
import { FieldMetadata } from '@/object-record/record-field/types/FieldMetadata';
|
||||
import { WorkflowStepFilterValueCompositeInput } from '@/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowStepFilterValueCompositeInput';
|
||||
@@ -90,6 +91,10 @@ export const WorkflowStepFilterValueInput = ({
|
||||
? getFieldMetadataItemById(fieldMetadataId)
|
||||
: undefined;
|
||||
|
||||
const isFilterableByMultiSelectValue =
|
||||
variableType === FieldMetadataType.MULTI_SELECT ||
|
||||
variableType === FieldMetadataType.SELECT;
|
||||
|
||||
if (
|
||||
!isDefined(variableType) ||
|
||||
!isFilterableFieldMetadataType(variableType) ||
|
||||
@@ -118,6 +123,19 @@ export const WorkflowStepFilterValueInput = ({
|
||||
);
|
||||
}
|
||||
|
||||
if (isFilterableByMultiSelectValue) {
|
||||
return (
|
||||
<FormMultiSelectFieldInput
|
||||
label={''}
|
||||
defaultValue={stepFilter.value}
|
||||
onChange={handleValueChange}
|
||||
readonly={readonly}
|
||||
VariablePicker={WorkflowVariablePicker}
|
||||
options={selectedFieldMetadataItem?.options ?? []}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const field = {
|
||||
type: variableType as FieldMetadataType,
|
||||
label: '',
|
||||
|
||||
Reference in New Issue
Block a user