mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Migrate behavior to global object
This commit is contained in:
parent
502497bccb
commit
8af4e6eb3f
@ -1,10 +1,9 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'entity-list',
|
is: 'entity-list',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'events-list',
|
is: 'events-list',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
require('./stream-status');
|
require('./stream-status');
|
||||||
|
|
||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'ha-sidebar',
|
is: 'ha-sidebar',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'ha-view-tabs',
|
is: 'ha-view-tabs',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
require('./domain-icon');
|
require('./domain-icon');
|
||||||
|
|
||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'services-list',
|
is: 'services-list',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'stream-status',
|
is: 'stream-status',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'ha-voice-command-dialog',
|
is: 'ha-voice-command-dialog',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
require('../state-summary/state-card-content');
|
require('../state-summary/state-card-content');
|
||||||
require('../components/state-history-charts');
|
require('../components/state-history-charts');
|
||||||
@ -10,7 +9,7 @@ const DOMAINS_WITH_NO_HISTORY = ['camera', 'configurator', 'scene'];
|
|||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'more-info-dialog',
|
is: 'more-info-dialog',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
stateObj: {
|
stateObj: {
|
||||||
|
@ -2,13 +2,16 @@ import moment from 'moment';
|
|||||||
import Polymer from './polymer';
|
import Polymer from './polymer';
|
||||||
|
|
||||||
import HomeAssistant from 'home-assistant-js';
|
import HomeAssistant from 'home-assistant-js';
|
||||||
import nuclearObserver from './util/bound-nuclear-behavior';
|
|
||||||
import validateAuth from './util/validate-auth';
|
import validateAuth from './util/validate-auth';
|
||||||
|
import hassBehavior from './util/hass-behavior';
|
||||||
|
|
||||||
|
window.hassBehavior = hassBehavior;
|
||||||
window.moment = moment;
|
window.moment = moment;
|
||||||
|
|
||||||
require('./layouts/login-form');
|
require('./layouts/login-form');
|
||||||
require('./layouts/home-assistant-main');
|
require('./layouts/home-assistant-main');
|
||||||
|
|
||||||
|
// While we figure out how ha-entity-marker can keep it's references
|
||||||
window.hass = new HomeAssistant();
|
window.hass = new HomeAssistant();
|
||||||
|
|
||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
@ -19,7 +22,7 @@ export default new Polymer({
|
|||||||
icons: null,
|
icons: null,
|
||||||
},
|
},
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
|
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
import removeInitMsg from '../util/remove-init-message';
|
import removeInitMsg from '../util/remove-init-message';
|
||||||
|
|
||||||
require('../components/ha-sidebar');
|
require('../components/ha-sidebar');
|
||||||
@ -27,7 +26,7 @@ require('../dialogs/ha-voice-command-dialog');
|
|||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'home-assistant-main',
|
is: 'home-assistant-main',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
|
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
import validateAuth from '../util/validate-auth';
|
import validateAuth from '../util/validate-auth';
|
||||||
import removeInitMsg from '../util/remove-init-message';
|
import removeInitMsg from '../util/remove-init-message';
|
||||||
|
|
||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'login-form',
|
is: 'login-form',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
require('./partial-base');
|
require('./partial-base');
|
||||||
require('../components/ha-cards');
|
require('../components/ha-cards');
|
||||||
@ -8,7 +7,7 @@ require('../components/ha-view-tabs');
|
|||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'partial-cards',
|
is: 'partial-cards',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
require('./partial-base');
|
require('./partial-base');
|
||||||
|
|
||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'partial-dev-info',
|
is: 'partial-dev-info',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
require('./partial-base');
|
require('./partial-base');
|
||||||
|
|
||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'partial-dev-template',
|
is: 'partial-dev-template',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
require('./partial-base');
|
require('./partial-base');
|
||||||
require('../components/state-history-charts');
|
require('../components/state-history-charts');
|
||||||
@ -7,7 +6,7 @@ require('../components/state-history-charts');
|
|||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'partial-history',
|
is: 'partial-history',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
require('./partial-base');
|
require('./partial-base');
|
||||||
require('../components/ha-logbook');
|
require('../components/ha-logbook');
|
||||||
@ -8,7 +7,7 @@ require('../components/loading-box');
|
|||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'partial-logbook',
|
is: 'partial-logbook',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
require('../components/entity/ha-entity-marker');
|
require('../components/entity/ha-entity-marker');
|
||||||
|
|
||||||
@ -8,7 +7,7 @@ window.L.Icon.Default.imagePath = '/static/images/leaflet';
|
|||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'partial-map',
|
is: 'partial-map',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'notification-manager',
|
is: 'notification-manager',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
|
|
||||||
require('../components/loading-box');
|
require('../components/loading-box');
|
||||||
|
|
||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'more-info-configurator',
|
is: 'more-info-configurator',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
stateObj: {
|
stateObj: {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
import nuclearObserver from '../util/bound-nuclear-behavior';
|
|
||||||
import dynamicContentUpdater from '../util/dynamic-content-updater';
|
import dynamicContentUpdater from '../util/dynamic-content-updater';
|
||||||
import stateMoreInfoType from '../util/state-more-info-type';
|
import stateMoreInfoType from '../util/state-more-info-type';
|
||||||
|
|
||||||
@ -8,7 +7,7 @@ require('../state-summary/state-card-content');
|
|||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'more-info-group',
|
is: 'more-info-group',
|
||||||
|
|
||||||
behaviors: [nuclearObserver],
|
behaviors: [window.hassBehavior],
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
hass: {
|
hass: {
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
import nuclearObserver from './nuclear-behavior';
|
|
||||||
|
|
||||||
export default nuclearObserver;
|
|
@ -16,7 +16,9 @@ export default {
|
|||||||
let getter = this.properties[key].bindNuclear;
|
let getter = this.properties[key].bindNuclear;
|
||||||
|
|
||||||
if (typeof getter !== 'function') {
|
if (typeof getter !== 'function') {
|
||||||
|
/* eslint-disable no-console */
|
||||||
console.warn(`Component ${this.nodeName} uses old style bindNuclear`);
|
console.warn(`Component ${this.nodeName} uses old style bindNuclear`);
|
||||||
|
/* eslint-enable no-console */
|
||||||
} else {
|
} else {
|
||||||
getter = getter(hass);
|
getter = getter(hass);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user