Skip to content

Commit

Permalink
Merge pull request #2366 from proddy/dev
Browse files Browse the repository at this point in the history
show progress bar when automatically installing firmware, fix modbus headers
  • Loading branch information
proddy authored Jan 21, 2025
2 parents becdc8c + 243471e commit 8a91c6e
Show file tree
Hide file tree
Showing 12 changed files with 5,830 additions and 5,444 deletions.
10,588 changes: 5,294 additions & 5,294 deletions docs/dump_entities.csv

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"@alova/adapter-xhr": "2.1.1",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@mui/icons-material": "^6.4.0",
"@mui/material": "^6.4.0",
"@mui/icons-material": "^6.4.1",
"@mui/material": "^6.4.1",
"@table-library/react-table-library": "4.1.7",
"alova": "3.2.8",
"async-validator": "^4.2.5",
Expand Down Expand Up @@ -57,8 +57,8 @@
"prettier": "^3.4.2",
"rollup-plugin-visualizer": "^5.14.0",
"terser": "^5.37.0",
"typescript-eslint": "8.20.0",
"vite": "^6.0.9",
"typescript-eslint": "8.21.0",
"vite": "^6.0.11",
"vite-plugin-imagemin": "^0.6.1",
"vite-tsconfig-paths": "^5.1.4"
},
Expand Down
25 changes: 13 additions & 12 deletions interface/src/app/status/SystemMonitor.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import { useState } from 'react';

import CancelIcon from '@mui/icons-material/Cancel';
import {
Box,
Button,
CircularProgress,
Dialog,
DialogContent,
Typography
} from '@mui/material';
import { Box, Button, Dialog, DialogContent, Typography } from '@mui/material';

import { callAction } from 'api/app';
import { readSystemStatus } from 'api/system';
Expand All @@ -20,6 +13,8 @@ import { useI18nContext } from 'i18n/i18n-react';
import { SystemStatusCodes } from 'types';
import { useInterval } from 'utils';

import { LinearProgressWithLabel } from '../../components/upload/LinearProgressWithLabel';

const SystemMonitor = () => {
const [errorMessage, setErrorMessage] = useState<string>();

Expand Down Expand Up @@ -81,7 +76,7 @@ const SystemMonitor = () => {
fontWeight={400}
textAlign="center"
>
{data?.status === SystemStatusCodes.SYSTEM_STATUS_UPLOADING
{data?.status >= SystemStatusCodes.SYSTEM_STATUS_UPLOADING
? LL.WAIT_FIRMWARE()
: data?.status === SystemStatusCodes.SYSTEM_STATUS_RESTART_REQUESTED
? LL.APPLICATION_RESTARTING()
Expand Down Expand Up @@ -110,9 +105,15 @@ const SystemMonitor = () => {
<Typography mt={2} variant="h6" fontWeight={400} textAlign="center">
{LL.PLEASE_WAIT()}&hellip;
</Typography>
<Box py={2}>
<CircularProgress size={32} />
</Box>
{data && data.status > SystemStatusCodes.SYSTEM_STATUS_UPLOADING && (
<Box width="100%" pl={2} pr={2} py={2}>
<LinearProgressWithLabel
value={Math.round(
data?.status - SystemStatusCodes.SYSTEM_STATUS_UPLOADING
)}
/>
</Box>
)}
</>
)}
</Box>
Expand Down
23 changes: 23 additions & 0 deletions interface/src/components/upload/LinearProgressWithLabel.tsx
Original file line number Diff line number Diff line change
@@ -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>
);
}
24 changes: 2 additions & 22 deletions interface/src/components/upload/SingleUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,15 @@ 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';

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>();
Expand Down
2 changes: 1 addition & 1 deletion interface/src/types/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { NetworkConnectionStatus } from './network';
export enum SystemStatusCodes {
SYSTEM_STATUS_NORMAL = 0,
SYSTEM_STATUS_PENDING_UPLOAD = 1,
SYSTEM_STATUS_UPLOADING = 2,
SYSTEM_STATUS_UPLOADING = 100,
SYSTEM_STATUS_ERROR_UPLOAD = 3,
SYSTEM_STATUS_PENDING_RESTART = 4,
SYSTEM_STATUS_RESTART_REQUESTED = 5
Expand Down
Loading

0 comments on commit 8a91c6e

Please sign in to comment.