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

Sortable columns in module index, avoid [400] Unsupported sorting field #1213

Merged
merged 1 commit into from
Jan 2, 2025

Conversation

didoda
Copy link
Member

@didoda didoda commented Jan 2, 2025

Sometimes in modules index page, the columns are considered sortable, even though they are not: a GET on BEdita APIs, with a sort by a non-sortable field, returns an error [400] Unsupported sorting field. This avoids that kind of error.

BEdita API don't provide in objects schema that information, whether a property can be used in ?sort=<prop> or not. So, the approach used is: some fields are considered always sortable (id, title, modified, date_ranges); all the other fields are considered not sortable, if they are not set in Properties.<objectType>.sortable configuration. An example follows:

{
  "bookings": {
    "sortable": ["booking_status"]
  }
}

Ref: https://github.com/bedita/manager/wiki/Setup:-Properties-display#sortable

@didoda didoda added the bug Something isn't working label Jan 2, 2025
@didoda didoda added this to the 5.x milestone Jan 2, 2025
@didoda didoda marked this pull request as ready for review January 2, 2025 11:04
Copy link

codecov bot commented Jan 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.64%. Comparing base (62e2b3c) to head (99abcae).
Report is 32 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1213      +/-   ##
============================================
- Coverage     99.65%   99.64%   -0.01%     
+ Complexity     1326     1316      -10     
============================================
  Files            98       97       -1     
  Lines          5205     5122      -83     
============================================
- Hits           5187     5104      -83     
  Misses           18       18              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@didoda didoda changed the title Sortable columns in module index Sortable columns in module index, avoid [400] Unsupported sorting field Jan 2, 2025
@didoda didoda merged commit 4055e0e into bedita:master Jan 2, 2025
6 checks passed
@didoda didoda deleted the fix/index-columns-sortable branch January 2, 2025 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working release:patch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant