diff --git a/src/main/webui/src/app/components/content/addons/Cache.jsx b/src/main/webui/src/app/components/content/addons/Cache.jsx index 47345d5..89efbae 100644 --- a/src/main/webui/src/app/components/content/addons/Cache.jsx +++ b/src/main/webui/src/app/components/content/addons/Cache.jsx @@ -16,6 +16,7 @@ import React, {useState} from 'react'; import {useForm} from 'react-hook-form'; +import {ConfirmDialog} from '../common/PopupDialogs.jsx'; import {IndyRest} from '#utils/RestClient.js'; @@ -37,13 +38,21 @@ export default function Cache() { const { register, handleSubmit, + trigger, formState: {errors} } = useForm(); - const submit = e => { - e.preventDefault(); + const [showConfirmBox, setShowConfirm] = useState(false); + const showConfirmLog = () =>{ + trigger().then(valid => valid && setShowConfirm(true)); + }; + const cancelConfirmLog = ()=>{ + setShowConfirm(false); + }; + const submit = () => { handleSubmit(data=>{ deleteCache(data.path); })(); + setShowConfirm(false); }; return
e.preventDefault()}>
@@ -57,7 +66,10 @@ export default function Cache() { {errors.path?.type === "required" && Metadata url is required}
- + +
diff --git a/src/main/webui/src/app/components/content/common/PopupDialogs.jsx b/src/main/webui/src/app/components/content/common/PopupDialogs.jsx index ce662c5..bc369f8 100644 --- a/src/main/webui/src/app/components/content/common/PopupDialogs.jsx +++ b/src/main/webui/src/app/components/content/common/PopupDialogs.jsx @@ -43,9 +43,9 @@ ChangeLogDialog.propTypes={ changelog: PropTypes.object }; -const ConfirmDialog = ({showBox, handleConfirm, handleCancel}) => +const ConfirmDialog = ({showBox, title, handleConfirm, handleCancel}) => - Are you sure to delete this repository? + {title} - +
); @@ -175,7 +177,9 @@ const StoreEditControlPanel = ({mode, store, handleSubmit, validate, changelog}) - + }