backup info and read

This commit is contained in:
2025-01-22 22:21:54 +01:00
parent 8cc967cf68
commit 88be5951a6
9 changed files with 131 additions and 29 deletions

View File

@@ -19,6 +19,17 @@ import { BatteryView } from "./batteryview";
import { FileView } from './fileview';
export class Controller {
getBackupInfo() {
fetch(PUBLIC_URL + "/backup_info")
.then(response => response.json())
.then(json => json as BackupHeader)
.then(header => {
controller.submitView.setBackupInfo(header)
})
.catch(error => {
console.log(error);
});
}
updateFileList() {
fetch(PUBLIC_URL + "/files")
.then(response => response.json())
@@ -142,10 +153,10 @@ export class Controller {
getBackupConfig() {
controller.progressview.addIndeterminate("get_backup_config", "Downloading Backup")
fetch(PUBLIC_URL + "/get_backup_config")
.then(response => response.json())
.then(response => response.text())
.then(loaded => {
controller.progressview.removeProgress("get_config")
alert(loaded)
controller.progressview.removeProgress("get_backup_config")
controller.submitView.setBackupJson(loaded);
})
}
@@ -399,5 +410,6 @@ controller.downloadConfig();
//controller.measure_moisture();
controller.version();
controller.updateFileList();
controller.getBackupInfo();
controller.progressview.removeProgress("rebooting");