mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 00:06:35 +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 './hassio-pages-with-tabs.js';
|
||||||
|
|
||||||
import applyThemesOnElement from '../../src/common/dom/apply_themes_on_element.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() {
|
static get template() {
|
||||||
return html`
|
return html`
|
||||||
<app-route route="[[route]]" pattern="/:page" data="{{routeData}}"></app-route>
|
<app-route route="[[route]]" pattern="/:page" data="{{routeData}}"></app-route>
|
||||||
@ -91,8 +91,7 @@ class HassioMain extends EventsMixin(PolymerElement) {
|
|||||||
|
|
||||||
routeChanged(route) {
|
routeChanged(route) {
|
||||||
if (route.path === '' && route.prefix === '/hassio') {
|
if (route.path === '' && route.prefix === '/hassio') {
|
||||||
history.replaceState(null, null, '/hassio/dashboard');
|
this.navigate('/hassio/dashboard', true);
|
||||||
this.fire('location-changed');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* polyfill for paper-dropdown */
|
||||||
import 'web-animations-js/web-animations-next-lite.min.js';
|
import 'web-animations-js/web-animations-next-lite.min.js';
|
||||||
|
|
||||||
import '@polymer/app-route/app-location.js';
|
import '@polymer/app-route/app-location.js';
|
||||||
@ -28,12 +29,6 @@ import applyThemesOnElement from '../common/dom/apply_themes_on_element.js';
|
|||||||
setPassiveTouchGestures(true);
|
setPassiveTouchGestures(true);
|
||||||
/* LastPass createElement workaround. See #428 */
|
/* LastPass createElement workaround. See #428 */
|
||||||
document.createElement = Document.prototype.createElement;
|
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 () {
|
window.removeInitMsg = function () {
|
||||||
var initMsg = document.getElementById('ha-init-skeleton');
|
var initMsg = document.getElementById('ha-init-skeleton');
|
||||||
if (initMsg) {
|
if (initMsg) {
|
||||||
|
@ -12,6 +12,7 @@ import '../util/ha-url-sync.js';
|
|||||||
import './partial-cards.js';
|
import './partial-cards.js';
|
||||||
import './partial-panel-resolver.js';
|
import './partial-panel-resolver.js';
|
||||||
import EventsMixin from '../mixins/events-mixin.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: "more-info-dialog" */ '../dialogs/ha-more-info-dialog.js');
|
||||||
import(/* webpackChunkName: "voice-command-dialog" */ '../dialogs/ha-voice-command-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'];
|
const NON_SWIPABLE_PANELS = ['kiosk', 'map'];
|
||||||
|
|
||||||
class HomeAssistantMain extends EventsMixin(PolymerElement) {
|
class HomeAssistantMain extends NavigateMixin(EventsMixin(PolymerElement)) {
|
||||||
static get template() {
|
static get template() {
|
||||||
return html`
|
return html`
|
||||||
<style>
|
<style>
|
||||||
@ -111,7 +112,7 @@ import(/* webpackChunkName: "voice-command-dialog" */ '../dialogs/ha-voice-comma
|
|||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
window.removeInitMsg();
|
window.removeInitMsg();
|
||||||
if (document.location.pathname === '/') {
|
if (document.location.pathname === '/') {
|
||||||
history.replaceState(null, null, '/states');
|
this.navigate('/states', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user