Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search filter issues #1890

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Changes from all 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 @@ -47,6 +47,8 @@ const TaskFilterViewComponent = React.memo(
const dispatch = useDispatch();
const { t } = useTranslation();
const [assigneeOptions, setAssigneeOptions] = useState([]);
const [inputValuesPresent, setInputValuesPresent] = useState(false); // State to track any input value is present or not

const handleClick = (e) => {
if (createSearchNode?.current?.contains(e.target)) {
return;
Expand Down Expand Up @@ -144,6 +146,16 @@ const TaskFilterViewComponent = React.memo(
setDisplayFilter(false);
};

//To disable the show results & clear filter btn if there no input values
useEffect(() => {
setInputValuesPresent(
( assignee || candidateGroup || processVariables?.length || dueStartDate || dueEndDate ||
followStartDate || followEndDate || createdStartDate || createdEndDate ||
priority || Object.keys(filterParams)?.length)
);
}, [assignee, candidateGroup, processVariables, dueStartDate, dueEndDate,
followStartDate, followEndDate, createdStartDate, createdEndDate, priority]);

const clearAllFilters = () => {
setAssignee("");
setCandidateGroup("");
Expand Down Expand Up @@ -427,18 +439,19 @@ const TaskFilterViewComponent = React.memo(
<button
className="btn btn-link text-danger"
onClick={() => clearAllFilters()}
disabled={!inputValuesPresent}
>
{t("Clear All Filters")}
</button>
</Col>
<Col className="text-right">
<Col className="text-end">
<button
className="btn btn-light me-1 "
onClick={() => setDisplayFilter(false)}
>
{t("Cancel")}
</button>
<button className="btn btn-dark" onClick={() => applyFilters()}>
<button disabled={!inputValuesPresent} className="btn btn-dark" onClick={() => applyFilters()}>
{t("Show results")}
</button>
</Col>
Expand Down
Loading