mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-26 17:16:52 +08:00
### What problem does this PR solve? Feat: Move the dataset permission drop-down box to a separate file for better permission control #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
30 lines
864 B
TypeScript
30 lines
864 B
TypeScript
import { SelectWithSearch } from '@/components/originui/select-with-search';
|
|
import { RAGFlowFormItem } from '@/components/ragflow-form';
|
|
import { PermissionRole } from '@/constants/permission';
|
|
import { useMemo } from 'react';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
export function PermissionFormField() {
|
|
const { t } = useTranslation();
|
|
const teamOptions = useMemo(() => {
|
|
return Object.values(PermissionRole).map((x) => ({
|
|
label: t('knowledgeConfiguration.' + x),
|
|
value: x,
|
|
}));
|
|
}, [t]);
|
|
|
|
return (
|
|
<RAGFlowFormItem
|
|
name="permission"
|
|
label={t('knowledgeConfiguration.permissions')}
|
|
tooltip={t('knowledgeConfiguration.permissionsTip')}
|
|
horizontal
|
|
>
|
|
<SelectWithSearch
|
|
options={teamOptions}
|
|
triggerClassName="w-3/4"
|
|
></SelectWithSearch>
|
|
</RAGFlowFormItem>
|
|
);
|
|
}
|