diff --git a/homeassistant/components/frontend/__init__.py b/homeassistant/components/frontend/__init__.py index 8ff722e41b2..2892e278c5c 100644 --- a/homeassistant/components/frontend/__init__.py +++ b/homeassistant/components/frontend/__init__.py @@ -20,13 +20,21 @@ INDEX_PATH = os.path.join(os.path.dirname(__file__), 'index.html.template') _LOGGER = logging.getLogger(__name__) +FRONTEND_URLS = [ + URL_ROOT, '/logbook', '/history', '/devService', '/devState', '/devEvent'] +STATES_URL = re.compile(r'/states(/([a-zA-Z\._\-0-9/]+)|)') + + def setup(hass, config): """ Setup serving the frontend. """ if 'http' not in hass.config.components: _LOGGER.error('Dependency http is not loaded') return False - hass.http.register_path('GET', URL_ROOT, _handle_get_root, False) + for url in FRONTEND_URLS: + hass.http.register_path('GET', url, _handle_get_root, False) + + hass.http.register_path('GET', STATES_URL, _handle_get_root, False) # Static files hass.http.register_path( diff --git a/homeassistant/components/frontend/version.py b/homeassistant/components/frontend/version.py index 5fcb22b713a..044c8d1ff62 100644 --- a/homeassistant/components/frontend/version.py +++ b/homeassistant/components/frontend/version.py @@ -1,2 +1,2 @@ """ DO NOT MODIFY. Auto-generated by build_frontend script """ -VERSION = "ebe24a2f60f975cd4fb26156c44f3f3d" +VERSION = "0a0110c72a6db31f3fa069a053363d05" diff --git a/homeassistant/components/frontend/www_static/frontend.html b/homeassistant/components/frontend/www_static/frontend.html index 9950fab0807..e8ef155378e 100644 --- a/homeassistant/components/frontend/www_static/frontend.html +++ b/homeassistant/components/frontend/www_static/frontend.html @@ -6032,87 +6032,99 @@ this._removeChildren(); - + + + + - - + + - - - - - @@ -28472,6 +28437,7 @@ paper-ripple { var uiUtil = window.hass.uiUtil; var entityDomainFilters = window.hass.util.entityDomainFilters; + var urlSync = window.hass.urlSync; Polymer({ is: 'home-assistant-main', @@ -28483,16 +28449,10 @@ paper-ripple { type: Boolean, }, - selected: { + activePage: { type: String, - bindNuclear: [ - navigationGetters.activePane, - navigationGetters.activeFilter, - function(pane, filter) { - return filter ? pane + '/' + filter : pane; - }, - ], - observer: 'selectedChanged', + bindNuclear: navigationGetters.activePage, + observer: 'activePageChanged', }, isSelectedStates: { @@ -28534,34 +28494,16 @@ paper-ripple { this.$.drawer.openDrawer(); }, - closeDrawer: function() { + activePageChanged: function() { this.$.drawer.closeDrawer(); }, - hashChanged: function(ev) { - var parts = ev.newURL.split('#'); - if (parts[1]) { - navigationActions.navigate.apply( - null, parts[1].split('/')); - } - }, - - selectedChanged: function(newVal) { - this.closeDrawer(); - window.location.hash = newVal; - }, - - ready: function() { - this.hashChanged({newURL: window.location.toString()}); - }, - attached: function() { - this.hashChanged = this.hashChanged.bind(this); - window.addEventListener('hashchange', this.hashChanged); + urlSync.startSync(); }, detached: function() { - window.removeEventListener('hashchange', this.hashChanged); + urlSync.stopSync(); }, }); })(); @@ -28594,7 +28536,7 @@ paper-ripple { var uiActions = window.hass.uiActions; var authGetters = window.hass.authGetters; var syncGetters = window.hass.syncGetters; - var uiPreferences = window.hass.uiPreferences; + var preferences = window.hass.localStoragePreferences; Polymer({ is: 'home-assistant', @@ -28622,11 +28564,11 @@ paper-ripple { // if auth was given, tell the backend if(this.auth) { uiActions.validateAuth(this.auth, false); - } else if (uiPreferences.authToken) { - uiActions.validateAuth(uiPreferences.authToken, true); + } else if (preferences.authToken) { + uiActions.validateAuth(preferences.authToken, true); } - uiPreferences.startSync(); + preferences.startSync(); }, }); diff --git a/homeassistant/components/frontend/www_static/polymer/home-assistant-js b/homeassistant/components/frontend/www_static/polymer/home-assistant-js index 53941ad076f..8242a36234b 160000 --- a/homeassistant/components/frontend/www_static/polymer/home-assistant-js +++ b/homeassistant/components/frontend/www_static/polymer/home-assistant-js @@ -1 +1 @@ -Subproject commit 53941ad076fa5d453370cb6922cf6770202dc76e +Subproject commit 8242a36234b4fc55c8baec79f8ca72a86ca22751 diff --git a/homeassistant/components/frontend/www_static/polymer/home-assistant.html b/homeassistant/components/frontend/www_static/polymer/home-assistant.html index ba5ef8aadc2..9e974279bdb 100644 --- a/homeassistant/components/frontend/www_static/polymer/home-assistant.html +++ b/homeassistant/components/frontend/www_static/polymer/home-assistant.html @@ -39,7 +39,7 @@ var uiActions = window.hass.uiActions; var authGetters = window.hass.authGetters; var syncGetters = window.hass.syncGetters; - var uiPreferences = window.hass.uiPreferences; + var preferences = window.hass.localStoragePreferences; Polymer({ is: 'home-assistant', @@ -67,11 +67,11 @@ // if auth was given, tell the backend if(this.auth) { uiActions.validateAuth(this.auth, false); - } else if (uiPreferences.authToken) { - uiActions.validateAuth(uiPreferences.authToken, true); + } else if (preferences.authToken) { + uiActions.validateAuth(preferences.authToken, true); } - uiPreferences.startSync(); + preferences.startSync(); }, }); diff --git a/homeassistant/components/frontend/www_static/polymer/layouts/home-assistant-main.html b/homeassistant/components/frontend/www_static/polymer/layouts/home-assistant-main.html index 2ca64f51806..66056bd0790 100644 --- a/homeassistant/components/frontend/www_static/polymer/layouts/home-assistant-main.html +++ b/homeassistant/components/frontend/www_static/polymer/layouts/home-assistant-main.html @@ -58,6 +58,7 @@ var uiUtil = window.hass.uiUtil; var entityDomainFilters = window.hass.util.entityDomainFilters; + var urlSync = window.hass.urlSync; Polymer({ is: 'home-assistant-main', @@ -69,16 +70,10 @@ type: Boolean, }, - selected: { + activePage: { type: String, - bindNuclear: [ - navigationGetters.activePane, - navigationGetters.activeFilter, - function(pane, filter) { - return filter ? pane + '/' + filter : pane; - }, - ], - observer: 'selectedChanged', + bindNuclear: navigationGetters.activePage, + observer: 'activePageChanged', }, isSelectedStates: { @@ -120,34 +115,16 @@ this.$.drawer.openDrawer(); }, - closeDrawer: function() { + activePageChanged: function() { this.$.drawer.closeDrawer(); }, - hashChanged: function(ev) { - var parts = ev.newURL.split('#'); - if (parts[1]) { - navigationActions.navigate.apply( - null, parts[1].split('/')); - } - }, - - selectedChanged: function(newVal) { - this.closeDrawer(); - window.location.hash = newVal; - }, - - ready: function() { - this.hashChanged({newURL: window.location.toString()}); - }, - attached: function() { - this.hashChanged = this.hashChanged.bind(this); - window.addEventListener('hashchange', this.hashChanged); + urlSync.startSync(); }, detached: function() { - window.removeEventListener('hashchange', this.hashChanged); + urlSync.stopSync(); }, }); })(); diff --git a/homeassistant/components/frontend/www_static/polymer/resources/ha-preferences.html b/homeassistant/components/frontend/www_static/polymer/resources/ha-preferences.html deleted file mode 100644 index cafba7be915..00000000000 --- a/homeassistant/components/frontend/www_static/polymer/resources/ha-preferences.html +++ /dev/null @@ -1,51 +0,0 @@ - diff --git a/homeassistant/components/frontend/www_static/polymer/resources/home-assistant-js.html b/homeassistant/components/frontend/www_static/polymer/resources/home-assistant-js.html index cc8c506bcad..e8094afb961 100644 --- a/homeassistant/components/frontend/www_static/polymer/resources/home-assistant-js.html +++ b/homeassistant/components/frontend/www_static/polymer/resources/home-assistant-js.html @@ -1,5 +1,4 @@ -