mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: layout access validation and switch in plane deploy issues route (#2351)
* chore: handled route validation and layout access validation in plane deploy issues * chore: impoved validation condition
This commit is contained in:
parent
7a3b556ae0
commit
05920a72a5
@ -44,19 +44,43 @@ const IssueNavbar = observer(() => {
|
|||||||
}, [projectStore, workspace_slug, project_slug]);
|
}, [projectStore, workspace_slug, project_slug]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (workspace_slug && project_slug) {
|
if (workspace_slug && project_slug && projectStore?.deploySettings) {
|
||||||
if (!board) {
|
const viewsAcceptable: string[] = [];
|
||||||
router.push({
|
let currentBoard: string | null = null;
|
||||||
pathname: `/${workspace_slug}/${project_slug}`,
|
|
||||||
query: {
|
if (projectStore?.deploySettings?.views?.list) viewsAcceptable.push("list");
|
||||||
board: "list",
|
if (projectStore?.deploySettings?.views?.kanban) viewsAcceptable.push("kanban");
|
||||||
},
|
if (projectStore?.deploySettings?.views?.calendar) viewsAcceptable.push("calendar");
|
||||||
});
|
if (projectStore?.deploySettings?.views?.gantt) viewsAcceptable.push("gantt");
|
||||||
return projectStore.setActiveBoard("list");
|
if (projectStore?.deploySettings?.views?.spreadsheet) viewsAcceptable.push("spreadsheet");
|
||||||
|
|
||||||
|
if (board) {
|
||||||
|
if (viewsAcceptable.includes(board.toString())) {
|
||||||
|
currentBoard = board.toString();
|
||||||
|
} else {
|
||||||
|
if (viewsAcceptable && viewsAcceptable.length > 0) {
|
||||||
|
currentBoard = viewsAcceptable[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (viewsAcceptable && viewsAcceptable.length > 0) {
|
||||||
|
currentBoard = viewsAcceptable[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentBoard) {
|
||||||
|
if (projectStore?.activeBoard === null || projectStore?.activeBoard !== currentBoard) {
|
||||||
|
projectStore.setActiveBoard(currentBoard);
|
||||||
|
router.push({
|
||||||
|
pathname: `/${workspace_slug}/${project_slug}`,
|
||||||
|
query: {
|
||||||
|
board: currentBoard,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
projectStore.setActiveBoard(board.toString());
|
|
||||||
}
|
}
|
||||||
}, [board, workspace_slug, project_slug]);
|
}, [board, workspace_slug, project_slug, router, projectStore, projectStore?.deploySettings]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="px-5 relative w-full flex items-center gap-4">
|
<div className="px-5 relative w-full flex items-center gap-4">
|
||||||
|
Loading…
Reference in New Issue
Block a user