mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-01 13:37:47 +00:00
Move companion entry
This commit is contained in:
parent
8f5751d5bb
commit
680e416453
@ -1,4 +1,4 @@
|
|||||||
import { mdiCellphoneCog, mdiCloudLock } from "@mdi/js";
|
import { mdiCloudLock } from "@mdi/js";
|
||||||
import "@polymer/app-layout/app-header/app-header";
|
import "@polymer/app-layout/app-header/app-header";
|
||||||
import "@polymer/app-layout/app-toolbar/app-toolbar";
|
import "@polymer/app-layout/app-toolbar/app-toolbar";
|
||||||
import {
|
import {
|
||||||
@ -110,29 +110,10 @@ class HaConfigDashboard extends LitElement {
|
|||||||
></ha-config-navigation>
|
></ha-config-navigation>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
${this._externalConfig?.hasSettingsScreen
|
|
||||||
? html`
|
|
||||||
<ha-config-navigation
|
|
||||||
.hass=${this.hass}
|
|
||||||
.narrow=${this.narrow}
|
|
||||||
.showAdvanced=${this.showAdvanced}
|
|
||||||
.pages=${[
|
|
||||||
{
|
|
||||||
path: "#external-app-configuration",
|
|
||||||
name: "Companion App",
|
|
||||||
description: "Location and notifications",
|
|
||||||
iconPath: mdiCellphoneCog,
|
|
||||||
iconColor: "#37474F",
|
|
||||||
core: true,
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
@click=${this._handleExternalAppConfiguration}
|
|
||||||
></ha-config-navigation>
|
|
||||||
`
|
|
||||||
: ""}
|
|
||||||
<ha-config-navigation
|
<ha-config-navigation
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
|
.externalConfig=${this._externalConfig}
|
||||||
.showAdvanced=${this.showAdvanced}
|
.showAdvanced=${this.showAdvanced}
|
||||||
.pages=${configSections.dashboard}
|
.pages=${configSections.dashboard}
|
||||||
></ha-config-navigation>
|
></ha-config-navigation>
|
||||||
@ -142,13 +123,6 @@ class HaConfigDashboard extends LitElement {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _handleExternalAppConfiguration(ev: Event) {
|
|
||||||
ev.preventDefault();
|
|
||||||
this.hass.auth.external!.fireMessage({
|
|
||||||
type: "config_screen/show",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
return [
|
return [
|
||||||
haStyle,
|
haStyle,
|
||||||
|
@ -6,6 +6,7 @@ import { canShowPage } from "../../../common/config/can_show_page";
|
|||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
import "../../../components/ha-icon-next";
|
import "../../../components/ha-icon-next";
|
||||||
import { CloudStatus, CloudStatusLoggedIn } from "../../../data/cloud";
|
import { CloudStatus, CloudStatusLoggedIn } from "../../../data/cloud";
|
||||||
|
import { ExternalConfig } from "../../../external_app/external_config";
|
||||||
import { PageNavigation } from "../../../layouts/hass-tabs-subpage";
|
import { PageNavigation } from "../../../layouts/hass-tabs-subpage";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
|
|
||||||
@ -19,10 +20,16 @@ class HaConfigNavigation extends LitElement {
|
|||||||
|
|
||||||
@property() public pages!: PageNavigation[];
|
@property() public pages!: PageNavigation[];
|
||||||
|
|
||||||
|
@property() public externalConfig?: ExternalConfig;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
${this.pages.map((page) =>
|
${this.pages.map((page) =>
|
||||||
canShowPage(this.hass, page)
|
(
|
||||||
|
page.path === "#external-app-configuration"
|
||||||
|
? !this.externalConfig?.hasSettingsScreen
|
||||||
|
: canShowPage(this.hass, page)
|
||||||
|
)
|
||||||
? html`
|
? html`
|
||||||
<a href=${page.path} aria-role="option" tabindex="-1">
|
<a href=${page.path} aria-role="option" tabindex="-1">
|
||||||
<paper-icon-item @click=${this._entryClicked}>
|
<paper-icon-item @click=${this._entryClicked}>
|
||||||
@ -77,6 +84,16 @@ class HaConfigNavigation extends LitElement {
|
|||||||
|
|
||||||
private _entryClicked(ev) {
|
private _entryClicked(ev) {
|
||||||
ev.currentTarget.blur();
|
ev.currentTarget.blur();
|
||||||
|
if (
|
||||||
|
ev.currentTarget.parentElement.href.endsWith(
|
||||||
|
"#external-app-configuration"
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
ev.preventDefault();
|
||||||
|
this.hass.auth.external!.fireMessage({
|
||||||
|
type: "config_screen/show",
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
mdiAccount,
|
mdiAccount,
|
||||||
mdiBadgeAccountHorizontal,
|
mdiBadgeAccountHorizontal,
|
||||||
|
mdiCellphoneCog,
|
||||||
mdiCog,
|
mdiCog,
|
||||||
mdiDevices,
|
mdiDevices,
|
||||||
mdiHomeAssistant,
|
mdiHomeAssistant,
|
||||||
@ -111,6 +112,13 @@ export const configSections: { [name: string]: PageNavigation[] } = {
|
|||||||
iconColor: "#E48629",
|
iconColor: "#E48629",
|
||||||
components: ["person", "zone", "users"],
|
components: ["person", "zone", "users"],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "#external-app-configuration",
|
||||||
|
name: "Companion App",
|
||||||
|
description: "Location and notifications",
|
||||||
|
iconPath: mdiCellphoneCog,
|
||||||
|
iconColor: "#81009D",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/config/core",
|
path: "/config/core",
|
||||||
name: "Settings",
|
name: "Settings",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user