456 files
This commit is contained in:
@@ -19,6 +19,7 @@ import { historyPhotoIds } from "../helpers/history-photos";
|
||||
import { renderRefChip } from "../helpers/reference";
|
||||
import { entryReadingValues } from "../helpers/reading-slots";
|
||||
import { matchesQuery } from "../helpers/search-match";
|
||||
import { historyNoteText } from "../helpers/history-note";
|
||||
|
||||
/** v2.2.0: only "lifecycle + cost-bearing" entries are user-editable.
|
||||
* Triggers are auto-generated by sensors and shouldn't be retroactively
|
||||
@@ -131,7 +132,13 @@ export function renderHistoryList(task: MaintenanceTask, ctx: HistoryContext) {
|
||||
if (ctx.search) {
|
||||
const search = ctx.search.toLowerCase();
|
||||
// #170: "8.3-2" (or just "-2") in the notes filter finds the entry by number.
|
||||
filtered = filtered.filter((h) => matchesQuery(h.notes, ctx.search) || (entryRefOf(ctx, h) ?? "").toLowerCase().endsWith(search));
|
||||
// The shown (translated) text of a note the backend wrote matches too.
|
||||
filtered = filtered.filter(
|
||||
(h) =>
|
||||
matchesQuery(h.notes, ctx.search) ||
|
||||
matchesQuery(historyNoteText(h.notes, L), ctx.search) ||
|
||||
(entryRefOf(ctx, h) ?? "").toLowerCase().endsWith(search),
|
||||
);
|
||||
}
|
||||
|
||||
if (filtered.length === 0) {
|
||||
@@ -213,7 +220,7 @@ export function renderHistoryEntry(entry: HistoryEntry, ctx: HistoryEntryContext
|
||||
: nothing}
|
||||
</div>
|
||||
<div class="history-date">${formatDateTime(entry.timestamp, L)}</div>
|
||||
${entry.notes ? html`<div>${entry.notes}</div>` : nothing}
|
||||
${entry.notes ? html`<div>${historyNoteText(entry.notes, L)}</div>` : nothing}
|
||||
${renderHistoryPhotos(ctx.hass, entry)}
|
||||
${renderHistoryReadings(entry, ctx)}
|
||||
${entry.cost != null || entry.duration != null || entry.trigger_value != null
|
||||
|
||||
@@ -185,6 +185,18 @@ export function renderTriggerProgress(row: TaskRow | MaintenanceTask, opts?: { t
|
||||
return nothing;
|
||||
}
|
||||
|
||||
// The battery-fleet task's sensor counts the batteries to replace against
|
||||
// an "above 0" limit — the generic label read "4.0 / 0 batteries", like a
|
||||
// broken ratio, and the zero limit's 100-wide scale painted an empty fleet
|
||||
// as a full red bar. Say what the number means and fill toward the count
|
||||
// that triggers.
|
||||
if (row.battery_fleet_task && triggerType === "threshold" && row.trigger_current_value != null) {
|
||||
const count = Math.round(row.trigger_current_value);
|
||||
const limit = tc.trigger_above ?? 0;
|
||||
pct = count > limit ? 100 : limit > 0 ? Math.max(0, (count / (limit + 1)) * 100) : 0;
|
||||
label = t("battery_fleet_progress", opts?.lang ?? "en").replace("{n}", formatNumber(count, opts?.lang, 0));
|
||||
}
|
||||
|
||||
const triggerOverflow = pct >= 100;
|
||||
const barColor = pct > 90 ? "var(--error-color, #f44336)"
|
||||
: pct > 70 ? "var(--warning-color, #ff9800)"
|
||||
|
||||
Reference in New Issue
Block a user