mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-08 01:46:35 +00:00
Pushed Updater card and more-info
This commit is contained in:
parent
43a2b6b238
commit
dd76a2a5c9
@ -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">
|
||||
|
@ -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',
|
||||
|
25
src/cards/state-card-updater.html
Normal file
25
src/cards/state-card-updater.html
Normal 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>
|
20
src/cards/state-card-updater.js
Normal file
20
src/cards/state-card-updater.js
Normal 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', {})
|
||||
},
|
||||
});
|
@ -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>
|
||||
|
@ -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',
|
||||
|
55
src/more-infos/more-info-updater.html
Normal file
55
src/more-infos/more-info-updater.html
Normal 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>
|
15
src/more-infos/more-info-updater.js
Normal file
15
src/more-infos/more-info-updater.js
Normal 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');
|
||||
},
|
||||
});
|
@ -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";
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user