Skip to content

Commit 28ad278

Browse files
committed
Added Functionalities for publish and save
1 parent 232e04f commit 28ad278

File tree

3 files changed

+32
-15
lines changed

3 files changed

+32
-15
lines changed

forms-flow-web/src/routes/Design/Forms/FlowEdit.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import React, {
77
} from "react";
88
import {
99
CustomButton,
10-
ConfirmModal,
10+
PromptModal,
1111
// HistoryModal,
1212
//CurlyBracketsIcon,
1313
VariableSelection,
@@ -343,19 +343,23 @@ const enableWorkflowChange = async () => {
343343
<>
344344
{/* <Card> */}
345345
<div>
346-
<ConfirmModal
346+
<PromptModal
347347
show={showDiscardModal}
348348
title={t(`Discard Flow Changes?`)}
349349
message={t(
350350
"Are you sure you want to discard all unsaved changes to the flow of the form?"
351351
)}
352-
messageSecondary={t("This action cannot be undone.")}
353352
primaryBtnAction={handleDiscardConfirm}
354353
onClose={handleDiscardModal}
355354
primaryBtnText={t("Yes, Discard All Unsaved Changes")}
356355
secondaryBtnText={t("No, Keep The Changes")}
357356
secondaryBtnAction={handleDiscardModal}
358-
size="sm"
357+
type="warning"
358+
size="md"
359+
primaryBtndataTestid="discard-confirm-button"
360+
secondoryBtndataTestid="discard-cancel-button"
361+
primaryBtnariaLabel={t("Yes, Discard All Unsaved Changes")}
362+
secondoryBtnariaLabel={t("No, Keep The Changes")}
359363
/>
360364
{/* <div className="head">
361365
{createDesigns && (
@@ -408,9 +412,10 @@ const enableWorkflowChange = async () => {
408412
{/* </Card> */}
409413
</div>
410414
{showMigrationModal && (
411-
<ConfirmModal
415+
<PromptModal
412416
show={showMigrationModal}
413417
title={t("***Migration Notice***")}
418+
size="lg"
414419
message={
415420
<div>
416421
<div className="message-primary mb-3">
@@ -457,7 +462,6 @@ const enableWorkflowChange = async () => {
457462
</div>
458463
}
459464
primaryBtnDisable={!isMigrationChecked}
460-
messageSecondary={null} // You can set this to `null` or remove it entirely if unused
461465
primaryBtnAction={handleMigration}
462466
onClose={handleCloseMigration}
463467
primaryBtnText={t(
@@ -466,7 +470,13 @@ const enableWorkflowChange = async () => {
466470
secondaryBtnText={t("Cancel")}
467471
secondaryBtnAction={handleCloseMigration}
468472
buttonLoading={isMigrationLoading}
469-
size="sm"
473+
type="info"
474+
primaryBtndataTestid="migration-confirm-button"
475+
secondoryBtndataTestid="migration-cancel-button"
476+
primaryBtnariaLabel={t(
477+
"Link this form that will keep the current flow and its history"
478+
)}
479+
secondoryBtnariaLabel={t("Cancel")}
470480
/>
471481
)}
472482

forms-flow-web/src/routes/Design/Process/ProcessCreateEdit.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ import {
2020
createNewDecision,
2121
} from "../../../components/Modeler/helpers/helper";
2222
import {
23-
ConfirmModal,
24-
ErrorModal,
23+
PromptModal,
2524
HistoryPage,
2625
V8CustomButton,
2726
FormStatusIcon
@@ -632,17 +631,21 @@ const ProcessCreateEdit = ({ type }) => {
632631
return (
633632
<div>
634633
<NavigateBlocker isBlock={isWorkflowChanged} message={"You have made changes that are not saved yet"} />
635-
<ConfirmModal
634+
<PromptModal
636635
show={showConfirmModal}
637636
title={modalContent.title}
638637
message={modalContent.message}
639-
messageSecondary={modalContent.messageSecondary || ""}
640638
primaryBtnAction={modalContent.primaryBtnAction}
641639
onClose={closeModal}
642640
secondaryBtnAction={modalContent.secondaryBtnAction}
643641
primaryBtnText={modalContent.primaryBtnText}
644642
secondaryBtnText={modalContent.secondaryBtnText}
645-
size="md"
643+
type="warning"
644+
size={modalType === "unpublish" ? "lg" : "md"}
645+
primaryBtndataTestid="confirm-primary-button"
646+
secondoryBtndataTestid="confirm-secondary-button"
647+
primaryBtnariaLabel={modalContent.primaryBtnText}
648+
secondoryBtnariaLabel={modalContent.secondaryBtnText}
646649
/>
647650

648651
<div className="header-section-1">
@@ -745,13 +748,17 @@ const ProcessCreateEdit = ({ type }) => {
745748
errorMessage={exportError}
746749
/>
747750
{showErrorModal && (
748-
<ErrorModal
751+
<PromptModal
749752
show={showErrorModal}
750753
onClose={handleCloseErrorModal}
751754
title={t("Error(s)")}
752755
message={errorMessage}
753756
primaryBtnAction={handleCloseErrorModal}
754757
primaryBtnText={t("Dismiss")}
758+
size="lg"
759+
type="error"
760+
primaryBtndataTestid="error-dismiss-button"
761+
primaryBtnariaLabel={t("Dismiss")}
755762
/>
756763
)}
757764
<HistoryPage

forms-flow-web/src/routes/Design/Process/ProcessTable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ const ProcessTable = React.memo(() => {
281281
height: 55,
282282
renderCell: params => (
283283
<span className="d-flex align-items-center">
284-
{params.value === "active" ?
284+
{params.value === "Published" ?
285285
<span className="status-live"></span> :
286286
<span className="status-draft"></span>}
287-
{params.value === "active" ? t("Live") : t("Draft")}
287+
{params.value === "Published" ? t("Live") : t("Draft")}
288288
</span>
289289
),
290290
},

0 commit comments

Comments
 (0)