mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-22 00:36:34 +00:00
Rename 'quick open dialog' to 'quick bar' (#7286)
This commit is contained in:
parent
f7a9ecff21
commit
c219f64322
@ -20,7 +20,7 @@ import { componentsWithService } from "../../common/config/components_with_servi
|
||||
import { domainIcon } from "../../common/entity/domain_icon";
|
||||
import { computeDomain } from "../../common/entity/compute_domain";
|
||||
import { domainToName } from "../../data/integration";
|
||||
import { QuickOpenDialogParams } from "./show-dialog-quick-open";
|
||||
import { QuickBarParams } from "./show-dialog-quick-bar";
|
||||
import { HassEntity } from "home-assistant-js-websocket";
|
||||
import { compare } from "../../common/string/compare";
|
||||
import memoizeOne from "memoize-one";
|
||||
@ -29,8 +29,8 @@ interface CommandItem extends ServiceCallRequest {
|
||||
text: string;
|
||||
}
|
||||
|
||||
@customElement("ha-quick-open-dialog")
|
||||
export class QuickOpenDialog extends LitElement {
|
||||
@customElement("ha-quick-bar")
|
||||
export class QuickBar extends LitElement {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
|
||||
@internalProperty() private _commandItems: CommandItem[] = [];
|
||||
@ -41,7 +41,7 @@ export class QuickOpenDialog extends LitElement {
|
||||
|
||||
@internalProperty() private _commandMode = false;
|
||||
|
||||
public async showDialog(params: QuickOpenDialogParams) {
|
||||
public async showDialog(params: QuickBarParams) {
|
||||
this._commandMode = params.commandMode || false;
|
||||
this._opened = true;
|
||||
this._commandItems = this._generateCommandItems();
|
||||
@ -67,7 +67,7 @@ export class QuickOpenDialog extends LitElement {
|
||||
class="heading"
|
||||
@value-changed=${this._entityFilterChanged}
|
||||
.label=${this.hass.localize(
|
||||
"ui.dialogs.quick-open.filter_placeholder"
|
||||
"ui.dialogs.quick-bar.filter_placeholder"
|
||||
)}
|
||||
type="search"
|
||||
value=${this._commandMode ? `>${this._itemFilter}` : this._itemFilter}
|
||||
@ -138,9 +138,9 @@ export class QuickOpenDialog extends LitElement {
|
||||
|
||||
return reloadableDomains.map((domain) => ({
|
||||
text:
|
||||
this.hass.localize(`ui.dialogs.quick-open.commands.reload.${domain}`) ||
|
||||
this.hass.localize(`ui.dialogs.quick-bar.commands.reload.${domain}`) ||
|
||||
this.hass.localize(
|
||||
"ui.dialogs.quick-open.commands.reload.reload",
|
||||
"ui.dialogs.quick-bar.commands.reload.reload",
|
||||
"domain",
|
||||
domainToName(this.hass.localize, domain)
|
||||
),
|
||||
@ -220,6 +220,6 @@ export class QuickOpenDialog extends LitElement {
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-quick-open-dialog": QuickOpenDialog;
|
||||
"ha-quick-bar": QuickBar;
|
||||
}
|
||||
}
|
20
src/dialogs/quick-bar/show-dialog-quick-bar.ts
Normal file
20
src/dialogs/quick-bar/show-dialog-quick-bar.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { fireEvent } from "../../common/dom/fire_event";
|
||||
|
||||
export interface QuickBarParams {
|
||||
entityFilter?: string;
|
||||
commandMode?: boolean;
|
||||
}
|
||||
|
||||
export const loadQuickBar = () =>
|
||||
import(/* webpackChunkName: "quick-bar-dialog" */ "./ha-quick-bar");
|
||||
|
||||
export const showQuickBar = (
|
||||
element: HTMLElement,
|
||||
dialogParams: QuickBarParams
|
||||
): void => {
|
||||
fireEvent(element, "show-dialog", {
|
||||
dialogTag: "ha-quick-bar",
|
||||
dialogImport: loadQuickBar,
|
||||
dialogParams,
|
||||
});
|
||||
};
|
@ -1,20 +0,0 @@
|
||||
import { fireEvent } from "../../common/dom/fire_event";
|
||||
|
||||
export interface QuickOpenDialogParams {
|
||||
entityFilter?: string;
|
||||
commandMode?: boolean;
|
||||
}
|
||||
|
||||
export const loadQuickOpenDialog = () =>
|
||||
import(/* webpackChunkName: "quick-open-dialog" */ "./ha-quick-open-dialog");
|
||||
|
||||
export const showQuickOpenDialog = (
|
||||
element: HTMLElement,
|
||||
dialogParams: QuickOpenDialogParams
|
||||
): void => {
|
||||
fireEvent(element, "show-dialog", {
|
||||
dialogTag: "ha-quick-open-dialog",
|
||||
dialogImport: loadQuickOpenDialog,
|
||||
dialogParams,
|
||||
});
|
||||
};
|
@ -17,10 +17,10 @@ import {
|
||||
import "./ha-init-page";
|
||||
import "./home-assistant-main";
|
||||
import { storeState } from "../util/ha-pref-storage";
|
||||
import QuickOpenMixin from "../state/quick-open-mixin";
|
||||
import QuickBarMixin from "../state/quick-bar-mixin";
|
||||
|
||||
@customElement("home-assistant")
|
||||
export class HomeAssistantAppEl extends QuickOpenMixin(HassElement) {
|
||||
export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
|
||||
@internalProperty() private _route?: Route;
|
||||
|
||||
@internalProperty() private _error = false;
|
||||
|
@ -1,13 +1,13 @@
|
||||
import type { Constructor, PropertyValues } from "lit-element";
|
||||
import { HassElement } from "./hass-element";
|
||||
import {
|
||||
QuickOpenDialogParams,
|
||||
showQuickOpenDialog,
|
||||
} from "../dialogs/quick-open/show-dialog-quick-open";
|
||||
QuickBarParams,
|
||||
showQuickBar,
|
||||
} from "../dialogs/quick-bar/show-dialog-quick-bar";
|
||||
|
||||
declare global {
|
||||
interface HASSDomEvents {
|
||||
"hass-quick-open": QuickOpenDialogParams;
|
||||
"hass-quick-bar": QuickBarParams;
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,12 +19,12 @@ export default <T extends Constructor<HassElement>>(superClass: T) =>
|
||||
document.addEventListener("keydown", (e: KeyboardEvent) => {
|
||||
if (e.code === "KeyP" && e.metaKey) {
|
||||
e.preventDefault();
|
||||
const eventParams: QuickOpenDialogParams = {};
|
||||
const eventParams: QuickBarParams = {};
|
||||
if (e.shiftKey) {
|
||||
eventParams.commandMode = true;
|
||||
}
|
||||
|
||||
showQuickOpenDialog(this, eventParams);
|
||||
showQuickBar(this, eventParams);
|
||||
}
|
||||
});
|
||||
}
|
@ -446,7 +446,7 @@
|
||||
}
|
||||
},
|
||||
"dialogs": {
|
||||
"quick-open": {
|
||||
"quick-bar": {
|
||||
"commands": {
|
||||
"reload": {
|
||||
"reload": "[%key:ui::panel::config::server_control::section::reloading::reload%]",
|
||||
|
Loading…
x
Reference in New Issue
Block a user