mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Show scripts as a button if cannot cancel
This commit is contained in:
parent
78c036f443
commit
6615f2366c
@ -6,6 +6,7 @@
|
|||||||
<link rel="import" href="state-card-media_player.html">
|
<link rel="import" href="state-card-media_player.html">
|
||||||
<link rel="import" href="state-card-rollershutter.html">
|
<link rel="import" href="state-card-rollershutter.html">
|
||||||
<link rel="import" href="state-card-scene.html">
|
<link rel="import" href="state-card-scene.html">
|
||||||
|
<link rel="import" href="state-card-script.html">
|
||||||
<link rel="import" href="state-card-thermostat.html">
|
<link rel="import" href="state-card-thermostat.html">
|
||||||
<link rel="import" href="state-card-toggle.html">
|
<link rel="import" href="state-card-toggle.html">
|
||||||
<link rel="import" href="state-card-weblink.html">
|
<link rel="import" href="state-card-weblink.html">
|
||||||
|
@ -8,6 +8,7 @@ require('./state-card-display');
|
|||||||
require('./state-card-input_select');
|
require('./state-card-input_select');
|
||||||
require('./state-card-media_player');
|
require('./state-card-media_player');
|
||||||
require('./state-card-scene');
|
require('./state-card-scene');
|
||||||
|
require('./state-card-script');
|
||||||
require('./state-card-rollershutter');
|
require('./state-card-rollershutter');
|
||||||
require('./state-card-thermostat');
|
require('./state-card-thermostat');
|
||||||
require('./state-card-toggle');
|
require('./state-card-toggle');
|
||||||
|
28
src/state-summary/state-card-script.html
Normal file
28
src/state-summary/state-card-script.html
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<link rel="import" href="../../bower_components/polymer/polymer.html">
|
||||||
|
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
|
||||||
|
|
||||||
|
<link rel="import" href="../components/state-info.html">
|
||||||
|
<link rel="import" href="../components/entity/ha-entity-toggle.html">
|
||||||
|
|
||||||
|
<dom-module id="state-card-script">
|
||||||
|
<style>
|
||||||
|
paper-icon-button {
|
||||||
|
border: 1px solid;
|
||||||
|
border-radius: 50%;
|
||||||
|
color: var(--default-primary-color);
|
||||||
|
line-height: 24px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class='horizontal justified layout'>
|
||||||
|
<state-info state-obj="[[stateObj]]"></state-info>
|
||||||
|
<template is='dom-if' if='[[stateObj.attributes.can_cancel]]'>
|
||||||
|
<ha-entity-toggle state-obj='[[stateObj]]'></ha-entity-toggle>
|
||||||
|
</template>
|
||||||
|
<template is='dom-if' if='[[!stateObj.attributes.can_cancel]]'>
|
||||||
|
<paper-icon-button on-tap='fireScript' icon='mdi:play'></paper-icon-button>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</dom-module>
|
21
src/state-summary/state-card-script.js
Normal file
21
src/state-summary/state-card-script.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import Polymer from '../polymer';
|
||||||
|
import hass from '../util/home-assistant-js-instance';
|
||||||
|
|
||||||
|
require('../components/state-info');
|
||||||
|
require('../components/entity/ha-entity-toggle');
|
||||||
|
|
||||||
|
const { serviceActions } = hass;
|
||||||
|
|
||||||
|
export default new Polymer({
|
||||||
|
is: 'state-card-script',
|
||||||
|
|
||||||
|
properties: {
|
||||||
|
stateObj: {
|
||||||
|
type: Object,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
fireScript() {
|
||||||
|
serviceActions.callTurnOn(this.stateObj.entityId);
|
||||||
|
},
|
||||||
|
});
|
@ -6,6 +6,7 @@ const DOMAINS_WITH_CARD = [
|
|||||||
'media_player',
|
'media_player',
|
||||||
'rollershutter',
|
'rollershutter',
|
||||||
'scene',
|
'scene',
|
||||||
|
'script',
|
||||||
'thermostat',
|
'thermostat',
|
||||||
'weblink',
|
'weblink',
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user