refactor tank info field names and improve null checks in UI
This commit is contained in:
@@ -226,22 +226,22 @@ export interface Detection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface TankInfo {
|
export interface TankInfo {
|
||||||
/// is there enough water in the tank
|
/// there is enough water in the tank
|
||||||
enough_water: boolean,
|
enough_water: boolean,
|
||||||
/// warning that water needs to be refilled soon
|
/// warning that water needs to be refilled soon
|
||||||
warn_level: boolean,
|
warn_level: boolean,
|
||||||
/// estimation how many ml are still in tank
|
/// estimation how many ml are still in the tank
|
||||||
left_ml: number | null,
|
volume_ml: number | null,
|
||||||
/// if there is was an issue with the water level sensor
|
/// if there is an issue with the water level sensor
|
||||||
sensor_error: string | null,
|
sensor_error: string | null,
|
||||||
/// raw water sensor value
|
/// raw water sensor value
|
||||||
raw: number | null,
|
fill_raw_v: number | null,
|
||||||
/// percent value
|
/// percent value
|
||||||
percent: number | null,
|
fill_pct: number | null,
|
||||||
/// water in tank might be frozen
|
/// water in the tank might be frozen
|
||||||
water_frozen: boolean,
|
water_frozen: boolean,
|
||||||
/// water temperature
|
/// water temperature
|
||||||
water_temp: number | null,
|
water_temp_c: number | null,
|
||||||
temp_sensor_error: string | null
|
temp_sensor_error: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -765,6 +765,11 @@ executeTasksSequentially().then(() => {
|
|||||||
controller.progressview.removeProgress("rebooting");
|
controller.progressview.removeProgress("rebooting");
|
||||||
|
|
||||||
window.addEventListener("beforeunload", (event) => {
|
window.addEventListener("beforeunload", (event) => {
|
||||||
|
// Only check for unsaved changes if initialConfig has been loaded
|
||||||
|
if (controller.initialConfig === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const currentConfig = controller.getConfig();
|
const currentConfig = controller.getConfig();
|
||||||
|
|
||||||
// Check if the current state differs from the initial configuration
|
// Check if the current state differs from the initial configuration
|
||||||
|
|||||||
@@ -93,28 +93,28 @@ export class TankConfigView {
|
|||||||
this.tank_measure_error.innerText = JSON.stringify(tankinfo.sensor_error) ;
|
this.tank_measure_error.innerText = JSON.stringify(tankinfo.sensor_error) ;
|
||||||
this.tank_measure_error_container.classList.remove("hidden")
|
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")
|
this.tank_measure_ml_container.classList.add("hidden")
|
||||||
} else {
|
} 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")
|
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")
|
this.tank_measure_percent_container.classList.add("hidden")
|
||||||
} else {
|
} 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")
|
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")
|
this.tank_measure_temperature_container.classList.add("hidden")
|
||||||
} else {
|
} 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")
|
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")
|
this.tank_measure_rawvolt_container.classList.add("hidden")
|
||||||
} else {
|
} 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")
|
this.tank_measure_rawvolt_container.classList.remove("hidden")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user