forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request home-assistant#80 from balloob/component-logbook
Add component logbook
- Loading branch information
Showing
14 changed files
with
460 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
""" DO NOT MODIFY. Auto-generated by build_frontend script """ | ||
VERSION = "a063d1482fd49e9297d64e1329324f1c" | ||
VERSION = "b06d3667e9e461173029ded9c0c9b815" |
49 changes: 39 additions & 10 deletions
49
homeassistant/components/frontend/www_static/frontend.html
Large diffs are not rendered by default.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
homeassistant/components/frontend/www_static/polymer/components/display-time.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<link rel="import" href="../bower_components/polymer/polymer.html"> | ||
|
||
<link rel="import" href="../resources/moment-js.html"> | ||
|
||
<polymer-element name="display-time" attributes="dateObj"> | ||
<template> | ||
{{ time }} | ||
</template> | ||
<script> | ||
(function() { | ||
var timeFormatOptions = {hour: 'numeric', minute: '2-digit'}; | ||
Polymer({ | ||
time: "", | ||
|
||
dateObjChanged: function(oldVal, newVal) { | ||
if (!newVal) { | ||
this.time = ""; | ||
} | ||
|
||
this.time = newVal.toLocaleTimeString([], timeFormatOptions); | ||
}, | ||
}); | ||
})(); | ||
</script> | ||
</polymer-element> |
17 changes: 17 additions & 0 deletions
17
homeassistant/components/frontend/www_static/polymer/components/ha-logbook.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<link rel="import" href="../bower_components/polymer/polymer.html"> | ||
|
||
<link rel="import" href="../components/logbook-entry.html"> | ||
|
||
<polymer-element name="ha-logbook" attributes="entries" noscript> | ||
<template> | ||
<style> | ||
.logbook { | ||
} | ||
</style> | ||
<div class='logbook'> | ||
<template repeat="{{entries as entry}}"> | ||
<logbook-entry entryObj="{{entry}}"></logbook-entry> | ||
</template> | ||
</div> | ||
</template> | ||
</polymer> |
60 changes: 60 additions & 0 deletions
60
homeassistant/components/frontend/www_static/polymer/components/logbook-entry.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<link rel="import" href="../bower_components/polymer/polymer.html"> | ||
<link rel="import" href="../bower_components/core-style/core-style.html"> | ||
|
||
<link rel="import" href="domain-icon.html"> | ||
<link rel="import" href="display-time.html"> | ||
<link rel="import" href="relative-ha-datetime.html"> | ||
|
||
<polymer-element name="logbook-entry" attributes="entryObj"> | ||
<template> | ||
<core-style ref='ha-main'></core-style> | ||
<style> | ||
.logbook-entry { | ||
line-height: 2em; | ||
} | ||
|
||
.time { | ||
width: 55px; | ||
font-size: .8em; | ||
} | ||
|
||
.icon { | ||
margin: 0 8px 0 16px; | ||
} | ||
|
||
.name { | ||
text-transform: capitalize; | ||
} | ||
|
||
.message { | ||
|
||
} | ||
</style> | ||
|
||
<div horizontal layout class='logbook-entry'> | ||
<display-time dateObj="{{entryObj.when}}" class='time secondary-text-color'></display-time> | ||
<domain-icon domain="{{entryObj.domain}}" class='icon primary-text-color'></domain-icon> | ||
<div class='message primary-text-color' flex> | ||
<template if="{{!entryObj.entityId}}"> | ||
<span class='name'>{{entryObj.name}}</span> | ||
</template> | ||
<template if="{{entryObj.entityId}}"> | ||
<a href='#' on-click="{{entityClicked}}" class='name'>{{entryObj.name}}</a> | ||
</template> | ||
{{entryObj.message}} | ||
</div> | ||
</div> | ||
</template> | ||
<script> | ||
(function() { | ||
var uiActions = window.hass.uiActions; | ||
|
||
Polymer({ | ||
entityClicked: function() { | ||
uiActions.showMoreInfoDialog(this.entryObj.entityId); | ||
} | ||
}); | ||
|
||
})(); | ||
</script> | ||
</polymer-element> |
2 changes: 1 addition & 1 deletion
2
homeassistant/components/frontend/www_static/polymer/home-assistant-js
Submodule home-assistant-js
updated
from e048bf to 282004
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
homeassistant/components/frontend/www_static/polymer/layouts/partial-logbook.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<link rel="import" href="../bower_components/polymer/polymer.html"> | ||
|
||
<link rel="import" href="./partial-base.html"> | ||
|
||
<link rel="import" href="../components/ha-logbook.html"> | ||
|
||
<polymer-element name="partial-logbook" attributes="narrow togglePanel"> | ||
<template> | ||
<style> | ||
.content { | ||
background-color: white; | ||
padding: 8px; | ||
} | ||
</style> | ||
<partial-base narrow="{{narrow}}" togglePanel="{{togglePanel}}"> | ||
<span header-title>Logbook</span> | ||
|
||
<span header-buttons> | ||
<paper-icon-button icon="refresh" | ||
on-click="{{handleRefreshClick}}"></paper-icon-button> | ||
</span> | ||
|
||
<div flex class="{{ {content: true, narrow: narrow, wide: !narrow} | tokenList }}"> | ||
<ha-logbook entries="{{entries}}"></ha-logbook> | ||
</div> | ||
</partial-base> | ||
</template> | ||
<script> | ||
var storeListenerMixIn = window.hass.storeListenerMixIn; | ||
var logbookActions = window.hass.logbookActions; | ||
|
||
Polymer(Polymer.mixin({ | ||
entries: null, | ||
|
||
attached: function() { | ||
this.listenToStores(true); | ||
}, | ||
|
||
detached: function() { | ||
this.stopListeningToStores(); | ||
}, | ||
|
||
logbookStoreChanged: function(logbookStore) { | ||
if (logbookStore.isStale()) { | ||
logbookActions.fetch(); | ||
} | ||
|
||
this.entries = logbookStore.all.toArray(); | ||
}, | ||
|
||
handleRefreshClick: function() { | ||
logbookActions.fetch(); | ||
}, | ||
}, storeListenerMixIn)); | ||
</script> | ||
</polymer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
homeassistant/components/frontend/www_static/polymer/resources/home-assistant-style.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.