Skip to content

Commit f506a20

Browse files
author
Damien LACHAUME / PALO-IT
committed
Add a warning message to prevent the modal window from closing if the process is in progress.
1 parent ca60e37 commit f506a20

File tree

1 file changed

+17
-1
lines changed
  • mithril-explorer/src/components/VerifyCertificate

1 file changed

+17
-1
lines changed

mithril-explorer/src/components/VerifyCertificate/index.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default function VerifyCertificate({ show, onClose, certificateHash }) {
1010
const [loading, setLoading] = useState(false);
1111
const [certificateData, setCertificateData] = useState(null);
1212
const [verificationDuration, setVerificationDuration] = useState(null);
13+
const [showWarning, setShowWarning] = useState(false);
1314

1415
useEffect(() => {
1516
async function buildClientAndVerifyChain() {
@@ -100,17 +101,32 @@ export default function VerifyCertificate({ show, onClose, certificateHash }) {
100101
(mithrilEventsDiv.scrollTop = mithrilEventsDiv.scrollHeight));
101102
}
102103

104+
const handleModalClose = () => {
105+
// Only allow closing if not loading
106+
if (loading) {
107+
setShowWarning(true);
108+
} else {
109+
onClose();
110+
}
111+
};
112+
103113
return (
104114
<Modal
105115
show={show}
106-
onHide={onClose}
116+
onHide={handleModalClose}
107117
size="xl"
108118
aria-labelledby="contained-modal-title-vcenter"
109119
centered>
110120
<Modal.Header closeButton>
111121
<Modal.Title>Verify certificate</Modal.Title>
112122
</Modal.Header>
113123
<Modal.Body>
124+
{showWarning && loading && (
125+
<div className="alert alert-warning" role="alert">
126+
Verification is in progress. Please wait until the process is complete (less than a
127+
minute).
128+
</div>
129+
)}
114130
{certificateData && (
115131
<>
116132
<h4>Certificate Details</h4>

0 commit comments

Comments
 (0)