mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: page and cycle refactor (#1159)
* fix: release note modal fix * chore: cycle and page endpoint refactor
This commit is contained in:
parent
26ba4d71c3
commit
c8caa925b1
@ -21,9 +21,7 @@ export const AllCyclesList: React.FC<Props> = ({ viewType }) => {
|
|||||||
workspaceSlug && projectId ? CYCLES_LIST(projectId.toString()) : null,
|
workspaceSlug && projectId ? CYCLES_LIST(projectId.toString()) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), "all")
|
||||||
cycle_view: "all",
|
|
||||||
})
|
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -21,9 +21,11 @@ export const CompletedCyclesList: React.FC<Props> = ({ viewType }) => {
|
|||||||
workspaceSlug && projectId ? COMPLETED_CYCLES_LIST(projectId.toString()) : null,
|
workspaceSlug && projectId ? COMPLETED_CYCLES_LIST(projectId.toString()) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
cyclesService.getCyclesWithParams(
|
||||||
cycle_view: "completed",
|
workspaceSlug.toString(),
|
||||||
})
|
projectId.toString(),
|
||||||
|
"completed"
|
||||||
|
)
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -21,9 +21,7 @@ export const DraftCyclesList: React.FC<Props> = ({ viewType }) => {
|
|||||||
workspaceSlug && projectId ? DRAFT_CYCLES_LIST(projectId.toString()) : null,
|
workspaceSlug && projectId ? DRAFT_CYCLES_LIST(projectId.toString()) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), "draft")
|
||||||
cycle_view: "draft",
|
|
||||||
})
|
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -21,9 +21,11 @@ export const UpcomingCyclesList: React.FC<Props> = ({ viewType }) => {
|
|||||||
workspaceSlug && projectId ? UPCOMING_CYCLES_LIST(projectId.toString()) : null,
|
workspaceSlug && projectId ? UPCOMING_CYCLES_LIST(projectId.toString()) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
cyclesService.getCyclesWithParams(
|
||||||
cycle_view: "upcoming",
|
workspaceSlug.toString(),
|
||||||
})
|
projectId.toString(),
|
||||||
|
"upcoming"
|
||||||
|
)
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -38,10 +38,7 @@ export const CycleSelect: React.FC<IssueCycleSelectProps> = ({
|
|||||||
const { data: cycles } = useSWR(
|
const { data: cycles } = useSWR(
|
||||||
workspaceSlug && projectId ? CYCLES_LIST(projectId) : null,
|
workspaceSlug && projectId ? CYCLES_LIST(projectId) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () => cycleServices.getCyclesWithParams(workspaceSlug as string, projectId as string, "all")
|
||||||
cycleServices.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
|
||||||
cycle_view: "all",
|
|
||||||
})
|
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -60,9 +60,11 @@ export const TransferIssuesModal: React.FC<Props> = ({ isOpen, handleClose }) =>
|
|||||||
workspaceSlug && projectId ? INCOMPLETE_CYCLES_LIST(projectId as string) : null,
|
workspaceSlug && projectId ? INCOMPLETE_CYCLES_LIST(projectId as string) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cyclesService.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
cyclesService.getCyclesWithParams(
|
||||||
cycle_view: "incomplete",
|
workspaceSlug as string,
|
||||||
})
|
projectId as string,
|
||||||
|
"incomplete"
|
||||||
|
)
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -36,9 +36,11 @@ export const SidebarCycleSelect: React.FC<Props> = ({
|
|||||||
workspaceSlug && projectId ? INCOMPLETE_CYCLES_LIST(projectId as string) : null,
|
workspaceSlug && projectId ? INCOMPLETE_CYCLES_LIST(projectId as string) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cyclesService.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
cyclesService.getCyclesWithParams(
|
||||||
cycle_view: "incomplete",
|
workspaceSlug as string,
|
||||||
})
|
projectId as string,
|
||||||
|
"incomplete"
|
||||||
|
)
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -18,10 +18,7 @@ export const AllPagesList: React.FC<TPagesListProps> = ({ viewType }) => {
|
|||||||
const { data: pages } = useSWR(
|
const { data: pages } = useSWR(
|
||||||
workspaceSlug && projectId ? ALL_PAGES_LIST(projectId as string) : null,
|
workspaceSlug && projectId ? ALL_PAGES_LIST(projectId as string) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () => pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, "all")
|
||||||
pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, {
|
|
||||||
page_view: "all",
|
|
||||||
})
|
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -19,9 +19,7 @@ export const FavoritePagesList: React.FC<TPagesListProps> = ({ viewType }) => {
|
|||||||
workspaceSlug && projectId ? FAVORITE_PAGES_LIST(projectId as string) : null,
|
workspaceSlug && projectId ? FAVORITE_PAGES_LIST(projectId as string) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, {
|
pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, "favorite")
|
||||||
page_view: "favorite",
|
|
||||||
})
|
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -19,9 +19,11 @@ export const MyPagesList: React.FC<TPagesListProps> = ({ viewType }) => {
|
|||||||
workspaceSlug && projectId ? MY_PAGES_LIST(projectId as string) : null,
|
workspaceSlug && projectId ? MY_PAGES_LIST(projectId as string) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, {
|
pagesService.getPagesWithParams(
|
||||||
page_view: "created_by_me",
|
workspaceSlug as string,
|
||||||
})
|
projectId as string,
|
||||||
|
"created_by_me"
|
||||||
|
)
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -19,9 +19,11 @@ export const OtherPagesList: React.FC<TPagesListProps> = ({ viewType }) => {
|
|||||||
workspaceSlug && projectId ? OTHER_PAGES_LIST(projectId as string) : null,
|
workspaceSlug && projectId ? OTHER_PAGES_LIST(projectId as string) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, {
|
pagesService.getPagesWithParams(
|
||||||
page_view: "created_by_other",
|
workspaceSlug as string,
|
||||||
})
|
projectId as string,
|
||||||
|
"created_by_other"
|
||||||
|
)
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -41,10 +41,12 @@ const WorkspacePage: NextPage = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<WorkspaceAuthorizationLayout noHeader>
|
<WorkspaceAuthorizationLayout noHeader>
|
||||||
<ProductUpdatesModal
|
{isProductUpdatesModalOpen && (
|
||||||
isOpen={isProductUpdatesModalOpen}
|
<ProductUpdatesModal
|
||||||
setIsOpen={setIsProductUpdatesModalOpen}
|
isOpen={isProductUpdatesModalOpen}
|
||||||
/>
|
setIsOpen={setIsProductUpdatesModalOpen}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<div className="p-8">
|
<div className="p-8">
|
||||||
<div className="flex flex-col gap-8">
|
<div className="flex flex-col gap-8">
|
||||||
<div className="text-brand-muted-1 flex flex-col justify-between gap-x-2 gap-y-6 rounded-lg border border-brand-base bg-brand-base px-8 py-6 md:flex-row md:items-center md:py-3">
|
<div className="text-brand-muted-1 flex flex-col justify-between gap-x-2 gap-y-6 rounded-lg border border-brand-base bg-brand-base px-8 py-6 md:flex-row md:items-center md:py-3">
|
||||||
|
@ -56,10 +56,7 @@ const SingleCycle: React.FC = () => {
|
|||||||
const { data: cycles } = useSWR(
|
const { data: cycles } = useSWR(
|
||||||
workspaceSlug && projectId ? CYCLES_LIST(projectId as string) : null,
|
workspaceSlug && projectId ? CYCLES_LIST(projectId as string) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () => cycleServices.getCyclesWithParams(workspaceSlug as string, projectId as string, "all")
|
||||||
cycleServices.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
|
||||||
cycle_view: "all",
|
|
||||||
})
|
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -73,9 +73,7 @@ const ProjectCycles: NextPage = () => {
|
|||||||
workspaceSlug && projectId ? CURRENT_CYCLE_LIST(projectId as string) : null,
|
workspaceSlug && projectId ? CURRENT_CYCLE_LIST(projectId as string) : null,
|
||||||
workspaceSlug && projectId
|
workspaceSlug && projectId
|
||||||
? () =>
|
? () =>
|
||||||
cycleService.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
cycleService.getCyclesWithParams(workspaceSlug as string, projectId as string, "current")
|
||||||
cycle_view: "current",
|
|
||||||
})
|
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -29,10 +29,12 @@ class ProjectCycleServices extends APIService {
|
|||||||
async getCyclesWithParams(
|
async getCyclesWithParams(
|
||||||
workspaceSlug: string,
|
workspaceSlug: string,
|
||||||
projectId: string,
|
projectId: string,
|
||||||
queries: any
|
cycleType: "all" | "current" | "upcoming" | "draft" | "completed" | "incomplete"
|
||||||
): Promise<ICycle[]> {
|
): Promise<ICycle[]> {
|
||||||
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/`, {
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/`, {
|
||||||
params: queries,
|
params: {
|
||||||
|
cycle_view: cycleType,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
@ -86,10 +86,12 @@ class PageServices extends APIService {
|
|||||||
async getPagesWithParams(
|
async getPagesWithParams(
|
||||||
workspaceSlug: string,
|
workspaceSlug: string,
|
||||||
projectId: string,
|
projectId: string,
|
||||||
queries: any
|
pageType: "all" | "favorite" | "created_by_me" | "created_by_other"
|
||||||
): Promise<IPage[]> {
|
): Promise<IPage[]> {
|
||||||
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/`, {
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/`, {
|
||||||
params: queries,
|
params: {
|
||||||
|
page_view: pageType,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user