mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 06:05:26 +01:00
Remove developer tools panel, add redirects (#161789)
Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
@@ -462,6 +462,20 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
# Shopping list panel was replaced by todo panel in 2023.11
|
||||
hass.http.register_redirect("/shopping-list", "/todo")
|
||||
|
||||
# Developer tools moved to config panel in 2026.2
|
||||
for url in (
|
||||
"/developer-tools",
|
||||
"/developer-tools/yaml",
|
||||
"/developer-tools/state",
|
||||
"/developer-tools/action",
|
||||
"/developer-tools/template",
|
||||
"/developer-tools/event",
|
||||
"/developer-tools/statistics",
|
||||
"/developer-tools/assist",
|
||||
"/developer-tools/debug",
|
||||
):
|
||||
hass.http.register_redirect(url, f"/config{url}")
|
||||
|
||||
hass.http.app.router.register_resource(IndexView(repo_path, hass))
|
||||
|
||||
async_register_built_in_panel(
|
||||
@@ -495,14 +509,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
|
||||
async_register_built_in_panel(hass, "profile")
|
||||
|
||||
async_register_built_in_panel(
|
||||
hass,
|
||||
"developer-tools",
|
||||
require_admin=True,
|
||||
sidebar_title="developer_tools",
|
||||
sidebar_icon="mdi:hammer",
|
||||
)
|
||||
|
||||
@callback
|
||||
def async_change_listener(
|
||||
resource_type: str,
|
||||
|
||||
@@ -1121,7 +1121,7 @@
|
||||
"title": "Deprecated option object_id used"
|
||||
},
|
||||
"invalid_platform_config": {
|
||||
"description": "Home Assistant detected an invalid config for a manually configured item.\n\nPlatform domain: **{domain}**\nConfiguration file: **{config_file}**\nNear line: **{line}**\nConfiguration found:\n```yaml\n{config}\n```\nError: **{error}**.\n\nMake sure the configuration is valid and [reload](/developer-tools/yaml) the manually configured MQTT items or restart Home Assistant to fix this issue.",
|
||||
"description": "Home Assistant detected an invalid config for a manually configured item.\n\nPlatform domain: **{domain}**\nConfiguration file: **{config_file}**\nNear line: **{line}**\nConfiguration found:\n```yaml\n{config}\n```\nError: **{error}**.\n\nMake sure the configuration is valid and [reload](/config/developer-tools/yaml) the manually configured MQTT items or restart Home Assistant to fix this issue.",
|
||||
"title": "Invalid config found for MQTT {domain} item"
|
||||
},
|
||||
"subentry_migration_discovery": {
|
||||
|
||||
@@ -937,13 +937,27 @@ async def test_get_version(
|
||||
assert msg["result"] == {"version": cur_version}
|
||||
|
||||
|
||||
async def test_static_paths(mock_http_client: TestClient) -> None:
|
||||
@pytest.mark.parametrize(
|
||||
("from_url", "to_url", "expected_status"),
|
||||
[
|
||||
("/.well-known/change-password", "/profile", 302),
|
||||
("/developer-tools", "/config/developer-tools", 301),
|
||||
("/developer-tools/yaml", "/config/developer-tools/yaml", 301),
|
||||
("/developer-tools/state", "/config/developer-tools/state", 301),
|
||||
("/developer-tools/action", "/config/developer-tools/action", 301),
|
||||
("/developer-tools/template", "/config/developer-tools/template", 301),
|
||||
("/developer-tools/event", "/config/developer-tools/event", 301),
|
||||
("/developer-tools/debug", "/config/developer-tools/debug", 301),
|
||||
("/shopping-list", "/todo", 301),
|
||||
],
|
||||
)
|
||||
async def test_static_paths(
|
||||
mock_http_client: TestClient, from_url: str, to_url: str, expected_status: int
|
||||
) -> None:
|
||||
"""Test static paths."""
|
||||
resp = await mock_http_client.get(
|
||||
"/.well-known/change-password", allow_redirects=False
|
||||
)
|
||||
assert resp.status == 302
|
||||
assert resp.headers["location"] == "/profile"
|
||||
resp = await mock_http_client.get(from_url, allow_redirects=False)
|
||||
assert resp.status == expected_status
|
||||
assert resp.headers["location"] == to_url
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("frontend_themes")
|
||||
|
||||
Reference in New Issue
Block a user