fix: admin can not delete own

This commit is contained in:
jialin
2025-10-23 17:09:30 +08:00
parent a815e71bfe
commit bf57290197
12 changed files with 57 additions and 18 deletions
@@ -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>
+8 -3
View File
@@ -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>