Resolves #70 Build default_view automatically
This commit is contained in:
@ -19,9 +19,26 @@ class UIBuilder {
|
||||
void build(EntityCollection entitiesCollection) {
|
||||
_entities = entitiesCollection;
|
||||
_views.clear();
|
||||
if (!_entities.hasDefaultView) {
|
||||
_createDefaultView();
|
||||
}
|
||||
_createViews(entitiesCollection.viewList);
|
||||
}
|
||||
|
||||
void _createDefaultView() {
|
||||
Map<String, List<String>> userGroupsList = _entities.getDefaultViewTopLevelEntities();
|
||||
TheLogger.log("RESULT", "${userGroupsList["userGroups"]}");
|
||||
TheLogger.log("RESULT", "${userGroupsList["notGroupedEntities"]}");
|
||||
View view = View("group.default_view", 0);
|
||||
userGroupsList["userGroups"].forEach((groupId){
|
||||
view.add(_entities.get(groupId));
|
||||
});
|
||||
userGroupsList["notGroupedEntities"].forEach((entityId){
|
||||
view.add(_entities.get(entityId));
|
||||
});
|
||||
_views["group.default_view"] = view;
|
||||
}
|
||||
|
||||
void _createViews(List<String> viewsList) {
|
||||
int counter = 0;
|
||||
viewsList.forEach((viewId) {
|
||||
|
Reference in New Issue
Block a user