mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 17:56:46 +00:00
Focus search input on dev tools statistics page when using search shortcut (#23738)
This commit is contained in:
parent
e703750136
commit
8bc78ba793
@ -49,6 +49,7 @@ import type { HomeAssistant } from "../../../types";
|
|||||||
import { showConfirmationDialog } from "../../lovelace/custom-card-helpers";
|
import { showConfirmationDialog } from "../../lovelace/custom-card-helpers";
|
||||||
import { fixStatisticsIssue } from "./fix-statistics";
|
import { fixStatisticsIssue } from "./fix-statistics";
|
||||||
import { showStatisticsAdjustSumDialog } from "./show-dialog-statistics-adjust-sum";
|
import { showStatisticsAdjustSumDialog } from "./show-dialog-statistics-adjust-sum";
|
||||||
|
import { KeyboardShortcutMixin } from "../../../mixins/keyboard-shortcut-mixin";
|
||||||
|
|
||||||
const FIX_ISSUES_ORDER: Record<StatisticsValidationResult["type"], number> = {
|
const FIX_ISSUES_ORDER: Record<StatisticsValidationResult["type"], number> = {
|
||||||
no_state: 0,
|
no_state: 0,
|
||||||
@ -77,7 +78,7 @@ type DisplayedStatisticData = StatisticData & {
|
|||||||
};
|
};
|
||||||
|
|
||||||
@customElement("developer-tools-statistics")
|
@customElement("developer-tools-statistics")
|
||||||
class HaPanelDevStatistics extends LitElement {
|
class HaPanelDevStatistics extends KeyboardShortcutMixin(LitElement) {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
@property({ type: Boolean }) public narrow = false;
|
@property({ type: Boolean }) public narrow = false;
|
||||||
@ -108,6 +109,8 @@ class HaPanelDevStatistics extends LitElement {
|
|||||||
|
|
||||||
@query("#sort-by-menu") private _sortByMenu!: HaMenu;
|
@query("#sort-by-menu") private _sortByMenu!: HaMenu;
|
||||||
|
|
||||||
|
@query("search-input-outlined") private _searchInput!: HTMLElement;
|
||||||
|
|
||||||
private _toggleGroupBy() {
|
private _toggleGroupBy() {
|
||||||
this._groupByMenu.open = !this._groupByMenu.open;
|
this._groupByMenu.open = !this._groupByMenu.open;
|
||||||
}
|
}
|
||||||
@ -682,6 +685,12 @@ class HaPanelDevStatistics extends LitElement {
|
|||||||
this._validateStatistics();
|
this._validateStatistics();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected supportedShortcuts(): SupportedShortcuts {
|
||||||
|
return {
|
||||||
|
f: () => this._searchInput.focus(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
return [
|
return [
|
||||||
haStyle,
|
haStyle,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user