mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
restart dialog
This commit is contained in:
@@ -65,6 +65,10 @@ const SystemStatus: FC = () => {
|
||||
immediate: false
|
||||
});
|
||||
|
||||
const { send: factoryPartitionCommand } = useRequest(SystemApi.factoryPartition(), {
|
||||
immediate: false
|
||||
});
|
||||
|
||||
const {
|
||||
data: data,
|
||||
send: loadData,
|
||||
@@ -229,6 +233,21 @@ const SystemStatus: FC = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const factoryPartition = async () => {
|
||||
setProcessing(true);
|
||||
await factoryPartitionCommand()
|
||||
.then(() => {
|
||||
setRestarting(true);
|
||||
})
|
||||
.catch((error: Error) => {
|
||||
toast.error(error.message);
|
||||
})
|
||||
.finally(() => {
|
||||
setConfirmRestart(false);
|
||||
setProcessing(false);
|
||||
});
|
||||
};
|
||||
|
||||
const renderRestartDialog = () => (
|
||||
<Dialog
|
||||
sx={dialogStyle}
|
||||
@@ -247,15 +266,28 @@ const SystemStatus: FC = () => {
|
||||
>
|
||||
{LL.CANCEL()}
|
||||
</Button>
|
||||
<Button
|
||||
startIcon={<PowerSettingsNewIcon />}
|
||||
variant="outlined"
|
||||
onClick={partition}
|
||||
disabled={processing}
|
||||
color="warning"
|
||||
>
|
||||
EMS-ESP Loader
|
||||
</Button>
|
||||
{data.has_loader && (
|
||||
<Button
|
||||
startIcon={<PowerSettingsNewIcon />}
|
||||
variant="outlined"
|
||||
onClick={factoryPartition}
|
||||
disabled={processing}
|
||||
color="warning"
|
||||
>
|
||||
EMS-ESP Boot
|
||||
</Button>
|
||||
)}
|
||||
{data.has_partition && (
|
||||
<Button
|
||||
startIcon={<PowerSettingsNewIcon />}
|
||||
variant="outlined"
|
||||
onClick={partition}
|
||||
disabled={processing}
|
||||
color="warning"
|
||||
>
|
||||
Partition
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
startIcon={<PowerSettingsNewIcon />}
|
||||
variant="outlined"
|
||||
|
||||
Reference in New Issue
Block a user