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) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
@ -13,7 +13,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.blue {
|
.blue {
|
||||||
--ha-label-badge-color: #039be5;
|
--ha-label-badge-color: #039be5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.green {
|
||||||
|
--ha-label-badge-color: #0DA035;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grey {
|
.grey {
|
||||||
|
@ -28,11 +28,8 @@ export default new Polymer({
|
|||||||
this.async(() => moreInfoActions.selectEntity(this.state.entityId), 1);
|
this.async(() => moreInfoActions.selectEntity(this.state.entityId), 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.state.domain === 'scene' && this.state.state === 'on' &&
|
if (this.state.domain === 'scene') {
|
||||||
!this.state.attributes.active_requested) {
|
serviceActions.callTurnOn(this.state.entityId);
|
||||||
// Scenes that are on but by virtue of other events then itself
|
|
||||||
// being turned on cannot be turned off.
|
|
||||||
return;
|
|
||||||
} else if (this.state.state === 'off') {
|
} else if (this.state.state === 'off') {
|
||||||
serviceActions.callTurnOn(this.state.entityId);
|
serviceActions.callTurnOn(this.state.entityId);
|
||||||
} else {
|
} else {
|
||||||
@ -43,6 +40,7 @@ export default new Polymer({
|
|||||||
computeClasses(state) {
|
computeClasses(state) {
|
||||||
switch (state.domain) {
|
switch (state.domain) {
|
||||||
case 'scene':
|
case 'scene':
|
||||||
|
return 'green';
|
||||||
case 'script':
|
case 'script':
|
||||||
return state.state === 'on' ? 'blue' : 'grey';
|
return state.state === 'on' ? 'blue' : 'grey';
|
||||||
default:
|
default:
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
transition: border .3s ease-in-out;
|
transition: border .3s ease-in-out;
|
||||||
}
|
}
|
||||||
.label-badge .value {
|
.label-badge .value {
|
||||||
|
font-size: 90%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ require('../components/state-history-charts');
|
|||||||
require('../more-infos/more-info-content');
|
require('../more-infos/more-info-content');
|
||||||
|
|
||||||
// if you don't want the history component to show add the domain to this array
|
// 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({
|
export default new Polymer({
|
||||||
is: 'more-info-dialog',
|
is: 'more-info-dialog',
|
||||||
|
@ -1,15 +1,22 @@
|
|||||||
<link rel="import" href="../../bower_components/polymer/polymer.html">
|
<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="../components/state-info.html">
|
||||||
<link rel="import" href="./state-card-toggle.html">
|
|
||||||
|
|
||||||
<dom-module id="state-card-scene">
|
<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>
|
||||||
<template is='dom-if' if='[[allowToggle]]'>
|
<div class='horizontal justified layout'>
|
||||||
<state-card-toggle state-obj="[[stateObj]]"></state-card-toggle>
|
<state-info state-obj="[[stateObj]]"></state-info>
|
||||||
</template>
|
<paper-icon-button on-tap='activateScene' icon='av:play-arrow'></paper-icon-button>
|
||||||
<template is='dom-if' if='[[!allowToggle]]'>
|
</div>
|
||||||
<state-card-display state-obj="[[stateObj]]"></state-card-display>
|
|
||||||
</template>
|
|
||||||
</template>
|
</template>
|
||||||
</dom-module>
|
</dom-module>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Polymer from '../polymer';
|
import Polymer from '../polymer';
|
||||||
|
import { serviceActions } from '../util/home-assistant-js-instance';
|
||||||
|
|
||||||
require('./state-card-display');
|
require('../components/state-info.js');
|
||||||
require('./state-card-toggle');
|
|
||||||
|
|
||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
is: 'state-card-scene',
|
is: 'state-card-scene',
|
||||||
@ -10,15 +10,11 @@ export default new Polymer({
|
|||||||
stateObj: {
|
stateObj: {
|
||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
|
|
||||||
allowToggle: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
computed: 'computeAllowToggle(stateObj)',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
computeAllowToggle(stateObj) {
|
activateScene(ev) {
|
||||||
return stateObj.state === 'off' || stateObj.attributes.active_requested;
|
// ev.preventDefault();
|
||||||
|
// ev.stopPropagation();
|
||||||
|
serviceActions.callTurnOn(this.stateObj.entityId);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -19,6 +19,6 @@ export default new Polymer({
|
|||||||
|
|
||||||
cardTapped(ev) {
|
cardTapped(ev) {
|
||||||
ev.stopPropagation();
|
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