Skip to content

Commit

Permalink
feat: support dataset changeOwner (#3483)
Browse files Browse the repository at this point in the history
* feat: support dataset changeOwner

* chore: update dataset change owner api
  • Loading branch information
FinleyGe authored Dec 31, 2024
1 parent 3d8b556 commit 92090fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion projects/app/src/pages/dataset/list/component/List.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useMemo, useRef, useState } from 'react';
import { resumeInheritPer } from '@/web/core/dataset/api';
import { changeOwner, resumeInheritPer } from '@/web/core/dataset/api';
import { Box, Flex, Grid, HStack } from '@chakra-ui/react';
import { DatasetTypeEnum, DatasetTypeMap } from '@fastgpt/global/core/dataset/constants';
import MyMenu from '@fastgpt/web/components/common/MyMenu';
Expand Down Expand Up @@ -422,6 +422,12 @@ function List() {

{!!editPerDataset && (
<ConfigPerModal
onChangeOwner={(tmbId: string) =>
changeOwner({
datasetId: editPerDataset._id,
ownerId: tmbId
}).then(() => loadMyDatasets())
}
hasParent={!!parentId}
refetchResource={loadMyDatasets}
isInheritPermission={editPerDataset.inheritPermission}
Expand Down
4 changes: 4 additions & 0 deletions projects/app/src/web/core/dataset/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import type {
listExistIdResponse
} from '@/pages/api/core/dataset/apiDataset/listExistId';
import { FeishuServer, YuqueServer } from '@fastgpt/global/core/dataset/apiDataset';
import { RequireOnlyOne } from '@fastgpt/global/common/type/utils';

/* ======================== dataset ======================= */
export const getDatasets = (data: GetDatasetListBody) =>
Expand Down Expand Up @@ -100,6 +101,9 @@ export const postCreateDatasetFolder = (data: DatasetFolderCreateBody) =>
export const resumeInheritPer = (datasetId: string) =>
GET(`/core/dataset/resumeInheritPermission`, { datasetId });

export const changeOwner = (data: { ownerId: string; datasetId: string }) =>
POST(`/proApi/core/dataset/changeOwner`, data);

/* =========== search test ============ */
export const postSearchText = (data: SearchTestProps) =>
POST<SearchTestResponse>(`/core/dataset/searchTest`, data);
Expand Down

0 comments on commit 92090fb

Please sign in to comment.