diff --git a/src/panels/config/automation/ha-automation-picker.ts b/src/panels/config/automation/ha-automation-picker.ts index b5208b944e..ad8be83b6d 100644 --- a/src/panels/config/automation/ha-automation-picker.ts +++ b/src/panels/config/automation/ha-automation-picker.ts @@ -379,7 +379,9 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) { this._navigateEntities(label), + }, + { + label: this.hass.localize("ui.panel.config.devices.caption"), + path: mdiDevices, + action: () => this._navigateDevices(label), + }, + { + label: this.hass.localize("ui.panel.config.automation.caption"), + path: mdiRobot, + action: () => this._navigateAutomations(label), + }, { label: this.hass.localize("ui.common.delete"), path: mdiDelete, @@ -225,6 +248,20 @@ export class HaConfigLabels extends LitElement { return false; } } + + private _navigateEntities(label: LabelRegistryEntry) { + navigate(`/config/entities?historyBack=1&label=${label.label_id}`); + } + + private _navigateDevices(label: LabelRegistryEntry) { + navigate(`/config/devices/dashboard?historyBack=1&label=${label.label_id}`); + } + + private _navigateAutomations(label: LabelRegistryEntry) { + navigate( + `/config/automation/dashboard?historyBack=1&label=${label.label_id}` + ); + } } declare global { diff --git a/src/panels/config/scene/ha-scene-dashboard.ts b/src/panels/config/scene/ha-scene-dashboard.ts index 36826e56df..ece548c706 100644 --- a/src/panels/config/scene/ha-scene-dashboard.ts +++ b/src/panels/config/scene/ha-scene-dashboard.ts @@ -96,6 +96,8 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) { @property({ attribute: false }) public scenes!: SceneEntity[]; + @state() private _searchParms = new URLSearchParams(window.location.search); + @state() private _activeFilters?: string[]; @state() private _filteredScenes?: string[] | null; @@ -530,6 +532,27 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) { this._applyFilters(); } + firstUpdated() { + if (this._searchParms.has("label")) { + this._filterLabel(); + } + } + + private _filterLabel() { + const label = this._searchParms.get("label"); + if (!label) { + return; + } + this._filters = { + ...this._filters, + "ha-filter-labels": { + value: [label], + items: undefined, + }, + }; + this._applyFilters(); + } + private _handleRowClicked(ev: HASSDomEvent) { const scene = this.scenes.find((a) => a.entity_id === ev.detail.id); diff --git a/src/panels/config/script/ha-script-picker.ts b/src/panels/config/script/ha-script-picker.ts index fa9a4b9208..b5ddc8cc22 100644 --- a/src/panels/config/script/ha-script-picker.ts +++ b/src/panels/config/script/ha-script-picker.ts @@ -572,6 +572,24 @@ class HaScriptPicker extends SubscribeMixin(LitElement) { if (this._searchParms.has("blueprint")) { this._filterBlueprint(); } + if (this._searchParms.has("label")) { + this._filterLabel(); + } + } + + private _filterLabel() { + const label = this._searchParms.get("label"); + if (!label) { + return; + } + this._filters = { + ...this._filters, + "ha-filter-labels": { + value: [label], + items: undefined, + }, + }; + this._applyFilters(); } private async _filterBlueprint() {