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

Pjdotson/sy 775 ontology ungrouping several folders at the same time causes #652

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .vscode/synnax.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@
},
{
"name": "alamos/py",
"path": "../alamos/py",
"path": "../alamos/py"
},
{
"name": "alamos/go",
"path": "../alamos/go",
"path": "../alamos/go"
},
{
"name": "alamos/ts",
"path": "../alamos/ts",
"path": "../alamos/ts"
},
{
"name": "x/media",
Expand All @@ -103,7 +103,7 @@
{
"name": "driver",
"path": "../driver"
},
}
],
"settings": {
"editor.formatOnSave": true,
Expand Down
2 changes: 1 addition & 1 deletion alamos/py/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "alamos"
version = "0.23.0"
version = "0.23.1"
description = ""
authors = ["Emiliano Bonilla <ebonilla@synnaxlabs.com>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion client/py/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "synnax"
version = "0.23.1"
version = "0.23.2"
description = "Synnax Client Library"
keywords = ["Synnax", "Synnax Python Client"]
authors = ["emiliano bonilla <emilbon99@gmail.com>"]
Expand Down
7 changes: 7 additions & 0 deletions console/src/group/ontology.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ const ungroupSelection = async ({
state,
}: Ontology.TreeContextMenuProps): Promise<void> => {
if (selection.parent == null) return;

// Sort the groups by depth that way deeper nested groups are ungrouped first.
selection.resources.sort((a, b) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pjdotson Can you explain how this fixes the problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only issue I could find was nested groups disappearing when ungrouping so if Group B is in Group A, ungrouping Group A first would not remove items originally in Group B from the tree. Ungrouping deeper groups first fixed that problem.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Thanks. Approved

const a_depth = selection.nodes.find((n) => n.key === a.id.toString())?.depth ?? 0;
const b_depth = selection.nodes.find((n) => n.key === b.id.toString())?.depth ?? 0;
return b_depth - a_depth;
});
for (const node of selection.resources) {
const id = node.id;
const children =
Expand Down
2 changes: 1 addition & 1 deletion freighter/py/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "synnax-freighter"
version = "0.23.0"
version = "0.23.1"
description = ""
authors = ["emiliano bonilla <emilbon99@gmail.com>"]
packages = [
Expand Down
Loading