Add persistent notification card

This commit is contained in:
Paulus Schoutsen 2016-06-24 22:33:32 -07:00
parent 168706fdb1
commit 1e1a3a1c84
4 changed files with 51 additions and 1 deletions

@ -1 +1 @@
Subproject commit 526ede8bf000ebfd38665c2a069577ead177297b
Subproject commit ef0de1d545665359927ddae503b64878953a9d2e

View File

@ -4,3 +4,4 @@
<link rel='import' href='./ha-entities-card.html'>
<link rel='import' href='./ha-introduction-card.html'>
<link rel='import' href='./ha-media_player-card.html'>
<link rel='import' href='./ha-persistent_notification-card.html'>

View File

@ -0,0 +1,47 @@
<link rel='import' href='../../bower_components/polymer/polymer.html'>
<link rel='import' href='../../bower_components/paper-button/paper-button.html'>
<link rel='import' href='../components/ha-card.html'>
<dom-module id='ha-persistent_notification-card'>
<style>
:host {
@apply(--paper-font-body1);
}
.content {
padding: 0 16px 16px;
}
paper-button {
margin: 8px;
font-weight: 500;
}
</style>
<template>
<ha-card header="[[computeTitle(stateObj)]]">
<div class='content'>[[stateObj.state]]</div>
<paper-button on-tap='dismissTap'>DISMISS</paper-button>
</ha-card>
</template>
</dom-module>
<script>
Polymer({
is: 'ha-persistent_notification-card',
properties: {
hass: {
type: Object,
},
},
computeTitle: function (stateObj) {
return stateObj.attributes.title || stateObj.entityDisplay;
},
dismissTap: function (ev) {
ev.preventDefault();
this.hass.entityActions.delete(this.stateObj);
},
});
</script>

View File

@ -7,10 +7,12 @@ import '../cards/ha-card-chooser';
const DOMAINS_WITH_CARD = {
camera: 4,
media_player: 3,
persistent_notification: 0,
};
const PRIORITY = {
configurator: -20,
persistent_notification: -15,
group: -10,
a: -1,
updater: 0,