1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-20 02:38:53 +00:00

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

View File

@@ -4,3 +4,4 @@
<link rel='import' href='./ha-entities-card.html'> <link rel='import' href='./ha-entities-card.html'>
<link rel='import' href='./ha-introduction-card.html'> <link rel='import' href='./ha-introduction-card.html'>
<link rel='import' href='./ha-media_player-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 = { const DOMAINS_WITH_CARD = {
camera: 4, camera: 4,
media_player: 3, media_player: 3,
persistent_notification: 0,
}; };
const PRIORITY = { const PRIORITY = {
configurator: -20, configurator: -20,
persistent_notification: -15,
group: -10, group: -10,
a: -1, a: -1,
updater: 0, updater: 0,