Skip to content

Commit

Permalink
Merge pull request #1948 from proddy/dev
Browse files Browse the repository at this point in the history
small improvements to upload
  • Loading branch information
proddy authored Aug 17, 2024
2 parents 8eb2de5 + 5de696d commit c7d721b
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 42 deletions.
2 changes: 1 addition & 1 deletion interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 0 additions & 8 deletions interface/src/app/main/Devices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 10 additions & 2 deletions interface/src/app/settings/DownloadUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,15 @@ const DownloadUpload = () => {
)}
</Box>

<SingleUpload setRestartNeeded={setRestartNeeded} />
<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>

{restartNeeded && (
{restartNeeded ? (
<MessageBox mt={2} level="warning" message={LL.RESTART_TEXT(0)}>
<Button
startIcon={<PowerSettingsNewIcon />}
Expand All @@ -312,6 +318,8 @@ const DownloadUpload = () => {
{LL.RESTART()}
</Button>
</MessageBox>
) : (
<SingleUpload setRestartNeeded={setRestartNeeded} />
)}
</>
);
Expand Down
9 changes: 6 additions & 3 deletions interface/src/app/status/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
34 changes: 23 additions & 11 deletions interface/src/components/upload/SingleUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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>();
Expand Down Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions interface/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion mock-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]"
Expand Down
10 changes: 5 additions & 5 deletions mock-api/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/emsdevicevalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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], // ""
Expand Down

0 comments on commit c7d721b

Please sign in to comment.