mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-02 12:48:30 +00:00
4.8.6 merge (#1943)
* Dataset collection forbid (#1885) * perf: tool call support same id * feat: collection forbid * feat: collection forbid * Inheritance Permission for apps (#1897) * feat: app schema define chore: references of authapp * feat: authApp method inheritance * feat: create and update api * feat: update * feat: inheritance Permission controller for app. * feat: abstract version of inheritPermission * feat: ancestorId for apps * chore: update app * fix: inheritPermission abstract version * feat: update folder defaultPermission * feat: app update api * chore: inheritance frontend * chore: app list api * feat: update defaultPermission in app deatil * feat: backend api finished * feat: app inheritance permission fe * fix: app update defaultpermission causes collaborator miss * fix: ts error * chore: adjust the codes * chore: i18n chore: i18n * chore: fe adjust and i18n * chore: adjust the code * feat: resume api; chore: rewrite update api and inheritPermission methods * chore: something * chore: fe code adjusting * feat: frontend adjusting * chore: fe code adjusting * chore: adjusting the code * perf: fe loading * format * Inheritance fix (#1908) * fix: SlideCard * fix: authapp did not return parent app for inheritance app * fix: fe adjusting * feat: fe adjusing * perf: inherit per ux * doc * fix: ts errors (#1916) * perf: inherit permission * fix: permission inherit * Workflow type (#1938) * perf: workflow type tmp workflow perf: workflow type feat: custom field config * perf: dynamic input * perf: node classify * perf: node classify * perf: node classify * perf: node classify * fix: workflow custom input * feat: text editor and customFeedback move to basic nodes * feat: community system plugin * fix: ts * feat: exprEval plugin * perf: workflow type * perf: plugin important * fix: default templates * perf: markdown hr css * lock * perf: fetch url * perf: new plugin version * fix: chat histories update * fix: collection paths invalid * perf: app card ui --------- Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
This commit is contained in:
@@ -39,7 +39,7 @@ const FolderPath = (props: {
|
||||
{concatPaths.map((item, i) => (
|
||||
<Flex key={item.parentId || i} alignItems={'center'}>
|
||||
<Box
|
||||
fontSize={['sm', fontSize || 'sm']}
|
||||
fontSize={['xs', fontSize || 'sm']}
|
||||
py={0.5}
|
||||
px={1.5}
|
||||
borderRadius={'md'}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { Box, Button, Flex, HStack } from '@chakra-ui/react';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import React from 'react';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { FolderIcon } from '@fastgpt/global/common/file/image/constants';
|
||||
@@ -13,6 +14,8 @@ import CollaboratorContextProvider, {
|
||||
} from '../../support/permission/MemberManager/context';
|
||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { useI18n } from '@/web/context/I18n';
|
||||
import ResumeInherit from '@/components/support/permission/ResumeInheritText';
|
||||
|
||||
const FolderSlideCard = ({
|
||||
refreshDeps,
|
||||
@@ -24,7 +27,11 @@ const FolderSlideCard = ({
|
||||
onDelete,
|
||||
|
||||
defaultPer,
|
||||
managePer
|
||||
managePer,
|
||||
isInheritPermission,
|
||||
resumeInheritPermission,
|
||||
hasParent,
|
||||
refetchResource
|
||||
}: {
|
||||
refreshDeps?: any[];
|
||||
name: string;
|
||||
@@ -40,9 +47,16 @@ const FolderSlideCard = ({
|
||||
onChange: (v: PermissionValueType) => Promise<any>;
|
||||
};
|
||||
managePer: MemberManagerInputPropsType;
|
||||
|
||||
isInheritPermission?: boolean;
|
||||
resumeInheritPermission?: () => Promise<void>;
|
||||
hasParent?: boolean;
|
||||
refetchResource?: () => Promise<any>;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const { feConfigs } = useSystemStore();
|
||||
const { commonT } = useI18n();
|
||||
const { toast } = useToast();
|
||||
|
||||
const { ConfirmModal, openConfirm } = useConfirm({
|
||||
type: 'delete',
|
||||
@@ -118,6 +132,12 @@ const FolderSlideCard = ({
|
||||
<Box>
|
||||
<FormLabel>{t('support.permission.Permission')}</FormLabel>
|
||||
|
||||
{!isInheritPermission && (
|
||||
<Box mt={2}>
|
||||
<ResumeInherit onResume={() => resumeInheritPermission?.().then(refetchResource)} />
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{managePer.permission.hasManagePer && (
|
||||
<Box mt={5}>
|
||||
<Box fontSize={'sm'} color={'myGray.500'}>
|
||||
@@ -127,12 +147,20 @@ const FolderSlideCard = ({
|
||||
mt="1"
|
||||
per={defaultPer.value}
|
||||
defaultPer={defaultPer.defaultValue}
|
||||
onChange={defaultPer.onChange}
|
||||
isInheritPermission={isInheritPermission}
|
||||
onChange={(v) => defaultPer.onChange(v)}
|
||||
hasParent={hasParent}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
<Box mt={6}>
|
||||
<CollaboratorContextProvider {...managePer} refreshDeps={refreshDeps}>
|
||||
<CollaboratorContextProvider
|
||||
{...managePer}
|
||||
refreshDeps={refreshDeps}
|
||||
refetchResource={refetchResource}
|
||||
isInheritPermission={isInheritPermission}
|
||||
hasParent={hasParent}
|
||||
>
|
||||
{({ MemberListCard, onOpenManageModal, onOpenAddMember }) => {
|
||||
return (
|
||||
<>
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import React, { useState, DragEvent, useCallback } from 'react';
|
||||
import type { BoxProps } from '@chakra-ui/react';
|
||||
import { useBoolean } from 'ahooks';
|
||||
|
||||
export const useFolderDrag = ({
|
||||
onDrop,
|
||||
@@ -10,11 +11,13 @@ export const useFolderDrag = ({
|
||||
}) => {
|
||||
const [dragId, setDragId] = useState<string>();
|
||||
const [targetId, setTargetId] = useState<string>();
|
||||
const [isDropping, { setTrue, setFalse }] = useBoolean();
|
||||
|
||||
const getBoxProps = useCallback(
|
||||
({ dataId, isFolder }: { dataId: string; isFolder: boolean }) => {
|
||||
return {
|
||||
draggable: true,
|
||||
userSelect: 'none' as any,
|
||||
'data-drag-id': isFolder ? dataId : undefined,
|
||||
onDragStart: (e: DragEvent<HTMLDivElement>) => {
|
||||
setDragId(dataId);
|
||||
@@ -29,15 +32,19 @@ export const useFolderDrag = ({
|
||||
e.preventDefault();
|
||||
setTargetId(undefined);
|
||||
},
|
||||
onDrop: (e: DragEvent<HTMLDivElement>) => {
|
||||
onDrop: async (e: DragEvent<HTMLDivElement>) => {
|
||||
e.preventDefault();
|
||||
setTrue();
|
||||
|
||||
if (targetId && dragId && targetId !== dragId) {
|
||||
onDrop(dragId, targetId);
|
||||
}
|
||||
try {
|
||||
if (targetId && dragId && targetId !== dragId) {
|
||||
await onDrop(dragId, targetId);
|
||||
}
|
||||
} catch (error) {}
|
||||
|
||||
setTargetId(undefined);
|
||||
setDragId(undefined);
|
||||
setFalse();
|
||||
},
|
||||
...(activeStyles &&
|
||||
targetId === dataId && {
|
||||
@@ -45,10 +52,11 @@ export const useFolderDrag = ({
|
||||
})
|
||||
};
|
||||
},
|
||||
[activeStyles, dragId, onDrop, targetId]
|
||||
[activeStyles, dragId, onDrop, setFalse, setTrue, targetId]
|
||||
);
|
||||
|
||||
return {
|
||||
getBoxProps
|
||||
getBoxProps,
|
||||
isDropping
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user