M: Improve fullname label and fix clone defaults
This commit is contained in:
parent
417583efa5
commit
e8509e44b1
|
@ -168,7 +168,7 @@ class LibraryViewSet(viewsets.ModelViewSet):
|
|||
|
||||
with transaction.atomic():
|
||||
clone.save()
|
||||
need_filter = 'items' in request.data
|
||||
need_filter = 'items' in request.data and len(request.data['items']) > 0
|
||||
for cst in RSForm(item).constituents():
|
||||
if not need_filter or cst.pk in request.data['items']:
|
||||
cst.pk = None
|
||||
|
|
|
@ -68,7 +68,7 @@ export function DlgCloneLibraryItem() {
|
|||
>
|
||||
<TextInput
|
||||
id='dlg_full_name' //
|
||||
label='Полное название'
|
||||
label='Название'
|
||||
{...register('title')}
|
||||
error={errors.title}
|
||||
/>
|
||||
|
|
|
@ -137,7 +137,7 @@ export function FormCreateItem() {
|
|||
<TextInput
|
||||
id='schema_title'
|
||||
{...register('title')}
|
||||
label='Полное название'
|
||||
label='Название'
|
||||
placeholder={file && 'Загрузить из файла'}
|
||||
error={errors.title}
|
||||
/>
|
||||
|
|
|
@ -56,7 +56,7 @@ export function TabInputOperation() {
|
|||
<div className='cc-fade-in cc-column'>
|
||||
<TextInput
|
||||
id='operation_title' //
|
||||
label='Полное название'
|
||||
label='Название'
|
||||
{...register('item_data.title')}
|
||||
error={errors.item_data?.title}
|
||||
/>
|
||||
|
|
|
@ -21,7 +21,7 @@ export function TabSynthesisOperation() {
|
|||
<div className='cc-fade-in cc-column'>
|
||||
<TextInput
|
||||
id='operation_title'
|
||||
label='Полное название'
|
||||
label='Название'
|
||||
{...register('item_data.title')}
|
||||
error={errors.item_data?.title}
|
||||
/>
|
||||
|
|
|
@ -14,7 +14,7 @@ export function TabOperation() {
|
|||
<div className='cc-fade-in cc-column'>
|
||||
<TextInput
|
||||
id='operation_title'
|
||||
label='Полное название'
|
||||
label='Названиее'
|
||||
{...register('item_data.title')}
|
||||
error={errors.item_data?.title}
|
||||
/>
|
||||
|
|
|
@ -63,7 +63,7 @@ export function FormOSS() {
|
|||
<TextInput
|
||||
id='schema_title'
|
||||
{...register('title')}
|
||||
label='Полное название'
|
||||
label='Название'
|
||||
className='mb-3'
|
||||
error={errors.title}
|
||||
disabled={!isMutable}
|
||||
|
|
|
@ -41,8 +41,13 @@ export function FormRSForm() {
|
|||
reset,
|
||||
formState: { isDirty, errors }
|
||||
} = useForm<IUpdateLibraryItemDTO>({
|
||||
resolver: zodResolver(schemaUpdateLibraryItem),
|
||||
defaultValues: {
|
||||
resolver: zodResolver(schemaUpdateLibraryItem)
|
||||
});
|
||||
const visible = useWatch({ control, name: 'visible' });
|
||||
const readOnly = useWatch({ control, name: 'read_only' });
|
||||
|
||||
useEffect(() => {
|
||||
reset({
|
||||
id: schema.id,
|
||||
item_type: LibraryItemType.RSFORM,
|
||||
title: schema.title,
|
||||
|
@ -50,10 +55,8 @@ export function FormRSForm() {
|
|||
description: schema.description,
|
||||
visible: schema.visible,
|
||||
read_only: schema.read_only
|
||||
}
|
||||
});
|
||||
const visible = useWatch({ control, name: 'visible' });
|
||||
const readOnly = useWatch({ control, name: 'read_only' });
|
||||
}, [schema, reset]);
|
||||
|
||||
useEffect(() => {
|
||||
setIsModified(isDirty);
|
||||
|
@ -76,7 +79,7 @@ export function FormRSForm() {
|
|||
<TextInput
|
||||
id='schema_title'
|
||||
{...register('title')}
|
||||
label='Полное название'
|
||||
label='Название'
|
||||
className='mb-3'
|
||||
error={errors.title}
|
||||
disabled={!isContentEditable}
|
||||
|
|
Loading…
Reference in New Issue
Block a user