tombol loading
This commit is contained in:
@@ -175,6 +175,7 @@ export default function List() {
|
|||||||
const createMenu = Boolean(anchorEl);
|
const createMenu = Boolean(anchorEl);
|
||||||
const importForm = useRef<HTMLInputElement>(null);
|
const importForm = useRef<HTMLInputElement>(null);
|
||||||
const [currentImportFileName, setCurrentImportFileName] = useState(null);
|
const [currentImportFileName, setCurrentImportFileName] = useState(null);
|
||||||
|
const [importLoading, setImportLoading] = useState(false);
|
||||||
|
|
||||||
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
||||||
setAnchorEl(event.currentTarget);
|
setAnchorEl(event.currentTarget);
|
||||||
@@ -205,7 +206,7 @@ export default function List() {
|
|||||||
Object.keys(appliedParams).length !== 0
|
Object.keys(appliedParams).length !== 0
|
||||||
? appliedParams
|
? appliedParams
|
||||||
: Object.fromEntries([...searchParams.entries(), ['order', order], ['orderBy', orderBy]]);
|
: Object.fromEntries([...searchParams.entries(), ['order', order], ['orderBy', orderBy]]);
|
||||||
|
setImportLoading(true);
|
||||||
axios.get('/report/logs/export', {
|
axios.get('/report/logs/export', {
|
||||||
params: { ...parameters },
|
params: { ...parameters },
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
@@ -215,6 +216,7 @@ export default function List() {
|
|||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
handleClose();
|
handleClose();
|
||||||
|
setImportLoading(false);
|
||||||
});
|
});
|
||||||
// axios.get(`report/logs/export`)
|
// axios.get(`report/logs/export`)
|
||||||
// .then((response) => {
|
// .then((response) => {
|
||||||
@@ -240,14 +242,15 @@ export default function List() {
|
|||||||
{!currentImportFileName && (
|
{!currentImportFileName && (
|
||||||
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
||||||
<SearchInput onSearch={applyFilter} />
|
<SearchInput onSearch={applyFilter} />
|
||||||
<Button
|
<LoadingButton
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
startIcon={<UploadIcon />}
|
startIcon={<UploadIcon />}
|
||||||
sx={{ p: 1.8 }}
|
sx={{ p: 1.8 }}
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
|
loading={importLoading}
|
||||||
>
|
>
|
||||||
Export
|
Export
|
||||||
</Button>
|
</LoadingButton>
|
||||||
<Menu
|
<Menu
|
||||||
id="import-button"
|
id="import-button"
|
||||||
anchorEl={anchorEl}
|
anchorEl={anchorEl}
|
||||||
|
|||||||
Reference in New Issue
Block a user