mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
fixed page actions: updatePageHandle
This commit is contained in:
parent
8ed4be5262
commit
3ba9b0d2f4
1 changed files with 29 additions and 1 deletions
|
|
@ -1319,6 +1319,34 @@ const EditorComponent = (props) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updatePageHandle = (pageId, newHandle) => {
|
||||||
|
const copyOfAppDefinition = JSON.parse(JSON.stringify(appDefinition));
|
||||||
|
|
||||||
|
updateEditorState({
|
||||||
|
isSaving: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const pageExists = Object.values(copyOfAppDefinition.pages).some((page) => page.handle === newHandle);
|
||||||
|
|
||||||
|
if (pageExists) {
|
||||||
|
toast.error('Page with same handle already exists');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newHandle.trim().length === 0) {
|
||||||
|
toast.error('Page handle cannot be empty');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newDefinition = _.cloneDeep(copyOfAppDefinition);
|
||||||
|
|
||||||
|
newDefinition.pages[pageId].handle = newHandle;
|
||||||
|
|
||||||
|
appDefinitionChanged(newDefinition, {
|
||||||
|
pageDefinitionChanged: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// !-------
|
// !-------
|
||||||
|
|
||||||
const currentState = props?.currentState;
|
const currentState = props?.currentState;
|
||||||
|
|
@ -1406,7 +1434,7 @@ const EditorComponent = (props) => {
|
||||||
hidePage={hidePage}
|
hidePage={hidePage}
|
||||||
unHidePage={unHidePage}
|
unHidePage={unHidePage}
|
||||||
updateHomePage={updateHomePage}
|
updateHomePage={updateHomePage}
|
||||||
// updatePageHandle={updatePageHandle}
|
updatePageHandle={updatePageHandle}
|
||||||
// updateOnPageLoadEvents={updateOnPageLoadEvents}
|
// updateOnPageLoadEvents={updateOnPageLoadEvents}
|
||||||
// showHideViewerNavigationControls={showHideViewerNavigation}
|
// showHideViewerNavigationControls={showHideViewerNavigation}
|
||||||
// updateOnSortingPages={updateOnSortingPages}
|
// updateOnSortingPages={updateOnSortingPages}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue