Use startsWith for m shortcut for partial match (#12464)

This commit is contained in:
Joakim Sørensen 2022-04-27 15:10:38 +02:00 committed by GitHub
parent ebc807a6a4
commit 307cd5ad8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -41,15 +41,15 @@ export const getMyRedirects = (hasSupervisor: boolean): Redirects => ({
component: "cloud",
redirect: "/config/cloud",
},
integrations: {
redirect: "/config/integrations",
},
config_flow_start: {
redirect: "/config/integrations/add",
params: {
domain: "string",
},
},
integrations: {
redirect: "/config/integrations",
},
config_mqtt: {
component: "mqtt",
redirect: "/config/mqtt",
@ -79,10 +79,6 @@ export const getMyRedirects = (hasSupervisor: boolean): Redirects => ({
areas: {
redirect: "/config/areas/dashboard",
},
blueprints: {
component: "blueprint",
redirect: "/config/blueprint/dashboard",
},
blueprint_import: {
component: "blueprint",
redirect: "/config/blueprint/dashboard/import",
@ -90,6 +86,10 @@ export const getMyRedirects = (hasSupervisor: boolean): Redirects => ({
blueprint_url: "url",
},
},
blueprints: {
component: "blueprint",
redirect: "/config/blueprint/dashboard",
},
automations: {
component: "automation",
redirect: "/config/automation/dashboard",

View File

@ -73,7 +73,7 @@ export default <T extends Constructor<HassElement>>(superClass: T) =>
for (const [slug, redirect] of Object.entries(
myPanel.getMyRedirects(isComponentLoaded(this.hass, "hassio"))
)) {
if (redirect.redirect === targetPath) {
if (targetPath.startsWith(redirect.redirect)) {
window.open(
`https://my.home-assistant.io/create-link/?redirect=${slug}`,
"_blank"