Skip to content

Commit

Permalink
Fixed workflow filter option (#1981)
Browse files Browse the repository at this point in the history
  • Loading branch information
shuhaib-aot authored Mar 27, 2024
1 parent 8ccf5f2 commit 2f1fcc7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions forms-flow-web/src/components/Form/Steps/WorkFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import ViewAndEditTaskvariable from "./ViewAndEditTaskvariable";
import { useTranslation } from "react-i18next";
import { listProcess } from "../../../apiManager/services/formatterService";
import { DEFAULT_WORKFLOW } from "../../../constants/taskConstants";
import { filterSelectOptionByLabel } from "../../../helper/helper";

const WorkFlow = React.memo(
({
Expand Down Expand Up @@ -137,6 +138,7 @@ const WorkFlow = React.memo(
updateTaskvariableToProcessData(updatedData);
};


useEffect(() => {
if (!workflow) {
setModified(true);
Expand Down Expand Up @@ -228,6 +230,7 @@ const WorkFlow = React.memo(
onChange={(selectedOption) => handleListChange(selectedOption)}
isDisabled={disableWorkflowAssociation}
inputId="select-workflow"
filterOption={filterSelectOptionByLabel}
getOptionLabel={(option) => (
<span data-testid={`form-workflow-option-${option.value}`}>
{option.label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import {
resetFormProcessData,
} from "../../../../apiManager/services/processServices";
import { fetchUserList } from "../../../../apiManager/services/bpmTaskServices";
import { filterSelectOptionByLabel } from "../../../../helper/helper";

const initialValueOfTaskAttribute = {
applicationId: true,
Expand Down Expand Up @@ -691,6 +692,7 @@ export default function CreateNewFilterDrawer({
onChange={(selectedOption) => {
setDefinitionKeyId(selectedOption?.label);
}}
filterOption={filterSelectOptionByLabel}
inputId="select-workflow"
getOptionLabel={(option) => (
<span data-testid={`form-workflow-option-${option.value}`}>
Expand Down
9 changes: 8 additions & 1 deletion forms-flow-web/src/helper/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,11 @@ const renderPage = (formStatus, processLoadError) => {
);
}
};
export { replaceUrl, addTenantkey, removeTenantKey, textTruncate, renderPage };

const filterSelectOptionByLabel = (option, searchText) => {
return option.data.label.toLowerCase().includes(searchText.toLowerCase());
};


export { replaceUrl, addTenantkey, removeTenantKey, textTruncate, renderPage,
filterSelectOptionByLabel};

0 comments on commit 2f1fcc7

Please sign in to comment.