mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-16 22:06:34 +00:00
Add option to hide the group card switch (#159)
* Add option to hide the group card switch * Changed hide_switch to control * lint * lint again * Pick state-card-display if control is hidden * fix permissions
This commit is contained in:
parent
2652823d35
commit
4697af1b0d
@ -110,7 +110,7 @@ Polymer({
|
|||||||
showGroupToggle: function (groupEntity, states) {
|
showGroupToggle: function (groupEntity, states) {
|
||||||
var canToggleCount;
|
var canToggleCount;
|
||||||
|
|
||||||
if (!groupEntity || !states ||
|
if (!groupEntity || !states || groupEntity.attributes.control === 'hidden' ||
|
||||||
(groupEntity.state !== 'on' && groupEntity.state !== 'off')) {
|
(groupEntity.state !== 'on' && groupEntity.state !== 'off')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -163,13 +163,12 @@ window.hassUtil.relativeTime.tests = [
|
|||||||
7, 'day',
|
7, 'day',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
window.hassUtil.stateCardType = function (hass, state) {
|
window.hassUtil.stateCardType = function (hass, state) {
|
||||||
if (state.state === 'unavailable') {
|
if (state.state === 'unavailable') {
|
||||||
return 'display';
|
return 'display';
|
||||||
} else if (window.hassUtil.DOMAINS_WITH_CARD.indexOf(state.domain) !== -1) {
|
} else if (window.hassUtil.DOMAINS_WITH_CARD.indexOf(state.domain) !== -1) {
|
||||||
return state.domain;
|
return state.domain;
|
||||||
} else if (window.hassUtil.canToggle(hass, state.entityId)) {
|
} else if (window.hassUtil.canToggle(hass, state.entityId) && state.attributes.control !== 'hidden') {
|
||||||
return 'toggle';
|
return 'toggle';
|
||||||
}
|
}
|
||||||
return 'display';
|
return 'display';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user