Skip to content

Commit

Permalink
Merge pull request #2500 from arun-s-aot/bugfix/FWF-4211-process-id-i…
Browse files Browse the repository at this point in the history
…ssue-on-unpublish

FWF-4211 [Bugfix] process id error after unpublish and save fixed
  • Loading branch information
arun-s-aot authored Jan 10, 2025
2 parents 528a6ad + 6db75d9 commit 480a21d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 4 additions & 6 deletions forms-flow-web/src/components/Form/EditForm/FlowEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import BPMNViewer from "../../BPMN/BpmnViewer.js";
import TaskVariableModal from "../../Modals/TaskVariableModal.js";

const FlowEdit = forwardRef(({ isPublished = false, CategoryType,
setWorkflowIsChanged, migration, setMigration, redirectUrl,
setWorkflowIsChanged,workflowIsChanged, migration, setMigration, redirectUrl,
isMigrated = true, mapperId,layoutNotsaved, handleCurrentLayout,
isMigrationLoading, setIsMigrationLoading, handleUnpublishAndSaveChanges }, ref) => {
const { t } = useTranslation();
Expand All @@ -52,7 +52,6 @@ const FlowEdit = forwardRef(({ isPublished = false, CategoryType,
const [isReverted, setIsReverted] = useState(false);
const { createDesigns } = userRoles();
const [showTaskVarModal, setShowTaskVarModal] = useState(false);
const [isWorkflowChanged, setIsWorkflowChanged] = useState(false);
const [isMigrationChecked, setIsMigrationChecked] = useState(false);
const [showMigrationModal, setShowMigrationModal] = useState(false);
/* --------- fetching all process history when click history button --------- */
Expand Down Expand Up @@ -84,12 +83,10 @@ const FlowEdit = forwardRef(({ isPublished = false, CategoryType,
setShowHistoryModal(!showHistoryModal);

const enableWorkflowChange = () => {
setIsWorkflowChanged(true);
setWorkflowIsChanged(true); // this function passed from parent
};

const disableWorkflowChange = () => {
setIsWorkflowChanged(false);
setWorkflowIsChanged(false); // this function passed from parent
};

Expand Down Expand Up @@ -254,7 +251,7 @@ const FlowEdit = forwardRef(({ isPublished = false, CategoryType,
className="mx-2"
label={t("Save Flow")}
onClick={isPublished ? handleUnpublishAndSaveChanges : handleSaveFlowClick}
disabled={!isWorkflowChanged}
disabled={!workflowIsChanged}
dataTestid="save-flow-layout"
ariaLabel={t("Save Flow Layout")}
buttonLoading={savingFlow}
Expand All @@ -264,7 +261,7 @@ const FlowEdit = forwardRef(({ isPublished = false, CategoryType,
size="md"
label={t("Discard Changes")}
onClick={handleDiscardModal}
disabled={!isWorkflowChanged}
disabled={!workflowIsChanged}
dataTestid="discard-flow-changes-testid"
ariaLabel={t("Discard Flow Changes")}
/>
Expand Down Expand Up @@ -391,6 +388,7 @@ FlowEdit.propTypes = {
}).isRequired,
isPublished: PropTypes.bool.isRequired,
setWorkflowIsChanged: PropTypes.func,
workflowIsChanged: PropTypes.bool,
migration: PropTypes.bool,
setMigration: PropTypes.func,
redirectUrl: PropTypes.string,
Expand Down
10 changes: 6 additions & 4 deletions forms-flow-web/src/components/Form/EditForm/FormEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -816,11 +816,12 @@ const handleSaveLayout = () => {
return;
}
/* ----------------------------- saving the data ---------------------------- */
const response = await getProcessDetails({
processKey: processListData.processKey,
});
dispatch(setProcessData(response.data));
if (!isFormLayout) {
const response = await getProcessDetails({
processKey: processListData.processKey,
});
dispatch(setProcessData(response.data));
if(response)
await flowRef.current.saveFlow({processId: response.data.id,showToast: false});
setLoadingVersioning(false); //setloading false after all function complete
} else {
Expand Down Expand Up @@ -1262,6 +1263,7 @@ const handleSaveLayout = () => {
{isProcessDetailsLoading ? <>loading...</> : <FlowEdit
ref={flowRef}
setWorkflowIsChanged={setWorkflowIsChanged}
workflowIsChanged={workflowIsChanged}
CategoryType={CategoryType}
isPublished={isPublished}
migration={migration}
Expand Down

0 comments on commit 480a21d

Please sign in to comment.