mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Add persistent notification card
This commit is contained in:
parent
168706fdb1
commit
1e1a3a1c84
@ -1 +1 @@
|
||||
Subproject commit 526ede8bf000ebfd38665c2a069577ead177297b
|
||||
Subproject commit ef0de1d545665359927ddae503b64878953a9d2e
|
@ -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'>
|
||||
|
47
src/cards/ha-persistent_notification-card.html
Normal file
47
src/cards/ha-persistent_notification-card.html
Normal 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>
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user