Update frontend

This commit is contained in:
Paulus Schoutsen 2016-05-28 18:38:46 -07:00
parent 9e0b107991
commit 70b74da3eb
11 changed files with 264 additions and 28 deletions

View file

@ -72,21 +72,26 @@ 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:
app_url = 'home-assistant-polymer/src/home-assistant.html' core_url = 'home-assistant-polymer/build/_core_compiled.js'
ui_url = 'home-assistant-polymer/src/home-assistant.html'
else: else:
app_url = "frontend-{}.html".format(version.VERSION) core_url = 'core-{}.js'.format(version.CORE)
ui_url = 'frontend-{}.html'.format(version.UI)
# 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:
auth = 'no_password_set' auth = 'true'
else: else:
auth = '' auth = 'false'
icons_url = '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(app_url=app_url, auth=auth, resp = template.render(
icons=mdi_version.VERSION) core_url=core_url, ui_url=ui_url, auth=auth,
icons_url=icons_url, icons=mdi_version.VERSION)
return self.Response(resp, mimetype="text/html") return self.Response(resp, mimetype='text/html')

View file

@ -28,7 +28,7 @@
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
margin-bottom: 97px; margin-bottom: 83px;
font-family: Roboto, sans-serif; font-family: Roboto, sans-serif;
font-size: 0pt; font-size: 0pt;
transition: font-size 2s; transition: font-size 2s;
@ -36,6 +36,7 @@
#ha-init-skeleton paper-spinner { #ha-init-skeleton paper-spinner {
height: 28px; height: 28px;
margin-top: 16px;
} }
#ha-init-skeleton a { #ha-init-skeleton a {
@ -59,8 +60,8 @@
.getElementById('ha-init-skeleton') .getElementById('ha-init-skeleton')
.classList.add('error'); .classList.add('error');
} }
window.noAuth = {{ auth }}
</script> </script>
<link rel='import' href='/static/{{ app_url }}' onerror='initError()' async>
</head> </head>
<body fullbleed> <body fullbleed>
<div id='ha-init-skeleton'> <div id='ha-init-skeleton'>
@ -81,6 +82,9 @@
document.head.appendChild(script) document.head.appendChild(script)
} }
</script> </script>
<home-assistant auth='{{ auth }}' icons='{{ icons }}'></home-assistant> <home-assistant icons='{{ icons }}'></home-assistant>
<script src='/static/{{ core_url }}'></script>
<link rel='import' href='/static/{{ ui_url }}' onerror='initError()' async>
<link rel='import' href='/static/{{ icons_url }}' async>
</body> </body>
</html> </html>

View file

@ -1,2 +1,3 @@
"""DO NOT MODIFY. Auto-generated by build_frontend script.""" """DO NOT MODIFY. Auto-generated by build_frontend script."""
VERSION = "f8e946ab1fb3dd26b876c47eb2f662bd" CORE = "d0b415dac66c8056d81380b258af5767"
UI = "c15aa95a7e159022655e2b45c20a83c1"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
Subproject commit 1840a90fcb52021c8ab7b4974ba4b0e14de2e604 Subproject commit 127e76601a52860a92f11f68004d94fba765dfa4

View file

@ -29,7 +29,7 @@
/* eslint-disable quotes, comma-spacing */ /* eslint-disable quotes, comma-spacing */
var PrecacheConfig = [["/","7dfda80562d1a6d56c37d7cc8ac501ca"],["/devEvent","7dfda80562d1a6d56c37d7cc8ac501ca"],["/devInfo","7dfda80562d1a6d56c37d7cc8ac501ca"],["/devService","7dfda80562d1a6d56c37d7cc8ac501ca"],["/devState","7dfda80562d1a6d56c37d7cc8ac501ca"],["/devTemplate","7dfda80562d1a6d56c37d7cc8ac501ca"],["/history","7dfda80562d1a6d56c37d7cc8ac501ca"],["/logbook","7dfda80562d1a6d56c37d7cc8ac501ca"],["/map","7dfda80562d1a6d56c37d7cc8ac501ca"],["/states","7dfda80562d1a6d56c37d7cc8ac501ca"],["/static/frontend-f8e946ab1fb3dd26b876c47eb2f662bd.html","7dfda80562d1a6d56c37d7cc8ac501ca"],["/static/mdi-9ee3d4466a65bef35c2c8974e91b37c0.html","9a6846935116cd29279c91e0ee0a26d0"],["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 = [["/","e848229d5d15736a24d8c41255214735"],["/devEvent","e848229d5d15736a24d8c41255214735"],["/devInfo","e848229d5d15736a24d8c41255214735"],["/devService","e848229d5d15736a24d8c41255214735"],["/devState","e848229d5d15736a24d8c41255214735"],["/devTemplate","e848229d5d15736a24d8c41255214735"],["/history","e848229d5d15736a24d8c41255214735"],["/logbook","e848229d5d15736a24d8c41255214735"],["/map","e848229d5d15736a24d8c41255214735"],["/states","e848229d5d15736a24d8c41255214735"],["/static/core-d0b415dac66c8056d81380b258af5767.js","dfafa8e9e34f53e8c36dd8b3f7299b2a"],["/static/frontend-c15aa95a7e159022655e2b45c20a83c1.html","e848229d5d15736a24d8c41255214735"],["/static/mdi-9ee3d4466a65bef35c2c8974e91b37c0.html","9a6846935116cd29279c91e0ee0a26d0"],["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

@ -8,6 +8,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/_core_compiled.js ../core.js
gzip build/_core_compiled.js -c -k -9 > ../core.js.gz
node script/sw-precache.js node script/sw-precache.js
cp build/service_worker.js .. cp build/service_worker.js ..
@ -17,9 +19,11 @@ gzip build/service_worker.js -c -k -9 > ../service_worker.js.gz
cd ../.. cd ../..
echo '"""DO NOT MODIFY. Auto-generated by build_frontend script."""' > version.py echo '"""DO NOT MODIFY. Auto-generated by build_frontend script."""' > version.py
if [ $(command -v md5) ]; then if [ $(command -v md5) ]; then
echo 'VERSION = "'`md5 -q www_static/frontend.html`'"' >> version.py echo 'CORE = "'`md5 -q www_static/core.js`'"' >> version.py
echo 'UI = "'`md5 -q www_static/frontend.html`'"' >> version.py
elif [ $(command -v md5sum) ]; then elif [ $(command -v md5sum) ]; then
echo 'VERSION = "'`md5sum www_static/frontend.html | 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
else else
echo 'Could not find an MD5 utility' echo 'Could not find an MD5 utility'
fi fi