mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-13 12:26:35 +00:00
Polymer 2 fixes (#330)
* Fix startup error in panel-resolver * Fix map panel stylesheet reference in develop mode under P2 * Fix automation editor recursion * Fix HA style
This commit is contained in:
parent
d705bd2e8f
commit
96ad1dae38
@ -160,6 +160,7 @@ Polymer({
|
|||||||
|
|
||||||
created: function () {
|
created: function () {
|
||||||
this.configChanged = this.configChanged.bind(this);
|
this.configChanged = this.configChanged.bind(this);
|
||||||
|
this._rendered = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
detached: function () {
|
detached: function () {
|
||||||
@ -169,6 +170,8 @@ Polymer({
|
|||||||
},
|
},
|
||||||
|
|
||||||
configChanged: function (config) {
|
configChanged: function (config) {
|
||||||
|
// onChange gets called a lot during initial rendering causing recursing calls.
|
||||||
|
if (this._rendered === null) return;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.errors = null;
|
this.errors = null;
|
||||||
this.dirty = true;
|
this.dirty = true;
|
||||||
|
@ -3,15 +3,17 @@
|
|||||||
<link rel="import" href="../../bower_components/app-layout/app-toolbar/app-toolbar.html">
|
<link rel="import" href="../../bower_components/app-layout/app-toolbar/app-toolbar.html">
|
||||||
|
|
||||||
<script src="../../bower_components/leaflet/dist/leaflet.js"></script>
|
<script src="../../bower_components/leaflet/dist/leaflet.js"></script>
|
||||||
<!-- otherwise the shadow dom polyfill breaks the CSS when vulcanized -->
|
|
||||||
<link rel="stylesheet" href="../../bower_components/leaflet/dist/leaflet.css" />
|
|
||||||
|
|
||||||
<link rel="import" href="../../src/components/ha-menu-button.html">
|
<link rel="import" href="../../src/components/ha-menu-button.html">
|
||||||
<link rel="import" href="./ha-entity-marker.html">
|
<link rel="import" href="./ha-entity-marker.html">
|
||||||
|
|
||||||
<dom-module id="ha-panel-map">
|
<dom-module id="ha-panel-map">
|
||||||
<template>
|
<template>
|
||||||
<link rel="stylesheet" href="../../bower_components/leaflet/dist/leaflet.css" />
|
<link
|
||||||
|
id='stylesheet'
|
||||||
|
rel="stylesheet"
|
||||||
|
href="../../bower_components/leaflet/dist/leaflet.css"
|
||||||
|
/>
|
||||||
|
|
||||||
<style include="ha-style">
|
<style include="ha-style">
|
||||||
#map {
|
#map {
|
||||||
@ -53,6 +55,11 @@ Polymer({
|
|||||||
},
|
},
|
||||||
|
|
||||||
attached: function () {
|
attached: function () {
|
||||||
|
// The link tag is resolved relative to the _current_ url instead of the
|
||||||
|
// source HTML file. Vulcanized this is taken care off. Fix it in dev.
|
||||||
|
if (window.HASS_DEV) {
|
||||||
|
this.$.stylesheet.href = '/static/home-assistant-polymer/bower_components/leaflet/dist/leaflet.css';
|
||||||
|
}
|
||||||
var map = this._map = window.L.map(this.$.map);
|
var map = this._map = window.L.map(this.$.map);
|
||||||
map.setView([51.505, -0.09], 13);
|
map.setView([51.505, -0.09], 13);
|
||||||
window.L.tileLayer(
|
window.L.tileLayer(
|
||||||
|
@ -77,7 +77,7 @@ Polymer({
|
|||||||
},
|
},
|
||||||
|
|
||||||
computeCurrentPanel: function (hass, routeData) {
|
computeCurrentPanel: function (hass, routeData) {
|
||||||
return hass.config.panels[routeData.panel];
|
return routeData ? hass.config.panels[routeData.panel] : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
panelChanged: function (panel) {
|
panelChanged: function (panel) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<link rel="import" href="../../bower_components/polymer/polymer.html">
|
<link rel="import" href="../../bower_components/polymer/polymer.html">
|
||||||
|
|
||||||
<style is="custom-style">
|
<custom-style>
|
||||||
|
<style is="custom-style">/* remove is= on Polymer 2 */
|
||||||
html {
|
html {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
||||||
@ -58,6 +59,7 @@
|
|||||||
--light-primary-opacity: 1.0;
|
--light-primary-opacity: 1.0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
</custom-style>
|
||||||
|
|
||||||
<dom-module id='ha-style'>
|
<dom-module id='ha-style'>
|
||||||
<template>
|
<template>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user