[WEB-1559] chore: updated pages response (#4821)

* dev: fix pages responses

* chore: updated pages response

* fix: search endpoint

* fix: pages delete endpoint

* fix: command k pages response

---------

Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
This commit is contained in:
Aaryan Khandelwal 2024-06-17 13:56:41 +05:30 committed by GitHub
parent 1028ec8735
commit aba2af9a7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 212 additions and 116 deletions

View file

@ -5,6 +5,7 @@ import { Briefcase, FileText, LayoutGrid } from "lucide-react";
import {
IWorkspaceDefaultSearchResult,
IWorkspaceIssueSearchResult,
IWorkspacePageSearchResult,
IWorkspaceProjectSearchResult,
IWorkspaceSearchResult,
} from "@plane/types";
@ -67,9 +68,9 @@ export const commandGroups: {
},
page: {
icon: <FileText className="h-3 w-3" />,
itemName: (page: IWorkspaceDefaultSearchResult) => (
itemName: (page: IWorkspacePageSearchResult) => (
<h6>
<span className="text-xs text-custom-text-300">{page.project__identifier}</span> {page.name}
<span className="text-xs text-custom-text-300">{page.project__identifiers?.[0]}</span> {page.name}
</h6>
),
path: (page: IWorkspaceDefaultSearchResult) =>

View file

@ -53,14 +53,14 @@ export class Page implements IPage {
logo_props: TLogoProps | undefined;
description_html: string | undefined;
color: string | undefined;
labels: string[] | undefined;
label_ids: string[] | undefined;
owned_by: string | undefined;
access: EPageAccess | undefined;
is_favorite: boolean;
is_locked: boolean;
archived_at: string | null | undefined;
workspace: string | undefined;
project: string | undefined;
project_ids: string[] | undefined;
created_by: string | undefined;
updated_by: string | undefined;
created_at: Date | undefined;
@ -81,14 +81,14 @@ export class Page implements IPage {
this.logo_props = page?.logo_props || undefined;
this.description_html = page?.description_html || undefined;
this.color = page?.color || undefined;
this.labels = page?.labels || undefined;
this.label_ids = page?.label_ids || undefined;
this.owned_by = page?.owned_by || undefined;
this.access = page?.access || EPageAccess.PUBLIC;
this.is_favorite = page?.is_favorite || false;
this.is_locked = page?.is_locked || false;
this.archived_at = page?.archived_at || undefined;
this.workspace = page?.workspace || undefined;
this.project = page?.project || undefined;
this.project_ids = page?.project_ids || undefined;
this.created_by = page?.created_by || undefined;
this.updated_by = page?.updated_by || undefined;
this.created_at = page?.created_at || undefined;
@ -104,14 +104,14 @@ export class Page implements IPage {
logo_props: observable.ref,
description_html: observable.ref,
color: observable.ref,
labels: observable,
label_ids: observable,
owned_by: observable.ref,
access: observable.ref,
is_favorite: observable.ref,
is_locked: observable.ref,
archived_at: observable.ref,
workspace: observable.ref,
project: observable.ref,
project_ids: observable,
created_by: observable.ref,
updated_by: observable.ref,
created_at: observable.ref,
@ -181,7 +181,7 @@ export class Page implements IPage {
name: this.name,
description_html: this.description_html,
color: this.color,
labels: this.labels,
label_ids: this.label_ids,
owned_by: this.owned_by,
access: this.access,
logo_props: this.logo_props,
@ -189,7 +189,7 @@ export class Page implements IPage {
is_locked: this.is_locked,
archived_at: this.archived_at,
workspace: this.workspace,
project: this.project,
project_ids: this.project_ids,
created_by: this.created_by,
updated_by: this.updated_by,
created_at: this.created_at,

View file

@ -95,7 +95,7 @@ export class ProjectPageStore implements IProjectPageStore {
if (!projectId) return undefined;
// helps to filter pages based on the pageType
let pagesByType = filterPagesByPageType(pageType, Object.values(this?.data || {}));
pagesByType = pagesByType.filter((p) => p.project === projectId);
pagesByType = pagesByType.filter((p) => p.project_ids?.includes(projectId));
const pages = (pagesByType.map((page) => page.id) as string[]) || undefined;
@ -114,7 +114,7 @@ export class ProjectPageStore implements IProjectPageStore {
const pagesByType = filterPagesByPageType(pageType, Object.values(this?.data || {}));
let filteredPages = pagesByType.filter(
(p) =>
p.project === projectId &&
p.project_ids?.includes(projectId) &&
getPageName(p.name).toLowerCase().includes(this.filters.searchQuery.toLowerCase()) &&
shouldFilterPage(p, this.filters.filters)
);