Fix wrong loadpoint title in error messages after UI reorder (#25800)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: andig <184815+andig@users.noreply.github.com> Co-authored-by: naltatis <152287+naltatis@users.noreply.github.com>
This commit is contained in:
parent
a5c73442ee
commit
f2647cdb48
2 changed files with 7 additions and 8 deletions
|
|
@ -13,7 +13,7 @@
|
|||
<div class="d-flex">
|
||||
<Notifications
|
||||
:notifications="notifications"
|
||||
:loadpointTitles="loadpointTitles"
|
||||
:loadpoints="loadpoints"
|
||||
class="me-2"
|
||||
/>
|
||||
<TopNavigation v-bind="topNavigation" />
|
||||
|
|
@ -194,9 +194,6 @@ export default defineComponent({
|
|||
energyflow() {
|
||||
return this.collectProps(Energyflow);
|
||||
},
|
||||
loadpointTitles() {
|
||||
return this.orderedVisibleLoadpoints.map((lp) => lp.displayTitle);
|
||||
},
|
||||
vehicleList() {
|
||||
const vehicles = this.vehicles || {};
|
||||
return Object.entries(vehicles).map(([name, vehicle]) => ({ name, ...vehicle }));
|
||||
|
|
|
|||
|
|
@ -90,14 +90,14 @@
|
|||
import "@h2d2/shopicons/es/regular/exclamationtriangle";
|
||||
import formatter from "@/mixins/formatter";
|
||||
import { defineComponent, type PropType } from "vue";
|
||||
import type { Notification, Timeout } from "@/types/evcc";
|
||||
import type { Notification, Timeout, UiLoadpoint } from "@/types/evcc";
|
||||
|
||||
export default defineComponent({
|
||||
name: "Notifications",
|
||||
mixins: [formatter],
|
||||
props: {
|
||||
notifications: { type: Array as PropType<Notification[]>, default: () => [] },
|
||||
loadpointTitles: { type: Array as PropType<string[]>, default: () => [] },
|
||||
loadpoints: { type: Array as PropType<UiLoadpoint[]>, default: () => [] },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -128,8 +128,10 @@ export default defineComponent({
|
|||
message({ message, lp }: { message: string | string[]; lp?: number }) {
|
||||
const lines = Array.isArray(message) ? message : [message];
|
||||
if (lp) {
|
||||
// add loadpoint title to first line
|
||||
lines[0] = `${this.loadpointTitles[lp - 1] || lp}: ${lines[0]}`;
|
||||
// Find loadpoint by id (which is the original 1-based index)
|
||||
const loadpoint = this.loadpoints.find((l) => l.id === String(lp));
|
||||
const title = loadpoint?.displayTitle || lp;
|
||||
lines[0] = `${title}: ${lines[0]}`;
|
||||
}
|
||||
return lines;
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue