From 4188d049cbc7a046fa2c4e1239f1dde75afb2a0a Mon Sep 17 00:00:00 2001 From: tajniak81 <13187254+tajniak81@users.noreply.github.com> Date: Thu, 3 Sep 2026 10:00:48 +0200 Subject: [PATCH] An email is an email, whichever list it arrived in Co-Authored-By: Claude Opus 5 --- Web App/web/src/i18n/da.json | 7 +++++++ Web App/web/src/i18n/en.json | 7 +++++++ Web App/web/src/i18n/pl.json | 7 +++++++ Web App/web/src/views/Charging.vue | 20 +++++++++++++++++--- 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/Web App/web/src/i18n/da.json b/Web App/web/src/i18n/da.json index 68aa14b..bb4d0aa 100644 --- a/Web App/web/src/i18n/da.json +++ b/Web App/web/src/i18n/da.json @@ -284,6 +284,13 @@ "blePassword": "Bluetooth-parringskode", "ownerId": "Ejer-id", "fields": { + "email": "E-mail", + "serial": "Serienummer", + "memberId": "Medlems-id", + "memberType": "Medlemstype", + "userId": "Bruger-id", + "status": "Status", + "inviteLimit": "Invitationsgrænse", "sessions": "Sessioner", "chargeTime": "Opladningstid", "energy": "Opladet energi", diff --git a/Web App/web/src/i18n/en.json b/Web App/web/src/i18n/en.json index 74425c9..128b655 100644 --- a/Web App/web/src/i18n/en.json +++ b/Web App/web/src/i18n/en.json @@ -270,6 +270,13 @@ "blePassword": "Bluetooth pairing code", "ownerId": "Owner id", "fields": { + "email": "Email", + "serial": "Serial", + "memberId": "Member id", + "memberType": "Member type", + "userId": "User id", + "status": "Status", + "inviteLimit": "Invite limit", "sessions": "Sessions", "chargeTime": "Time charging", "energy": "Energy charged", diff --git a/Web App/web/src/i18n/pl.json b/Web App/web/src/i18n/pl.json index 63619e3..e93253c 100644 --- a/Web App/web/src/i18n/pl.json +++ b/Web App/web/src/i18n/pl.json @@ -286,6 +286,13 @@ "blePassword": "Kod parowania Bluetooth", "ownerId": "Identyfikator właściciela", "fields": { + "email": "E-mail", + "serial": "Numer seryjny", + "memberId": "Identyfikator członka", + "memberType": "Typ członka", + "userId": "Identyfikator użytkownika", + "status": "Status", + "inviteLimit": "Limit zaproszeń", "sessions": "Sesje", "chargeTime": "Czas ładowania", "energy": "Naładowana energia", diff --git a/Web App/web/src/views/Charging.vue b/Web App/web/src/views/Charging.vue index 90cc686..504244f 100644 --- a/Web App/web/src/views/Charging.vue +++ b/Web App/web/src/views/Charging.vue @@ -1055,8 +1055,20 @@ const VIEW_FIELDS = { "list[].alias_name": "cardName", "list[].card_number": "cardNumber", "list[].create_time": { label: "added", time: true }, + // Who else the charger is shared with, one person per record. + email: "email", + device_sn: "serial", + member_id: "memberId", + member_type: "memberType", + user_id: "userId", + status: "status", + max_invite_members_count: "inviteLimit", }; +// The name a record carries for itself, in the order the views use one: an RFID +// card is its alias, an endpoint its name, a person their address. +const VIEW_ITEM_TITLES = ["alias_name", "name", "email"]; + // list[0].card_number split into the list, which record, and which field. const VIEW_LIST_KEY = /^([A-Za-z0-9_.]+)\[(\d+)\]\.(.+)$/; @@ -1072,7 +1084,9 @@ function viewTimeValue(v) { // keyed by the cloud's own key when it does not. The key is kept either way — // it is what the row is drawn under and what makes it unique. function viewRow(key, lookup, value) { - const spec = VIEW_FIELDS[lookup]; + // A field inside a list is looked up under its own list first and under the + // bare field name second, so an email is an email whichever list it came in. + const spec = VIEW_FIELDS[lookup] ?? VIEW_FIELDS[lookup.split("].").pop()]; const label = typeof spec === "string" ? spec : spec?.label; return { key, @@ -1100,8 +1114,8 @@ function viewRowGroups(attrs) { const [, list, index, field] = m; const id = `${list}[${index}]`; if (!items.has(id)) { - const label = attrs[`${id}.alias_name`] || attrs[`${id}.name`] || `#${Number(index) + 1}`; - const titleKey = attrs[`${id}.alias_name`] ? `${id}.alias_name` : attrs[`${id}.name`] ? `${id}.name` : ""; + const titleKey = VIEW_ITEM_TITLES.map((f) => `${id}.${f}`).find((k) => attrs[k]) || ""; + const label = attrs[titleKey] || `#${Number(index) + 1}`; items.set(id, { key: id, index: Number(index), label, titleKey, rows: [] }); } const item = items.get(id);