Hide edit and delete actions for YAML dashboards in config (#29368)

YAML dashboards are defined in configuration files and cannot be
modified or deleted through the UI. This change ensures the edit
and delete actions are only shown for storage-mode dashboards.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Paul Bottein 2026-02-03 15:25:40 +01:00 committed by GitHub
parent fcc6f1b5e9
commit 0eb7229819
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View File

@ -80,7 +80,7 @@ export class DialogLovelaceDashboardDetail extends LitElement {
)}
>
<div>
${this._params.dashboard && !this._params.dashboard.id
${this._params.dashboard?.mode === "yaml"
? this.hass.localize(
"ui.panel.config.lovelace.dashboards.cant_edit_yaml"
)
@ -97,7 +97,7 @@ export class DialogLovelaceDashboardDetail extends LitElement {
</div>
${this._params.urlPath
? html`
${this._params.dashboard?.id
${this._params.dashboard?.mode === "storage"
? html`
<ha-button
slot="secondaryAction"
@ -123,7 +123,7 @@ export class DialogLovelaceDashboardDetail extends LitElement {
dialogInitialFocus
>
${this._params.urlPath
? this._params.dashboard?.id
? this._params.dashboard?.mode === "storage"
? this.hass.localize(
"ui.panel.config.lovelace.dashboards.detail.update"
)
@ -232,8 +232,9 @@ export class DialogLovelaceDashboardDetail extends LitElement {
}
private async _updateDashboard() {
if (this._params?.urlPath && !this._params.dashboard?.id) {
if (this._params?.urlPath && this._params.dashboard?.mode === "yaml") {
this.closeDialog();
return;
}
this._submitting = true;
try {

View File

@ -281,7 +281,8 @@ export class HaConfigLovelaceDashboards extends LitElement {
action: () => this._handleSetAsDefault(dashboard),
disabled: dashboard.default,
},
...(dashboard.type === "user_created"
...(dashboard.type === "user_created" &&
dashboard.mode === "storage"
? [
{
path: mdiPencil,