mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-14 12:56:37 +00:00
Scenes and scripts will no longer be badges
It lead to a confusing user experience
This commit is contained in:
parent
2621941919
commit
e933aa8708
@ -1,14 +1,12 @@
|
|||||||
import Polymer from '../../polymer';
|
import Polymer from '../../polymer';
|
||||||
import hass from '../../util/home-assistant-js-instance';
|
import hass from '../../util/home-assistant-js-instance';
|
||||||
import domainIcon from '../../util/domain-icon';
|
import domainIcon from '../../util/domain-icon';
|
||||||
import canToggle from '../../util/can-toggle';
|
|
||||||
import stateIcon from '../../util/state-icon';
|
import stateIcon from '../../util/state-icon';
|
||||||
|
|
||||||
require('../../components/ha-label-badge');
|
require('../../components/ha-label-badge');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
moreInfoActions,
|
moreInfoActions,
|
||||||
serviceActions,
|
|
||||||
} = hass;
|
} = hass;
|
||||||
|
|
||||||
export default new Polymer({
|
export default new Polymer({
|
||||||
@ -27,24 +25,12 @@ export default new Polymer({
|
|||||||
|
|
||||||
badgeTap(ev) {
|
badgeTap(ev) {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
if (!canToggle(this.state.entityId)) {
|
this.async(() => moreInfoActions.selectEntity(this.state.entityId), 1);
|
||||||
this.async(() => moreInfoActions.selectEntity(this.state.entityId), 1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.state.domain === 'scene' || this.state.state === 'off') {
|
|
||||||
serviceActions.callTurnOn(this.state.entityId);
|
|
||||||
} else {
|
|
||||||
serviceActions.callTurnOff(this.state.entityId);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
computeClasses(state) {
|
computeClasses(state) {
|
||||||
switch (state.domain) {
|
switch (state.domain) {
|
||||||
case 'scene':
|
|
||||||
return 'green';
|
|
||||||
case 'binary_sensor':
|
case 'binary_sensor':
|
||||||
case 'script':
|
|
||||||
return state.state === 'on' ? 'blue' : 'grey';
|
|
||||||
case 'updater':
|
case 'updater':
|
||||||
return 'blue';
|
return 'blue';
|
||||||
default:
|
default:
|
||||||
@ -58,8 +44,6 @@ export default new Polymer({
|
|||||||
case 'device_tracker':
|
case 'device_tracker':
|
||||||
case 'updater':
|
case 'updater':
|
||||||
case 'sun':
|
case 'sun':
|
||||||
case 'scene':
|
|
||||||
case 'script':
|
|
||||||
case 'alarm_control_panel':
|
case 'alarm_control_panel':
|
||||||
return null;
|
return null;
|
||||||
case 'sensor':
|
case 'sensor':
|
||||||
@ -85,9 +69,7 @@ export default new Polymer({
|
|||||||
return domainIcon(state.domain, state.state);
|
return domainIcon(state.domain, state.state);
|
||||||
case 'binary_sensor':
|
case 'binary_sensor':
|
||||||
case 'device_tracker':
|
case 'device_tracker':
|
||||||
case 'scene':
|
|
||||||
case 'updater':
|
case 'updater':
|
||||||
case 'script':
|
|
||||||
return stateIcon(state);
|
return stateIcon(state);
|
||||||
case 'sun':
|
case 'sun':
|
||||||
return state.state === 'above_horizon' ?
|
return state.state === 'above_horizon' ?
|
||||||
@ -106,9 +88,6 @@ export default new Polymer({
|
|||||||
return 'unavai';
|
return 'unavai';
|
||||||
}
|
}
|
||||||
switch (state.domain) {
|
switch (state.domain) {
|
||||||
case 'scene':
|
|
||||||
case 'script':
|
|
||||||
return state.domain;
|
|
||||||
case 'device_tracker':
|
case 'device_tracker':
|
||||||
return state.state === 'not_home' ? 'Away' : state.state;
|
return state.state === 'not_home' ? 'Away' : state.state;
|
||||||
case 'alarm_control_panel':
|
case 'alarm_control_panel':
|
||||||
|
@ -23,8 +23,6 @@ const PRIORITY = {
|
|||||||
alarm_control_panel: 3,
|
alarm_control_panel: 3,
|
||||||
sensor: 5,
|
sensor: 5,
|
||||||
binary_sensor: 6,
|
binary_sensor: 6,
|
||||||
scene: 7,
|
|
||||||
script: 8,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function getPriority(domain) {
|
function getPriority(domain) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user