Every row, every time, dashes included
The information card drew a row only when it had a value, so two chargers side by side had two different shapes and neither could be read against the other — and a field the service is silent about looked the same as a field the card never offers. Every row is drawn now, with a dash where there is nothing to say, which is itself worth seeing. Service id loses the rule that hid it when it matched the serial. Kept, it would have printed a dash for a charger that does have one, and a dash that means "no" where the answer is "the same as above" is worse than the repetition. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
ad785ee9f8
commit
7cbc81778c
@@ -229,10 +229,11 @@ function homeChargerSubtitle(c) {
|
||||
return [c.serial, c.model, c.siteName].filter(Boolean).join(" · ");
|
||||
}
|
||||
|
||||
// Everything the record holds about one charger, as label/value rows. A field
|
||||
// the service never sent is left out rather than shown as a dash: the point of
|
||||
// the card is what is known. The provider's own id for the charger is the serial
|
||||
// for both services we speak to, so it appears only when it is something else.
|
||||
// Everything the card can say about one charger, as label/value rows. Every row
|
||||
// is drawn every time, a field nothing supplied included: which fields a charger
|
||||
// has an answer for is itself worth seeing, and a row that comes and goes with
|
||||
// the data makes two chargers side by side impossible to read against each
|
||||
// other. Nothing to say is said with a dash.
|
||||
function chargerInfoRows(c) {
|
||||
const live = liveFor(c) || {};
|
||||
const rows = [
|
||||
@@ -250,12 +251,14 @@ function chargerInfoRows(c) {
|
||||
// on it here would be inventing it.
|
||||
["chargePower", live.power],
|
||||
["ocpp", ocppStatusLabel(live)],
|
||||
["providerId", c.providerChargerId === c.serial ? "" : c.providerChargerId],
|
||||
["providerId", c.providerChargerId],
|
||||
["added", c.created ? formatDateTime(c.created) : ""],
|
||||
];
|
||||
return rows
|
||||
.filter(([, value]) => value !== "" && value != null)
|
||||
.map(([key, value]) => ({ key, label: t(`charging.info.${key}`), value }));
|
||||
return rows.map(([key, value]) => ({
|
||||
key,
|
||||
label: t(`charging.info.${key}`),
|
||||
value: value === "" || value == null ? "—" : value,
|
||||
}));
|
||||
}
|
||||
|
||||
async function refreshCtl() {
|
||||
|
||||
Reference in New Issue
Block a user