mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Scenes can can no longer be toggled
This commit is contained in:
parent
3d6792691a
commit
5973dd4171
@ -26,7 +26,8 @@ export default new Polymer({
|
||||
},
|
||||
|
||||
entityTapped(ev) {
|
||||
if (ev.target.classList.contains('paper-toggle-button')) {
|
||||
if (ev.target.classList.contains('paper-toggle-button') ||
|
||||
ev.target.classList.contains('paper-icon-button')) {
|
||||
return;
|
||||
}
|
||||
ev.stopPropagation();
|
||||
|
@ -16,6 +16,10 @@
|
||||
--ha-label-badge-color: #039be5;
|
||||
}
|
||||
|
||||
.green {
|
||||
--ha-label-badge-color: #0DA035;
|
||||
}
|
||||
|
||||
.grey {
|
||||
--ha-label-badge-color: var(--paper-grey-500);
|
||||
}
|
||||
|
@ -28,11 +28,8 @@ export default new Polymer({
|
||||
this.async(() => moreInfoActions.selectEntity(this.state.entityId), 1);
|
||||
return;
|
||||
}
|
||||
if (this.state.domain === 'scene' && this.state.state === 'on' &&
|
||||
!this.state.attributes.active_requested) {
|
||||
// Scenes that are on but by virtue of other events then itself
|
||||
// being turned on cannot be turned off.
|
||||
return;
|
||||
if (this.state.domain === 'scene') {
|
||||
serviceActions.callTurnOn(this.state.entityId);
|
||||
} else if (this.state.state === 'off') {
|
||||
serviceActions.callTurnOn(this.state.entityId);
|
||||
} else {
|
||||
@ -43,6 +40,7 @@ export default new Polymer({
|
||||
computeClasses(state) {
|
||||
switch (state.domain) {
|
||||
case 'scene':
|
||||
return 'green';
|
||||
case 'script':
|
||||
return state.state === 'on' ? 'blue' : 'grey';
|
||||
default:
|
||||
|
@ -29,6 +29,7 @@
|
||||
transition: border .3s ease-in-out;
|
||||
}
|
||||
.label-badge .value {
|
||||
font-size: 90%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ require('../components/state-history-charts');
|
||||
require('../more-infos/more-info-content');
|
||||
|
||||
// if you don't want the history component to show add the domain to this array
|
||||
const DOMAINS_WITH_NO_HISTORY = ['camera', 'configurator'];
|
||||
const DOMAINS_WITH_NO_HISTORY = ['camera', 'configurator', 'scene'];
|
||||
|
||||
export default new Polymer({
|
||||
is: 'more-info-dialog',
|
||||
|
@ -1,15 +1,22 @@
|
||||
<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="./state-card-display.html">
|
||||
<link rel="import" href="./state-card-toggle.html">
|
||||
<link rel="import" href="../components/state-info.html">
|
||||
|
||||
<dom-module id="state-card-scene">
|
||||
<style>
|
||||
paper-icon-button {
|
||||
border: 1px solid;
|
||||
border-radius: 50%;
|
||||
color: var(--default-primary-color);
|
||||
line-height: 24px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<template is='dom-if' if='[[allowToggle]]'>
|
||||
<state-card-toggle state-obj="[[stateObj]]"></state-card-toggle>
|
||||
</template>
|
||||
<template is='dom-if' if='[[!allowToggle]]'>
|
||||
<state-card-display state-obj="[[stateObj]]"></state-card-display>
|
||||
</template>
|
||||
<div class='horizontal justified layout'>
|
||||
<state-info state-obj="[[stateObj]]"></state-info>
|
||||
<paper-icon-button on-tap='activateScene' icon='av:play-arrow'></paper-icon-button>
|
||||
</div>
|
||||
</template>
|
||||
</dom-module>
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Polymer from '../polymer';
|
||||
import { serviceActions } from '../util/home-assistant-js-instance';
|
||||
|
||||
require('./state-card-display');
|
||||
require('./state-card-toggle');
|
||||
require('../components/state-info.js');
|
||||
|
||||
export default new Polymer({
|
||||
is: 'state-card-scene',
|
||||
@ -10,15 +10,11 @@ export default new Polymer({
|
||||
stateObj: {
|
||||
type: Object,
|
||||
},
|
||||
|
||||
allowToggle: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
computed: 'computeAllowToggle(stateObj)',
|
||||
},
|
||||
},
|
||||
|
||||
computeAllowToggle(stateObj) {
|
||||
return stateObj.state === 'off' || stateObj.attributes.active_requested;
|
||||
activateScene(ev) {
|
||||
// ev.preventDefault();
|
||||
// ev.stopPropagation();
|
||||
serviceActions.callTurnOn(this.stateObj.entityId);
|
||||
},
|
||||
});
|
||||
|
@ -19,6 +19,6 @@ export default new Polymer({
|
||||
|
||||
cardTapped(ev) {
|
||||
ev.stopPropagation();
|
||||
this.async(() => moreInfoActions.selectEntity(this.stateObj.entityId), 100);
|
||||
this.async(() => moreInfoActions.selectEntity(this.stateObj.entityId), 1);
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user