Yuki Takei 4 luni în urmă
părinte
comite
cdfbe4036f

+ 1 - 0
apps/app/src/client/components/ItemsTree/hooks/use-data-loader.ts

@@ -10,6 +10,7 @@ function constructRootPageForVirtualRoot(rootPageId: string, allPagesCount: numb
   return {
   return {
     _id: rootPageId,
     _id: rootPageId,
     path: '/',
     path: '/',
+    parent: null,
     descendantCount: allPagesCount,
     descendantCount: allPagesCount,
     grant: 1,
     grant: 1,
     isEmpty: false,
     isEmpty: false,

+ 4 - 4
apps/app/src/client/components/TreeItem/interfaces/index.ts

@@ -1,10 +1,10 @@
 import type { IPageToDeleteWithMeta } from '@growi/core';
 import type { IPageToDeleteWithMeta } from '@growi/core';
 
 
-import type { IPageForItem } from '~/interfaces/page';
+import type { IPageForTreeItem } from '~/interfaces/page';
 import type { IPageForPageDuplicateModal } from '~/states/ui/modal/page-duplicate';
 import type { IPageForPageDuplicateModal } from '~/states/ui/modal/page-duplicate';
 
 
 type TreeItemBaseProps = {
 type TreeItemBaseProps = {
-  item: IPageForItem,
+  item: IPageForTreeItem,
   itemLevel: number,
   itemLevel: number,
   isEnableActions: boolean,
   isEnableActions: boolean,
   isReadOnlyUser: boolean,
   isReadOnlyUser: boolean,
@@ -31,6 +31,6 @@ export type TreeItemProps = TreeItemBaseProps & {
   showAlternativeContent?: boolean,
   showAlternativeContent?: boolean,
   customAlternativeComponents?: Array<React.FunctionComponent<TreeItemToolProps>>,
   customAlternativeComponents?: Array<React.FunctionComponent<TreeItemToolProps>>,
   onToggle: () => void;
   onToggle: () => void;
-  onClick?(page: IPageForItem): void,
-  onWheelClick?(page: IPageForItem): void,
+  onClick?(page: IPageForTreeItem): void,
+  onWheelClick?(page: IPageForTreeItem): void,
 };
 };

+ 1 - 1
apps/app/src/interfaces/page.ts

@@ -23,7 +23,7 @@ export type IPageForItem = Partial<
 
 
 export type IPageForTreeItem = Pick<
 export type IPageForTreeItem = Pick<
   IPageHasId,
   IPageHasId,
-  '_id' | 'path' | 'descendantCount' | 'grant' | 'isEmpty' | 'wip'
+  '_id' | 'path' | 'parent' | 'descendantCount' | 'grant' | 'isEmpty' | 'wip'
 > & {
 > & {
   processData?: IPageOperationProcessData;
   processData?: IPageOperationProcessData;
 };
 };

+ 1 - 0
apps/app/src/server/routes/apiv3/page-listing.ts

@@ -206,6 +206,7 @@ const routerFactory = (crowi: Crowi): Router => {
         const item: IPageForTreeItem = {
         const item: IPageForTreeItem = {
           _id: page._id.toString(),
           _id: page._id.toString(),
           path: page.path,
           path: page.path,
+          parent: page.parent,
           descendantCount: page.descendantCount,
           descendantCount: page.descendantCount,
           grant: page.grant,
           grant: page.grant,
           isEmpty: page.isEmpty,
           isEmpty: page.isEmpty,