198 files

This commit is contained in:
Home Assistant Version Control committed 2026-10-11 23:51:59 +00:00
1 parent 4a64770282
commit 669d229519
198 files changed
+4891 -2815

No files matched your search

@@ -1,7 +1,7 @@
/** Maintenance Supporter Sidebar Panel. */
import { LitElement, html, nothing, type TemplateResult } from "lit";
import { isSafeHttpUrl } from "./helpers/url";
import { isSafeLink } from "./helpers/url";
import { queryTokens, scoreFields } from "./helpers/search-match";
import { objectRef, parseRef, renderRefChip, taskRef, type HasRef } from "./helpers/reference";
import { applySubscriptionEvent, type SubscriptionEvent } from "./helpers/subscription-merge";
@@ -13,6 +13,7 @@ import { LS_KEYS, lsGet, lsSet } from "./helpers/storage-keys";
import { openHtmlInNewTab, openSignedDocument, preopenTab, signApiPath } from "./helpers/document-url";
import { readObjectsCache, writeObjectsCache } from "./helpers/objects-cache";
import { hydrateObjects } from "./helpers/hydrate-objects";
import { taskIsFor, taskUserIds } from "./helpers/assignees";
import { daysProgress } from "./helpers/interval";
import { buildObjectReportHtml, type ReportLabels } from "./helpers/report";
import { warrantyStatus } from "./helpers/warranty";
@@ -1215,7 +1216,8 @@ export class MaintenanceSupporterPanel extends LitElement {
const userId = this._filterUser === "current_user"
? this._userService?.getCurrentUserId()
: this._filterUser;
if (task.responsible_user_id !== userId) continue;
// Theirs, or shared with them while nobody is responsible.
if (!taskIsFor(task, userId)) continue;
}
// Label filter (v2.26 — also captured by saved views)
@@ -1907,7 +1909,7 @@ export class MaintenanceSupporterPanel extends LitElement {
case "document":
case "content":
if (r.docKind === "weblink") {
if (isSafeHttpUrl(r.url)) window.open(r.url!, "_blank", "noopener");
if (isSafeLink(r.url)) window.open(r.url!, "_blank", "noopener");
} else if (r.docId) {
// A content hit opens the PDF on the matching page (browser viewers
// honour #page=N; the Companion app's external viewer may not).
@@ -3044,7 +3046,7 @@ export class MaintenanceSupporterPanel extends LitElement {
* Companion-safe recipe as the documents section). */
private _openManualDoc(doc: ManualDocRef): void {
if (doc.kind !== "file") {
if (isSafeHttpUrl(doc.url)) window.open(doc.url!, "_blank", "noopener");
if (isSafeLink(doc.url)) window.open(doc.url!, "_blank", "noopener");
return;
}
void openSignedDocument(this.hass, doc.id).catch(() => {
@@ -3544,12 +3546,12 @@ export class MaintenanceSupporterPanel extends LitElement {
const archivedCount = this._objects.reduce(
(n, o) => n + o.tasks.filter((tk) => tk.archived).length, 0,
);
// The people someone can filter by: everyone responsible for a task, plus
// The people someone can filter by: everyone a task is meant for, plus
// the person a saved view narrows to — otherwise that view leaves the
// select blank while it filters.
const filterPeople = new Set<string>();
for (const o of this._objects) {
for (const tk of o.tasks) if (tk.responsible_user_id) filterPeople.add(tk.responsible_user_id);
for (const tk of o.tasks) for (const id of taskUserIds(tk)) filterPeople.add(id);
}
if (this._filterUser && this._filterUser !== "current_user") filterPeople.add(this._filterUser);
const personOptions = [...filterPeople]
@@ -4411,7 +4413,7 @@ export class MaintenanceSupporterPanel extends LitElement {
// handbook attached must not render "—" here (prod: Easee vs Epson).
const manualDoc = (o.manual_docs || [])[0];
return html`<td class="oc-documentation_url">${
isSafeHttpUrl(o.documentation_url)
isSafeLink(o.documentation_url)
? html`<a href=${o.documentation_url} target="_blank" rel="noopener noreferrer"
@click=${(e: Event) => e.stopPropagation()}><ha-icon icon="mdi:file-document-outline"></ha-icon></a>`
: manualDoc
@@ -4789,7 +4791,7 @@ export class MaintenanceSupporterPanel extends LitElement {
${o.place_missing ? html`<span class="place-missing-badge">${t("place_missing", L)}</span>` : nothing}
</p>`
: nothing}
${isSafeHttpUrl(o.documentation_url)
${isSafeLink(o.documentation_url)
? html`<p class="meta">${t("documentation_url_label", L)}:
<a href=${o.documentation_url} target="_blank" rel="noopener noreferrer">${o.documentation_url}</a>
</p>`