Pushed Updater card and more-info

This commit is contained in:
Ryan Kraus 2015-07-13 23:21:01 -04:00
parent 43a2b6b238
commit dd76a2a5c9
11 changed files with 129 additions and 2 deletions

View File

@ -6,3 +6,4 @@
<link rel="import" href="state-card-configurator.html">
<link rel="import" href="state-card-scene.html">
<link rel="import" href="state-card-media_player.html">
<link rel="import" href="state-card-updater.html">

View File

@ -8,6 +8,7 @@ require('./state-card-thermostat');
require('./state-card-configurator');
require('./state-card-scene');
require('./state-card-media_player');
require('./state-card-updater');
export default Polymer({
is: 'state-card-content',

View File

@ -0,0 +1,25 @@
<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/state-info.html">
<dom-module id="state-card-updater">
<style>
.state {
margin-left: 16px;
text-transform: capitalize;
font-weight: 300;
font-size: 1.3rem;
text-align: right;
}
</style>
<template>
<div class='horizontal justified layout'>
<state-info state-obj="[[stateObj]]"></state-info>
<paper-button raised on-tap="buttonTapped">
Update
</paper-button>
</div>
</template>
</dom-module>

View File

@ -0,0 +1,20 @@
import { serviceActions } from 'home-assistant-js';
import Polymer from '../polymer';
require('../components/state-info');
export default Polymer({
is: 'state-card-updater',
properties: {
stateObj: {
type: Object,
},
},
buttonTapped: function(ev) {
ev.stopPropagation();
window.hass.serviceActions.callService('updater', 'update', {})
},
});

View File

@ -9,6 +9,7 @@
<link rel='import' href='more-info-light.html'>
<link rel='import' href='more-info-media_player.html'>
<link rel='import' href='more-info-camera.html'>
<link rel='import' href='more-info-updater.html'>
<dom-module id='more-info-content'>
<style>

View File

@ -10,6 +10,7 @@ require('./more-info-script');
require('./more-info-light');
require('./more-info-media_player');
require('./more-info-camera');
require('./more-info-updater');
export default Polymer({
is: 'more-info-content',

View File

@ -0,0 +1,55 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/paper-button/paper-button.html">
<dom-module id="more-info-updater">
<style>
.data-entry .value {
max-width: 200px;
}
.center {
text-align: center;
}
.centered {
margin: auto;
}
.divider {
padding: 5px;
}
.link {
color: #03A9F4;
}
</style>
<template>
<div class='layout vertical'>
<!-- GitHub Link -->
<div class='data-entry layout justified horizontal center' style="width:100%" id='setting'>
<paper-button class='centered link' on-tap="linkTapped">
View on GitHub
</paper-button>
</div>
<div class='data-entry layout justified horizontal'>
<div class='key'>Updated On:</div>
<div class='value'>[[stateObj.attributes.date]]</div>
</div>
<div class='data-entry layout justified vertical'>
<div class='key'>Release Notes:</div>
<div class='centered'>[[stateObj.attributes.message]]<br /></div>
</div>
<div class='divider'></div>
<div class='data-entry layout justified vertical'>
<div class='key'>Remote SHA:</div>
<div class='centered'>[[stateObj.attributes.remote_sha]]<br /></div>
</div>
<div class='data-entry layout justified vertical'>
<div class='key'>Local SHA:</div>
<div class='centered'>[[stateObj.attributes.local_sha]]<br /></div>
</div>
</div>
</template>
</dom-module>

View File

@ -0,0 +1,15 @@
import { util } from 'home-assistant-js';
export default Polymer({
is: 'more-info-updater',
properties: {
stateObj: {
type: Object,
},
},
linkTapped: function(stateObj) {
window.open(this.stateObj.attributes.link, '_blank');
},
});

View File

@ -51,6 +51,13 @@ export default function domainIcon(domain, state) {
case 'scene':
return 'social:pages';
case 'updater':
if(state == "True") {
return 'icons:cloud-download';
} else {
return 'icons:cloud-done';
}
default:
return "bookmark";
}

View File

@ -1,7 +1,7 @@
import { reactor, serviceGetters } from 'home-assistant-js';
const DOMAINS_WITH_CARD = [
'thermostat', 'configurator', 'scene', 'media_player'];
'thermostat', 'configurator', 'scene', 'media_player', 'updater'];
export default function stateCardType(state) {
if(DOMAINS_WITH_CARD.indexOf(state.domain) !== -1) {

View File

@ -1,5 +1,6 @@
const DOMAINS_WITH_MORE_INFO = [
'light', 'group', 'sun', 'configurator', 'thermostat', 'script', 'media_player', 'camera'
'light', 'group', 'sun', 'configurator', 'thermostat', 'script',
'media_player', 'camera', 'updater'
];
export default function stateMoreInfoType(state) {