From d52afc3f7136e99c8f5424b7fcef3c871dfda560 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 3 Apr 2024 16:11:32 +0200 Subject: [PATCH] Add settings shortcut to scene and script table (#20375) --- src/panels/config/scene/ha-scene-dashboard.ts | 16 ++++++++++++++++ src/panels/config/script/ha-script-picker.ts | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/panels/config/scene/ha-scene-dashboard.ts b/src/panels/config/scene/ha-scene-dashboard.ts index 990ab42656..663d9dc720 100644 --- a/src/panels/config/scene/ha-scene-dashboard.ts +++ b/src/panels/config/scene/ha-scene-dashboard.ts @@ -2,6 +2,7 @@ import { consume } from "@lit-labs/context"; import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; import { mdiChevronRight, + mdiCog, mdiContentDuplicate, mdiDelete, mdiDotsVertical, @@ -82,6 +83,7 @@ import { showAlertDialog, showConfirmationDialog, } from "../../../dialogs/generic/show-dialog-box"; +import { showMoreInfoDialog } from "../../../dialogs/more-info/show-ha-more-info-dialog"; import "../../../layouts/hass-tabs-subpage-data-table"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { haStyle } from "../../../resources/styles"; @@ -283,6 +285,13 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) { ), action: () => this._showInfo(scene), }, + { + path: mdiCog, + label: this.hass.localize( + "ui.panel.config.automation.picker.show_settings" + ), + action: () => this._openSettings(scene), + }, { path: mdiPlay, label: this.hass.localize( @@ -815,6 +824,13 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) { fireEvent(this, "hass-more-info", { entityId: scene.entity_id }); } + private _openSettings(scene: SceneEntity) { + showMoreInfoDialog(this, { + entityId: scene.entity_id, + view: "settings", + }); + } + private _activateScene = async (scene: SceneEntity) => { await activateScene(this.hass, scene.entity_id); showToast(this, { diff --git a/src/panels/config/script/ha-script-picker.ts b/src/panels/config/script/ha-script-picker.ts index 4d0242e934..a548613d1a 100644 --- a/src/panels/config/script/ha-script-picker.ts +++ b/src/panels/config/script/ha-script-picker.ts @@ -1,6 +1,7 @@ import { consume } from "@lit-labs/context"; import { mdiChevronRight, + mdiCog, mdiContentDuplicate, mdiDelete, mdiDotsVertical, @@ -83,6 +84,7 @@ import { showAlertDialog, showConfirmationDialog, } from "../../../dialogs/generic/show-dialog-box"; +import { showMoreInfoDialog } from "../../../dialogs/more-info/show-ha-more-info-dialog"; import "../../../layouts/hass-tabs-subpage-data-table"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { haStyle } from "../../../resources/styles"; @@ -294,6 +296,13 @@ class HaScriptPicker extends SubscribeMixin(LitElement) { ), action: () => this._showInfo(script), }, + { + path: mdiCog, + label: this.hass.localize( + "ui.panel.config.automation.picker.show_settings" + ), + action: () => this._openSettings(script), + }, { path: mdiTag, label: this.hass.localize( @@ -895,6 +904,13 @@ class HaScriptPicker extends SubscribeMixin(LitElement) { fireEvent(this, "hass-more-info", { entityId: script.entity_id }); } + private _openSettings(script: any) { + showMoreInfoDialog(this, { + entityId: script.entity_id, + view: "settings", + }); + } + private _showTrace(script: any) { const entry = this.entityRegistry.find( (e) => e.entity_id === script.entity_id