From 052744e3d177b46200feb611009aae84d03603bb Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 2 Jan 2025 17:18:34 +0100 Subject: [PATCH] Update and add backup my links (#23556) * Update and add backup my links --- src/panels/my/ha-panel-my.ts | 30 ++++++++++++++++++------------ src/state/quick-bar-mixin.ts | 4 +--- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/panels/my/ha-panel-my.ts b/src/panels/my/ha-panel-my.ts index cab1cfbafb09..c2ae6a8e72d1 100644 --- a/src/panels/my/ha-panel-my.ts +++ b/src/panels/my/ha-panel-my.ts @@ -16,7 +16,7 @@ import "../../layouts/hass-error-screen"; import type { HomeAssistant, Route } from "../../types"; import { documentationUrl } from "../../util/documentation-url"; -export const getMyRedirects = (hasSupervisor: boolean): Redirects => ({ +export const getMyRedirects = (): Redirects => ({ application_credentials: { redirect: "/config/application_credentials", }, @@ -244,16 +244,24 @@ export const getMyRedirects = (hasSupervisor: boolean): Redirects => ({ redirect: "/media-browser", }, backup: { - component: hasSupervisor ? "hassio" : "backup", - redirect: hasSupervisor ? "/hassio/backups" : "/config/backup", + component: "backup", + redirect: "/config/backup", + }, + backup_list: { + component: "backup", + redirect: "/config/backup/backups", + }, + backup_config: { + component: "backup", + redirect: "/config/backup/settings", }, supervisor_snapshots: { - component: hasSupervisor ? "hassio" : "backup", - redirect: hasSupervisor ? "/hassio/backups" : "/config/backup", + component: "backup", + redirect: "/config/backup", }, supervisor_backups: { - component: hasSupervisor ? "hassio" : "backup", - redirect: hasSupervisor ? "/hassio/backups" : "/config/backup", + component: "backup", + redirect: "/config/backup", }, supervisor_system: { // Moved from Supervisor panel in 2022.5 @@ -278,10 +286,8 @@ export const getMyRedirects = (hasSupervisor: boolean): Redirects => ({ }, }); -const getRedirect = ( - path: string, - hasSupervisor: boolean -): Redirect | undefined => getMyRedirects(hasSupervisor)?.[path]; +const getRedirect = (path: string): Redirect | undefined => + getMyRedirects()?.[path]; export type ParamType = "url" | "string" | "string?"; @@ -314,7 +320,7 @@ class HaPanelMy extends LitElement { const path = this.route.path.substring(1); const hasSupervisor = isComponentLoaded(this.hass, "hassio"); - this._redirect = getRedirect(path, hasSupervisor); + this._redirect = getRedirect(path); if (path.startsWith("supervisor") && this._redirect === undefined) { if (!hasSupervisor) { diff --git a/src/state/quick-bar-mixin.ts b/src/state/quick-bar-mixin.ts index 30a96e7e9366..daea4440796a 100644 --- a/src/state/quick-bar-mixin.ts +++ b/src/state/quick-bar-mixin.ts @@ -150,9 +150,7 @@ export default >(superClass: T) => const myPanel = await import("../panels/my/ha-panel-my"); - for (const [slug, redirect] of Object.entries( - myPanel.getMyRedirects(isHassio) - )) { + for (const [slug, redirect] of Object.entries(myPanel.getMyRedirects())) { if (targetPath.startsWith(redirect.redirect)) { myParams.append("redirect", slug); if (redirect.params) {