Still #154 default view

This commit is contained in:
Yegor Vialov
2018-10-25 00:54:20 +03:00
parent 88cfcb4382
commit 4e955e98d8
4 changed files with 82 additions and 67 deletions

View File

@ -3,21 +3,21 @@ part of 'main.dart';
class EntityCollection {
Map<String, Entity> _allEntities;
Map<String, Entity> views;
//Map<String, Entity> views;
bool get isEmpty => _allEntities.isEmpty;
List<Entity> get viewEntities => _allEntities.values.where((entity) => entity.isView).toList();
EntityCollection() {
_allEntities = {};
views = {};
//views = {};
}
bool get hasDefaultView => _allEntities.keys.contains("group.default_view");
void parse(List rawData) {
_allEntities.clear();
views.clear();
//views.clear();
TheLogger.log("Debug","Parsing ${rawData.length} Home Assistant entities");
rawData.forEach((rawEntityData) {
@ -27,9 +27,9 @@ class EntityCollection {
if ((entity.isGroup) && (entity.childEntityIds != null)) {
entity.childEntities = getAll(entity.childEntityIds);
}
if (entity.isView) {
/*if (entity.isView) {
views[entityId] = entity;
}
}*/
});
}