mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 14:56:37 +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 { computeDomain } from "../../../common/entity/compute_domain";
|
||||
import { computeObjectId } from "../../../common/entity/compute_object_id";
|
||||
import { extractSearchParam } from "../../../common/url/search-params";
|
||||
import "../../../components/buttons/ha-progress-button";
|
||||
import "../../../components/entity/ha-entity-picker";
|
||||
import "../../../components/ha-card";
|
||||
@ -40,7 +41,14 @@ class HaPanelDevService extends LitElement {
|
||||
|
||||
protected 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 service = Object.keys(this.hass.services[domain]).sort()[0];
|
||||
this._serviceData = {
|
||||
|
@ -15,6 +15,7 @@ import {
|
||||
import "../../layouts/hass-error-screen";
|
||||
import { isComponentLoaded } from "../../common/config/is_component_loaded";
|
||||
import { domainToName } from "../../data/integration";
|
||||
import { documentationUrl } from "../../util/documentation-url";
|
||||
|
||||
const REDIRECTS: Redirects = {
|
||||
developer_states: {
|
||||
@ -23,12 +24,21 @@ const REDIRECTS: Redirects = {
|
||||
developer_services: {
|
||||
redirect: "/developer-tools/service",
|
||||
},
|
||||
developer_call_service: {
|
||||
redirect: "/developer-tools/service",
|
||||
params: {
|
||||
service: "string",
|
||||
},
|
||||
},
|
||||
developer_template: {
|
||||
redirect: "/developer-tools/template",
|
||||
},
|
||||
developer_events: {
|
||||
redirect: "/developer-tools/event",
|
||||
},
|
||||
config: {
|
||||
redirect: "/config",
|
||||
},
|
||||
cloud: {
|
||||
component: "cloud",
|
||||
redirect: "/config/cloud",
|
||||
@ -42,6 +52,18 @@ const REDIRECTS: Redirects = {
|
||||
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: {
|
||||
redirect: "/config/devices/dashboard",
|
||||
},
|
||||
@ -52,39 +74,49 @@ const REDIRECTS: Redirects = {
|
||||
redirect: "/config/areas/dashboard",
|
||||
},
|
||||
blueprints: {
|
||||
component: "blueprint",
|
||||
redirect: "/config/blueprint/dashboard",
|
||||
},
|
||||
blueprint_import: {
|
||||
component: "blueprint",
|
||||
redirect: "/config/blueprint/dashboard/import",
|
||||
params: {
|
||||
blueprint_url: "url",
|
||||
},
|
||||
},
|
||||
automations: {
|
||||
component: "automation",
|
||||
redirect: "/config/automation/dashboard",
|
||||
},
|
||||
scenes: {
|
||||
component: "scene",
|
||||
redirect: "/config/scene/dashboard",
|
||||
},
|
||||
scripts: {
|
||||
component: "script",
|
||||
redirect: "/config/script/dashboard",
|
||||
},
|
||||
helpers: {
|
||||
redirect: "/config/helpers",
|
||||
},
|
||||
tags: {
|
||||
component: "tags",
|
||||
redirect: "/config/tags",
|
||||
},
|
||||
lovelace_dashboards: {
|
||||
component: "lovelace",
|
||||
redirect: "/config/lovelace/dashboards",
|
||||
},
|
||||
lovelace_resources: {
|
||||
component: "lovelace",
|
||||
redirect: "/config/lovelace/resources",
|
||||
},
|
||||
people: {
|
||||
component: "person",
|
||||
redirect: "/config/person",
|
||||
},
|
||||
zones: {
|
||||
component: "zone",
|
||||
redirect: "/config/zone",
|
||||
},
|
||||
users: {
|
||||
@ -108,6 +140,14 @@ const REDIRECTS: Redirects = {
|
||||
profile: {
|
||||
redirect: "/profile/dashboard",
|
||||
},
|
||||
logbook: {
|
||||
component: "logbook",
|
||||
redirect: "/logbook",
|
||||
},
|
||||
history: {
|
||||
component: "history",
|
||||
redirect: "/history",
|
||||
},
|
||||
};
|
||||
|
||||
export type ParamType = "url" | "string";
|
||||
@ -201,12 +241,16 @@ class HaPanelMy extends LitElement {
|
||||
) || "This redirect is not supported.";
|
||||
break;
|
||||
case "no_supervisor":
|
||||
error =
|
||||
this.hass.localize(
|
||||
"ui.panel.my.component_not_loaded",
|
||||
"integration",
|
||||
"Home Assistant Supervisor"
|
||||
) || "This redirect requires Home Assistant Supervisor.";
|
||||
error = this.hass.localize(
|
||||
"ui.panel.my.no_supervisor",
|
||||
"docs_link",
|
||||
html`<a
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
href="${documentationUrl(this.hass, "/installation")}"
|
||||
>${this.hass.localize("ui.panel.my.documentation")}</a
|
||||
>`
|
||||
);
|
||||
break;
|
||||
default:
|
||||
error = this.hass.localize("ui.panel.my.error") || "Unknown error";
|
||||
|
@ -826,6 +826,8 @@
|
||||
"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.",
|
||||
"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",
|
||||
"error": "An unknown error occured"
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user