182 files

This commit is contained in:
Home Assistant Version Control
2026-08-17 12:11:35 +00:00
parent 7dddf6bb13
commit ece15a1c1b
183 changed files with 11457 additions and 3092 deletions
@@ -4,7 +4,9 @@ import { LitElement, html, css, nothing } from "lit";
import { applySubscriptionEvent, type SubscriptionEvent } from "./helpers/subscription-merge";
import { hydrateObjects } from "./helpers/hydrate-objects";
import { property, state } from "lit/decorators.js";
import { sharedStyles, STATUS_COLORS, t, ensureLocale, isLocaleLoaded, setDateTimePrefs, formatDueDays } from "./styles";
import { sharedStyles, STATUS_COLORS, t, ensureLocale, isLocaleLoaded, setDateTimePrefs, formatDueDays, langOf } from "./styles";
import { openSignedDocument } from "./helpers/document-url";
import { registerCustomCard } from "./helpers/register-card";
import type {
HomeAssistant,
MaintenanceObjectResponse,
@@ -54,7 +56,7 @@ export class MaintenanceSupporterCard extends LitElement {
private _docsLoadedFor = new Set<string>();
private get _lang(): string {
return this.hass?.language || "en";
return langOf(this.hass);
}
static getConfigElement() {
@@ -240,16 +242,10 @@ export class MaintenanceSupporterCard extends LitElement {
window.open(doc.url, "_blank", "noopener");
return;
}
const win = window.open("about:blank", "_blank");
try {
const signed = await this.hass.connection.sendMessagePromise<{ path: string }>({
type: "auth/sign_path",
path: `/api/maintenance_supporter/document/${doc.id}`,
expires: 300,
});
if (win) win.location.href = new URL(signed.path, window.location.origin).href;
await openSignedDocument(this.hass, doc.id);
} catch {
if (win) win.close();
/* silent — the card has no error surface */
}
}
@@ -696,8 +692,7 @@ if (!customElements.get("maintenance-supporter-card")) {
}
// Register as custom card so the Lovelace card picker lists it.
(window as any).customCards = (window as any).customCards || [];
(window as any).customCards.push({
registerCustomCard({
type: "maintenance-supporter-card",
name: "Maintenance Supporter",
description: "Overview of your maintenance tasks with quick actions.",