Update frontend

This commit is contained in:
Paulus Schoutsen
2016-07-12 00:10:05 -07:00
parent 6cb91e66c8
commit 6d60287455
13 changed files with 123 additions and 24 deletions

View File

@@ -76,11 +76,14 @@ class IndexView(HomeAssistantView):
def get(self, request, entity_id=None): def get(self, request, entity_id=None):
"""Serve the index view.""" """Serve the index view."""
if self.hass.wsgi.development: if self.hass.wsgi.development:
core_url = 'home-assistant-polymer/build/_core_compiled.js' core_url = '/static/home-assistant-polymer/build/_core_compiled.js'
ui_url = 'home-assistant-polymer/src/home-assistant.html' ui_url = '/static/home-assistant-polymer/src/home-assistant.html'
map_url = ('/static/home-assistant-polymer/src/layouts/'
'partial-map.html')
else: else:
core_url = 'core-{}.js'.format(version.CORE) core_url = '/static/core-{}.js'.format(version.CORE)
ui_url = 'frontend-{}.html'.format(version.UI) ui_url = '/static/frontend-{}.html'.format(version.UI)
map_url = '/static/partial-map-{}.html'.format(version.MAP)
# auto login if no password was set # auto login if no password was set
if self.hass.config.api.api_password is None: if self.hass.config.api.api_password is None:
@@ -88,14 +91,14 @@ class IndexView(HomeAssistantView):
else: else:
auth = 'false' auth = 'false'
icons_url = 'mdi-{}.html'.format(mdi_version.VERSION) icons_url = '/static/mdi-{}.html'.format(mdi_version.VERSION)
template = self.templates.get_template('index.html') template = self.templates.get_template('index.html')
# pylint is wrong # pylint is wrong
# pylint: disable=no-member # pylint: disable=no-member
resp = template.render( resp = template.render(
core_url=core_url, ui_url=ui_url, auth=auth, core_url=core_url, ui_url=ui_url, map_url=map_url, auth=auth,
icons_url=icons_url, icons=mdi_version.VERSION) icons_url=icons_url, icons=mdi_version.VERSION)
return self.Response(resp, mimetype='text/html') return self.Response(resp, mimetype='text/html')

View File

@@ -64,8 +64,11 @@
document document
.getElementById('ha-init-skeleton') .getElementById('ha-init-skeleton')
.classList.add('error'); .classList.add('error');
} };
window.noAuth = {{ auth }} window.noAuth = {{ auth }};
window.deferredLoading = {
map: '{{ map_url }}',
};
</script> </script>
</head> </head>
<body fullbleed> <body fullbleed>
@@ -76,9 +79,9 @@
</div> </div>
<home-assistant icons='{{ icons }}'></home-assistant> <home-assistant icons='{{ icons }}'></home-assistant>
{# <script src='/static/home-assistant-polymer/build/_demo_data_compiled.js'></script> #} {# <script src='/static/home-assistant-polymer/build/_demo_data_compiled.js'></script> #}
<script src='/static/{{ core_url }}'></script> <script src='{{ core_url }}'></script>
<link rel='import' href='/static/{{ ui_url }}' onerror='initError()' async> <link rel='import' href='{{ ui_url }}' onerror='initError()' async>
<link rel='import' href='/static/{{ icons_url }}' async> <link rel='import' href='{{ icons_url }}' async>
<script> <script>
var webComponentsSupported = ( var webComponentsSupported = (
'registerElement' in document && 'registerElement' in document &&

View File

@@ -1,3 +1,4 @@
"""DO NOT MODIFY. Auto-generated by build_frontend script.""" """DO NOT MODIFY. Auto-generated by build_frontend script."""
CORE = "27fb37706dc723c31cc467edeabaae5e" CORE = "190f3331fdbf7118e11c4ae1de3c197a"
UI = "b0083f18b71bc0911d6e189e3b023dce" UI = "a3bdf93df6b926a99bb427f8af684541"
MAP = "248e12589e3e3d10357adb46b1797ff3"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -29,7 +29,7 @@
/* eslint-disable quotes, comma-spacing */ /* eslint-disable quotes, comma-spacing */
var PrecacheConfig = [["/","42f8a55847b7687eb5bf29637b5049c3"],["/devEvent","42f8a55847b7687eb5bf29637b5049c3"],["/devInfo","42f8a55847b7687eb5bf29637b5049c3"],["/devService","42f8a55847b7687eb5bf29637b5049c3"],["/devState","42f8a55847b7687eb5bf29637b5049c3"],["/devTemplate","42f8a55847b7687eb5bf29637b5049c3"],["/history","42f8a55847b7687eb5bf29637b5049c3"],["/logbook","42f8a55847b7687eb5bf29637b5049c3"],["/map","42f8a55847b7687eb5bf29637b5049c3"],["/states","42f8a55847b7687eb5bf29637b5049c3"],["/static/core-27fb37706dc723c31cc467edeabaae5e.js","863819dc100efdbbff2de424f9e9924c"],["/static/frontend-b0083f18b71bc0911d6e189e3b023dce.html","42f8a55847b7687eb5bf29637b5049c3"],["/static/mdi-758957b7ea989d6beca60e218ea7f7dd.html","4c32b01a3a5b194630963ff7ec4df36f"],["static/favicon-192x192.png","419903b8422586a7e28021bbe9011175"],["static/fonts/roboto/Roboto-Bold.ttf","d329cc8b34667f114a95422aaad1b063"],["static/fonts/roboto/Roboto-Light.ttf","7b5fb88f12bec8143f00e21bc3222124"],["static/fonts/roboto/Roboto-Medium.ttf","fe13e4170719c2fc586501e777bde143"],["static/fonts/roboto/Roboto-Regular.ttf","ac3f799d5bbaf5196fab15ab8de8431c"],["static/images/card_media_player_bg.png","a34281d1c1835d338a642e90930e61aa"],["static/webcomponents-lite.min.js","b0f32ad3c7749c40d486603f31c9d8b1"]]; var PrecacheConfig = [["/","c92b07b3335c166ffcc72a2da1d36909"],["/devEvent","c92b07b3335c166ffcc72a2da1d36909"],["/devInfo","c92b07b3335c166ffcc72a2da1d36909"],["/devService","c92b07b3335c166ffcc72a2da1d36909"],["/devState","c92b07b3335c166ffcc72a2da1d36909"],["/devTemplate","c92b07b3335c166ffcc72a2da1d36909"],["/history","c92b07b3335c166ffcc72a2da1d36909"],["/logbook","c92b07b3335c166ffcc72a2da1d36909"],["/map","c92b07b3335c166ffcc72a2da1d36909"],["/states","c92b07b3335c166ffcc72a2da1d36909"],["/static/core-190f3331fdbf7118e11c4ae1de3c197a.js","a881d94e39b965460813e25368fa8452"],["/static/frontend-a3bdf93df6b926a99bb427f8af684541.html","d00203ab83ec4b7c07b8d8c91b71b0d5"],["/static/mdi-758957b7ea989d6beca60e218ea7f7dd.html","4c32b01a3a5b194630963ff7ec4df36f"],["/static/partial-map-248e12589e3e3d10357adb46b1797ff3.html","cb27761f19029e2b26941d9e499696ca"],["static/favicon-192x192.png","419903b8422586a7e28021bbe9011175"],["static/fonts/roboto/Roboto-Bold.ttf","d329cc8b34667f114a95422aaad1b063"],["static/fonts/roboto/Roboto-Light.ttf","7b5fb88f12bec8143f00e21bc3222124"],["static/fonts/roboto/Roboto-Medium.ttf","fe13e4170719c2fc586501e777bde143"],["static/fonts/roboto/Roboto-Regular.ttf","ac3f799d5bbaf5196fab15ab8de8431c"],["static/images/card_media_player_bg.png","a34281d1c1835d338a642e90930e61aa"],["static/webcomponents-lite.min.js","b0f32ad3c7749c40d486603f31c9d8b1"]];
/* eslint-enable quotes, comma-spacing */ /* eslint-enable quotes, comma-spacing */
var CacheNamePrefix = 'sw-precache-v1--' + (self.registration ? self.registration.scope : '') + '-'; var CacheNamePrefix = 'sw-precache-v1--' + (self.registration ? self.registration.scope : '') + '-';

View File

@@ -10,6 +10,8 @@ npm run frontend_prod
cp bower_components/webcomponentsjs/webcomponents-lite.min.js .. cp bower_components/webcomponentsjs/webcomponents-lite.min.js ..
cp build/frontend.html .. cp build/frontend.html ..
gzip build/frontend.html -c -k -9 > ../frontend.html.gz gzip build/frontend.html -c -k -9 > ../frontend.html.gz
cp build/partial-map.html ..
gzip build/partial-map.html -c -k -9 > ../partial-map.html.gz
cp build/_core_compiled.js ../core.js cp build/_core_compiled.js ../core.js
gzip build/_core_compiled.js -c -k -9 > ../core.js.gz gzip build/_core_compiled.js -c -k -9 > ../core.js.gz
@@ -23,9 +25,11 @@ echo '"""DO NOT MODIFY. Auto-generated by build_frontend script."""' > version.p
if [ $(command -v md5) ]; then if [ $(command -v md5) ]; then
echo 'CORE = "'`md5 -q www_static/core.js`'"' >> version.py echo 'CORE = "'`md5 -q www_static/core.js`'"' >> version.py
echo 'UI = "'`md5 -q www_static/frontend.html`'"' >> version.py echo 'UI = "'`md5 -q www_static/frontend.html`'"' >> version.py
echo 'MAP = "'`md5 -q www_static/partial-map.html`'"' >> version.py
elif [ $(command -v md5sum) ]; then elif [ $(command -v md5sum) ]; then
echo 'CORE = "'`md5sum www_static/core.js | cut -c-32`'"' >> version.py echo 'CORE = "'`md5sum www_static/core.js | cut -c-32`'"' >> version.py
echo 'UI = "'`md5sum www_static/frontend.html | cut -c-32`'"' >> version.py echo 'UI = "'`md5sum www_static/frontend.html | cut -c-32`'"' >> version.py
echo 'MAP = "'`md5sum www_static/partial-map.html | cut -c-32`'"' >> version.py
else else
echo 'Could not find an MD5 utility' echo 'Could not find an MD5 utility'
fi fi