refactor tank info field names and improve null checks in UI

This commit is contained in:
2026-05-27 15:18:46 +02:00
parent f5f73723d1
commit 3618b3329c
3 changed files with 21 additions and 16 deletions

View File

@@ -226,22 +226,22 @@ export interface Detection {
}
export interface TankInfo {
/// is there enough water in the tank
/// there is enough water in the tank
enough_water: boolean,
/// warning that water needs to be refilled soon
warn_level: boolean,
/// estimation how many ml are still in tank
left_ml: number | null,
/// if there is was an issue with the water level sensor
/// estimation how many ml are still in the tank
volume_ml: number | null,
/// if there is an issue with the water level sensor
sensor_error: string | null,
/// raw water sensor value
raw: number | null,
fill_raw_v: number | null,
/// percent value
percent: number | null,
/// water in tank might be frozen
fill_pct: number | null,
/// water in the tank might be frozen
water_frozen: boolean,
/// water temperature
water_temp: number | null,
water_temp_c: number | null,
temp_sensor_error: string | null
}

View File

@@ -765,6 +765,11 @@ executeTasksSequentially().then(() => {
controller.progressview.removeProgress("rebooting");
window.addEventListener("beforeunload", (event) => {
// Only check for unsaved changes if initialConfig has been loaded
if (controller.initialConfig === null) {
return;
}
const currentConfig = controller.getConfig();
// Check if the current state differs from the initial configuration

View File

@@ -93,28 +93,28 @@ export class TankConfigView {
this.tank_measure_error.innerText = JSON.stringify(tankinfo.sensor_error) ;
this.tank_measure_error_container.classList.remove("hidden")
}
if (tankinfo.left_ml == null){
if (tankinfo.volume_ml == null){
this.tank_measure_ml_container.classList.add("hidden")
} else {
this.tank_measure_ml.innerText = tankinfo.left_ml.toString();
this.tank_measure_ml.innerText = tankinfo.volume_ml.toString();
this.tank_measure_ml_container.classList.remove("hidden")
}
if (tankinfo.percent == null){
if (tankinfo.fill_pct == null){
this.tank_measure_percent_container.classList.add("hidden")
} else {
this.tank_measure_percent.innerText = tankinfo.percent.toString();
this.tank_measure_percent.innerText = tankinfo.fill_pct.toString();
this.tank_measure_percent_container.classList.remove("hidden")
}
if (tankinfo.water_temp == null){
if (tankinfo.water_temp_c == null){
this.tank_measure_temperature_container.classList.add("hidden")
} else {
this.tank_measure_temperature.innerText = tankinfo.water_temp.toString();
this.tank_measure_temperature.innerText = tankinfo.water_temp_c.toString();
this.tank_measure_temperature_container.classList.remove("hidden")
}
if (tankinfo.raw == null){
if (tankinfo.fill_raw_v == null){
this.tank_measure_rawvolt_container.classList.add("hidden")
} else {
this.tank_measure_rawvolt.innerText = tankinfo.raw.toString();
this.tank_measure_rawvolt.innerText = tankinfo.fill_raw_v.toString();
this.tank_measure_rawvolt_container.classList.remove("hidden")
}