Skip to content

Commit

Permalink
Merge pull request #2291 from fahad-aot/featue/FWF-3667-subflow-list-…
Browse files Browse the repository at this point in the history
…page

Featue/fwf 3667 subflow list page
  • Loading branch information
arun-s-aot authored Oct 22, 2024
2 parents 418063a + 1c614bd commit 0d63fce
Show file tree
Hide file tree
Showing 9 changed files with 440 additions and 14 deletions.
1 change: 1 addition & 0 deletions forms-flow-web/src/actions/actionConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ const ACTION_CONSTANTS = {
//authorization
SET_USER_GROUPS:"SET_USER_GROUPS",
SET_ROLES:"SET_ROLES",
SET_SUBFLOW_COUNT:"SET_SUBFLOW_COUNT",
};

export default ACTION_CONSTANTS;
9 changes: 8 additions & 1 deletion forms-flow-web/src/actions/processActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,11 @@ export const setIsPublicDiagram = (data) => (dispatch) => {
type: ACTION_CONSTANTS.IS_PUBLIC_DIAGRAM,
payload: data,
});
};
};

export const setSubflowCount = (data) => (dispatch) => {
dispatch({
type: ACTION_CONSTANTS.SET_SUBFLOW_COUNT,
payload: data,
});
};
49 changes: 46 additions & 3 deletions forms-flow-web/src/apiManager/services/processServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import {
setResetProcess,
setAllDmnProcessList,
setBpmnModel,
setApplicationCount,
setSubflowCount
} from "../../actions/processActions";
import { setApplicationCount } from "../../actions/processActions";
import { replaceUrl } from "../../helper/helper";
import { StorageService } from "@formsflow/service";

Expand Down Expand Up @@ -120,6 +121,48 @@ export const fetchAllBpmProcesses = ( {tenant_key = null,
};
};

export const fetchAllProcesses = ({
limit,
searchKey = "",
sortOrder,
processType ,
sortBy,
pageNo = 1 ,} = {},
...rest
) => {
const done = rest.length ? rest[0] : () => {};

// let url = API.GET_PROCESSES_DETAILS
let url = `${API.GET_PROCESSES_DETAILS}?pageNo=${pageNo}&limit=${limit
}&sortOrder=${sortOrder}&processType=${processType}&sortBy=${sortBy}&name=${searchKey}`;
return (dispatch) => {
// eslint-disable-next-line max-len
RequestService.httpGETRequest(
url,
{},
StorageService.get(StorageService.User.AUTH_TOKEN),
true
)
.then((res) => {
if (res?.data) {
dispatch(setSubflowCount(res.data.totalCount));
// let unique = removeTenantDuplicates(res.data.process, tenant_key);
dispatch(setProcessStatusLoading(false));
dispatch(setAllProcessList(res.data.process));

done(null, res.data);
} else {
dispatch(setAllProcessList([]));
}
})
// eslint-disable-next-line no-unused-vars
.catch((error) => {
console.log(error);
dispatch(setProcessLoadError(true));
});
};
};

export const fetchAllBpmProcessesCount = (tenant_key,searchKey,) => {
let url =
API.GET_BPM_PROCESS_LIST_COUNT +
Expand Down Expand Up @@ -220,7 +263,7 @@ export const getFormProcesses = (formId, ...rest) => {
)
.then((res) => {
if (res.data) {
console.log("res.data", res.data);
// console.log("res.data", res.data);
dispatch(setFormPreviosData(res.data));
dispatch(setFormProcessesData(res.data));
// need to check api and put exact respose
Expand All @@ -241,7 +284,7 @@ export const getFormProcesses = (formId, ...rest) => {
};
};

export const getProcessDetails = (processKey) =>
export const getProcessDetails = (processKey) =>
RequestService.httpGETRequest(`${API.GET_PROCESSES_DETAILS}/${processKey}`);

export const updateProcess = ({id,data,type}) => {
Expand Down
10 changes: 5 additions & 5 deletions forms-flow-web/src/components/Form/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const List = React.memo((props) => {
}, [dispatch]);

useEffect(() => {
console.log("================", importError);
// console.log("================", importError);
dispatch(setBPMFormListLoading(true));
}, []);

Expand Down Expand Up @@ -201,7 +201,7 @@ const List = React.memo((props) => {
const dataString = JSON.stringify(data);
formImport(fileContent, dataString)
.then((res) => {
console.log(res);
// console.log(res);
setImportLoader(false);
setFormSubmitted(false);

Expand Down Expand Up @@ -285,7 +285,7 @@ const List = React.memo((props) => {
setNameError(errors.title);
return;
}
console.log(form,"FORM");
// console.log(form,"FORM");
form.components = [];
const newFormData = addHiddenApplicationComponent(form);
const newForm = {
Expand Down Expand Up @@ -347,7 +347,7 @@ const List = React.memo((props) => {
handleSearch={handleSearch}
handleClearSearch={handleClearSearch}
placeholder={t("Search Form Name and Description")}
searchFormLoading={searchFormLoading}
searchLoading={searchFormLoading}
title={t("Search Form Name and Description")}
dataTestId="form-search-input"
/>
Expand All @@ -356,7 +356,7 @@ const List = React.memo((props) => {
{createDesigns && (
<CustomButton
variant="primary"
size="md"
size="sm"
label="New Form"
onClick={() => setNewFormModal(true)}
className=""
Expand Down
4 changes: 2 additions & 2 deletions forms-flow-web/src/components/Form/constants/FormTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ function FormTable() {
<span data-testid={`form-status-${e._id}`} className="d-flex align-items-center">
{e.status === "active" ? (
<>
<div className="status-live"></div>
<span className="status-live"></span>
</>
) : (
<div className="status-draft"></div>
<span className="status-draft"></span>
)}
{e.status === "active" ? t("Live") : t("Draft")}
</span>
Expand Down
Loading

0 comments on commit 0d63fce

Please sign in to comment.