An email is an email, whichever list it arrived in

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
tajniak81
2026-09-03 10:00:48 +02:00
co-authored by Claude Opus 5
parent 928a39e03e
commit 4188d049cb
4 changed files with 38 additions and 3 deletions
+7
View File
@@ -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",
+7
View File
@@ -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",
+7
View File
@@ -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",
+17 -3
View File
@@ -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);