Merge pull request #1948 from proddy/dev

small improvements to upload
This commit is contained in:
Proddy
2024-08-17 12:40:30 +02:00
committed by GitHub
9 changed files with 57 additions and 42 deletions

View File

@@ -48,7 +48,7 @@
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/babel__core": "^7",
"@types/formidable": "^3",
"@types/node": "^22.3.0",
"@types/node": "^22.4.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/react-router-dom": "^5.3.3",

View File

@@ -177,14 +177,6 @@ const Devices = () => {
height: 42px;
}
`,
BaseCell: `
&:nth-of-type(2) {
text-align: left;
},
&:nth-of-type(4) {
text-align: center;
}
`,
HeaderRow: `
.th {
padding: 8px;

View File

@@ -299,9 +299,15 @@ const DownloadUpload = () => {
)}
</Box>
<SingleUpload setRestartNeeded={setRestartNeeded} />
<Typography sx={{ pt: 2, pb: 2 }} variant="h6" color="primary">
{LL.UPLOAD()}
</Typography>
{restartNeeded && (
<Box mb={2} color="warning.main">
<Typography variant="body2">{LL.UPLOAD_TEXT()}</Typography>
</Box>
{restartNeeded ? (
<MessageBox mt={2} level="warning" message={LL.RESTART_TEXT(0)}>
<Button
startIcon={<PowerSettingsNewIcon />}
@@ -312,6 +318,8 @@ const DownloadUpload = () => {
{LL.RESTART()}
</Button>
</MessageBox>
) : (
<SingleUpload setRestartNeeded={setRestartNeeded} />
)}
</>
);

View File

@@ -63,9 +63,12 @@ const SystemStatus = () => {
immediate: false
});
const { send: factoryPartitionCommand } = useRequest(SystemApi.factoryPartition(), {
immediate: false
});
const { send: factoryPartitionCommand } = useRequest(
SystemApi.factoryPartition(),
{
immediate: false
}
);
const {
data: data,

View File

@@ -2,7 +2,13 @@ import { useEffect, useState } from 'react';
import { toast } from 'react-toastify';
import CancelIcon from '@mui/icons-material/Cancel';
import { Box, Button, LinearProgress, Typography } from '@mui/material';
import {
Box,
Button,
LinearProgress,
type LinearProgressProps,
Typography
} from '@mui/material';
import * as SystemApi from 'api/system';
@@ -11,6 +17,21 @@ 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>
);
}
const SingleUpload = ({ setRestartNeeded }) => {
const [md5, setMd5] = useState<string>();
const [file, setFile] = useState<File>();
@@ -50,19 +71,10 @@ const SingleUpload = ({ setRestartNeeded }) => {
return (
<>
<Typography sx={{ pt: 2, pb: 2 }} variant="h6" color="primary">
{LL.UPLOAD()}
</Typography>
<Box mb={2} color="warning.main">
<Typography variant="body2">{LL.UPLOAD_TEXT()}</Typography>
</Box>
{isUploading ? (
<>
<Box width="100%" p={2}>
<LinearProgress
variant="determinate"
<LinearProgressWithLabel
value={
progress.total === 0 || progress.loaded === 0
? 0

View File

@@ -1454,12 +1454,12 @@ __metadata:
languageName: node
linkType: hard
"@types/node@npm:^22.3.0":
version: 22.3.0
resolution: "@types/node@npm:22.3.0"
"@types/node@npm:^22.4.0":
version: 22.4.0
resolution: "@types/node@npm:22.4.0"
dependencies:
undici-types: "npm:~6.18.2"
checksum: 10c0/855be3b97f4262a84818f889ff898e147dcef4f72b866e3551a8367380cdb63a45cf3929f09d9a0647f62706f8d4772e91a1ecd1bd7c6a80d6744c2b0cbca608
undici-types: "npm:~6.19.2"
checksum: 10c0/84cd094b19a27e0db425f1d02614e4f7ac59b5eb3b21e288c8f8d4d0a4c9ad370107bc1a649d4c2b4e810cd133feea26e0bbf7e7c617f93e9e139d6d2568cf50
languageName: node
linkType: hard
@@ -1677,7 +1677,7 @@ __metadata:
"@trivago/prettier-plugin-sort-imports": "npm:^4.3.0"
"@types/babel__core": "npm:^7"
"@types/formidable": "npm:^3"
"@types/node": "npm:^22.3.0"
"@types/node": "npm:^22.4.0"
"@types/react": "npm:^18.3.3"
"@types/react-dom": "npm:^18.3.0"
"@types/react-router-dom": "npm:^5.3.3"
@@ -6882,10 +6882,10 @@ __metadata:
languageName: node
linkType: hard
"undici-types@npm:~6.18.2":
version: 6.18.2
resolution: "undici-types@npm:6.18.2"
checksum: 10c0/dea28163891a5af7624c120107dc07a74c369ee94c6dd1d0de29af061ee129fac4846f97130589f4436b85f6102c73d30328ca908be02626dd8ab9fec5642aba
"undici-types@npm:~6.19.2":
version: 6.19.6
resolution: "undici-types@npm:6.19.6"
checksum: 10c0/9b2264c5700e7169c6c62c643aac56cd8984c5fd7e18ed31ff11780260e137f6340dee8317a2e6e0ae3c49f5e5ef6fa577ea07193cbaa535265cba76a267cae9
languageName: node
linkType: hard

View File

@@ -14,7 +14,7 @@
"eslint": "^9.9.0",
"eslint-config-prettier": "^9.1.0",
"formidable": "^3.5.1",
"itty-router": "^5.0.17",
"itty-router": "^5.0.18",
"prettier": "^3.3.3"
},
"packageManager": "yarn@4.4.0"

View File

@@ -841,10 +841,10 @@ __metadata:
languageName: node
linkType: hard
"itty-router@npm:^5.0.17":
version: 5.0.17
resolution: "itty-router@npm:5.0.17"
checksum: 10c0/769af6e8fc902485d1cb6bb577ae40a71613cdaad76b1334bfd3a5f4ddb6141e35322ec3fca01f37ea0e37b3aceba067dcbb70c9455c1756c5bee24a4cd83231
"itty-router@npm:^5.0.18":
version: 5.0.18
resolution: "itty-router@npm:5.0.18"
checksum: 10c0/f21afcf16135622de665b340e16262add2c35dab037c051448df8a2dd49bd83dfa1cf9323000839994157202befaa79f95bbc9e0ed106114cb9da66275ad9408
languageName: node
linkType: hard
@@ -963,7 +963,7 @@ __metadata:
eslint: "npm:^9.9.0"
eslint-config-prettier: "npm:^9.1.0"
formidable: "npm:^3.5.1"
itty-router: "npm:^5.0.17"
itty-router: "npm:^5.0.18"
prettier: "npm:^3.3.3"
languageName: unknown
linkType: soft

View File

@@ -156,7 +156,7 @@ const char * const * DeviceValue::DeviceValueTAG_s[] = {
};
// tags used in MQTT topic names. Macthes sequence from DeviceValueTAG_s
// tags used in MQTT topic names. Matches sequence from DeviceValueTAG_s
const char * const DeviceValue::DeviceValueTAG_mqtt[] = {
FL_(tag_device_data)[0], // ""