fix: admin can not delete own
This commit is contained in:
@@ -186,11 +186,11 @@ const AccessControlForm = forwardRef((props: AccessControlFormProps, ref) => {
|
||||
item.title.toLowerCase().includes(inputValue.toLowerCase())
|
||||
}
|
||||
render={(item) => (
|
||||
<span className="flex-center gap-8">
|
||||
<span className="flex-center gap-4">
|
||||
<span>{item.title}</span>
|
||||
<span className="text-tertiary">
|
||||
{item.is_admin
|
||||
? `(${intl.formatMessage({ id: 'models.table.admin' })})`
|
||||
? `[${intl.formatMessage({ id: 'models.table.admin' })}]`
|
||||
: ''}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
@@ -52,6 +52,7 @@ const TargetForm: React.FC<TargetFormProps> = forwardRef((props, ref) => {
|
||||
const { getRuleMessage } = useAppUtils();
|
||||
const intl = useIntl();
|
||||
const [form] = Form.useForm();
|
||||
const localPath = Form.useWatch('local_path', form);
|
||||
|
||||
useEffect(() => {
|
||||
const init = async () => {
|
||||
@@ -95,18 +96,22 @@ const TargetForm: React.FC<TargetFormProps> = forwardRef((props, ref) => {
|
||||
|
||||
const isExisting = currentWorker?.children?.some((child) => {
|
||||
const isSameFile =
|
||||
child.fileName === (fileName || '') ||
|
||||
child.fileName === (fileName || localPath || '') ||
|
||||
minimatch(child.fileName || '', fileName || '');
|
||||
|
||||
return child.repoId === selectedModel?.name && isSameFile;
|
||||
return child.repoId === (selectedModel?.name || '') && isSameFile;
|
||||
});
|
||||
|
||||
const localeId = localPath
|
||||
? 'resources.modelfiles.form.added'
|
||||
: 'resources.modelfiles.form.exsting';
|
||||
|
||||
return (
|
||||
<span>
|
||||
{data.label}
|
||||
{isExisting && (
|
||||
<span className="text-tertiary m-l-4">
|
||||
({intl.formatMessage({ id: 'resources.modelfiles.form.exsting' })})
|
||||
[{intl.formatMessage({ id: localeId })}]
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user