Can download a copy of storage
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
31
central_frontend/src/routes/ManagementRoute.tsx
Normal file
31
central_frontend/src/routes/ManagementRoute.tsx
Normal file
@ -0,0 +1,31 @@
|
||||
import { Button } from "@mui/material";
|
||||
import { useConfirm } from "../hooks/context_providers/ConfirmDialogProvider";
|
||||
import { SolarEnergyRouteContainer } from "../widgets/SolarEnergyRouteContainer";
|
||||
import { APIClient } from "../api/ApiClient";
|
||||
|
||||
export function ManagementRoute(): React.ReactElement {
|
||||
const confirm = useConfirm();
|
||||
|
||||
const downloadBackup = async () => {
|
||||
try {
|
||||
if (
|
||||
!(await confirm(
|
||||
`Do you really want to download a copy of the storage? It will contain sensitive information!`
|
||||
))
|
||||
)
|
||||
return;
|
||||
|
||||
location.href = APIClient.backendURL() + "/management/download_storage";
|
||||
} catch (e) {
|
||||
console.error(`Failed to donwload a backup of the storage! Error: ${e}`);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<SolarEnergyRouteContainer label="Management">
|
||||
<Button variant="outlined" onClick={downloadBackup}>
|
||||
Download a backup of storage
|
||||
</Button>
|
||||
</SolarEnergyRouteContainer>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user