From 0e720ef48e48e694368bd114217a8370e8b6cc90 Mon Sep 17 00:00:00 2001 From: adriano Date: Tue, 6 Sep 2022 01:09:52 -0300 Subject: [PATCH] =?UTF-8?q?Altera=C3=A7=C3=A3o=20no=20botao=20download=20c?= =?UTF-8?q?sv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/Report/index.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/frontend/src/pages/Report/index.js b/frontend/src/pages/Report/index.js index 7a05945..1c776a7 100644 --- a/frontend/src/pages/Report/index.js +++ b/frontend/src/pages/Report/index.js @@ -22,6 +22,7 @@ import fileDownload from 'js-file-download' import openSocket from "socket.io-client"; +import { TramOutlined } from "@material-ui/icons"; const report = [{ 'value': '1', 'label': 'Atendimento por atendentes' }, { 'value': '2', 'label': 'Usuários online/offline' }] @@ -249,6 +250,7 @@ const Report = () => { const [onQueueStatus, setOnQueueProcessStatus] = useState(undefined) const [csvFile, setCsvFile] = useState() + @@ -415,26 +417,30 @@ const Report = () => { return () => clearTimeout(delayDebounceFn); }, [ userA ]) + - - const handleCSVDownload = async () => { + const handleCSVDownload = async () => { + + setOnQueueProcessStatus('downloading') try { let res = await apiBroker.get(`/reports/download/${csvFile}`, { responseType: 'blob' }); if (res) { - fileDownload(res.data, `${csvFile}`); - - setOnQueueProcessStatus('empty') + fileDownload(res.data, `${csvFile}`); + setOnQueueProcessStatus('empty') } + } catch (err) { console.log(err); } + } + const handleCSVMessages = () => { @@ -599,14 +605,20 @@ const Report = () => { <> ); + case 'downloading': + return ( + <> + DOWNLOADING... + ); + default: return (<>WAITING...);