mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 23:06:40 +00:00
My redirects tweaks (#8447)
This commit is contained in:
parent
bde925a0e3
commit
5c66a02711
@ -11,6 +11,7 @@ import memoizeOne from "memoize-one";
|
|||||||
import { LocalStorage } from "../../../common/decorators/local-storage";
|
import { LocalStorage } from "../../../common/decorators/local-storage";
|
||||||
import { computeDomain } from "../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||||
import { computeObjectId } from "../../../common/entity/compute_object_id";
|
import { computeObjectId } from "../../../common/entity/compute_object_id";
|
||||||
|
import { extractSearchParam } from "../../../common/url/search-params";
|
||||||
import "../../../components/buttons/ha-progress-button";
|
import "../../../components/buttons/ha-progress-button";
|
||||||
import "../../../components/entity/ha-entity-picker";
|
import "../../../components/entity/ha-entity-picker";
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
@ -40,7 +41,14 @@ class HaPanelDevService extends LitElement {
|
|||||||
|
|
||||||
protected firstUpdated(params) {
|
protected firstUpdated(params) {
|
||||||
super.firstUpdated(params);
|
super.firstUpdated(params);
|
||||||
if (!this._serviceData?.service) {
|
const serviceParam = extractSearchParam("service");
|
||||||
|
if (serviceParam) {
|
||||||
|
this._serviceData = {
|
||||||
|
service: serviceParam,
|
||||||
|
target: {},
|
||||||
|
data: {},
|
||||||
|
};
|
||||||
|
} else if (!this._serviceData?.service) {
|
||||||
const domain = Object.keys(this.hass.services).sort()[0];
|
const domain = Object.keys(this.hass.services).sort()[0];
|
||||||
const service = Object.keys(this.hass.services[domain]).sort()[0];
|
const service = Object.keys(this.hass.services[domain]).sort()[0];
|
||||||
this._serviceData = {
|
this._serviceData = {
|
||||||
|
@ -15,6 +15,7 @@ import {
|
|||||||
import "../../layouts/hass-error-screen";
|
import "../../layouts/hass-error-screen";
|
||||||
import { isComponentLoaded } from "../../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../../common/config/is_component_loaded";
|
||||||
import { domainToName } from "../../data/integration";
|
import { domainToName } from "../../data/integration";
|
||||||
|
import { documentationUrl } from "../../util/documentation-url";
|
||||||
|
|
||||||
const REDIRECTS: Redirects = {
|
const REDIRECTS: Redirects = {
|
||||||
developer_states: {
|
developer_states: {
|
||||||
@ -23,12 +24,21 @@ const REDIRECTS: Redirects = {
|
|||||||
developer_services: {
|
developer_services: {
|
||||||
redirect: "/developer-tools/service",
|
redirect: "/developer-tools/service",
|
||||||
},
|
},
|
||||||
|
developer_call_service: {
|
||||||
|
redirect: "/developer-tools/service",
|
||||||
|
params: {
|
||||||
|
service: "string",
|
||||||
|
},
|
||||||
|
},
|
||||||
developer_template: {
|
developer_template: {
|
||||||
redirect: "/developer-tools/template",
|
redirect: "/developer-tools/template",
|
||||||
},
|
},
|
||||||
developer_events: {
|
developer_events: {
|
||||||
redirect: "/developer-tools/event",
|
redirect: "/developer-tools/event",
|
||||||
},
|
},
|
||||||
|
config: {
|
||||||
|
redirect: "/config",
|
||||||
|
},
|
||||||
cloud: {
|
cloud: {
|
||||||
component: "cloud",
|
component: "cloud",
|
||||||
redirect: "/config/cloud",
|
redirect: "/config/cloud",
|
||||||
@ -42,6 +52,18 @@ const REDIRECTS: Redirects = {
|
|||||||
domain: "string",
|
domain: "string",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
config_mqtt: {
|
||||||
|
component: "mqtt",
|
||||||
|
redirect: "/config/mqtt",
|
||||||
|
},
|
||||||
|
config_zha: {
|
||||||
|
component: "zha",
|
||||||
|
redirect: "/config/zha/dashboard",
|
||||||
|
},
|
||||||
|
config_zwave_js: {
|
||||||
|
component: "zwave_js",
|
||||||
|
redirect: "/config/zwave_js/dashboard",
|
||||||
|
},
|
||||||
devices: {
|
devices: {
|
||||||
redirect: "/config/devices/dashboard",
|
redirect: "/config/devices/dashboard",
|
||||||
},
|
},
|
||||||
@ -52,39 +74,49 @@ const REDIRECTS: Redirects = {
|
|||||||
redirect: "/config/areas/dashboard",
|
redirect: "/config/areas/dashboard",
|
||||||
},
|
},
|
||||||
blueprints: {
|
blueprints: {
|
||||||
|
component: "blueprint",
|
||||||
redirect: "/config/blueprint/dashboard",
|
redirect: "/config/blueprint/dashboard",
|
||||||
},
|
},
|
||||||
blueprint_import: {
|
blueprint_import: {
|
||||||
|
component: "blueprint",
|
||||||
redirect: "/config/blueprint/dashboard/import",
|
redirect: "/config/blueprint/dashboard/import",
|
||||||
params: {
|
params: {
|
||||||
blueprint_url: "url",
|
blueprint_url: "url",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
automations: {
|
automations: {
|
||||||
|
component: "automation",
|
||||||
redirect: "/config/automation/dashboard",
|
redirect: "/config/automation/dashboard",
|
||||||
},
|
},
|
||||||
scenes: {
|
scenes: {
|
||||||
|
component: "scene",
|
||||||
redirect: "/config/scene/dashboard",
|
redirect: "/config/scene/dashboard",
|
||||||
},
|
},
|
||||||
scripts: {
|
scripts: {
|
||||||
|
component: "script",
|
||||||
redirect: "/config/script/dashboard",
|
redirect: "/config/script/dashboard",
|
||||||
},
|
},
|
||||||
helpers: {
|
helpers: {
|
||||||
redirect: "/config/helpers",
|
redirect: "/config/helpers",
|
||||||
},
|
},
|
||||||
tags: {
|
tags: {
|
||||||
|
component: "tags",
|
||||||
redirect: "/config/tags",
|
redirect: "/config/tags",
|
||||||
},
|
},
|
||||||
lovelace_dashboards: {
|
lovelace_dashboards: {
|
||||||
|
component: "lovelace",
|
||||||
redirect: "/config/lovelace/dashboards",
|
redirect: "/config/lovelace/dashboards",
|
||||||
},
|
},
|
||||||
lovelace_resources: {
|
lovelace_resources: {
|
||||||
|
component: "lovelace",
|
||||||
redirect: "/config/lovelace/resources",
|
redirect: "/config/lovelace/resources",
|
||||||
},
|
},
|
||||||
people: {
|
people: {
|
||||||
|
component: "person",
|
||||||
redirect: "/config/person",
|
redirect: "/config/person",
|
||||||
},
|
},
|
||||||
zones: {
|
zones: {
|
||||||
|
component: "zone",
|
||||||
redirect: "/config/zone",
|
redirect: "/config/zone",
|
||||||
},
|
},
|
||||||
users: {
|
users: {
|
||||||
@ -108,6 +140,14 @@ const REDIRECTS: Redirects = {
|
|||||||
profile: {
|
profile: {
|
||||||
redirect: "/profile/dashboard",
|
redirect: "/profile/dashboard",
|
||||||
},
|
},
|
||||||
|
logbook: {
|
||||||
|
component: "logbook",
|
||||||
|
redirect: "/logbook",
|
||||||
|
},
|
||||||
|
history: {
|
||||||
|
component: "history",
|
||||||
|
redirect: "/history",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ParamType = "url" | "string";
|
export type ParamType = "url" | "string";
|
||||||
@ -201,12 +241,16 @@ class HaPanelMy extends LitElement {
|
|||||||
) || "This redirect is not supported.";
|
) || "This redirect is not supported.";
|
||||||
break;
|
break;
|
||||||
case "no_supervisor":
|
case "no_supervisor":
|
||||||
error =
|
error = this.hass.localize(
|
||||||
this.hass.localize(
|
"ui.panel.my.no_supervisor",
|
||||||
"ui.panel.my.component_not_loaded",
|
"docs_link",
|
||||||
"integration",
|
html`<a
|
||||||
"Home Assistant Supervisor"
|
target="_blank"
|
||||||
) || "This redirect requires Home Assistant Supervisor.";
|
rel="noreferrer noopener"
|
||||||
|
href="${documentationUrl(this.hass, "/installation")}"
|
||||||
|
>${this.hass.localize("ui.panel.my.documentation")}</a
|
||||||
|
>`
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error = this.hass.localize("ui.panel.my.error") || "Unknown error";
|
error = this.hass.localize("ui.panel.my.error") || "Unknown error";
|
||||||
|
@ -826,6 +826,8 @@
|
|||||||
"my": {
|
"my": {
|
||||||
"not_supported": "This redirect is not supported by your Home Assistant instance. Check the {link} for the supported redirects and the version they where introduced.",
|
"not_supported": "This redirect is not supported by your Home Assistant instance. Check the {link} for the supported redirects and the version they where introduced.",
|
||||||
"component_not_loaded": "This redirect is not supported by your Home Assistant instance. You need the integration {integration} to use this redirect.",
|
"component_not_loaded": "This redirect is not supported by your Home Assistant instance. You need the integration {integration} to use this redirect.",
|
||||||
|
"no_supervisor": "This redirect is not supported by your Home Assistant installation. It needs either the Home Assistant Operating System or Home Assistant Supervised installation method. For more information, see the {docs_link}.",
|
||||||
|
"documentation": "documentation",
|
||||||
"faq_link": "My Home Assistant FAQ",
|
"faq_link": "My Home Assistant FAQ",
|
||||||
"error": "An unknown error occured"
|
"error": "An unknown error occured"
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user