feat: added workspace member filter for actor fields (#16628)
Closes #16619 This PR adds support for filtering ACTOR fields by `Workspace Member` subfield, enabling users to filter records by who created them with a `Me` option. I replicated the same UX and code structure as the Relation field filter for consistency. Each filter selection triggers a server-side GraphQL call. But there is client-side filtering in `isRecordMatchingFilter.ts` which instantly filters already-loaded records while the server is fetching new results. I replicated this behaviour from how `FULL_NAME` and other composite fields handle filtering. UX decision that were taken by me (Let me know if changes are needed) : - The filter shows comma separated selected workspace member names until 3 members are selected. After that it shows [no of selected members] workspace members. <img width="643" height="283" alt="Screenshot 2025-12-17 at 8 01 23 PM" src="https://github.com/user-attachments/assets/18d524f4-979b-4d92-ad64-aa7b63be7897" /> <img width="774" height="309" alt="Screenshot 2025-12-17 at 8 01 33 PM" src="https://github.com/user-attachments/assets/779f374f-1501-48f9-afa2-a78628e067b1" /> <img width="737" height="397" alt="Screenshot 2025-12-17 at 8 01 40 PM" src="https://github.com/user-attachments/assets/4e8b963e-8a0f-467d-91ae-48bca4e1d842" /> <img width="697" height="334" alt="Screenshot 2025-12-17 at 8 01 53 PM" src="https://github.com/user-attachments/assets/c9a0e4bb-48b4-486b-a4f9-d7c49ff3852c" /> <img width="684" height="343" alt="Screenshot 2025-12-17 at 8 02 04 PM" src="https://github.com/user-attachments/assets/d5c45eba-06a3-40fc-b9d0-d585dc8bc136" /> --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
+17
-5
@@ -1,8 +1,13 @@
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { FormCountryMultiSelectInput } from '@/object-record/record-field/ui/form-types/components/FormCountryMultiSelectInput';
|
||||
import { FormMultiSelectFieldInput } from '@/object-record/record-field/ui/form-types/components/FormMultiSelectFieldInput';
|
||||
import { FormNumberFieldInput } from '@/object-record/record-field/ui/form-types/components/FormNumberFieldInput';
|
||||
import { FormSingleRecordPicker } from '@/object-record/record-field/ui/form-types/components/FormSingleRecordPicker';
|
||||
import { FormRelationToOneFieldInput } from '@/object-record/record-field/ui/form-types/components/FormRelationToOneFieldInput';
|
||||
import { FormTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormTextFieldInput';
|
||||
import {
|
||||
type FieldRelationToOneValue,
|
||||
type FieldRelationValue,
|
||||
} from '@/object-record/record-field/ui/types/FieldMetadata';
|
||||
import { CURRENCIES } from '@/settings/data-model/constants/Currencies';
|
||||
import { WorkflowStepFilterContext } from '@/workflow/workflow-steps/filters/states/context/WorkflowStepFilterContext';
|
||||
import { WorkflowVariablePicker } from '@/workflow/workflow-variables/components/WorkflowVariablePicker';
|
||||
@@ -21,9 +26,11 @@ const ACTOR_SOURCE_OPTIONS: SelectOption[] = Object.values(
|
||||
export const WorkflowStepFilterValueCompositeInput = ({
|
||||
stepFilter,
|
||||
onChange,
|
||||
onClear,
|
||||
}: {
|
||||
stepFilter: StepFilter;
|
||||
onChange: (newValue: JsonValue) => void;
|
||||
onClear: () => void;
|
||||
}) => {
|
||||
const { readonly } = useContext(WorkflowStepFilterContext);
|
||||
const { type: filterType, compositeFieldSubFieldName: subFieldName } =
|
||||
@@ -90,12 +97,17 @@ export const WorkflowStepFilterValueCompositeInput = ({
|
||||
VariablePicker={WorkflowVariablePicker}
|
||||
/>
|
||||
) : subFieldName === 'workspaceMemberId' ? (
|
||||
<FormSingleRecordPicker
|
||||
objectNameSingulars={['workspaceMember']}
|
||||
defaultValue={stepFilter.value}
|
||||
<FormRelationToOneFieldInput
|
||||
objectNameSingular={CoreObjectNameSingular.WorkspaceMember}
|
||||
defaultValue={
|
||||
stepFilter.value as
|
||||
| FieldRelationValue<FieldRelationToOneValue>
|
||||
| string
|
||||
}
|
||||
onChange={onChange}
|
||||
disabled={readonly}
|
||||
onClear={onClear}
|
||||
VariablePicker={WorkflowVariablePicker}
|
||||
readonly={readonly}
|
||||
/>
|
||||
) : (
|
||||
<FormTextFieldInput
|
||||
|
||||
+11
@@ -93,6 +93,15 @@ export const WorkflowStepFilterValueInput = ({
|
||||
});
|
||||
};
|
||||
|
||||
const handleClearValue = () => {
|
||||
upsertStepFilterSettings({
|
||||
stepFilterToUpsert: {
|
||||
...stepFilter,
|
||||
value: '',
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const handleRelativeDateFilterChange = (
|
||||
newRelativeDateFilter: RelativeDateFilter,
|
||||
) => {
|
||||
@@ -182,6 +191,7 @@ export const WorkflowStepFilterValueInput = ({
|
||||
<WorkflowStepFilterValueCompositeInput
|
||||
stepFilter={stepFilter}
|
||||
onChange={handleValueChange}
|
||||
onClear={handleClearValue}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -269,6 +279,7 @@ export const WorkflowStepFilterValueInput = ({
|
||||
field={field}
|
||||
defaultValue={stepFilter.value}
|
||||
onChange={handleValueChange}
|
||||
onClear={handleClearValue}
|
||||
readonly={readonly}
|
||||
VariablePicker={WorkflowVariablePicker}
|
||||
placeholder={t`Enter value`}
|
||||
|
||||
Reference in New Issue
Block a user