mirror of
https://github.com/makeplane/plane
synced 2025-08-07 19:59:33 +00:00
refactor: page actions (#6327)
This commit is contained in:
committed by
GitHub
parent
6321977f1f
commit
d3d3bf79f9
@@ -2,6 +2,7 @@ export * from "./ai";
|
||||
export * from "./estimates";
|
||||
export * from "./gantt-chart";
|
||||
export * from "./issues";
|
||||
export * from "./page";
|
||||
export * from "./project";
|
||||
export * from "./user-permissions";
|
||||
export * from "./workspace";
|
||||
|
||||
1
web/ce/constants/page.ts
Normal file
1
web/ce/constants/page.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const ENABLE_MOVE_PAGE = false;
|
||||
@@ -28,6 +28,8 @@ import { cn } from "@/helpers/common.helper";
|
||||
import { usePageOperations } from "@/hooks/use-page-operations";
|
||||
// plane web components
|
||||
import { MovePageModal } from "@/plane-web/components/pages";
|
||||
// plane web constants
|
||||
import { ENABLE_MOVE_PAGE } from "@/plane-web/constants";
|
||||
// store types
|
||||
import { TPageInstance } from "@/store/pages/base-page";
|
||||
|
||||
@@ -132,7 +134,7 @@ export const PageActions: React.FC<Props> = observer((props) => {
|
||||
action: () => setMovePageModal(true),
|
||||
title: "Move",
|
||||
icon: FileOutput,
|
||||
shouldRender: canCurrentUserMovePage,
|
||||
shouldRender: canCurrentUserMovePage && ENABLE_MOVE_PAGE,
|
||||
},
|
||||
];
|
||||
if (extraOptions) {
|
||||
|
||||
@@ -104,6 +104,7 @@ export const PageOptionsDropdown: React.FC<Props> = observer((props) => {
|
||||
"full-screen",
|
||||
"copy-link",
|
||||
"make-a-copy",
|
||||
"move",
|
||||
"toggle-lock",
|
||||
"toggle-access",
|
||||
"archive-restore",
|
||||
|
||||
@@ -171,4 +171,14 @@ export class ProjectPageService extends APIService {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async move(workspaceSlug: string, projectId: string, pageId: string, newProjectId: string): Promise<void> {
|
||||
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/move/`, {
|
||||
new_project_id: newProjectId,
|
||||
})
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,5 +306,15 @@ export class ProjectPageStore implements IProjectPageStore {
|
||||
* @param {string} pageId
|
||||
* @param {string} newProjectId
|
||||
*/
|
||||
movePage = async (workspaceSlug: string, projectId: string, pageId: string, newProjectId: string) => {};
|
||||
movePage = async (workspaceSlug: string, projectId: string, pageId: string, newProjectId: string) => {
|
||||
try {
|
||||
await this.service.move(workspaceSlug, projectId, pageId, newProjectId);
|
||||
runInAction(() => {
|
||||
unset(this.data, [pageId]);
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Unable to move page", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
1
web/ee/constants/page.ts
Normal file
1
web/ee/constants/page.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "ce/constants/page";
|
||||
Reference in New Issue
Block a user