Make the frontend available sooner (Part 1 of 2) (#36263)

* Part 1 of 2 (no breaking changes in part 1).

When integrations configured via the UI block startup or fail to start,
the webserver can remain offline which make it is impossible
to recover without manually changing files in
.storage since the UI is not available.

This change is the foundation that part 2 will build on
and enable a listener to start the webserver when the frontend
is finished loading.

Frontend Changes (home-assistant/frontend#6068)

* Address review comments

* bump timeout to 1800s, adjust comment

* bump timeout to 4h

* remove timeout failsafe

* and the test
This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-06-02 13:54:11 -05:00
1 parent 7338feb659
commit 578d4a9b6a
13 files changed
+126 -62

No files matched your search

+34 -29
View File
@@ -4,6 +4,7 @@ import unittest
from homeassistant import setup
from homeassistant.components import frontend
from tests.async_mock import patch
from tests.common import get_test_home_assistant
@@ -26,38 +27,42 @@ class TestPanelIframe(unittest.TestCase):
]
for conf in to_try:
assert not setup.setup_component(
self.hass, "panel_iframe", {"panel_iframe": conf}
)
with patch(
"homeassistant.components.http.start_http_server_and_save_config"
):
assert not setup.setup_component(
self.hass, "panel_iframe", {"panel_iframe": conf}
)
def test_correct_config(self):
"""Test correct config."""
assert setup.setup_component(
self.hass,
"panel_iframe",
{
"panel_iframe": {
"router": {
"icon": "mdi:network-wireless",
"title": "Router",
"url": "http://192.168.1.1",
"require_admin": True,
},
"weather": {
"icon": "mdi:weather",
"title": "Weather",
"url": "https://www.wunderground.com/us/ca/san-diego",
"require_admin": True,
},
"api": {"icon": "mdi:weather", "title": "Api", "url": "/api"},
"ftp": {
"icon": "mdi:weather",
"title": "FTP",
"url": "ftp://some/ftp",
},
}
},
)
with patch("homeassistant.components.http.start_http_server_and_save_config"):
assert setup.setup_component(
self.hass,
"panel_iframe",
{
"panel_iframe": {
"router": {
"icon": "mdi:network-wireless",
"title": "Router",
"url": "http://192.168.1.1",
"require_admin": True,
},
"weather": {
"icon": "mdi:weather",
"title": "Weather",
"url": "https://www.wunderground.com/us/ca/san-diego",
"require_admin": True,
},
"api": {"icon": "mdi:weather", "title": "Api", "url": "/api"},
"ftp": {
"icon": "mdi:weather",
"title": "FTP",
"url": "ftp://some/ftp",
},
}
},
)
panels = self.hass.data[frontend.DATA_PANELS]