|
@@ -32,6 +32,8 @@ const PageDuplicateModal = (props) => {
|
|
|
const [isDuplicateRecursively, setIsDuplicateRecursively] = useState(true);
|
|
const [isDuplicateRecursively, setIsDuplicateRecursively] = useState(true);
|
|
|
const [isDuplicateRecursivelyWithoutExistPath, setIsDuplicateRecursivelyWithoutExistPath] = useState(true);
|
|
const [isDuplicateRecursivelyWithoutExistPath, setIsDuplicateRecursivelyWithoutExistPath] = useState(true);
|
|
|
|
|
|
|
|
|
|
+ const existPaths = ['/test146'];
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* change pageNameInput for PagePathAutoComplete
|
|
* change pageNameInput for PagePathAutoComplete
|
|
|
* @param {string} value
|
|
* @param {string} value
|
|
@@ -56,6 +58,23 @@ const PageDuplicateModal = (props) => {
|
|
|
setIsDuplicateRecursivelyWithoutExistPath(!isDuplicateRecursivelyWithoutExistPath);
|
|
setIsDuplicateRecursivelyWithoutExistPath(!isDuplicateRecursivelyWithoutExistPath);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function checkExistPath() {
|
|
|
|
|
+ let existFlag = false;
|
|
|
|
|
+ return subordinatedPaths.map((duplicatedNewPath) => {
|
|
|
|
|
+ const existPath = existPaths.includes(duplicatedNewPath); // existPaths is dummy data
|
|
|
|
|
+ let result;
|
|
|
|
|
+ if (existPath) {
|
|
|
|
|
+ result = <li className="text-danger">{duplicatedNewPath} (exist)</li>;
|
|
|
|
|
+ existFlag = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ result = <li>{duplicatedNewPath}</li>;
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ })
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const getSubordinatedList = useCallback(async() => {
|
|
const getSubordinatedList = useCallback(async() => {
|
|
|
try {
|
|
try {
|
|
|
const res = await appContainer.apiv3Get('/pages/subordinated-list', { path });
|
|
const res = await appContainer.apiv3Get('/pages/subordinated-list', { path });
|
|
@@ -140,24 +159,21 @@ const PageDuplicateModal = (props) => {
|
|
|
</label>
|
|
</label>
|
|
|
</ul>
|
|
</ul>
|
|
|
<ul>
|
|
<ul>
|
|
|
- {subordinatedPaths.length > 0 && (
|
|
|
|
|
- <input
|
|
|
|
|
- className="custom-control-input"
|
|
|
|
|
- name="withoutExistRecursively"
|
|
|
|
|
- id="cbDuplicatewithoutExistRecursively"
|
|
|
|
|
- type="checkbox"
|
|
|
|
|
- checked={isDuplicateRecursivelyWithoutExistPath}
|
|
|
|
|
- onChange={changeIsDuplicateRecursivelyWithoutExistPathHandler}
|
|
|
|
|
- />
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ <input
|
|
|
|
|
+ className="custom-control-input"
|
|
|
|
|
+ name="withoutExistRecursively"
|
|
|
|
|
+ id="cbDuplicatewithoutExistRecursively"
|
|
|
|
|
+ type="checkbox"
|
|
|
|
|
+ checked={isDuplicateRecursivelyWithoutExistPath}
|
|
|
|
|
+ onChange={changeIsDuplicateRecursivelyWithoutExistPathHandler}
|
|
|
|
|
+ />
|
|
|
<label className="custom-control-label" htmlFor="cbDuplicatewithoutExistRecursively">
|
|
<label className="custom-control-label" htmlFor="cbDuplicatewithoutExistRecursively">
|
|
|
{ t('modal_duplicate.label.Duplicate without exist path') }
|
|
{ t('modal_duplicate.label.Duplicate without exist path') }
|
|
|
</label>
|
|
</label>
|
|
|
</ul>
|
|
</ul>
|
|
|
<div>
|
|
<div>
|
|
|
<ul>
|
|
<ul>
|
|
|
- {isDuplicateRecursively && subordinatedPaths.map(duplicatedNewPath => <li key={duplicatedNewPath}>{duplicatedNewPath}</li>)}
|
|
|
|
|
|
|
+ {isDuplicateRecursively && checkExistPath()}
|
|
|
</ul>
|
|
</ul>
|
|
|
</div>
|
|
</div>
|
|
|
<div> {getSubordinatedError} </div>
|
|
<div> {getSubordinatedError} </div>
|