Can manually download an OTA update

This commit is contained in:
2024-10-08 22:13:36 +02:00
parent 6cf7c2cae1
commit 2e4a2b68dd
4 changed files with 53 additions and 8 deletions

View File

@ -37,6 +37,13 @@ export class OTAAPI {
});
}
/**
* Get the link to download an OTA update
*/
static DownloadOTAUpdateURL(platform: string, version: string): string {
return APIClient.backendURL() + `/ota/${platform}/${version}`;
}
/**
* Get the list of OTA updates
*/

View File

@ -1,3 +1,5 @@
import DownloadIcon from "@mui/icons-material/Download";
import FileUploadIcon from "@mui/icons-material/FileUpload";
import {
IconButton,
Paper,
@ -9,13 +11,13 @@ import {
TableRow,
Tooltip,
} from "@mui/material";
import { SolarEnergyRouteContainer } from "../widgets/SolarEnergyRouteContainer";
import FileUploadIcon from "@mui/icons-material/FileUpload";
import { UploadUpdateDialog } from "../dialogs/UploadUpdateDialog";
import { filesize } from "filesize";
import React from "react";
import { OTAAPI, OTAUpdate } from "../api/OTAApi";
import { UploadUpdateDialog } from "../dialogs/UploadUpdateDialog";
import { AsyncWidget } from "../widgets/AsyncWidget";
import { filesize } from "filesize";
import { RouterLink } from "../widgets/RouterLink";
import { SolarEnergyRouteContainer } from "../widgets/SolarEnergyRouteContainer";
export function OTARoute(): React.ReactElement {
const [list, setList] = React.useState<string[] | undefined>();
@ -97,6 +99,7 @@ function _OTAList(p: { list: OTAUpdate[] }): React.ReactElement {
<TableCell align="center">Platform</TableCell>
<TableCell align="center">Version</TableCell>
<TableCell align="center">File size</TableCell>
<TableCell align="center"></TableCell>
</TableRow>
</TableHead>
<TableBody>
@ -105,6 +108,17 @@ function _OTAList(p: { list: OTAUpdate[] }): React.ReactElement {
<TableCell align="center">{row.platform}</TableCell>
<TableCell align="center">{row.version}</TableCell>
<TableCell align="center">{filesize(row.file_size)}</TableCell>
<TableCell align="center">
<Tooltip title="Download a copy of the firmware">
<RouterLink
to={OTAAPI.DownloadOTAUpdateURL(row.platform, row.version)}
>
<IconButton>
<DownloadIcon />
</IconButton>
</RouterLink>
</Tooltip>
</TableCell>
</TableRow>
))}
</TableBody>