SenseNet / sn-client

Monorepo for sensenet client packages 🐱‍💻
https://sensenet.com
GNU General Public License v2.0
24 stars 37 forks source link

[CTD] Content type definition ordering on admin ui #1400

Closed tusmester closed 5 months ago

tusmester commented 2 years ago

I want to see CTDs ordered by Display name on admin ui so that I can find ctds easier. It is OK to freeze this ui (prevent users from changing ordering) if that is necessary for this to work.

Current behavior

A simple query that orders ctds by display name returns them in an incorrect order. Query:

https://netcore-service.test.sensenet.com/odata.svc/Root/System/Schema/ContentTypes?$orderby=DisplayName&$select=Id,Name,DisplayName&query=%2BTypeIs%3A%27ContentType%27%20.AUTOFILTERS%3AOFF&metadata=no&$inlinecount=allpages&$top=10000

Result fragment (see the Article ctd):

{
    "Name": "BinaryFieldSetting",
    "DisplayName": "Binary field"
},
{
    "Name": "Blog",
    "DisplayName": "Blog"
},
{
    "Name": "BlogPost",
    "DisplayName": "Blog post"
},
{
    "Name": "Article",
    "DisplayName": "Article"
},
{
    "Name": "DateTimeFieldSetting",
    "DisplayName": "DateTime field"
},
{
    "Name": "DocumentLibrary",
    "DisplayName": "Document Library"
}

This is caused by the fact that CTD display name index may contain multiple words in multiple languages and this may affect ordering.

Solution

This is most likely cannot be solved on the server side because of multiple terms for multiple languages. Client-side sorting is necessary.

tusmester commented 2 years ago

Check this after fixing the CTD indexing issue.