mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Everything through navigate mixin
This commit is contained in:
parent
dba388f723
commit
e1c9f3deea
@ -8,9 +8,9 @@ import './hassio-data.js';
|
||||
import './hassio-pages-with-tabs.js';
|
||||
|
||||
import applyThemesOnElement from '../../src/common/dom/apply_themes_on_element.js';
|
||||
import EventsMixin from '../../src/mixins/events-mixin.js';
|
||||
import NavigateMixin from '../../src/mixins/navigate-mixin.js';
|
||||
|
||||
class HassioMain extends EventsMixin(PolymerElement) {
|
||||
class HassioMain extends NavigateMixin(PolymerElement) {
|
||||
static get template() {
|
||||
return html`
|
||||
<app-route route="[[route]]" pattern="/:page" data="{{routeData}}"></app-route>
|
||||
@ -91,8 +91,7 @@ class HassioMain extends EventsMixin(PolymerElement) {
|
||||
|
||||
routeChanged(route) {
|
||||
if (route.path === '' && route.prefix === '/hassio') {
|
||||
history.replaceState(null, null, '/hassio/dashboard');
|
||||
this.fire('location-changed');
|
||||
this.navigate('/hassio/dashboard', true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* polyfill for paper-dropdown */
|
||||
import 'web-animations-js/web-animations-next-lite.min.js';
|
||||
|
||||
import '@polymer/app-route/app-location.js';
|
||||
@ -28,12 +29,6 @@ import applyThemesOnElement from '../common/dom/apply_themes_on_element.js';
|
||||
setPassiveTouchGestures(true);
|
||||
/* LastPass createElement workaround. See #428 */
|
||||
document.createElement = Document.prototype.createElement;
|
||||
/* polyfill for paper-dropdown */
|
||||
/*
|
||||
FIXME(polymer-modulizer): the above comments were extracted
|
||||
from HTML and may be out of place here. Review them and
|
||||
then delete this comment!
|
||||
*/
|
||||
window.removeInitMsg = function () {
|
||||
var initMsg = document.getElementById('ha-init-skeleton');
|
||||
if (initMsg) {
|
||||
|
@ -12,6 +12,7 @@ import '../util/ha-url-sync.js';
|
||||
import './partial-cards.js';
|
||||
import './partial-panel-resolver.js';
|
||||
import EventsMixin from '../mixins/events-mixin.js';
|
||||
import NavigateMixin from '../mixins/navigate-mixin.js';
|
||||
|
||||
import(/* webpackChunkName: "more-info-dialog" */ '../dialogs/ha-more-info-dialog.js');
|
||||
import(/* webpackChunkName: "voice-command-dialog" */ '../dialogs/ha-voice-command-dialog.js');
|
||||
@ -19,7 +20,7 @@ import(/* webpackChunkName: "voice-command-dialog" */ '../dialogs/ha-voice-comma
|
||||
{
|
||||
const NON_SWIPABLE_PANELS = ['kiosk', 'map'];
|
||||
|
||||
class HomeAssistantMain extends EventsMixin(PolymerElement) {
|
||||
class HomeAssistantMain extends NavigateMixin(EventsMixin(PolymerElement)) {
|
||||
static get template() {
|
||||
return html`
|
||||
<style>
|
||||
@ -111,7 +112,7 @@ import(/* webpackChunkName: "voice-command-dialog" */ '../dialogs/ha-voice-comma
|
||||
super.connectedCallback();
|
||||
window.removeInitMsg();
|
||||
if (document.location.pathname === '/') {
|
||||
history.replaceState(null, null, '/states');
|
||||
this.navigate('/states', true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user