mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-27 14:57:20 +00:00
Move companion app config from sidebar to configuration dashboard (#10733)
* Move companion app config from sidebar to configuration dashboard * Remove translation refrence
This commit is contained in:
parent
02644b923f
commit
0611133065
@ -3,7 +3,6 @@ import {
|
|||||||
mdiBell,
|
mdiBell,
|
||||||
mdiCalendar,
|
mdiCalendar,
|
||||||
mdiCart,
|
mdiCart,
|
||||||
mdiCellphoneCog,
|
|
||||||
mdiChartBox,
|
mdiChartBox,
|
||||||
mdiClose,
|
mdiClose,
|
||||||
mdiCog,
|
mdiCog,
|
||||||
@ -45,10 +44,6 @@ import {
|
|||||||
PersistentNotification,
|
PersistentNotification,
|
||||||
subscribeNotifications,
|
subscribeNotifications,
|
||||||
} from "../data/persistent_notification";
|
} from "../data/persistent_notification";
|
||||||
import {
|
|
||||||
ExternalConfig,
|
|
||||||
getExternalConfig,
|
|
||||||
} from "../external_app/external_config";
|
|
||||||
import { actionHandler } from "../panels/lovelace/common/directives/action-handler-directive";
|
import { actionHandler } from "../panels/lovelace/common/directives/action-handler-directive";
|
||||||
import { haStyleScrollbar } from "../resources/styles";
|
import { haStyleScrollbar } from "../resources/styles";
|
||||||
import type { HomeAssistant, PanelInfo, Route } from "../types";
|
import type { HomeAssistant, PanelInfo, Route } from "../types";
|
||||||
@ -195,8 +190,6 @@ class HaSidebar extends LitElement {
|
|||||||
|
|
||||||
@property({ type: Boolean }) public editMode = false;
|
@property({ type: Boolean }) public editMode = false;
|
||||||
|
|
||||||
@state() private _externalConfig?: ExternalConfig;
|
|
||||||
|
|
||||||
@state() private _notifications?: PersistentNotification[];
|
@state() private _notifications?: PersistentNotification[];
|
||||||
|
|
||||||
@state() private _renderEmptySortable = false;
|
@state() private _renderEmptySortable = false;
|
||||||
@ -243,7 +236,6 @@ class HaSidebar extends LitElement {
|
|||||||
changedProps.has("expanded") ||
|
changedProps.has("expanded") ||
|
||||||
changedProps.has("narrow") ||
|
changedProps.has("narrow") ||
|
||||||
changedProps.has("alwaysExpand") ||
|
changedProps.has("alwaysExpand") ||
|
||||||
changedProps.has("_externalConfig") ||
|
|
||||||
changedProps.has("_notifications") ||
|
changedProps.has("_notifications") ||
|
||||||
changedProps.has("editMode") ||
|
changedProps.has("editMode") ||
|
||||||
changedProps.has("_renderEmptySortable") ||
|
changedProps.has("_renderEmptySortable") ||
|
||||||
@ -274,11 +266,6 @@ class HaSidebar extends LitElement {
|
|||||||
protected firstUpdated(changedProps: PropertyValues) {
|
protected firstUpdated(changedProps: PropertyValues) {
|
||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
|
|
||||||
if (this.hass && this.hass.auth.external) {
|
|
||||||
getExternalConfig(this.hass.auth.external).then((conf) => {
|
|
||||||
this._externalConfig = conf;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
subscribeNotifications(this.hass.connection, (notifications) => {
|
subscribeNotifications(this.hass.connection, (notifications) => {
|
||||||
this._notifications = notifications;
|
this._notifications = notifications;
|
||||||
});
|
});
|
||||||
@ -376,7 +363,6 @@ class HaSidebar extends LitElement {
|
|||||||
: this._renderPanels(beforeSpacer)}
|
: this._renderPanels(beforeSpacer)}
|
||||||
${this._renderSpacer()}
|
${this._renderSpacer()}
|
||||||
${this._renderPanels(afterSpacer)}
|
${this._renderPanels(afterSpacer)}
|
||||||
${this._renderExternalConfiguration()}
|
|
||||||
</paper-listbox>
|
</paper-listbox>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@ -561,34 +547,6 @@ class HaSidebar extends LitElement {
|
|||||||
</a>`;
|
</a>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _renderExternalConfiguration() {
|
|
||||||
return html`${this._externalConfig && this._externalConfig.hasSettingsScreen
|
|
||||||
? html`
|
|
||||||
<a
|
|
||||||
aria-role="option"
|
|
||||||
aria-label=${this.hass.localize(
|
|
||||||
"ui.sidebar.external_app_configuration"
|
|
||||||
)}
|
|
||||||
href="#external-app-configuration"
|
|
||||||
tabindex="-1"
|
|
||||||
@click=${this._handleExternalAppConfiguration}
|
|
||||||
@mouseenter=${this._itemMouseEnter}
|
|
||||||
@mouseleave=${this._itemMouseLeave}
|
|
||||||
>
|
|
||||||
<paper-icon-item>
|
|
||||||
<ha-svg-icon
|
|
||||||
slot="item-icon"
|
|
||||||
.path=${mdiCellphoneCog}
|
|
||||||
></ha-svg-icon>
|
|
||||||
<span class="item-text">
|
|
||||||
${this.hass.localize("ui.sidebar.external_app_configuration")}
|
|
||||||
</span>
|
|
||||||
</paper-icon-item>
|
|
||||||
</a>
|
|
||||||
`
|
|
||||||
: ""}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
private get _tooltip() {
|
private get _tooltip() {
|
||||||
return this.shadowRoot!.querySelector(".tooltip")! as HTMLDivElement;
|
return this.shadowRoot!.querySelector(".tooltip")! as HTMLDivElement;
|
||||||
}
|
}
|
||||||
@ -760,13 +718,6 @@ class HaSidebar extends LitElement {
|
|||||||
fireEvent(this, "hass-show-notifications");
|
fireEvent(this, "hass-show-notifications");
|
||||||
}
|
}
|
||||||
|
|
||||||
private _handleExternalAppConfiguration(ev: Event) {
|
|
||||||
ev.preventDefault();
|
|
||||||
this.hass.auth.external!.fireMessage({
|
|
||||||
type: "config_screen/show",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private _toggleSidebar(ev: CustomEvent) {
|
private _toggleSidebar(ev: CustomEvent) {
|
||||||
if (ev.detail.action !== "tap") {
|
if (ev.detail.action !== "tap") {
|
||||||
return;
|
return;
|
||||||
|
@ -1,14 +1,25 @@
|
|||||||
import { mdiCloudLock } from "@mdi/js";
|
import { mdiCellphoneCog, 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 { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import {
|
||||||
import { customElement, property } from "lit/decorators";
|
css,
|
||||||
|
CSSResultGroup,
|
||||||
|
html,
|
||||||
|
LitElement,
|
||||||
|
PropertyValues,
|
||||||
|
TemplateResult,
|
||||||
|
} from "lit";
|
||||||
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
import "../../../components/ha-icon-next";
|
import "../../../components/ha-icon-next";
|
||||||
import "../../../components/ha-menu-button";
|
import "../../../components/ha-menu-button";
|
||||||
import { CloudStatus } from "../../../data/cloud";
|
import { CloudStatus } from "../../../data/cloud";
|
||||||
import { SupervisorAvailableUpdates } from "../../../data/supervisor/supervisor";
|
import { SupervisorAvailableUpdates } from "../../../data/supervisor/supervisor";
|
||||||
|
import {
|
||||||
|
ExternalConfig,
|
||||||
|
getExternalConfig,
|
||||||
|
} from "../../../external_app/external_config";
|
||||||
import "../../../layouts/ha-app-layout";
|
import "../../../layouts/ha-app-layout";
|
||||||
import { haStyle } from "../../../resources/styles";
|
import { haStyle } from "../../../resources/styles";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
@ -32,6 +43,18 @@ class HaConfigDashboard extends LitElement {
|
|||||||
|
|
||||||
@property() public showAdvanced!: boolean;
|
@property() public showAdvanced!: boolean;
|
||||||
|
|
||||||
|
@state() private _externalConfig?: ExternalConfig;
|
||||||
|
|
||||||
|
protected firstUpdated(changedProps: PropertyValues) {
|
||||||
|
super.firstUpdated(changedProps);
|
||||||
|
|
||||||
|
if (this.hass && this.hass.auth.external) {
|
||||||
|
getExternalConfig(this.hass.auth.external).then((conf) => {
|
||||||
|
this._externalConfig = conf;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<ha-app-layout>
|
<ha-app-layout>
|
||||||
@ -86,6 +109,25 @@ class HaConfigDashboard extends LitElement {
|
|||||||
></ha-config-navigation>
|
></ha-config-navigation>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
|
${this._externalConfig?.hasSettingsScreen
|
||||||
|
? html`
|
||||||
|
<ha-config-navigation
|
||||||
|
.hass=${this.hass}
|
||||||
|
.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}
|
||||||
.showAdvanced=${this.showAdvanced}
|
.showAdvanced=${this.showAdvanced}
|
||||||
@ -97,6 +139,13 @@ 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,
|
||||||
|
@ -899,7 +899,6 @@
|
|||||||
"dismiss": "Dismiss"
|
"dismiss": "Dismiss"
|
||||||
},
|
},
|
||||||
"sidebar": {
|
"sidebar": {
|
||||||
"external_app_configuration": "App Configuration",
|
|
||||||
"sidebar_toggle": "Sidebar Toggle",
|
"sidebar_toggle": "Sidebar Toggle",
|
||||||
"done": "Done",
|
"done": "Done",
|
||||||
"hide_panel": "Hide panel",
|
"hide_panel": "Hide panel",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user