mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-17 06:16:33 +00:00
Merge pull request #1 from rmkraus/master
Added Updater card and more-info
This commit is contained in:
commit
e127cb3e25
@ -9,6 +9,7 @@
|
|||||||
<link rel='import' href='more-info-light.html'>
|
<link rel='import' href='more-info-light.html'>
|
||||||
<link rel='import' href='more-info-media_player.html'>
|
<link rel='import' href='more-info-media_player.html'>
|
||||||
<link rel='import' href='more-info-camera.html'>
|
<link rel='import' href='more-info-camera.html'>
|
||||||
|
<link rel='import' href='more-info-updater.html'>
|
||||||
|
|
||||||
<dom-module id='more-info-content'>
|
<dom-module id='more-info-content'>
|
||||||
<style>
|
<style>
|
||||||
|
@ -10,6 +10,7 @@ require('./more-info-script');
|
|||||||
require('./more-info-light');
|
require('./more-info-light');
|
||||||
require('./more-info-media_player');
|
require('./more-info-media_player');
|
||||||
require('./more-info-camera');
|
require('./more-info-camera');
|
||||||
|
require('./more-info-updater');
|
||||||
|
|
||||||
export default Polymer({
|
export default Polymer({
|
||||||
is: 'more-info-content',
|
is: 'more-info-content',
|
||||||
|
60
src/more-infos/more-info-updater.html
Normal file
60
src/more-infos/more-info-updater.html
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<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'>
|
||||||
|
|
||||||
|
<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' 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='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>
|
20
src/more-infos/more-info-updater.js
Normal file
20
src/more-infos/more-info-updater.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { util } from 'home-assistant-js';
|
||||||
|
import { serviceActions } from 'home-assistant-js';
|
||||||
|
|
||||||
|
export default Polymer({
|
||||||
|
is: 'more-info-updater',
|
||||||
|
|
||||||
|
properties: {
|
||||||
|
stateObj: {
|
||||||
|
type: Object,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
updateTapped: function(stateObj) {
|
||||||
|
serviceActions.callService('updater', 'update', {})
|
||||||
|
},
|
||||||
|
|
||||||
|
linkTapped: function(stateObj) {
|
||||||
|
window.open(this.stateObj.attributes.link, '_blank');
|
||||||
|
},
|
||||||
|
});
|
@ -51,6 +51,13 @@ export default function domainIcon(domain, state) {
|
|||||||
case 'scene':
|
case 'scene':
|
||||||
return 'social:pages';
|
return 'social:pages';
|
||||||
|
|
||||||
|
case 'updater':
|
||||||
|
if(state == "True") {
|
||||||
|
return 'icons:cloud-download';
|
||||||
|
} else {
|
||||||
|
return 'icons:cloud-done';
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return "bookmark";
|
return "bookmark";
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const DOMAINS_WITH_MORE_INFO = [
|
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) {
|
export default function stateMoreInfoType(state) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user