From 62a150d54761494a8fccd94e6edd63a1c75cd939 Mon Sep 17 00:00:00 2001 From: Ivan Kudinov Date: Tue, 3 Dec 2024 12:17:02 +0300 Subject: [PATCH] CCS-102689 Add total size in files upload --- .../modules/max-file-size/MaxFileSizePage.tsx | 16 +++++++++++----- .../modules/max-file-size/max-file-size.store.ts | 4 ++-- frontend/package.json | 4 ++-- frontend/smartapp-manifest.json | 2 +- frontend/yarn.lock | 8 ++++---- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/frontend/app/modules/max-file-size/MaxFileSizePage.tsx b/frontend/app/modules/max-file-size/MaxFileSizePage.tsx index a2fe459..7b153a1 100644 --- a/frontend/app/modules/max-file-size/MaxFileSizePage.tsx +++ b/frontend/app/modules/max-file-size/MaxFileSizePage.tsx @@ -9,16 +9,20 @@ import { observer } from 'mobx-react' const MaxFileSizePage: FC = () => { const { maxFileSizeStore: store } = useStore() - const [maxSize, setMaxSize] = useState(10_000_000) + const [maxSize, setMaxSize] = useState('10000000') + const [totalSize, setTotalSize] = useState('30000000') const [mime, setMime] = useState('') - const handleMaxSizeChange = (event: React.ChangeEvent) => - setMaxSize(parseInt(event.target.value, 10)) + const handleMaxSizeChange = (event: React.ChangeEvent) => setMaxSize(event.target.value) + + const handleTotalSizeChange = (event: React.ChangeEvent) => setTotalSize(event.target.value) const handleMimeChange = (event: React.ChangeEvent) => setMime(event.target.value) const handleSubmit = () => { - store.uploadFile(mime, maxSize) + const maxSizeParsed = maxSize ? parseInt(maxSize, 10) : undefined + const totalSizeParsed = totalSize ? parseInt(totalSize, 10) : undefined + store.uploadFile(mime, maxSizeParsed, totalSizeParsed) } return ( @@ -26,8 +30,10 @@ const MaxFileSizePage: FC = () => { Mime тип - Размер в байтах + Размер одного файла в байтах + Размер всех файлов в байтах +