mirror of
https://github.com/home-assistant/core
synced 2024-07-12 07:21:24 +02:00
Import frontend (#64104)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
4bce92dd2d
commit
946238fb02
@ -9,7 +9,7 @@ from typing import cast, final
|
||||
|
||||
from aiohttp import web
|
||||
|
||||
from homeassistant.components import http
|
||||
from homeassistant.components import frontend, http
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import STATE_OFF, STATE_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -42,8 +42,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
hass.http.register_view(CalendarListView(component))
|
||||
hass.http.register_view(CalendarEventView(component))
|
||||
|
||||
hass.components.frontend.async_register_built_in_panel(
|
||||
"calendar", "calendar", "hass:calendar"
|
||||
frontend.async_register_built_in_panel(
|
||||
hass, "calendar", "calendar", "hass:calendar"
|
||||
)
|
||||
|
||||
await component.async_setup(config)
|
||||
|
@ -6,6 +6,7 @@ import os
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import frontend
|
||||
from homeassistant.components.http import HomeAssistantView
|
||||
from homeassistant.const import CONF_ID, EVENT_COMPONENT_LOADED
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
@ -35,8 +36,8 @@ ACTION_DELETE = "delete"
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the config component."""
|
||||
hass.components.frontend.async_register_built_in_panel(
|
||||
"config", "config", "hass:cog", require_admin=True
|
||||
frontend.async_register_built_in_panel(
|
||||
hass, "config", "config", "hass:cog", require_admin=True
|
||||
)
|
||||
|
||||
async def setup_panel(panel_name):
|
||||
|
@ -5,6 +5,7 @@ import logging
|
||||
|
||||
from aiohttp import web
|
||||
|
||||
from homeassistant.components import frontend
|
||||
from homeassistant.components.http import HomeAssistantView
|
||||
from homeassistant.const import ATTR_ICON
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -62,7 +63,7 @@ class HassIOAddonPanel(HomeAssistantView):
|
||||
|
||||
async def delete(self, request, addon):
|
||||
"""Handle remove add-on panel requests."""
|
||||
self.hass.components.frontend.async_remove_panel(addon)
|
||||
frontend.async_remove_panel(self.hass, addon)
|
||||
return web.Response()
|
||||
|
||||
async def get_panels(self):
|
||||
|
@ -12,7 +12,7 @@ from aiohttp import web
|
||||
from sqlalchemy import not_, or_
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import websocket_api
|
||||
from homeassistant.components import frontend, websocket_api
|
||||
from homeassistant.components.http import HomeAssistantView
|
||||
from homeassistant.components.recorder import history, models as history_models
|
||||
from homeassistant.components.recorder.statistics import (
|
||||
@ -98,9 +98,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
use_include_order = conf.get(CONF_ORDER)
|
||||
|
||||
hass.http.register_view(HistoryPeriodView(filters, use_include_order))
|
||||
hass.components.frontend.async_register_built_in_panel(
|
||||
"history", "history", "hass:chart-box"
|
||||
)
|
||||
frontend.async_register_built_in_panel(hass, "history", "history", "hass:chart-box")
|
||||
websocket_api.async_register_command(hass, ws_get_statistics_during_period)
|
||||
websocket_api.async_register_command(hass, ws_get_list_statistic_ids)
|
||||
|
||||
|
@ -11,6 +11,7 @@ from sqlalchemy.orm import aliased
|
||||
from sqlalchemy.sql.expression import literal
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import frontend
|
||||
from homeassistant.components.automation import EVENT_AUTOMATION_TRIGGERED
|
||||
from homeassistant.components.history import sqlalchemy_filter_from_include_exclude_conf
|
||||
from homeassistant.components.http import HomeAssistantView
|
||||
@ -154,8 +155,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
message = message.async_render(parse_result=False)
|
||||
async_log_entry(hass, name, message, domain, entity_id)
|
||||
|
||||
hass.components.frontend.async_register_built_in_panel(
|
||||
"logbook", "logbook", "hass:format-list-bulleted-type"
|
||||
frontend.async_register_built_in_panel(
|
||||
hass, "logbook", "logbook", "hass:format-list-bulleted-type"
|
||||
)
|
||||
|
||||
if conf := config.get(DOMAIN, {}):
|
||||
|
@ -11,6 +11,7 @@ from aiohttp import web
|
||||
from aiohttp.web_exceptions import HTTPNotFound
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.components import frontend
|
||||
from homeassistant.components.http import HomeAssistantView
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
@ -36,9 +37,7 @@ SCAN_INTERVAL = timedelta(seconds=30)
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Track states and offer events for mailboxes."""
|
||||
mailboxes: list[Mailbox] = []
|
||||
hass.components.frontend.async_register_built_in_panel(
|
||||
"mailbox", "mailbox", "mdi:mailbox"
|
||||
)
|
||||
frontend.async_register_built_in_panel(hass, "mailbox", "mailbox", "mdi:mailbox")
|
||||
hass.http.register_view(MailboxPlatformsView(mailboxes))
|
||||
hass.http.register_view(MailboxMessageView(mailboxes))
|
||||
hass.http.register_view(MailboxMediaView(mailboxes))
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""Support for showing device locations."""
|
||||
from homeassistant.components import frontend
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
@ -7,7 +8,5 @@ DOMAIN = "map"
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Register the built-in map panel."""
|
||||
hass.components.frontend.async_register_built_in_panel(
|
||||
"map", "map", "hass:tooltip-account"
|
||||
)
|
||||
frontend.async_register_built_in_panel(hass, "map", "map", "hass:tooltip-account")
|
||||
return True
|
||||
|
@ -7,7 +7,7 @@ from urllib.parse import quote
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import websocket_api
|
||||
from homeassistant.components import frontend, websocket_api
|
||||
from homeassistant.components.http.auth import async_sign_path
|
||||
from homeassistant.components.media_player.const import ATTR_MEDIA_CONTENT_ID
|
||||
from homeassistant.components.media_player.errors import BrowseError
|
||||
@ -44,8 +44,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
hass.data[DOMAIN] = {}
|
||||
websocket_api.async_register_command(hass, websocket_browse_media)
|
||||
websocket_api.async_register_command(hass, websocket_resolve_media)
|
||||
hass.components.frontend.async_register_built_in_panel(
|
||||
"media-browser", "media_browser", "hass:play-box-multiple"
|
||||
frontend.async_register_built_in_panel(
|
||||
hass, "media-browser", "media_browser", "hass:play-box-multiple"
|
||||
)
|
||||
local_source.async_setup(hass)
|
||||
await async_process_integration_platforms(
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""Support for my.home-assistant.io redirect service."""
|
||||
from homeassistant.components import frontend
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
@ -8,7 +9,5 @@ URL_PATH = "_my_redirect"
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Register hidden _my_redirect panel."""
|
||||
hass.components.frontend.async_register_built_in_panel(
|
||||
DOMAIN, frontend_url_path=URL_PATH
|
||||
)
|
||||
frontend.async_register_built_in_panel(hass, DOMAIN, frontend_url_path=URL_PATH)
|
||||
return True
|
||||
|
@ -3,6 +3,7 @@ import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import frontend
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
@ -116,7 +117,8 @@ async def async_register_panel(
|
||||
|
||||
config["_panel_custom"] = custom_panel_config
|
||||
|
||||
hass.components.frontend.async_register_built_in_panel(
|
||||
frontend.async_register_built_in_panel(
|
||||
hass,
|
||||
component_name="custom",
|
||||
sidebar_title=sidebar_title,
|
||||
sidebar_icon=sidebar_icon,
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Register an iFrame front end panel."""
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import frontend
|
||||
from homeassistant.const import CONF_ICON, CONF_URL
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
@ -40,7 +41,8 @@ CONFIG_SCHEMA = vol.Schema(
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the iFrame frontend panels."""
|
||||
for url_path, info in config[DOMAIN].items():
|
||||
hass.components.frontend.async_register_built_in_panel(
|
||||
frontend.async_register_built_in_panel(
|
||||
hass,
|
||||
"iframe",
|
||||
info.get(CONF_TITLE),
|
||||
info.get(CONF_ICON),
|
||||
|
@ -6,7 +6,7 @@ import uuid
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components import http, websocket_api
|
||||
from homeassistant.components import frontend, http, websocket_api
|
||||
from homeassistant.components.http.data_validator import RequestDataValidator
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_NAME
|
||||
@ -162,8 +162,8 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
||||
hass.http.register_view(UpdateShoppingListItemView)
|
||||
hass.http.register_view(ClearCompletedItemsView)
|
||||
|
||||
hass.components.frontend.async_register_built_in_panel(
|
||||
"shopping-list", "shopping_list", "mdi:cart"
|
||||
frontend.async_register_built_in_panel(
|
||||
hass, "shopping-list", "shopping_list", "mdi:cart"
|
||||
)
|
||||
|
||||
websocket_api.async_register_command(
|
||||
|
Loading…
Reference in New Issue
Block a user