|
@@ -32,9 +32,8 @@ const PageDuplicateModal = (props) => {
|
|
|
const [errs, setErrs] = useState(null);
|
|
const [errs, setErrs] = useState(null);
|
|
|
|
|
|
|
|
const [subordinatedPages, setSubordinatedPages] = useState([]);
|
|
const [subordinatedPages, setSubordinatedPages] = useState([]);
|
|
|
- const [isDuplicateRecursively, setIsDuplicateRecursively] = useState(false);
|
|
|
|
|
- const [isDuplicateRecursivelyWithoutExistPath, setIsDuplicateRecursivelyWithoutExistPath] = useState(false);
|
|
|
|
|
- const [isDuplicateRecursivelyExist] = useState(false);
|
|
|
|
|
|
|
+ const [isDuplicateRecursively, setIsDuplicateRecursively] = useState(true);
|
|
|
|
|
+ const [isDuplicateRecursivelyWithoutExistPath, setIsDuplicateRecursivelyWithoutExistPath] = useState(true);
|
|
|
const [existingPaths, setExistingPaths] = useState([]);
|
|
const [existingPaths, setExistingPaths] = useState([]);
|
|
|
|
|
|
|
|
const checkExistPaths = async(newParentPath) => {
|
|
const checkExistPaths = async(newParentPath) => {
|
|
@@ -166,27 +165,33 @@ const PageDuplicateModal = (props) => {
|
|
|
onChange={changeIsDuplicateRecursivelyHandler}
|
|
onChange={changeIsDuplicateRecursivelyHandler}
|
|
|
/>
|
|
/>
|
|
|
<label className="custom-control-label" htmlFor="cbDuplicateRecursively">
|
|
<label className="custom-control-label" htmlFor="cbDuplicateRecursively">
|
|
|
- { t('modal_duplicate.label.Duplicate with child') }
|
|
|
|
|
|
|
+ { t('modal_duplicate.label.Recursively') }
|
|
|
|
|
+ <p className="form-text text-muted mt-0">{ t('modal_duplicate.help.recursive') }</p>
|
|
|
</label>
|
|
</label>
|
|
|
- </div>
|
|
|
|
|
- {isDuplicateRecursively && <ComparePathsTable subordinatedPages={subordinatedPages} newPagePath={pageNameInput} />}
|
|
|
|
|
- {isDuplicateRecursively && existingPaths.length !== 0 && <DuplicatePathsTable existingPaths={existingPaths} oldPagePath={pageNameInput} />}
|
|
|
|
|
-
|
|
|
|
|
- {isDuplicateRecursively && (
|
|
|
|
|
- <div className="custom-control custom-checkbox custom-checkbox-warning">
|
|
|
|
|
- <input
|
|
|
|
|
- className="custom-control-input"
|
|
|
|
|
- name="withoutExistRecursively"
|
|
|
|
|
- id="cbDuplicatewithoutExistRecursively"
|
|
|
|
|
- type="checkbox"
|
|
|
|
|
- checked={isDuplicateRecursivelyWithoutExistPath}
|
|
|
|
|
- onChange={changeIsDuplicateRecursivelyWithoutExistPathHandler}
|
|
|
|
|
- />
|
|
|
|
|
- <label className="custom-control-label" htmlFor="cbDuplicatewithoutExistRecursively">
|
|
|
|
|
- { t('modal_duplicate.label.Duplicate without exist path') }
|
|
|
|
|
- </label>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <div>
|
|
|
|
|
+ {isDuplicateRecursively && existingPaths.length !== 0 && (
|
|
|
|
|
+ <div className="custom-control custom-checkbox custom-checkbox-warning">
|
|
|
|
|
+ <input
|
|
|
|
|
+ className="custom-control-input"
|
|
|
|
|
+ name="withoutExistRecursively"
|
|
|
|
|
+ id="cbDuplicatewithoutExistRecursively"
|
|
|
|
|
+ type="checkbox"
|
|
|
|
|
+ checked={isDuplicateRecursivelyWithoutExistPath}
|
|
|
|
|
+ onChange={changeIsDuplicateRecursivelyWithoutExistPathHandler}
|
|
|
|
|
+ />
|
|
|
|
|
+ <label className="custom-control-label" htmlFor="cbDuplicatewithoutExistRecursively">
|
|
|
|
|
+ { t('modal_duplicate.label.Duplicate without exist path') }
|
|
|
|
|
+ </label>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
</div>
|
|
</div>
|
|
|
- )}
|
|
|
|
|
|
|
+ <div>
|
|
|
|
|
+ {isDuplicateRecursively && <ComparePathsTable subordinatedPages={subordinatedPages} newPagePath={pageNameInput} />}
|
|
|
|
|
+ {isDuplicateRecursively && existingPaths.length !== 0 && <DuplicatePathsTable existingPaths={existingPaths} oldPagePath={pageNameInput} />}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
</ModalBody>
|
|
</ModalBody>
|
|
|
<ModalFooter>
|
|
<ModalFooter>
|
|
|
<ApiErrorMessageList errs={errs} targetPath={pageNameInput} />
|
|
<ApiErrorMessageList errs={errs} targetPath={pageNameInput} />
|
|
@@ -194,7 +199,7 @@ const PageDuplicateModal = (props) => {
|
|
|
type="button"
|
|
type="button"
|
|
|
className="btn btn-primary"
|
|
className="btn btn-primary"
|
|
|
onClick={duplicate}
|
|
onClick={duplicate}
|
|
|
- disabled={(isDuplicateRecursively && isDuplicateRecursivelyExist && !isDuplicateRecursivelyWithoutExistPath) || (path === pageNameInput)}
|
|
|
|
|
|
|
+ disabled={(isDuplicateRecursively && !isDuplicateRecursivelyWithoutExistPath && existingPaths.length !== 0)}
|
|
|
>
|
|
>
|
|
|
{ t('modal_duplicate.label.Duplicate page') }
|
|
{ t('modal_duplicate.label.Duplicate page') }
|
|
|
</button>
|
|
</button>
|