mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
Remove support for deprecated hidden property (#6220)
* Remove support for deprecated hidden property * Lint * Make sure to keep zones out of generated LL
This commit is contained in:
parent
7637d36146
commit
7b7e023103
@ -14,20 +14,20 @@ export const getViewEntities = (
|
|||||||
view.attributes.entity_id.forEach((entityId) => {
|
view.attributes.entity_id.forEach((entityId) => {
|
||||||
const entity = entities[entityId];
|
const entity = entities[entityId];
|
||||||
|
|
||||||
if (entity && !entity.attributes.hidden) {
|
if (!entity) {
|
||||||
viewEntities[entity.entity_id] = entity;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (computeDomain(entity.entity_id) === "group") {
|
viewEntities[entity.entity_id] = entity;
|
||||||
const groupEntities = getGroupEntities(entities, entity as GroupEntity);
|
|
||||||
|
|
||||||
Object.keys(groupEntities).forEach((grEntityId) => {
|
if (computeDomain(entity.entity_id) === "group") {
|
||||||
const grEntity = groupEntities[grEntityId];
|
const groupEntities = getGroupEntities(entities, entity as GroupEntity);
|
||||||
|
|
||||||
if (!grEntity.attributes.hidden) {
|
Object.keys(groupEntities).forEach((grEntityId) => {
|
||||||
viewEntities[grEntityId] = grEntity;
|
const grEntity = groupEntities[grEntityId];
|
||||||
}
|
|
||||||
});
|
viewEntities[grEntityId] = grEntity;
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -487,7 +487,6 @@ class HaConfigZwave extends LocalizeMixin(EventsMixin(PolymerElement)) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
!ent.attributes.hidden &&
|
|
||||||
"node_id" in ent.attributes &&
|
"node_id" in ent.attributes &&
|
||||||
ent.attributes.node_id === nodeid &&
|
ent.attributes.node_id === nodeid &&
|
||||||
!ent.entity_id.match("zwave[.]")
|
!ent.entity_id.match("zwave[.]")
|
||||||
|
@ -60,6 +60,7 @@ const HIDE_DOMAIN = new Set([
|
|||||||
"device_tracker",
|
"device_tracker",
|
||||||
"geo_location",
|
"geo_location",
|
||||||
"persistent_notification",
|
"persistent_notification",
|
||||||
|
"zone",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let subscribedRegistries = false;
|
let subscribedRegistries = false;
|
||||||
@ -227,10 +228,7 @@ const computeDefaultViewStates = (entities: HassEntities): HassEntities => {
|
|||||||
const states = {};
|
const states = {};
|
||||||
Object.keys(entities).forEach((entityId) => {
|
Object.keys(entities).forEach((entityId) => {
|
||||||
const stateObj = entities[entityId];
|
const stateObj = entities[entityId];
|
||||||
if (
|
if (!HIDE_DOMAIN.has(computeStateDomain(stateObj))) {
|
||||||
!stateObj.attributes.hidden &&
|
|
||||||
!HIDE_DOMAIN.has(computeStateDomain(stateObj))
|
|
||||||
) {
|
|
||||||
states[entityId] = entities[entityId];
|
states[entityId] = entities[entityId];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -124,7 +124,6 @@ class HaPanelMap extends LocalizeMixin(PolymerElement) {
|
|||||||
var entity = hass.states[entityId];
|
var entity = hass.states[entityId];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(entity.attributes.hidden && computeStateDomain(entity) !== "zone") ||
|
|
||||||
entity.state === "home" ||
|
entity.state === "home" ||
|
||||||
!("latitude" in entity.attributes) ||
|
!("latitude" in entity.attributes) ||
|
||||||
!("longitude" in entity.attributes)
|
!("longitude" in entity.attributes)
|
||||||
|
@ -92,7 +92,6 @@ hassAttributeUtil.LOGIC_STATE_ATTRIBUTES = hassAttributeUtil.LOGIC_STATE_ATTRIBU
|
|||||||
description: "Device class",
|
description: "Device class",
|
||||||
domains: ["binary_sensor", "cover", "humidifier", "sensor", "switch"],
|
domains: ["binary_sensor", "cover", "humidifier", "sensor", "switch"],
|
||||||
},
|
},
|
||||||
hidden: { type: "boolean", description: "Hide from UI" },
|
|
||||||
assumed_state: {
|
assumed_state: {
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
domains: [
|
domains: [
|
||||||
|
@ -4,7 +4,6 @@ import { getViewEntities } from "../../../src/common/entity/get_view_entities";
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
createEntities,
|
createEntities,
|
||||||
createEntity,
|
|
||||||
createGroup,
|
createGroup,
|
||||||
createView,
|
createView,
|
||||||
entityMap,
|
entityMap,
|
||||||
@ -47,33 +46,4 @@ describe("getViewEntities", () => {
|
|||||||
|
|
||||||
assert.deepEqual(expectedEntities, getViewEntities(entities, view));
|
assert.deepEqual(expectedEntities, getViewEntities(entities, view));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not include hidden entities inside groups", () => {
|
|
||||||
const visibleEntity = createEntity({ attributes: { hidden: false } });
|
|
||||||
const hiddenEntity = createEntity({ attributes: { hidden: true } });
|
|
||||||
const group1 = createGroup({
|
|
||||||
attributes: {
|
|
||||||
entity_id: [visibleEntity.entity_id, hiddenEntity.entity_id],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const entities = {
|
|
||||||
[visibleEntity.entity_id]: visibleEntity,
|
|
||||||
[hiddenEntity.entity_id]: hiddenEntity,
|
|
||||||
[group1.entity_id]: group1,
|
|
||||||
};
|
|
||||||
|
|
||||||
const view = createView({
|
|
||||||
attributes: {
|
|
||||||
entity_id: [group1.entity_id],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const expectedEntities = {
|
|
||||||
[visibleEntity.entity_id]: visibleEntity,
|
|
||||||
[group1.entity_id]: group1,
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.deepEqual(expectedEntities, getViewEntities(entities, view));
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user