diff --git a/interface/src/api/system.ts b/interface/src/api/system.ts index 7b5e46c7b..be023f9e0 100644 --- a/interface/src/api/system.ts +++ b/interface/src/api/system.ts @@ -18,6 +18,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 diff --git a/interface/src/app/status/Status.tsx b/interface/src/app/status/Status.tsx index 9e8d97327..f918c4fbb 100644 --- a/interface/src/app/status/Status.tsx +++ b/interface/src/app/status/Status.tsx @@ -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 = () => ( { > {LL.CANCEL()} - + {data.has_loader && ( + + )} + {data.has_partition && ( + + )}