show progress bar when automatically installing firmware

This commit is contained in:
proddy
2025-01-21 22:06:01 +01:00
parent b8f97ec94d
commit 243471e21d
6 changed files with 46 additions and 37 deletions

View File

@@ -0,0 +1,23 @@
import {
Box,
LinearProgress,
type LinearProgressProps,
Typography
} from '@mui/material';
export function LinearProgressWithLabel(
props: LinearProgressProps & { value: number }
) {
return (
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Box sx={{ width: '100%', mr: 1 }}>
<LinearProgress variant="determinate" {...props} />
</Box>
<Box sx={{ minWidth: 35 }}>
<Typography variant="body2" color="text.secondary">{`${Math.round(
props.value
)}%`}</Typography>
</Box>
</Box>
);
}

View File

@@ -2,13 +2,7 @@ import { useEffect, useState } from 'react';
import { toast } from 'react-toastify';
import CancelIcon from '@mui/icons-material/Cancel';
import {
Box,
Button,
LinearProgress,
type LinearProgressProps,
Typography
} from '@mui/material';
import { Box, Button, Typography } from '@mui/material';
import * as SystemApi from 'api/system';
@@ -16,21 +10,7 @@ import { useRequest } from 'alova/client';
import { useI18nContext } from 'i18n/i18n-react';
import DragNdrop from './DragNdrop';
function LinearProgressWithLabel(props: LinearProgressProps & { value: number }) {
return (
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Box sx={{ width: '100%', mr: 1 }}>
<LinearProgress variant="determinate" {...props} />
</Box>
<Box sx={{ minWidth: 35 }}>
<Typography variant="body2" color="text.secondary">{`${Math.round(
props.value
)}%`}</Typography>
</Box>
</Box>
);
}
import { LinearProgressWithLabel } from './LinearProgressWithLabel';
const SingleUpload = ({ doRestart }) => {
const [md5, setMd5] = useState<string>();