M: Prevent user from creating OSS from file

This commit is contained in:
Ivan 2024-09-02 18:38:24 +03:00
parent d23f02420a
commit 64076ec7d2

View File

@ -114,24 +114,33 @@ function FormCreateItem() {
handleSelectLocation(initLocation); handleSelectLocation(initLocation);
}, [initLocation, handleSelectLocation]); }, [initLocation, handleSelectLocation]);
useLayoutEffect(() => {
if (itemType !== LibraryItemType.RSFORM) {
setFile(undefined);
setFileName('');
}
}, [itemType]);
return ( return (
<form className={clsx('cc-column', 'min-w-[30rem] max-w-[30rem] mx-auto', 'px-6 py-3')} onSubmit={handleSubmit}> <form className={clsx('cc-column', 'min-w-[30rem] max-w-[30rem] mx-auto', 'px-6 py-3')} onSubmit={handleSubmit}>
<h1> <h1>
<Overlay position='top-0 right-[0.5rem]'> {itemType == LibraryItemType.RSFORM ? (
<input <Overlay position='top-0 right-[0.5rem]'>
id='schema_file' <input
ref={inputRef} id='schema_file'
type='file' ref={inputRef}
style={{ display: 'none' }} type='file'
accept={EXTEOR_TRS_FILE} style={{ display: 'none' }}
onChange={handleFileChange} accept={EXTEOR_TRS_FILE}
/> onChange={handleFileChange}
<MiniButton />
title='Загрузить из Экстеор' <MiniButton
icon={<IconDownload size='1.25rem' className='icon-primary' />} title='Загрузить из Экстеор'
onClick={() => inputRef.current?.click()} icon={<IconDownload size='1.25rem' className='icon-primary' />}
/> onClick={() => inputRef.current?.click()}
</Overlay> />
</Overlay>
) : null}
Создание схемы Создание схемы
</h1> </h1>