Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix group sorting when there are no trees #4542

Merged
merged 3 commits into from
Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.md).
- Fixed the import of datasets which was temporarily broken. [#4497](https://github.com/scalableminds/webknossos/pull/4497)
- Fixed the displayed segment ids in segmentation tab when "Render Missing Data Black" is turned off. [#4480](https://github.com/scalableminds/webknossos/pull/4480)
- The datastore checks if a organization folder can be created before creating a new organization. [#4501](https://github.com/scalableminds/webknossos/pull/4501)
- Fixed a bug where under certain circumstances groups in the tree tab were not sorted by name. [#4542](https://github.com/scalableminds/webknossos/pull/4542)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,11 @@ export function insertTreesAndTransform(
expanded: expandedGroupIds[groupId] != null ? expandedGroupIds[groupId] : true,
children: insertTreesAndTransform(group.children, groupToTreesMap, expandedGroupIds, sortBy),
});
if (groupToTreesMap[groupId] != null) {
// Groups are always sorted by name and appear before the trees, trees are sorted according to the sortBy prop
treeNode.children = _.orderBy(treeNode.children, ["name"], ["asc"]).concat(
_.orderBy(groupToTreesMap[groupId], [sortBy], ["asc"]).map(makeTreeNodeFromTree),
);
}
// Groups are always sorted by name and appear before the trees, trees are sorted according to the sortBy prop
const trees = _.orderBy(groupToTreesMap[groupId] || [], [sortBy], ["asc"]).map(
makeTreeNodeFromTree,
);
treeNode.children = _.orderBy(treeNode.children, ["name"], ["asc"]).concat(trees);
treeNode.isChecked = _.every(treeNode.children, groupOrTree => groupOrTree.isChecked);
return treeNode;
});
Expand Down