fix: add dataset edit permissions (#13223)

This commit is contained in:
Wu Tianwei
2025-02-06 14:26:16 +08:00
committed by GitHub
parent 186e2d972e
commit 49b4144ffd
10 changed files with 112 additions and 106 deletions

View File

@@ -23,6 +23,7 @@ type Props = {
onRemove: () => void
onChange: (dataSet: DataSet) => void
readonly?: boolean
editable?: boolean
}
const DatasetItem: FC<Props> = ({
@@ -30,6 +31,7 @@ const DatasetItem: FC<Props> = ({
onRemove,
onChange,
readonly,
editable = true,
}) => {
const media = useBreakpoints()
const { t } = useTranslation()
@@ -75,14 +77,16 @@ const DatasetItem: FC<Props> = ({
</div>
{!readonly && (
<div className='hidden group-hover/dataset-item:flex shrink-0 ml-2 items-center space-x-1'>
<ActionButton
onClick={(e) => {
e.stopPropagation()
showSettingsModal()
}}
>
<RiEditLine className='w-4 h-4 flex-shrink-0 text-text-tertiary' />
</ActionButton>
{
editable && <ActionButton
onClick={(e) => {
e.stopPropagation()
showSettingsModal()
}}
>
<RiEditLine className='w-4 h-4 flex-shrink-0 text-text-tertiary' />
</ActionButton>
}
<ActionButton
onClick={handleRemove}
state={ActionButtonState.Destructive}
@@ -102,7 +106,7 @@ const DatasetItem: FC<Props> = ({
{
payload.provider === 'external' && <Badge
className='group-hover/dataset-item:hidden shrink-0'
text={t('dataset.externalTag')}
text={t('dataset.externalTag') as string}
/>
}