mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-09 17:29:50 +03:00
Merge branch 'emsesp:dev' into dev
This commit is contained in:
@@ -13,6 +13,7 @@ export const readSystemStatus = () =>
|
||||
// commands
|
||||
export const restart = () => alovaInstance.Post('/rest/restart');
|
||||
export const partition = () => alovaInstance.Post('/rest/partition');
|
||||
export const factoryPartition = () => alovaInstance.Post('/rest/factoryPartition');
|
||||
export const factoryReset = () => alovaInstance.Post('/rest/factoryReset');
|
||||
|
||||
// SystemLog
|
||||
|
||||
@@ -63,6 +63,10 @@ const SystemStatus = () => {
|
||||
immediate: false
|
||||
});
|
||||
|
||||
const { send: factoryPartitionCommand } = useRequest(SystemApi.factoryPartition(), {
|
||||
immediate: false
|
||||
});
|
||||
|
||||
const {
|
||||
data: data,
|
||||
send: loadData,
|
||||
@@ -230,6 +234,21 @@ const SystemStatus = () => {
|
||||
});
|
||||
};
|
||||
|
||||
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}
|
||||
@@ -248,15 +267,28 @@ const SystemStatus = () => {
|
||||
>
|
||||
{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"
|
||||
|
||||
@@ -24,7 +24,7 @@ export interface HardwareStatus {
|
||||
psram: boolean;
|
||||
psram_size?: number;
|
||||
free_psram?: number;
|
||||
has_loader: boolean;
|
||||
|
||||
free_caps: number;
|
||||
model: string;
|
||||
}
|
||||
@@ -44,6 +44,8 @@ export interface SystemStatus {
|
||||
ap_status: boolean;
|
||||
network_status: NetworkConnectionStatus;
|
||||
wifi_rssi: number;
|
||||
has_loader: boolean;
|
||||
has_partition: boolean;
|
||||
}
|
||||
|
||||
export enum LogLevel {
|
||||
|
||||
Reference in New Issue
Block a user