mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 14:56:37 +00:00
Inline domain icon (#1739)
This commit is contained in:
parent
442375f76e
commit
c90e13d35e
@ -1,33 +0,0 @@
|
|||||||
import '@polymer/iron-icon/iron-icon.js';
|
|
||||||
import { html } from '@polymer/polymer/lib/utils/html-tag.js';
|
|
||||||
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
||||||
|
|
||||||
import domainIcon from '../common/entity/domain_icon.js';
|
|
||||||
|
|
||||||
class DomainIcon extends PolymerElement {
|
|
||||||
static get template() {
|
|
||||||
return html`
|
|
||||||
<iron-icon icon="[[computeIcon(domain, state)]]"></iron-icon>
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
static get properties() {
|
|
||||||
return {
|
|
||||||
domain: {
|
|
||||||
type: String,
|
|
||||||
value: '',
|
|
||||||
},
|
|
||||||
|
|
||||||
state: {
|
|
||||||
type: String,
|
|
||||||
value: '',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
computeIcon(domain, state) {
|
|
||||||
return domainIcon(domain, state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
customElements.define('domain-icon', DomainIcon);
|
|
@ -1,12 +1,12 @@
|
|||||||
import '@polymer/iron-flex-layout/iron-flex-layout-classes.js';
|
import '@polymer/iron-flex-layout/iron-flex-layout-classes.js';
|
||||||
|
import '@polymer/iron-icon/iron-icon.js';
|
||||||
import { html } from '@polymer/polymer/lib/utils/html-tag.js';
|
import { html } from '@polymer/polymer/lib/utils/html-tag.js';
|
||||||
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
||||||
|
|
||||||
import '../../components/domain-icon.js';
|
|
||||||
|
|
||||||
|
|
||||||
import formatTime from '../../common/datetime/format_time.js';
|
import formatTime from '../../common/datetime/format_time.js';
|
||||||
import EventsMixin from '../../mixins/events-mixin.js';
|
import EventsMixin from '../../mixins/events-mixin.js';
|
||||||
|
import domainIcon from '../../common/entity/domain_icon.js';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @appliesMixin EventsMixin
|
* @appliesMixin EventsMixin
|
||||||
@ -52,7 +52,7 @@ class HaLogbook extends EventsMixin(PolymerElement) {
|
|||||||
<template is="dom-repeat" items="[[entries]]">
|
<template is="dom-repeat" items="[[entries]]">
|
||||||
<div class="horizontal layout entry">
|
<div class="horizontal layout entry">
|
||||||
<div class="time">[[_formatTime(item.when)]]</div>
|
<div class="time">[[_formatTime(item.when)]]</div>
|
||||||
<domain-icon domain="[[item.domain]]" class="icon"></domain-icon>
|
<iron-icon icon="[[_computeIcon(item.domain)]]"></iron-icon>
|
||||||
<div class="message" flex="">
|
<div class="message" flex="">
|
||||||
<template is="dom-if" if="[[!item.entity_id]]">
|
<template is="dom-if" if="[[!item.entity_id]]">
|
||||||
<span class="name">[[item.name]]</span>
|
<span class="name">[[item.name]]</span>
|
||||||
@ -85,6 +85,10 @@ class HaLogbook extends EventsMixin(PolymerElement) {
|
|||||||
return formatTime(new Date(date), this.language);
|
return formatTime(new Date(date), this.language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_computeIcon(domain) {
|
||||||
|
return domainIcon(domain);
|
||||||
|
}
|
||||||
|
|
||||||
entityClicked(ev) {
|
entityClicked(ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
this.fire('hass-more-info', { entityId: ev.model.item.entity_id });
|
this.fire('hass-more-info', { entityId: ev.model.item.entity_id });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user