From cb7251cb5e49ea8a3a64ddaf3149e4366468f527 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 5 May 2025 12:54:33 -0400 Subject: [PATCH] Reorder my links (#25319) --- src/panels/my/ha-panel-my.ts | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/panels/my/ha-panel-my.ts b/src/panels/my/ha-panel-my.ts index c308cc32e4..d41ef36863 100644 --- a/src/panels/my/ha-panel-my.ts +++ b/src/panels/my/ha-panel-my.ts @@ -16,6 +16,11 @@ import "../../layouts/hass-error-screen"; import type { HomeAssistant, Route } from "../../types"; import { documentationUrl } from "../../util/documentation-url"; +// When a user presses "m", the user is redirected to the first redirect +// for which holds true currentPath.startsWith(redirect.redirect) +// That's why redirects should be sorted with more specific ones first +// Or else pressing "M" will link to the higher level page. + export const getMyRedirects = (): Redirects => ({ application_credentials: { redirect: "/config/application_credentials", @@ -73,15 +78,15 @@ export const getMyRedirects = (): Redirects => ({ brand: "string", }, }, - integrations: { - redirect: "/config/integrations", - }, integration: { redirect: "/config/integrations/integration", params: { domain: "string", }, }, + integrations: { + redirect: "/config/integrations", + }, config_mqtt: { component: "mqtt", redirect: "/config/mqtt", @@ -106,10 +111,6 @@ export const getMyRedirects = (): Redirects => ({ component: "matter", redirect: "/config/matter/add", }, - config_bluetooth: { - component: "bluetooth", - redirect: "/config/bluetooth", - }, bluetooth_advertisement_monitor: { component: "bluetooth", redirect: "/config/bluetooth/advertisement-monitor", @@ -118,6 +119,10 @@ export const getMyRedirects = (): Redirects => ({ component: "bluetooth", redirect: "/config/bluetooth/connection-monitor", }, + config_bluetooth: { + component: "bluetooth", + redirect: "/config/bluetooth", + }, config_dhcp: { component: "dhcp", redirect: "/config/dhcp", @@ -252,12 +257,12 @@ export const getMyRedirects = (): Redirects => ({ // customize was removed in 2021.12, fallback to dashboard redirect: "/config/dashboard", }, - profile: { - redirect: "/profile", - }, profile_security: { redirect: "/profile/security", }, + profile: { + redirect: "/profile", + }, logbook: { component: "logbook", redirect: "/logbook", @@ -270,10 +275,6 @@ export const getMyRedirects = (): Redirects => ({ component: "media_source", redirect: "/media-browser", }, - backup: { - component: "backup", - redirect: "/config/backup", - }, backup_list: { component: "backup", redirect: "/config/backup/backups", @@ -282,6 +283,10 @@ export const getMyRedirects = (): Redirects => ({ component: "backup", redirect: "/config/backup/settings", }, + backup: { + component: "backup", + redirect: "/config/backup", + }, supervisor_snapshots: { component: "backup", redirect: "/config/backup",