mirror of
https://github.com/home-assistant/frontend.git
synced 2025-10-19 16:49:43 +00:00
Compare commits
2 Commits
20251001.4
...
fix-naviga
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9a6e48a82b | ||
![]() |
a8b8fb4c30 |
@@ -164,7 +164,6 @@ export class HaRelatedItems extends LitElement {
|
|||||||
return html`
|
return html`
|
||||||
<a
|
<a
|
||||||
href=${`/config/integrations/integration/${entry.domain}#config_entry=${entry.entry_id}`}
|
href=${`/config/integrations/integration/${entry.domain}#config_entry=${entry.entry_id}`}
|
||||||
@click=${this._navigateAwayClose}
|
|
||||||
>
|
>
|
||||||
<ha-list-item hasMeta graphic="icon">
|
<ha-list-item hasMeta graphic="icon">
|
||||||
<img
|
<img
|
||||||
@@ -191,7 +190,6 @@ export class HaRelatedItems extends LitElement {
|
|||||||
(integration) =>
|
(integration) =>
|
||||||
html`<a
|
html`<a
|
||||||
href=${`/config/integrations/integration/${integration}`}
|
href=${`/config/integrations/integration/${integration}`}
|
||||||
@click=${this._navigateAwayClose}
|
|
||||||
>
|
>
|
||||||
<ha-list-item hasMeta graphic="icon">
|
<ha-list-item hasMeta graphic="icon">
|
||||||
<img
|
<img
|
||||||
@@ -223,10 +221,7 @@ export class HaRelatedItems extends LitElement {
|
|||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<a
|
<a href="/config/devices/device/${relatedDeviceId}">
|
||||||
href="/config/devices/device/${relatedDeviceId}"
|
|
||||||
@click=${this._navigateAwayClose}
|
|
||||||
>
|
|
||||||
<ha-list-item hasMeta graphic="icon">
|
<ha-list-item hasMeta graphic="icon">
|
||||||
<ha-svg-icon
|
<ha-svg-icon
|
||||||
.path=${mdiDevices}
|
.path=${mdiDevices}
|
||||||
@@ -251,10 +246,7 @@ export class HaRelatedItems extends LitElement {
|
|||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<a
|
<a href="/config/areas/area/${relatedAreaId}">
|
||||||
href="/config/areas/area/${relatedAreaId}"
|
|
||||||
@click=${this._navigateAwayClose}
|
|
||||||
>
|
|
||||||
<ha-list-item
|
<ha-list-item
|
||||||
hasMeta
|
hasMeta
|
||||||
.graphic=${area.picture ? "avatar" : "icon"}
|
.graphic=${area.picture ? "avatar" : "icon"}
|
||||||
@@ -364,10 +356,7 @@ export class HaRelatedItems extends LitElement {
|
|||||||
const blueprintMeta = this._blueprints
|
const blueprintMeta = this._blueprints
|
||||||
? this._blueprints.automation[path]
|
? this._blueprints.automation[path]
|
||||||
: undefined;
|
: undefined;
|
||||||
return html`<a
|
return html`<a href="/config/blueprint/dashboard">
|
||||||
href="/config/blueprint/dashboard"
|
|
||||||
@click=${this._navigateAwayClose}
|
|
||||||
>
|
|
||||||
<ha-list-item hasMeta graphic="icon">
|
<ha-list-item hasMeta graphic="icon">
|
||||||
<ha-svg-icon
|
<ha-svg-icon
|
||||||
.path=${mdiPaletteSwatch}
|
.path=${mdiPaletteSwatch}
|
||||||
@@ -421,10 +410,7 @@ export class HaRelatedItems extends LitElement {
|
|||||||
const blueprintMeta = this._blueprints
|
const blueprintMeta = this._blueprints
|
||||||
? this._blueprints.script[path]
|
? this._blueprints.script[path]
|
||||||
: undefined;
|
: undefined;
|
||||||
return html`<a
|
return html`<a href="/config/blueprint/dashboard">
|
||||||
href="/config/blueprint/dashboard"
|
|
||||||
@click=${this._navigateAwayClose}
|
|
||||||
>
|
|
||||||
<ha-list-item hasMeta graphic="icon">
|
<ha-list-item hasMeta graphic="icon">
|
||||||
<ha-svg-icon
|
<ha-svg-icon
|
||||||
.path=${mdiPaletteSwatch}
|
.path=${mdiPaletteSwatch}
|
||||||
@@ -468,14 +454,6 @@ export class HaRelatedItems extends LitElement {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _navigateAwayClose() {
|
|
||||||
// allow new page to open before closing dialog
|
|
||||||
await new Promise((resolve) => {
|
|
||||||
setTimeout(resolve, 0);
|
|
||||||
});
|
|
||||||
fireEvent(this, "close-dialog");
|
|
||||||
}
|
|
||||||
|
|
||||||
private async _findRelated() {
|
private async _findRelated() {
|
||||||
this._related = await findRelated(this.hass, this.itemType, this.itemId);
|
this._related = await findRelated(this.hass, this.itemType, this.itemId);
|
||||||
if (this._related.config_entry) {
|
if (this._related.config_entry) {
|
||||||
|
@@ -3,7 +3,6 @@ import type { PropertyValues } from "lit";
|
|||||||
import { LitElement, css, html, nothing } from "lit";
|
import { LitElement, css, html, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import { isComponentLoaded } from "../../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../../common/config/is_component_loaded";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
|
||||||
import { computeDomain } from "../../common/entity/compute_domain";
|
import { computeDomain } from "../../common/entity/compute_domain";
|
||||||
import { createSearchParam } from "../../common/url/search-params";
|
import { createSearchParam } from "../../common/url/search-params";
|
||||||
import type { ChartResizeOptions } from "../../components/chart/ha-chart-base";
|
import type { ChartResizeOptions } from "../../components/chart/ha-chart-base";
|
||||||
@@ -77,7 +76,7 @@ export class MoreInfoHistory extends LitElement {
|
|||||||
</div>
|
</div>
|
||||||
${__DEMO__
|
${__DEMO__
|
||||||
? nothing
|
? nothing
|
||||||
: html`<a href=${this._showMoreHref} @click=${this._close}
|
: html`<a href=${this._showMoreHref}
|
||||||
>${this.hass.localize(
|
>${this.hass.localize(
|
||||||
"ui.dialogs.more_info_control.show_more"
|
"ui.dialogs.more_info_control.show_more"
|
||||||
)}</a
|
)}</a
|
||||||
@@ -244,10 +243,6 @@ export class MoreInfoHistory extends LitElement {
|
|||||||
this._setRedrawTimer();
|
this._setRedrawTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _close(): void {
|
|
||||||
setTimeout(() => fireEvent(this, "close-dialog"), 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
static styles = css`
|
static styles = css`
|
||||||
.header {
|
.header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@@ -4,7 +4,6 @@ import { css, html, LitElement, nothing } from "lit";
|
|||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { isComponentLoaded } from "../../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../../common/config/is_component_loaded";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
|
||||||
import { createSearchParam } from "../../common/url/search-params";
|
import { createSearchParam } from "../../common/url/search-params";
|
||||||
import "../../panels/logbook/ha-logbook";
|
import "../../panels/logbook/ha-logbook";
|
||||||
import type { HomeAssistant } from "../../types";
|
import type { HomeAssistant } from "../../types";
|
||||||
@@ -36,7 +35,7 @@ export class MoreInfoLogbook extends LitElement {
|
|||||||
<div class="title">
|
<div class="title">
|
||||||
${this.hass.localize("ui.dialogs.more_info_control.logbook")}
|
${this.hass.localize("ui.dialogs.more_info_control.logbook")}
|
||||||
</div>
|
</div>
|
||||||
<a href=${this._showMoreHref} @click=${this._close}
|
<a href=${this._showMoreHref}
|
||||||
>${this.hass.localize("ui.dialogs.more_info_control.show_more")}</a
|
>${this.hass.localize("ui.dialogs.more_info_control.show_more")}</a
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@@ -67,10 +66,6 @@ export class MoreInfoLogbook extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _close(): void {
|
|
||||||
setTimeout(() => fireEvent(this, "close-dialog"), 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
css`
|
css`
|
||||||
|
@@ -142,7 +142,7 @@ export class HaVoiceCommandDialog extends LitElement {
|
|||||||
${this.hass.user?.is_admin
|
${this.hass.user?.is_admin
|
||||||
? html`<li divider role="separator"></li>
|
? html`<li divider role="separator"></li>
|
||||||
<a href="/config/voice-assistants/assistants"
|
<a href="/config/voice-assistants/assistants"
|
||||||
><ha-list-item @click=${this.closeDialog}
|
><ha-list-item
|
||||||
>${this.hass.localize(
|
>${this.hass.localize(
|
||||||
"ui.dialogs.voice_command.manage_assistants"
|
"ui.dialogs.voice_command.manage_assistants"
|
||||||
)}</ha-list-item
|
)}</ha-list-item
|
||||||
|
@@ -237,7 +237,6 @@ class HaDomainIntegrations extends LitElement {
|
|||||||
["cloud", "google_assistant", "alexa"].includes(domain) &&
|
["cloud", "google_assistant", "alexa"].includes(domain) &&
|
||||||
isComponentLoaded(this.hass, "cloud")
|
isComponentLoaded(this.hass, "cloud")
|
||||||
) {
|
) {
|
||||||
fireEvent(this, "close-dialog");
|
|
||||||
navigate("/config/cloud");
|
navigate("/config/cloud");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -33,6 +33,7 @@ import { documentationUrl } from "../../../util/documentation-url";
|
|||||||
import { showAddUserDialog } from "../users/show-dialog-add-user";
|
import { showAddUserDialog } from "../users/show-dialog-add-user";
|
||||||
import { showAdminChangePasswordDialog } from "../users/show-dialog-admin-change-password";
|
import { showAdminChangePasswordDialog } from "../users/show-dialog-admin-change-password";
|
||||||
import type { PersonDetailDialogParams } from "./show-dialog-person-detail";
|
import type { PersonDetailDialogParams } from "./show-dialog-person-detail";
|
||||||
|
import { fireEvent } from "../../../common/dom/fire_event";
|
||||||
|
|
||||||
const includeDomains = ["device_tracker"];
|
const includeDomains = ["device_tracker"];
|
||||||
|
|
||||||
@@ -101,6 +102,20 @@ class DialogPersonDetail extends LitElement {
|
|||||||
await this.updateComplete;
|
await this.updateComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public closeDialog() {
|
||||||
|
// If we do not have a person ID yet (= person creation dialog was just cancelled), but
|
||||||
|
// we already created a user ID for it, delete it now to not have it "free floating".
|
||||||
|
if (!this._personExists && this._userId) {
|
||||||
|
const callback = this._params?.refreshUsers;
|
||||||
|
deleteUser(this.hass, this._userId).then(() => {
|
||||||
|
callback?.();
|
||||||
|
});
|
||||||
|
this._userId = undefined;
|
||||||
|
}
|
||||||
|
this._params = undefined;
|
||||||
|
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||||
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
if (!this._params) {
|
if (!this._params) {
|
||||||
return nothing;
|
return nothing;
|
||||||
@@ -109,7 +124,7 @@ class DialogPersonDetail extends LitElement {
|
|||||||
return html`
|
return html`
|
||||||
<ha-dialog
|
<ha-dialog
|
||||||
open
|
open
|
||||||
@closed=${this._close}
|
@closed=${this.closeDialog}
|
||||||
scrimClickAction
|
scrimClickAction
|
||||||
escapeKeyAction
|
escapeKeyAction
|
||||||
.heading=${createCloseHeading(
|
.heading=${createCloseHeading(
|
||||||
@@ -163,7 +178,7 @@ class DialogPersonDetail extends LitElement {
|
|||||||
</ha-settings-row>
|
</ha-settings-row>
|
||||||
|
|
||||||
${this._renderUserFields()}
|
${this._renderUserFields()}
|
||||||
${this._deviceTrackersAvailable(this.hass)
|
${!this._deviceTrackersAvailable(this.hass)
|
||||||
? html`
|
? html`
|
||||||
<p>
|
<p>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
@@ -205,10 +220,7 @@ class DialogPersonDetail extends LitElement {
|
|||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a @click=${this.closeDialog} href="/config/integrations">
|
||||||
@click=${this._closeDialog}
|
|
||||||
href="/config/integrations"
|
|
||||||
>
|
|
||||||
${this.hass!.localize(
|
${this.hass!.localize(
|
||||||
"ui.panel.config.person.detail.link_integrations_page"
|
"ui.panel.config.person.detail.link_integrations_page"
|
||||||
)}</a
|
)}</a
|
||||||
@@ -329,10 +341,6 @@ class DialogPersonDetail extends LitElement {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _closeDialog() {
|
|
||||||
this._params = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
private _nameChanged(ev) {
|
private _nameChanged(ev) {
|
||||||
this._error = undefined;
|
this._error = undefined;
|
||||||
this._name = ev.target.value;
|
this._name = ev.target.value;
|
||||||
@@ -496,7 +504,7 @@ class DialogPersonDetail extends LitElement {
|
|||||||
await this._params!.createEntry(values);
|
await this._params!.createEntry(values);
|
||||||
this._personExists = true;
|
this._personExists = true;
|
||||||
}
|
}
|
||||||
this._params = undefined;
|
this.closeDialog();
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this._error = err ? err.message : "Unknown error";
|
this._error = err ? err.message : "Unknown error";
|
||||||
} finally {
|
} finally {
|
||||||
@@ -511,25 +519,13 @@ class DialogPersonDetail extends LitElement {
|
|||||||
if (this._params!.entry!.user_id) {
|
if (this._params!.entry!.user_id) {
|
||||||
deleteUser(this.hass, this._params!.entry!.user_id);
|
deleteUser(this.hass, this._params!.entry!.user_id);
|
||||||
}
|
}
|
||||||
this._params = undefined;
|
this.closeDialog();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
this._submitting = false;
|
this._submitting = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _close(): void {
|
|
||||||
// If we do not have a person ID yet (= person creation dialog was just cancelled), but
|
|
||||||
// we already created a user ID for it, delete it now to not have it "free floating".
|
|
||||||
if (!this._personExists && this._userId) {
|
|
||||||
deleteUser(this.hass, this._userId);
|
|
||||||
this._params?.refreshUsers();
|
|
||||||
this._userId = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._params = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
return [
|
return [
|
||||||
haStyleDialog,
|
haStyleDialog,
|
||||||
|
@@ -181,11 +181,7 @@ export class DialogVoiceAssistantPipelineDetail extends LitElement {
|
|||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.voice_assistants.assistants.pipeline.detail.no_cloud_message"
|
"ui.panel.config.voice_assistants.assistants.pipeline.detail.no_cloud_message"
|
||||||
)}
|
)}
|
||||||
<a
|
<a href="/config/cloud" slot="action">
|
||||||
href="/config/cloud"
|
|
||||||
slot="action"
|
|
||||||
@click=${this.closeDialog}
|
|
||||||
>
|
|
||||||
<ha-button>
|
<ha-button>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.voice_assistants.assistants.pipeline.detail.no_cloud_action"
|
"ui.panel.config.voice_assistants.assistants.pipeline.detail.no_cloud_action"
|
||||||
|
Reference in New Issue
Block a user