From 5c78b740053ea450848a5364c2d289d296216704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Tue, 7 Dec 2021 00:10:50 +0100 Subject: [PATCH] Reorder configuration (#10817) --- .../config/blueprint/ha-blueprint-overview.ts | 2 +- .../config/dashboard/ha-config-dashboard.ts | 30 +----------- .../config/dashboard/ha-config-navigation.ts | 19 +++++++- src/panels/config/ha-panel-config.ts | 46 +++++++++++-------- .../config/helpers/ha-config-helpers.ts | 2 +- 5 files changed, 49 insertions(+), 50 deletions(-) diff --git a/src/panels/config/blueprint/ha-blueprint-overview.ts b/src/panels/config/blueprint/ha-blueprint-overview.ts index 0e65094222..35fd53a523 100644 --- a/src/panels/config/blueprint/ha-blueprint-overview.ts +++ b/src/panels/config/blueprint/ha-blueprint-overview.ts @@ -224,7 +224,7 @@ class HaBlueprintOverview extends LitElement { .narrow=${this.narrow} back-path="/config" .route=${this.route} - .tabs=${configSections.automations} + .tabs=${configSections.blueprints} .columns=${this._columns(this.narrow, this.hass.language)} .data=${this._processedBlueprints(this.blueprints)} id="entity_id" diff --git a/src/panels/config/dashboard/ha-config-dashboard.ts b/src/panels/config/dashboard/ha-config-dashboard.ts index 3d7dc017f8..5e033fcf4c 100644 --- a/src/panels/config/dashboard/ha-config-dashboard.ts +++ b/src/panels/config/dashboard/ha-config-dashboard.ts @@ -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-toolbar/app-toolbar"; import { @@ -110,29 +110,10 @@ class HaConfigDashboard extends LitElement { > ` : ""} - ${this._externalConfig?.hasSettingsScreen - ? html` - - ` - : ""} @@ -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 { return [ haStyle, diff --git a/src/panels/config/dashboard/ha-config-navigation.ts b/src/panels/config/dashboard/ha-config-navigation.ts index b577fe1abe..a076385d10 100644 --- a/src/panels/config/dashboard/ha-config-navigation.ts +++ b/src/panels/config/dashboard/ha-config-navigation.ts @@ -6,6 +6,7 @@ import { canShowPage } from "../../../common/config/can_show_page"; import "../../../components/ha-card"; import "../../../components/ha-icon-next"; import { CloudStatus, CloudStatusLoggedIn } from "../../../data/cloud"; +import { ExternalConfig } from "../../../external_app/external_config"; import { PageNavigation } from "../../../layouts/hass-tabs-subpage"; import { HomeAssistant } from "../../../types"; @@ -19,10 +20,16 @@ class HaConfigNavigation extends LitElement { @property() public pages!: PageNavigation[]; + @property() public externalConfig?: ExternalConfig; + protected render(): TemplateResult { return html` ${this.pages.map((page) => - canShowPage(this.hass, page) + ( + page.path === "#external-app-configuration" + ? this.externalConfig?.hasSettingsScreen + : canShowPage(this.hass, page) + ) ? html` @@ -77,6 +84,16 @@ class HaConfigNavigation extends LitElement { private _entryClicked(ev) { 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 { diff --git a/src/panels/config/ha-panel-config.ts b/src/panels/config/ha-panel-config.ts index 333d87a27f..9b1a3243db 100644 --- a/src/panels/config/ha-panel-config.ts +++ b/src/panels/config/ha-panel-config.ts @@ -1,6 +1,7 @@ import { mdiAccount, mdiBadgeAccountHorizontal, + mdiCellphoneCog, mdiCog, mdiDevices, mdiHomeAssistant, @@ -57,22 +58,22 @@ export const configSections: { [name: string]: PageNavigation[] } = { { path: "/config/automation", name: "Automations & Scenes", - description: "Automations, blueprints, scenes and scripts", + description: "Manage automations, scenes, scripts and helpers", iconPath: mdiRobot, iconColor: "#518C43", - components: ["automation", "blueprint", "scene", "script"], - }, - { - path: "/config/helpers", - name: "Automation Helpers", - description: "Elements that help build automations", - iconPath: mdiTools, - iconColor: "#4D2EA4", core: true, }, + { + path: "/config/blueprint", + name: "Blueprints", + description: "Manage blueprints", + iconPath: mdiPaletteSwatch, + iconColor: "#64B5F6", + component: "blueprint", + }, { path: "/hassio", - name: "Add-ons & Backups (Supervisor)", + name: "Add-ons, Backups & Supervisor", description: "Create backups, check logs or reboot your system", iconPath: mdiHomeAssistant, iconColor: "#4084CD", @@ -111,6 +112,13 @@ export const configSections: { [name: string]: PageNavigation[] } = { iconColor: "#E48629", components: ["person", "zone", "users"], }, + { + path: "#external-app-configuration", + name: "Companion App", + description: "Location and notifications", + iconPath: mdiCellphoneCog, + iconColor: "#8E24AA", + }, { path: "/config/core", name: "Settings", @@ -155,13 +163,6 @@ export const configSections: { [name: string]: PageNavigation[] } = { }, ], automations: [ - { - component: "blueprint", - path: "/config/blueprint", - translationKey: "ui.panel.config.blueprint.caption", - iconPath: mdiPaletteSwatch, - iconColor: "#518C43", - }, { component: "automation", path: "/config/automation", @@ -183,8 +184,6 @@ export const configSections: { [name: string]: PageNavigation[] } = { iconPath: mdiScriptText, iconColor: "#518C43", }, - ], - helpers: [ { component: "helpers", path: "/config/helpers", @@ -194,6 +193,15 @@ export const configSections: { [name: string]: PageNavigation[] } = { core: true, }, ], + blueprints: [ + { + component: "blueprint", + path: "/config/blueprint", + translationKey: "ui.panel.config.blueprint.caption", + iconPath: mdiPaletteSwatch, + iconColor: "#518C43", + }, + ], tags: [ { component: "tag", diff --git a/src/panels/config/helpers/ha-config-helpers.ts b/src/panels/config/helpers/ha-config-helpers.ts index d33d73e32b..3a54f1de0a 100644 --- a/src/panels/config/helpers/ha-config-helpers.ts +++ b/src/panels/config/helpers/ha-config-helpers.ts @@ -132,7 +132,7 @@ export class HaConfigHelpers extends LitElement { .narrow=${this.narrow} back-path="/config" .route=${this.route} - .tabs=${configSections.helpers} + .tabs=${configSections.automations} .columns=${this._columns(this.narrow, this.hass.language)} .data=${this._getItems(this._stateItems)} @row-click=${this._openEditDialog}