further components and bootstrap initial
This commit is contained in:
28
rust/src_webpack/src/ota.ts
Normal file
28
rust/src_webpack/src/ota.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { Controller } from "./main";
|
||||
|
||||
export class OTAView {
|
||||
file1Upload: HTMLInputElement;
|
||||
firmware_buildtime: HTMLDivElement;
|
||||
firmware_githash: HTMLDivElement;
|
||||
|
||||
constructor(controller: Controller) {
|
||||
this.firmware_buildtime = document.getElementById("firmware_buildtime") as HTMLDivElement;
|
||||
this.firmware_githash = document.getElementById("firmware_githash") as HTMLDivElement;
|
||||
|
||||
const file = document.getElementById("firmware_file") as HTMLInputElement;
|
||||
this.file1Upload = file
|
||||
this.file1Upload.onchange = () => {
|
||||
var selectedFile = file.files?.[0];
|
||||
if (selectedFile == null) {
|
||||
//TODO error dialog here
|
||||
return
|
||||
}
|
||||
controller.uploadNewFirmware(selectedFile);
|
||||
};
|
||||
}
|
||||
|
||||
setVersion(versionInfo: VersionInfo) {
|
||||
this.firmware_buildtime.innerText = versionInfo.build_time;
|
||||
this.firmware_githash.innerText = versionInfo.git_hash;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user