forked from github/plane
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
|
||||
? () =>
|
||||
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
||||
cycle_view: "all",
|
||||
})
|
||||
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), "all")
|
||||
: null
|
||||
);
|
||||
|
||||
|
@ -21,9 +21,11 @@ export const CompletedCyclesList: React.FC<Props> = ({ viewType }) => {
|
||||
workspaceSlug && projectId ? COMPLETED_CYCLES_LIST(projectId.toString()) : null,
|
||||
workspaceSlug && projectId
|
||||
? () =>
|
||||
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
||||
cycle_view: "completed",
|
||||
})
|
||||
cyclesService.getCyclesWithParams(
|
||||
workspaceSlug.toString(),
|
||||
projectId.toString(),
|
||||
"completed"
|
||||
)
|
||||
: null
|
||||
);
|
||||
|
||||
|
@ -21,9 +21,7 @@ export const DraftCyclesList: React.FC<Props> = ({ viewType }) => {
|
||||
workspaceSlug && projectId ? DRAFT_CYCLES_LIST(projectId.toString()) : null,
|
||||
workspaceSlug && projectId
|
||||
? () =>
|
||||
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
||||
cycle_view: "draft",
|
||||
})
|
||||
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), "draft")
|
||||
: null
|
||||
);
|
||||
|
||||
|
@ -21,9 +21,11 @@ export const UpcomingCyclesList: React.FC<Props> = ({ viewType }) => {
|
||||
workspaceSlug && projectId ? UPCOMING_CYCLES_LIST(projectId.toString()) : null,
|
||||
workspaceSlug && projectId
|
||||
? () =>
|
||||
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
||||
cycle_view: "upcoming",
|
||||
})
|
||||
cyclesService.getCyclesWithParams(
|
||||
workspaceSlug.toString(),
|
||||
projectId.toString(),
|
||||
"upcoming"
|
||||
)
|
||||
: null
|
||||
);
|
||||
|
||||
|
@ -38,10 +38,7 @@ export const CycleSelect: React.FC<IssueCycleSelectProps> = ({
|
||||
const { data: cycles } = useSWR(
|
||||
workspaceSlug && projectId ? CYCLES_LIST(projectId) : null,
|
||||
workspaceSlug && projectId
|
||||
? () =>
|
||||
cycleServices.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
||||
cycle_view: "all",
|
||||
})
|
||||
? () => cycleServices.getCyclesWithParams(workspaceSlug as string, projectId as string, "all")
|
||||
: null
|
||||
);
|
||||
|
||||
|
@ -60,9 +60,11 @@ export const TransferIssuesModal: React.FC<Props> = ({ isOpen, handleClose }) =>
|
||||
workspaceSlug && projectId ? INCOMPLETE_CYCLES_LIST(projectId as string) : null,
|
||||
workspaceSlug && projectId
|
||||
? () =>
|
||||
cyclesService.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
||||
cycle_view: "incomplete",
|
||||
})
|
||||
cyclesService.getCyclesWithParams(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
"incomplete"
|
||||
)
|
||||
: null
|
||||
);
|
||||
|
||||
|
@ -36,9 +36,11 @@ export const SidebarCycleSelect: React.FC<Props> = ({
|
||||
workspaceSlug && projectId ? INCOMPLETE_CYCLES_LIST(projectId as string) : null,
|
||||
workspaceSlug && projectId
|
||||
? () =>
|
||||
cyclesService.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
||||
cycle_view: "incomplete",
|
||||
})
|
||||
cyclesService.getCyclesWithParams(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
"incomplete"
|
||||
)
|
||||
: null
|
||||
);
|
||||
|
||||
|
@ -18,10 +18,7 @@ export const AllPagesList: React.FC<TPagesListProps> = ({ viewType }) => {
|
||||
const { data: pages } = useSWR(
|
||||
workspaceSlug && projectId ? ALL_PAGES_LIST(projectId as string) : null,
|
||||
workspaceSlug && projectId
|
||||
? () =>
|
||||
pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, {
|
||||
page_view: "all",
|
||||
})
|
||||
? () => pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, "all")
|
||||
: null
|
||||
);
|
||||
|
||||
|
@ -19,9 +19,7 @@ export const FavoritePagesList: React.FC<TPagesListProps> = ({ viewType }) => {
|
||||
workspaceSlug && projectId ? FAVORITE_PAGES_LIST(projectId as string) : null,
|
||||
workspaceSlug && projectId
|
||||
? () =>
|
||||
pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, {
|
||||
page_view: "favorite",
|
||||
})
|
||||
pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, "favorite")
|
||||
: null
|
||||
);
|
||||
|
||||
|
@ -19,9 +19,11 @@ export const MyPagesList: React.FC<TPagesListProps> = ({ viewType }) => {
|
||||
workspaceSlug && projectId ? MY_PAGES_LIST(projectId as string) : null,
|
||||
workspaceSlug && projectId
|
||||
? () =>
|
||||
pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, {
|
||||
page_view: "created_by_me",
|
||||
})
|
||||
pagesService.getPagesWithParams(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
"created_by_me"
|
||||
)
|
||||
: null
|
||||
);
|
||||
|
||||
|
@ -19,9 +19,11 @@ export const OtherPagesList: React.FC<TPagesListProps> = ({ viewType }) => {
|
||||
workspaceSlug && projectId ? OTHER_PAGES_LIST(projectId as string) : null,
|
||||
workspaceSlug && projectId
|
||||
? () =>
|
||||
pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, {
|
||||
page_view: "created_by_other",
|
||||
})
|
||||
pagesService.getPagesWithParams(
|
||||
workspaceSlug as string,
|
||||
projectId as string,
|
||||
"created_by_other"
|
||||
)
|
||||
: null
|
||||
);
|
||||
|
||||
|
@ -41,10 +41,12 @@ const WorkspacePage: NextPage = () => {
|
||||
|
||||
return (
|
||||
<WorkspaceAuthorizationLayout noHeader>
|
||||
<ProductUpdatesModal
|
||||
isOpen={isProductUpdatesModalOpen}
|
||||
setIsOpen={setIsProductUpdatesModalOpen}
|
||||
/>
|
||||
{isProductUpdatesModalOpen && (
|
||||
<ProductUpdatesModal
|
||||
isOpen={isProductUpdatesModalOpen}
|
||||
setIsOpen={setIsProductUpdatesModalOpen}
|
||||
/>
|
||||
)}
|
||||
<div className="p-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">
|
||||
|
@ -56,10 +56,7 @@ const SingleCycle: React.FC = () => {
|
||||
const { data: cycles } = useSWR(
|
||||
workspaceSlug && projectId ? CYCLES_LIST(projectId as string) : null,
|
||||
workspaceSlug && projectId
|
||||
? () =>
|
||||
cycleServices.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
||||
cycle_view: "all",
|
||||
})
|
||||
? () => cycleServices.getCyclesWithParams(workspaceSlug as string, projectId as string, "all")
|
||||
: null
|
||||
);
|
||||
|
||||
|
@ -73,9 +73,7 @@ const ProjectCycles: NextPage = () => {
|
||||
workspaceSlug && projectId ? CURRENT_CYCLE_LIST(projectId as string) : null,
|
||||
workspaceSlug && projectId
|
||||
? () =>
|
||||
cycleService.getCyclesWithParams(workspaceSlug as string, projectId as string, {
|
||||
cycle_view: "current",
|
||||
})
|
||||
cycleService.getCyclesWithParams(workspaceSlug as string, projectId as string, "current")
|
||||
: null
|
||||
);
|
||||
|
||||
|
@ -29,10 +29,12 @@ class ProjectCycleServices extends APIService {
|
||||
async getCyclesWithParams(
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
queries: any
|
||||
cycleType: "all" | "current" | "upcoming" | "draft" | "completed" | "incomplete"
|
||||
): Promise<ICycle[]> {
|
||||
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/`, {
|
||||
params: queries,
|
||||
params: {
|
||||
cycle_view: cycleType,
|
||||
},
|
||||
})
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
|
@ -86,10 +86,12 @@ class PageServices extends APIService {
|
||||
async getPagesWithParams(
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
queries: any
|
||||
pageType: "all" | "favorite" | "created_by_me" | "created_by_other"
|
||||
): Promise<IPage[]> {
|
||||
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/`, {
|
||||
params: queries,
|
||||
params: {
|
||||
page_view: pageType,
|
||||
},
|
||||
})
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
|
Loading…
Reference in New Issue
Block a user