diff --git a/src/locales/en.js b/src/locales/en.js index 9a508ecb6..35621724b 100644 --- a/src/locales/en.js +++ b/src/locales/en.js @@ -1601,6 +1601,7 @@ export default { 'componentRepository.categories.group': 'Group', 'componentRepository.components.installedVersion': 'Installed Version', 'componentRepository.components.genericError': 'An Error has occurred in the Application', + 'page.invalidChildPositionError': 'A page belonging to a group cannot be placed as a child of the root', 'page.invalidPositionError': 'A page can only be a direct child of a page with the same owner group or free access', 'app.installFailed': 'An Error occurred and the Bundle could not be installed', 'app.uninstallFailed': 'An Error occurred and the Bundle could not be uninstalled', diff --git a/src/locales/it.js b/src/locales/it.js index 9ab892b8a..f0aaaab34 100644 --- a/src/locales/it.js +++ b/src/locales/it.js @@ -1601,6 +1601,7 @@ export default { 'componentRepository.categories.group': 'Gruppo', 'componentRepository.components.installedVersion': 'Versione installata', 'componentRepository.components.genericError': 'Si è verificato un errore nell\'applicazione', + 'page.invalidChildPositionError': 'Una pagina appartenente ad un gruppo non può essere posizionata figlia della root', 'page.invalidPositionError': 'Una pagina può essere figlia solo di un\'altra pagina con lo stesso owner group o con owner group free access', 'app.installFailed': 'Si è verificato un errore e non è stato possibile installare il Bundle', 'app.uninstallFailed': 'Si è verificato un errore e non è stato possibile disinstallare il Bundle', diff --git a/src/locales/pt.js b/src/locales/pt.js index 65992fff9..a54541dff 100644 --- a/src/locales/pt.js +++ b/src/locales/pt.js @@ -1021,6 +1021,7 @@ export default { 'componentRepository.categories.group': 'Grupo', 'componentRepository.components.installedVersion': 'Versão Instalada', 'componentRepository.components.genericError': 'Ocorreu um erro no aplicativo', + 'page.invalidChildPositionError': 'Uma página que pertence a um grupo não pode se tornar um filho direto da raiz atual', 'page.invalidPositionError': 'Uma página só pode ser filha direta de uma página com o mesmo grupo de proprietários ou free access', 'app.installFailed': 'Ocorreu um erro e o pacote não pôde ser instalado', 'app.uninstallFailed': 'Ocorreu um erro e o pacote não pôde ser desinstalado', diff --git a/src/state/pages/actions.js b/src/state/pages/actions.js index 3d70286ae..aa8068161 100644 --- a/src/state/pages/actions.js +++ b/src/state/pages/actions.js @@ -37,6 +37,9 @@ import { getAppTourProgress } from 'state/app-tour/selectors'; const INVALID_PAGE_POSITION_ERROR = { id: 'page.invalidPositionError' }; const INVALID_PAGE_POSITION_STATUS_CODE = 422; +const INVALID_PAGE_CHILD_POSITION_ERROR = { id: 'page.invalidChildPositionError' }; +const INVALID_PAGE_CHILD_POSITION_STATUS_CODE = 400; + const RESET_FOR_CLONE = { code: '', titles: '', @@ -237,11 +240,7 @@ export const fetchPageTree = pageCode => async (dispatch) => { return response.payload; }; -/** - * will call: - * http://confluence.entando.org/display/E5/Page+Tree - * /pages - */ + export const handleExpandPage = (pageCode = HOMEPAGE_CODE, alwaysExpand) => ( (dispatch, getState) => { const state = getState(); @@ -286,6 +285,8 @@ export const setPageParent = (pageCode, newParentCode) => (dispatch, getState) = dispatch(setPageParentSync(pageCode, oldParentCode, newParentCode)); } else if (response && response.status === INVALID_PAGE_POSITION_STATUS_CODE) { dispatch(addToast(INVALID_PAGE_POSITION_ERROR, TOAST_ERROR)); + } else if (response && response.status === INVALID_PAGE_CHILD_POSITION_STATUS_CODE) { + dispatch(addToast(INVALID_PAGE_CHILD_POSITION_ERROR, TOAST_ERROR)); } else { response.json().then((json) => { json.errors.forEach(err => dispatch(addToast(err.message, TOAST_ERROR)));