Skip to content

Commit

Permalink
no modal for empty tree-group deletion (#4506)
Browse files Browse the repository at this point in the history
* dont prompt for user confirmation for empty tree-group

* prettify code
  • Loading branch information
youri-k authored Mar 30, 2020
1 parent f889636 commit 628a6e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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);

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

handleDelete = () => {
Expand Down

0 comments on commit 628a6e3

Please sign in to comment.