Fix card editor help links (#25408)

This commit is contained in:
karwosts 2025-05-09 09:38:03 -07:00 committed by Bram Kragten
parent 724df18175
commit 75a2c061c2
2 changed files with 19 additions and 6 deletions

View File

@ -110,11 +110,7 @@ export class HuiDialogEditCard
}
protected updated(changedProps: PropertyValues): void {
if (
!this._cardConfig ||
this._documentationURL !== undefined ||
!changedProps.has("_cardConfig")
) {
if (!this._cardConfig || !changedProps.has("_cardConfig")) {
return;
}

View File

@ -7,6 +7,23 @@ import {
import type { HomeAssistant } from "../../../types";
import { documentationUrl } from "../../../util/documentation-url";
const NON_STANDARD_URLS = {
"energy-date-selection": "energy/#energy-date-picker",
"energy-usage-graph": "energy/#energy-usage-graph",
"energy-solar-graph": "energy/#solar-production-graph",
"energy-gas-graph": "energy/#gas-consumption-graph",
"energy-water-graph": "energy/#water-consumption-graph",
"energy-distribution": "energy/#energy-distribution",
"energy-sources-table": "energy/#energy-sources-table",
"energy-grid-neutrality-gauge": "energy/#grid-neutrality-gauge",
"energy-solar-consumed-gauge": "energy/#solar-consumed-gauge",
"energy-carbon-consumed-gauge": "energy/#carbon-consumed-gauge",
"energy-self-sufficiency-gauge": "energy/#self-sufficiency-gauge",
"energy-devices-graph": "energy/#devices-energy-graph",
"energy-devices-detail-graph": "energy/#detail-devices-energy-graph",
"energy-sankey": "energy/#sankey-energy-graph",
};
export const getCardDocumentationURL = (
hass: HomeAssistant,
type: string
@ -15,7 +32,7 @@ export const getCardDocumentationURL = (
return getCustomCardEntry(stripCustomPrefix(type))?.documentationURL;
}
return `${documentationUrl(hass, "/dashboards/")}${type}`;
return `${documentationUrl(hass, "/dashboards/")}${NON_STANDARD_URLS[type] || type}`;
};
export const getBadgeDocumentationURL = (