From 9698e787b28bae02ff2f80779dcc16b10a09641d Mon Sep 17 00:00:00 2001 From: Proddy Date: Thu, 19 Oct 2023 21:37:46 +0200 Subject: [PATCH] remove dialog from upload as C++ code does restart immediately --- interface/package.json | 4 +- .../src/framework/system/UploadFileForm.tsx | 52 +++---------------- interface/yarn.lock | 20 +++---- 3 files changed, 19 insertions(+), 57 deletions(-) diff --git a/interface/package.json b/interface/package.json index d094bbb65..a8e216820 100644 --- a/interface/package.json +++ b/interface/package.json @@ -28,7 +28,7 @@ "@table-library/react-table-library": "4.1.7", "@types/lodash-es": "^4.17.10", "@types/node": "^20.8.7", - "@types/react": "^18.2.29", + "@types/react": "^18.2.30", "@types/react-dom": "^18.2.14", "@types/react-router-dom": "^5.3.3", "alova": "^2.13.1", @@ -52,7 +52,7 @@ "@preact/preset-vite": "^2.6.0", "@typescript-eslint/eslint-plugin": "^6.8.0", "@typescript-eslint/parser": "^6.8.0", - "concurrently": "^8.2.1", + "concurrently": "^8.2.2", "eslint": "^8.51.0", "eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb-typescript": "^17.1.0", diff --git a/interface/src/framework/system/UploadFileForm.tsx b/interface/src/framework/system/UploadFileForm.tsx index c904995c4..3a22eb540 100644 --- a/interface/src/framework/system/UploadFileForm.tsx +++ b/interface/src/framework/system/UploadFileForm.tsx @@ -1,13 +1,10 @@ -import CancelIcon from '@mui/icons-material/Cancel'; import DownloadIcon from '@mui/icons-material/GetApp'; -import PowerSettingsNewIcon from '@mui/icons-material/PowerSettingsNew'; -import { Typography, Button, Box, Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material'; +import { Typography, Button, Box } from '@mui/material'; import { useRequest } from 'alova'; import { useState, type FC } from 'react'; import { toast } from 'react-toastify'; import RestartMonitor from './RestartMonitor'; -import { dialogStyle } from 'CustomTheme'; import * as SystemApi from 'api/system'; import { SectionContent, SingleUpload } from 'components'; @@ -17,7 +14,6 @@ import * as EMSESP from 'project/api'; const UploadFileForm: FC = () => { const { LL } = useI18nContext(); const [restarting, setRestarting] = useState(); - const [confirmRestart, setConfirmRestart] = useState(false); const [md5, setMd5] = useState(); const { send: getSettings, onSuccess: onSuccessGetSettings } = useRequest(EMSESP.getSettings(), { @@ -36,10 +32,6 @@ const UploadFileForm: FC = () => { immediate: false }); - const { send: restartCommand } = useRequest(SystemApi.restart(), { - immediate: false - }); - const { loading: isUploading, uploading: progress, @@ -56,7 +48,7 @@ const UploadFileForm: FC = () => { setMd5(data.md5); toast.success(LL.UPLOAD() + ' MD5 ' + LL.SUCCESSFUL()); } else { - setConfirmRestart(true); + setRestarting(true); } }); @@ -72,19 +64,6 @@ const UploadFileForm: FC = () => { }); }; - const restart = async () => { - await restartCommand() - .then(() => { - setRestarting(true); - }) - .catch((err) => { - toast.error(err.message); - }) - .finally(() => { - setConfirmRestart(false); - }); - }; - const saveFile = (json: any, endpoint: string) => { const anchor = document.createElement('a'); anchor.href = URL.createObjectURL( @@ -144,33 +123,17 @@ const UploadFileForm: FC = () => { }); }; - const renderRestartDialog = () => ( - setConfirmRestart(false)}> - {LL.UPLOAD() + ' ' + LL.SUCCESSFUL()} - {LL.RESTART_TEXT()} - - - - - - ); - const content = () => ( <> {LL.UPLOAD()} - {LL.UPLOAD_TEXT()} + + {LL.UPLOAD_TEXT()} +
+ {LL.RESTART_TEXT()}. +
{md5 && ( @@ -226,7 +189,6 @@ const UploadFileForm: FC = () => { )} - {renderRestartDialog()} ); return ( diff --git a/interface/yarn.lock b/interface/yarn.lock index 8ccbb91fb..cffae6de8 100644 --- a/interface/yarn.lock +++ b/interface/yarn.lock @@ -1370,14 +1370,14 @@ __metadata: languageName: node linkType: hard -"@types/react@npm:^18.2.29": - version: 18.2.29 - resolution: "@types/react@npm:18.2.29" +"@types/react@npm:^18.2.30": + version: 18.2.30 + resolution: "@types/react@npm:18.2.30" dependencies: "@types/prop-types": "npm:*" "@types/scheduler": "npm:*" csstype: "npm:^3.0.2" - checksum: c261e4e2ec18a7244c959cb40ac2f43b0fa7f0b40fcce615243402fc61699cbebf6f2eae2632b8a0f0a2775a1ca735279b15543349cafa276c064b591712b85b + checksum: dcad8aed0d0bf5731f4c6a7e8d28d8f571bd031c6c94edbcc1b7ab2c86e7cf61ae49d66c3229e1849fb4b82c5aa7be7c40e71ac5c2d7fef4eafb7a3b4abd25d6 languageName: node linkType: hard @@ -1550,14 +1550,14 @@ __metadata: "@table-library/react-table-library": "npm:4.1.7" "@types/lodash-es": "npm:^4.17.10" "@types/node": "npm:^20.8.7" - "@types/react": "npm:^18.2.29" + "@types/react": "npm:^18.2.30" "@types/react-dom": "npm:^18.2.14" "@types/react-router-dom": "npm:^5.3.3" "@typescript-eslint/eslint-plugin": "npm:^6.8.0" "@typescript-eslint/parser": "npm:^6.8.0" alova: "npm:^2.13.1" async-validator: "npm:^4.2.5" - concurrently: "npm:^8.2.1" + concurrently: "npm:^8.2.2" eslint: "npm:^8.51.0" eslint-config-airbnb: "npm:^19.0.4" eslint-config-airbnb-typescript: "npm:^17.1.0" @@ -2384,9 +2384,9 @@ __metadata: languageName: node linkType: hard -"concurrently@npm:^8.2.1": - version: 8.2.1 - resolution: "concurrently@npm:8.2.1" +"concurrently@npm:^8.2.2": + version: 8.2.2 + resolution: "concurrently@npm:8.2.2" dependencies: chalk: "npm:^4.1.2" date-fns: "npm:^2.30.0" @@ -2400,7 +2400,7 @@ __metadata: bin: conc: dist/bin/concurrently.js concurrently: dist/bin/concurrently.js - checksum: 8a7cb8caeb9430f939ae6ba3ccdce6080e7f3084dcbffb6383059002937bbe771d71f8f4f854258e6138f52918637a3d66a6b21fd19d0ea69c426011f878e701 + checksum: dcb1aa69d9c611a7bda9d4fc0fe1e388f971d1744acec7e0d52dffa2ef55743f1266ec9292f414c5789b9f61734b3fce772bd005d4de9564a949fb121b97bae1 languageName: node linkType: hard