webapp: Make compiler happy

This commit is contained in:
Thomas Basler
2025-08-26 20:34:49 +02:00
parent 8608af2995
commit c12663a359
2 changed files with 17 additions and 13 deletions

View File

@@ -165,17 +165,19 @@ export default defineComponent({
return this.$t('dtuadmin.dBm', { dbm: this.$n(this.dtuConfigList.cmt_palevel * 1) });
},
cmtMinFrequency() {
return this.dtuConfigList.country_def[this.dtuConfigList.cmt_country].freq_min;
return this.dtuConfigList.country_def?.[this.dtuConfigList.cmt_country]?.freq_min;
},
cmtMaxFrequency() {
return this.dtuConfigList.country_def[this.dtuConfigList.cmt_country].freq_max;
return this.dtuConfigList.country_def?.[this.dtuConfigList.cmt_country]?.freq_max;
},
cmtIsOutOfLegalRange() {
const country = this.dtuConfigList.country_def?.[this.dtuConfigList.cmt_country];
if (!country) {
return false;
}
return (
this.dtuConfigList.cmt_frequency <
this.dtuConfigList.country_def[this.dtuConfigList.cmt_country].freq_legal_min ||
this.dtuConfigList.cmt_frequency >
this.dtuConfigList.country_def[this.dtuConfigList.cmt_country].freq_legal_max
this.dtuConfigList.cmt_frequency < country.freq_legal_min ||
this.dtuConfigList.cmt_frequency > country.freq_legal_max
);
},
},
@@ -184,7 +186,9 @@ export default defineComponent({
// Don't do anything on initial load (then oldValue equals undefined)
if (oldValue != undefined) {
this.$nextTick(() => {
this.dtuConfigList.cmt_frequency = this.dtuConfigList.country_def[newValue].freq_default;
if (this.dtuConfigList.country_def[newValue]) {
this.dtuConfigList.cmt_frequency = this.dtuConfigList.country_def[newValue].freq_default;
}
});
}
},

View File

@@ -44,7 +44,7 @@
}"
>
{{ $n(inverter.AC[0]?.Power?.v || 0, 'decimalNoDigits') }}
{{ inverter.AC[0].Power?.u }}
{{ inverter.AC[0]?.Power?.u }}
</span>
<span v-else class="badge text-bg-light">-</span>
</div>
@@ -196,11 +196,11 @@
(chanType.name == 'DC' && getSumIrridiation(inverter) == 0) ||
(chanType.name == 'DC' &&
getSumIrridiation(inverter) > 0 &&
chanType.obj[channel].Irradiation?.max) ||
chanType.obj[channel]?.Irradiation?.max) ||
0 > 0
"
>
<div class="col">
<div class="col" v-if="chanType.obj[channel]">
<InverterChannelInfo
:channelData="chanType.obj[channel]"
:channelType="chanType.name"
@@ -557,7 +557,7 @@ export default defineComponent({
},
data() {
return {
isLogged: this.isLoggedIn(),
isLogged: isLoggedIn(),
socket: {} as WebSocket,
heartInterval: 0,
@@ -705,7 +705,7 @@ export default defineComponent({
if (foundIdx == -1) {
Object.assign(this.liveData.inverters, newData.inverters);
this.liveData.inverters.forEach((inv) => this.resetDataAging(inv));
} else {
} else if (this.liveData.inverters[foundIdx]) {
Object.assign(this.liveData.inverters[foundIdx], newData.inverters[0]);
this.resetDataAging(this.liveData.inverters[foundIdx]);
}
@@ -945,7 +945,7 @@ export default defineComponent({
getSumIrridiation(inv: Inverter): number {
let total = 0;
Object.keys(inv.DC).forEach((key) => {
total += inv.DC[key as unknown as number].Irradiation?.max || 0;
total += inv.DC[key as unknown as number]?.Irradiation?.max || 0;
});
return total;
},