UI Improvements (#7)
* Initial version with UI templates * Implement basic screens * Linting & bump to 0.3.0 * Tick off some TODOs
This commit is contained in:
committed by
GitHub
parent
597d9cdf7d
commit
0d61861343
@@ -1,6 +1,7 @@
|
||||
"""Helper functions for the integration."""
|
||||
|
||||
from homeassistant.components import http
|
||||
from .views.loader import AsyncTemplateRenderer
|
||||
|
||||
|
||||
def get_url(path: str) -> str:
|
||||
@@ -10,3 +11,12 @@ def get_url(path: str) -> str:
|
||||
|
||||
base_uri = str(req.url).split("/auth", 2)[0]
|
||||
return f"{base_uri}{path}"
|
||||
|
||||
|
||||
async def get_view(template: str, parameters: dict | None = None) -> str:
|
||||
"""Returns the generated HTML of the requested view."""
|
||||
if parameters is None:
|
||||
parameters = {}
|
||||
|
||||
renderer = AsyncTemplateRenderer()
|
||||
return await renderer.render_template(f"{template}.html", **parameters)
|
||||
|
||||
Reference in New Issue
Block a user