Applying Updater suggested fixes

This commit is contained in:
Ryan Kraus 2015-07-14 20:32:19 -04:00
parent 5a4295b27a
commit 2a437c7023
7 changed files with 16 additions and 53 deletions

View File

@ -6,4 +6,3 @@
<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,7 +8,6 @@ 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

@ -1,25 +0,0 @@
<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

@ -1,20 +0,0 @@
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();
serviceActions.callService('updater', 'update', {})
},
});

View File

@ -22,24 +22,29 @@
<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">
<div class='horizontal layout center'>
<paper-button raised class='centered link' raised on-tap="updateTapped">
Update
</paper-button>
<paper-button raised class='centered link' on-tap="linkTapped">
View on GitHub
</paper-button>
</div>
<div class='divider'></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='data-entry layout justified vertical' hidden='[[!stateObj.attributes.message]]'>
<div class='key'>Release Notes:</div>
<div class='centered'>[[stateObj.attributes.message]]<br /></div>
</div>
<div class='divider'></div>
<div class='divider'></div>
<div class='data-entry layout justified vertical'>
<div class='key'>Remote SHA:</div>

View File

@ -1,4 +1,5 @@
import { util } from 'home-assistant-js';
import { serviceActions } from 'home-assistant-js';
export default Polymer({
is: 'more-info-updater',
@ -9,6 +10,10 @@ export default Polymer({
},
},
updateTapped: function(stateObj) {
serviceActions.callService('updater', 'update', {})
},
linkTapped: function(stateObj) {
window.open(this.stateObj.attributes.link, '_blank');
},

View File

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