backup info and read
This commit is contained in:
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user