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

V15: Implement sorting for the in-memory navigation structures (document and media) #17280

Merged

Conversation

elit0451
Copy link
Member

@elit0451 elit0451 commented Oct 15, 2024

Details

  • The NavigationNode model now keeps track of the sortOrder as well;
    • Parent and Children properties are refactored to reference Guid keys instead of the whole NavigationNode object - which means we need to resolve the NavigationNode from the key in all the properties' usages (i.e. ContentNavigationServiceBase).
  • Adding a new UpdateSortOrder() to the INavigationManagementService.cs;
    • Add() changed its signature to have a sortOrder parameter as well, due to a special case when adding nodes directly to the root (where parentKey is null), the sort order must be provided to ensure the item appears in the correct position among other root-level items. We can't calculate the amount of children based on the parent here.
  • Cache refreshers (document and media) are updated to update the sort order in the navigation structure;
  • Added integration and unit tests for both document and media.

Test

  • Create a simple content type with template;
  • Create a nested tree structure that you would use for sorting, something like:
Root
   - Child 1
     - Grandchild 1
     - Grandchild 2
   - Child 2
     - Grandchild 3
       - Great-grandchild 1
   - Child 3
     - Grandchild 4
  • Create a new Partial View from "List Descendants From Current Page" and call it ListDescendants.cshtml;
  • In the Root template use the following line @await Html.PartialAsync("ListDescendants") to display it, so the template looks like:
@using Umbraco.Cms.Web.Common.PublishedModels;
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@{
	Layout = null;
}

<h2>Descendants</h2>
@await Html.PartialAsync("ListDescendants")
  • In the Content section, sort the children on a parent node;
  • Verify that the tree from the template reflects those changes.

iOvergaard and others added 17 commits October 1, 2024 15:22
* Fixed the failing tests of Member Group due to UI changes

* Fixed the failing tests of Member due to UI changes

* Fixed the failing tests of User due to UI changes

* Fixed failing tests for Dictionary and Document Type

* Updated tests due to test helper changes

* Bumped version

* Updated assert steps due to the response changes

* Updated tests due to api helper changes

* Updated tests due to UI changes

* Fixed tests for delete partial view

* Fixed tests

* Added more waits

* Updated assert steps

* Fixed failing tests for Block Grid and Media

* Added more waits

* Added skip tests

* Removed waits time

* Updated assertion steps for User

* Added todo

* Updated tests due to api helper changes

* Bumped version

* Added skip tests
…v15/feature/implement-sorting-for-navigation-str

# Conflicts:
#	src/Umbraco.Web.UI.Client
#	version.json
…v15/feature/implement-sorting-for-navigation-str

# Conflicts:
#	src/Umbraco.Web.UI.Client
@elit0451 elit0451 changed the title V15: Implement sorting for the in-memory navigation structure V15: Implement sorting for the in-memory navigation structures (document and media) Oct 15, 2024
@elit0451 elit0451 marked this pull request as ready for review October 15, 2024 17:27
…mplement-sorting-for-navigation-str

# Conflicts:
#	src/Umbraco.Web.UI.Client
Copy link
Member

@bergmania bergmania left a comment

Choose a reason for hiding this comment

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

Looks good and tests out great. I love all the new tests 💪

@bergmania bergmania merged commit 44ff8dc into release/15.0 Oct 16, 2024
12 of 15 checks passed
@bergmania bergmania deleted the v15/feature/implement-sorting-for-navigation-str branch October 16, 2024 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants