Skip to content

Commit

Permalink
changed single form type to multiple form type support for filtering … (
Browse files Browse the repository at this point in the history
#1705)

* changed single form type to multiple form type support for filtering through query

* removed form type form fron-end
  • Loading branch information
shuhaib-aot authored Nov 13, 2023
1 parent 6e56e9c commit 7b82e55
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def find_all_forms(
sort_order=None,
form_ids=None,
is_active=None,
form_type=None,
**filters,
): # pylint: disable=too-many-arguments
"""Fetch all active and inactive forms which are not deleted."""
Expand All @@ -204,6 +205,9 @@ def find_all_forms(
and_(FormProcessMapper.deleted.is_(False)),
FormProcessMapper.id.in_(filtered_form_ids),
)
# form type is list of type to filter the form
if form_type:
query = query.filter(FormProcessMapper.form_type.in_(form_type))

if is_active is not None:
value = FormProcessMapperStatus["ACTIVE" if is_active else "INACTIVE"].value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,11 @@ def get(): # pylint: disable=too-many-locals
limit: int = dict_data.get("limit")
sort_by: str = dict_data.get("sort_by", "id")
sort_order: str = dict_data.get("sort_order", "desc")
form_type: str = dict_data.get("form_type", "form")
form_type: str = dict_data.get("form_type", None)
is_active = dict_data.get("is_active", None)

if form_type:
form_type = form_type.split(",")
if form_name:
form_name: str = form_name.replace("%", r"\%").replace("_", r"\_")

Expand Down
7 changes: 1 addition & 6 deletions forms-flow-web/src/components/Form/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ const List = React.memo((props) => {
const designerFormLoading = useSelector(
(state) => state.formCheckList.designerFormLoading
);
const searchText = useSelector((state) => state.bpmForms.searchText);
const formType = useSelector((state) => state.bpmForms.formType);
const searchText = useSelector((state) => state.bpmForms.searchText);

const isDesigner = userRoles.includes(STAFF_DESIGNER);
const pageNo = useSelector((state) => state.bpmForms.page);
Expand Down Expand Up @@ -108,9 +107,6 @@ const List = React.memo((props) => {

const fetchForms = () => {
let filters = [pageNo, limit, sortBy, sortOrder, searchText];
if (isDesigner) {
filters.push(formType);
}
dispatch(setFormSearchLoading(true));
dispatch(fetchBPMFormList(...filters));
};
Expand All @@ -126,7 +122,6 @@ const List = React.memo((props) => {
sortBy,
sortOrder,
searchText,
formType,
]);

const formCheck = (formCheckList) => {
Expand Down

0 comments on commit 7b82e55

Please sign in to comment.