Add settings shortcut to scene and script table (#20375)

This commit is contained in:
Bram Kragten 2024-04-03 16:11:32 +02:00 committed by GitHub
parent 92f6083e0b
commit d52afc3f71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 0 deletions

View File

@ -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, {

View File

@ -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