From cee82e6a434f7bb83776a2102c72fff2cd09aea5 Mon Sep 17 00:00:00 2001 From: shuhaib s <95394061+shuhaib-aot@users.noreply.github.com> Date: Tue, 14 Nov 2023 16:01:10 +0530 Subject: [PATCH 1/3] fixed drop down issue in form table and process tab pagination issues (#1715) * button padding fix * fixed drop down issue in form table and process tab pagination issues --- .../components/Form/Steps/PreviewStepper.js | 19 ++-- .../Form/Steps/TaskvariableCreate.js | 11 +- .../components/Form/constants/FormTable.js | 107 ++++++++---------- .../Modeler/Editors/BpmnEditor/index.js | 18 +-- .../components/Modeler/constants/bpmnTable.js | 11 +- .../components/Modeler/constants/dmnTable.js | 11 +- 6 files changed, 88 insertions(+), 89 deletions(-) diff --git a/forms-flow-web/src/components/Form/Steps/PreviewStepper.js b/forms-flow-web/src/components/Form/Steps/PreviewStepper.js index dc476bc743..6fb3d23399 100644 --- a/forms-flow-web/src/components/Form/Steps/PreviewStepper.js +++ b/forms-flow-web/src/components/Form/Steps/PreviewStepper.js @@ -404,8 +404,9 @@ const Preview = React.memo( )} > - @@ -415,7 +416,7 @@ const Preview = React.memo(
-
+
)} > -
@@ -504,7 +506,7 @@ const Preview = React.memo(
-
+
)} > -
diff --git a/forms-flow-web/src/components/Form/Steps/TaskvariableCreate.js b/forms-flow-web/src/components/Form/Steps/TaskvariableCreate.js index a42102f38e..e0afc8b479 100644 --- a/forms-flow-web/src/components/Form/Steps/TaskvariableCreate.js +++ b/forms-flow-web/src/components/Form/Steps/TaskvariableCreate.js @@ -52,7 +52,7 @@ const TaskvariableCreate = ({ options, addTaskVariable }) => { inputId="selectTaskVariable" /> - + { placeholder={t("Enter Label")} /> - +
{t("Show in list")} { setShowInList(!showInList); }} @@ -79,15 +80,15 @@ const TaskvariableCreate = ({ options, addTaskVariable }) => { - + diff --git a/forms-flow-web/src/components/Form/constants/FormTable.js b/forms-flow-web/src/components/Form/constants/FormTable.js index f48eb3622a..32a73c74e0 100644 --- a/forms-flow-web/src/components/Form/constants/FormTable.js +++ b/forms-flow-web/src/components/Form/constants/FormTable.js @@ -1,9 +1,8 @@ -/* eslint-disable */ + import React, { useState, useEffect } from "react"; import { InputGroup, FormControl, - DropdownButton, Dropdown, } from "react-bootstrap"; import { useDispatch, useSelector } from "react-redux"; @@ -14,8 +13,7 @@ import { setBPMFormListPage, setBPMFormListSort, setBpmFormSearch, - setFormDeleteStatus, - // setBpmFormType, + setFormDeleteStatus, } from "../../../actions/formActions"; import SelectFormForDownload from "../FileUpload/SelectFormForDownload"; import LoadingOverlay from "react-loading-overlay"; @@ -28,7 +26,7 @@ import { import { useTranslation } from "react-i18next"; import { Translation } from "react-i18next"; import { getAllApplicationCount, getFormProcesses, resetFormProcessData } from "../../../apiManager/services/processServices"; -import { setIsApplicationCountLoading, setResetProcess } from "../../../actions/processActions"; +import { setIsApplicationCountLoading } from "../../../actions/processActions"; import { HelperServices } from "@formsflow/service"; import _ from "lodash"; @@ -52,18 +50,7 @@ function FormTable() { const searchText = useSelector((state) => state.bpmForms.searchText); const [search, setSearch] = useState(searchText || ""); const redirectUrl = MULTITENANCY_ENABLED ? `/tenant/${tenantKey}/` : "/"; - - const [openIndex, setOpenIndex] = useState(-1); // -1 means no dropdown open - - const toggleDropdown = (index) => { - if (openIndex === index) { - // Clicking on the currently open row should close it - setOpenIndex(-1); - } else { - // Clicking on a different row should open it and close the previous one - setOpenIndex(index); - } - }; + const isApplicationCountLoading = useSelector((state) => state.process.isApplicationCountLoading); const pageOptions = [ { @@ -92,12 +79,7 @@ function FormTable() { dispatch(setBPMFormListSort(updatedSort)); dispatch(setBPMFormListPage(1)); }; - - // const handleTypeChange = (type) => { - // dispatch(setBPMFormListPage(1)); - // dispatch(setBPMFormLimit(5)); - // dispatch(setBpmFormType(type)); - // }; + useEffect(() => { setSearch(searchText); @@ -116,13 +98,12 @@ function FormTable() { const viewOrEditForm = (formId) => { dispatch(resetFormProcessData()); - dispatch(setResetProcess()); dispatch(push(`${redirectUrl}formflow/${formId}/view-edit`)); }; const submitNewForm = (formId)=>{ dispatch(push(`${redirectUrl}form/${formId}`)); - } + }; const handleClearSearch = () => { setSearch(""); @@ -147,16 +128,7 @@ function FormTable() { ); - const submitNew = (formData) => { - return ( - - ); - }; + const deleteForms = (formData) => { dispatch(setIsApplicationCountLoading(true)); @@ -183,6 +155,21 @@ function FormTable() { }) ); }; + + const CustomToggle = React.forwardRef(({ children, onClick }, ref) => ( + + )); + + const noDataFound = () => { return ( @@ -203,7 +190,7 @@ function FormTable() { }; return ( <> - +
@@ -301,38 +288,44 @@ function FormTable() { - ); @@ -372,7 +365,7 @@ function FormTable() { - {t("Showing")} {limit * pageNo - (limit - 1)} {t("to")}{" "} + {t("Showing")} {(limit * pageNo) - (limit - 1)} {t("to")}{" "} {limit * pageNo > totalForms ? totalForms : limit * pageNo}{" "} {t("of")} {totalForms} {t("results")} diff --git a/forms-flow-web/src/components/Modeler/Editors/BpmnEditor/index.js b/forms-flow-web/src/components/Modeler/Editors/BpmnEditor/index.js index 90578c874c..11efdb1c00 100644 --- a/forms-flow-web/src/components/Modeler/Editors/BpmnEditor/index.js +++ b/forms-flow-web/src/components/Modeler/Editors/BpmnEditor/index.js @@ -54,8 +54,8 @@ export default React.memo( const [lintErrors, setLintErrors] = useState([]); const [deploymentLoading, setDeploymentLoading] = useState(false); const redirectUrl = MULTITENANCY_ENABLED ? `/tenant/${tenantKey}/` : "/"; - const [processName,setProcessName] = useState(true); - const bpmPropertyInput = document.getElementById("bio-properties-panel-name")?.value; + // const [processName,setProcessName] = useState(true); + // const bpmPropertyInput = document.getElementById("bio-properties-panel-name")?.value; const containerRef = useCallback((node) => { if (node !== null) { @@ -63,11 +63,11 @@ export default React.memo( } }, []); - useEffect(() => { - if (bpmPropertyInput) { - setProcessName(false); - } - }, [!bpmPropertyInput]); + // useEffect(() => { + // if (bpmPropertyInput) { + // setProcessName(false); + // } + // }, [!bpmPropertyInput]); const cancel = () => { dispatch(push(`${redirectUrl}processes`)); @@ -326,14 +326,14 @@ export default React.memo( variant="outline-dark" className="ml-3" onClick={handleExport} - disabled={processName || !bpmPropertyInput} + // disabled={processName || !bpmPropertyInput} > {t("Export")} diff --git a/forms-flow-web/src/components/Modeler/constants/bpmnTable.js b/forms-flow-web/src/components/Modeler/constants/bpmnTable.js index 3081c13bfc..e8f560aecb 100644 --- a/forms-flow-web/src/components/Modeler/constants/bpmnTable.js +++ b/forms-flow-web/src/components/Modeler/constants/bpmnTable.js @@ -46,7 +46,7 @@ function BpmnTable() { ) ); setCountLoading(true); - fetchAllBpmProcessesCount(tenantKey, search) + fetchAllBpmProcessesCount(tenantKey, searchText) .then((result) => { setTotalProcess(result.data?.count || 0); }) @@ -96,8 +96,8 @@ function BpmnTable() {
{e.anonymous ? t("Anonymous") : t("Private")} {" "} - + {viewOrEdit(e)} -
toggleDropdown(index)} - > - ... -
- {openIndex === index && ( - +
+ + + + + + + {userRoles.includes(STAFF_REVIEWER) || + userRoles.includes(CLIENT) ? ( + { + submitNewForm(e?._id); + }} + > + + {t("Submit New")} + + ) : null} deleteForms(e)}> {t("Delete")} - {(userRoles.includes(STAFF_REVIEWER) || userRoles.includes(CLIENT))?( - {console.log(e);submitNewForm(e?._id)}}> - - {t("Submit New")} - - ) : null} - - )} + +
- + @@ -148,13 +148,14 @@ function BpmnTable() { {process.map((processItem) => ( - + - diff --git a/forms-flow-web/src/components/Modeler/constants/dmnTable.js b/forms-flow-web/src/components/Modeler/constants/dmnTable.js index 98b8651abb..2b7dcf2dad 100644 --- a/forms-flow-web/src/components/Modeler/constants/dmnTable.js +++ b/forms-flow-web/src/components/Modeler/constants/dmnTable.js @@ -48,7 +48,7 @@ function DmnTable() { ) ); setCountLoading(true); - fetchAllDmnProcessesCount(tenantKey, search) + fetchAllDmnProcessesCount(tenantKey, searchText) .then((result) => { setTotalProcess(result.data?.count || 0); }) @@ -97,8 +97,8 @@ function DmnTable() {
{t("Key")} {t("Workflow Name")}{t("Key")} {t("Type")} @@ -140,7 +140,7 @@ function BpmnTable() { style={{ height: "300px" }} className="text-center" > - {t("No Process Found")} + { isLoading ? null : t("No Process Found")}
{processItem.key} {processItem.name}{processItem.key} {t("BPMN")} + + {t("Edit Workflow")}
- + @@ -149,13 +149,14 @@ function DmnTable() { {dmn.map((processItem) => ( - + - From fe3aad4808ea60729f69592314a474e99c05f4ce Mon Sep 17 00:00:00 2001 From: fahad-aot <99656326+fahad-aot@users.noreply.github.com> Date: Tue, 14 Nov 2023 16:03:31 +0530 Subject: [PATCH 2/3] added dropdow for submission status & translation changes (#1714) Co-authored-by: shuhaib s <95394061+shuhaib-aot@users.noreply.github.com> --- .../Application/ApplicationFilter.js | 78 +++++++++++-------- .../Application/ApplicationTable.js | 4 +- forms-flow-web/src/components/Draft/Edit.js | 4 +- .../src/components/Form/Item/Edit.js | 4 +- .../src/components/Form/Item/View.js | 4 +- .../components/Form/constants/FormTable.js | 4 +- .../components/Modeler/constants/bpmnTable.js | 2 +- .../components/Modeler/constants/dmnTable.js | 2 +- 8 files changed, 61 insertions(+), 41 deletions(-) diff --git a/forms-flow-web/src/components/Application/ApplicationFilter.js b/forms-flow-web/src/components/Application/ApplicationFilter.js index 389bdcf2d3..22e472c632 100644 --- a/forms-flow-web/src/components/Application/ApplicationFilter.js +++ b/forms-flow-web/src/components/Application/ApplicationFilter.js @@ -5,13 +5,16 @@ import { useDispatch, useSelector } from "react-redux"; import { getAllApplications } from "../../apiManager/services/applicationServices"; import { useTranslation } from "react-i18next"; -const ApplicationFilter = ({ setDisplayFilter,filterParams,setFilterParams }) => { +const ApplicationFilter = ({ setDisplayFilter, filterParams, setFilterParams }) => { const dispatch = useDispatch(); const createSearchNode = useRef(); - const [applicationId,setApplicationId] = useState(filterParams.id || ""); - const [applicationName,setApplicationName] = useState(filterParams.applicationName || ""); - const [applicationStatus,setApplicationStatus] = useState(filterParams.applicationStatus || ""); - const [lastModified,setLastModified] = useState(filterParams.modified || null); + const [applicationId, setApplicationId] = useState(filterParams.id || ""); + const [applicationName, setApplicationName] = useState(filterParams.applicationName || ""); + const [applicationStatus, setApplicationStatus] = useState(filterParams.applicationStatus || ""); + const [lastModified, setLastModified] = useState(filterParams.modified || null); + const applicationStatusOptions = useSelector( + (state) => state.applications.applicationStatus + ); const pageNo = useSelector((state) => state.applications?.activePage); const limit = useSelector((state) => state.applications?.countPerPage); const { t } = useTranslation(); @@ -42,30 +45,37 @@ const ApplicationFilter = ({ setDisplayFilter,filterParams,setFilterParams }) => setApplicationName(""); setLastModified(null); setFilterParams({}); - let filters = { - applicationName:null, - id:null, - applicationStatus:null, - modified:null, - page:pageNo, - limit:limit, + let filters = { + applicationName: null, + id: null, + applicationStatus: null, + modified: null, + page: pageNo, + limit: limit, }; dispatch(getAllApplications(filters)); }; - const applyFilters = ()=>{ + const applyFilters = () => { let filterParams = { - applicationName:applicationName, - id:applicationId, - applicationStatus:applicationStatus, - modified:lastModified, - page:pageNo, - limit:limit, + applicationName: applicationName, + id: applicationId, + applicationStatus: applicationStatus, + modified: lastModified, + page: pageNo, + limit: limit, }; setFilterParams(filterParams); dispatch(getAllApplications(filterParams)); }; + const getApplicationStatusOptions = (applicationStatusOptions) => { + const selectOptions = applicationStatusOptions.map((option) => { + return { value: option, label: option }; + }); + return selectOptions; + }; + return (
- + /> - +
- - {t("Submission Status")} + - + { onSetDateRange(selectedRange); @@ -144,7 +160,7 @@ const ApplicationFilter = ({ setDisplayFilter,filterParams,setFilterParams }) => className="text-danger small " onClick={() => clearAllFilters()} > - {t("Clear All Filters")} + {t("Clear All Filters")} @@ -152,11 +168,11 @@ const ApplicationFilter = ({ setDisplayFilter,filterParams,setFilterParams }) => className="btn btn-light mr-1 " onClick={() => setDisplayFilter(false)} > - {t("Cancel")} + {t("Cancel")} @@ -166,4 +182,4 @@ const ApplicationFilter = ({ setDisplayFilter,filterParams,setFilterParams }) => ); }; -export default ApplicationFilter; +export default ApplicationFilter; \ No newline at end of file diff --git a/forms-flow-web/src/components/Application/ApplicationTable.js b/forms-flow-web/src/components/Application/ApplicationTable.js index cd68d6f70d..cd0262d337 100644 --- a/forms-flow-web/src/components/Application/ApplicationTable.js +++ b/forms-flow-web/src/components/Application/ApplicationTable.js @@ -122,9 +122,9 @@ const ApplicationTable = () => {
{t("Key")} {t("Workflow Name")}{t("Key")} {t("Type")} @@ -141,7 +141,7 @@ function DmnTable() { style={{ height: "300px" }} className="text-center" > - {t("No DMN Found")} + { isLoading ? null : t("No Process Found")}
{processItem.key} {processItem.name}{processItem.key} {t("DMN")} + + {t("Edit Workflow")}
- + - +
{t("Id")}{t("Submission Id")} {t("Form Title")}{t("Status")}{t("Submission Status")} {t("Last Modified")}
diff --git a/forms-flow-web/src/components/Draft/Edit.js b/forms-flow-web/src/components/Draft/Edit.js index 63ae283ef6..113eddede5 100644 --- a/forms-flow-web/src/components/Draft/Edit.js +++ b/forms-flow-web/src/components/Draft/Edit.js @@ -436,7 +436,9 @@ const mapDispatchToProps = (dispatch, ownProps) => { onCustomEvent: (customEvent, redirectUrl) => { switch (customEvent.type) { case CUSTOM_EVENT_TYPE.CUSTOM_SUBMIT_DONE: - toast.success("Submission Saved."); + toast.success( + {(t) => t("Submission Saved")} + ); dispatch(push(`${redirectUrl}draft`)); break; case CUSTOM_EVENT_TYPE.CANCEL_SUBMISSION: diff --git a/forms-flow-web/src/components/Form/Item/Edit.js b/forms-flow-web/src/components/Form/Item/Edit.js index dff0cf8d1f..02eff935c0 100644 --- a/forms-flow-web/src/components/Form/Item/Edit.js +++ b/forms-flow-web/src/components/Form/Item/Edit.js @@ -510,7 +510,7 @@ const Edit = React.memo(() => {