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

no modal for empty tree-group deletion #4506

Merged
merged 4 commits into from Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -17,6 +17,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.md).
### Changed
- Reported datasets can now overwrite existing ones that are reported as missing, this ignores the isScratch precedence. [#4465](https://github.com/scalableminds/webknossos/pull/4465)
- Users can now input floating point numbers into the rotation field in flight and oblique mode. These values will get rounded internally. [#4507](https://github.com/scalableminds/webknossos/pull/4507)
- Deleting an empty tree group in the `Trees` tab no longer prompts for user confirmation. [#4506](https://github.com/scalableminds/webknossos/pull/4506)

### Fixed
- Users only get tasks of datasets that they can access. [#4488](https://github.com/scalableminds/webknossos/pull/4488)
Expand Down
10 changes: 9 additions & 1 deletion frontend/javascripts/oxalis/view/right-menu/trees_tab_view.js
Expand Up @@ -322,7 +322,15 @@ class TreesTabView extends React.PureComponent<Props, State> {
};

showDeleteGroupModal = (id: number) => {
this.setState({ groupToDelete: id });
if (!this.props.skeletonTracing) return;

const { trees, treeGroups } = this.props.skeletonTracing;
const treeGroupToDelete = treeGroups.find(el => el.groupId === id);
const groupToTreesMap = createGroupToTreesMap(trees);
youri-k marked this conversation as resolved.
Show resolved Hide resolved

if (treeGroupToDelete && treeGroupToDelete.children.length === 0 && !groupToTreesMap[id])
this.deleteGroup(id);
else this.setState({ groupToDelete: id });
};

handleDelete = () => {
Expand Down